diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 3d2c6295f88f0c..d3c222df06c380 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -40,7 +40,11 @@ RUN apt-get update \ icecc \ && : -RUN groupadd -g $USER_GID $USERNAME \ +RUN (getent passwd $USER_UID && userdel -f $(getent passwd $USER_UID | cut -d: -f1) || true) \ + && (getent group $USER_GID && groupdel -f $(getent group $USER_GID | cut -d: -f1) || true) \ + && (getent passwd $USERNAME && userdel -f $USERNAME || true) \ + && (getent group $USERNAME && groupdel -f $USERNAME || true) \ + && groupadd -g $USER_GID $USERNAME \ && useradd --no-log-init -s /bin/bash -u $USER_UID -g $USER_GID -G docker,sudo -m $USERNAME \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME \ diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 465526ea8799e4..be423b04c039d7 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:92 + image: ghcr.io/project-chip/chip-build:93 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4d16657b353871..2539edcf6a82fa 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -43,7 +43,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -139,7 +139,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -308,7 +308,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -371,7 +371,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -490,7 +490,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index d2298bbca33ca0..c897952d45107c 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 options: --user root steps: @@ -57,7 +57,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:92 + image: ghcr.io/project-chip/chip-build-esp32:93 options: --user root steps: @@ -78,7 +78,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:92 + image: ghcr.io/project-chip/chip-build-nrf-platform:93 options: --user root steps: @@ -99,7 +99,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:92 + image: ghcr.io/project-chip/chip-build-telink:93 options: --user root steps: @@ -111,7 +111,7 @@ jobs: platform: telink # - name: Update Zephyr to specific revision (for developers purpose) # shell: bash - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 9ab2325bf76bc7bec92a3ff93fad80ec5d3eae7c" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 8b29ee6b118ebe6eeec3224dbe343474e11403d8" - name: CI Examples Telink shell: bash run: | diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 4af7b3d8ed8eb2..eb45f76f389779 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -84,7 +84,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:92 + image: ghcr.io/project-chip/chip-build-doxygen:93 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 92ee46b49dbf74..2c1c2555e797e2 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:92 + image: ghcr.io/project-chip/chip-build-ameba:93 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index ce4fef94fde653..61ac888ad415a6 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:92 + image: ghcr.io/project-chip/chip-build-asr:93 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index ed6e583285ebd0..c0178a04c2cb48 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:92 + image: ghcr.io/project-chip/chip-build-bouffalolab:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index 68f5ecf09f7c9b..0aaec6d6cc3bf3 100644 --- a/.github/workflows/examples-cc13xx_26xx.yaml +++ b/.github/workflows/examples-cc13xx_26xx.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:92 + image: ghcr.io/project-chip/chip-build-ti:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index 935c5df723dea6..c7615bc27de48f 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:92 + image: ghcr.io/project-chip/chip-build-ti:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 1b970abf6a52af..8e40a0df999f4c 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:92 + image: ghcr.io/project-chip/chip-build-efr32:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index ba90be6082c868..20ced0375b8f5d 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:92 + image: ghcr.io/project-chip/chip-build-esp32:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -124,7 +124,7 @@ jobs: if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif' container: - image: ghcr.io/project-chip/chip-build-esp32:92 + image: ghcr.io/project-chip/chip-build-esp32:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 165d9015fa5570..5b7ee30abe1828 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-infineon:92 + image: ghcr.io/project-chip/chip-build-infineon:93 env: # TODO: this should probably be part of the dockerfile itself CY_TOOLS_PATHS: /opt/Tools/ModusToolbox/tools_3.2 diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 5815d1d1d35cda..84a36addb83f94 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:92 + image: ghcr.io/project-chip/chip-build-crosscompile:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 69d832282a4fcb..33098465c1cdcb 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:92 + image: ghcr.io/project-chip/chip-build-imx:93 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 5c1fbcbdf67dfb..b4ed1cd92d2d1d 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 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 8480509c00fcfc..4bc173f7cc9e64 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 steps: - name: Checkout diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 65a23f6b1ac509..5b2d082ff5e6f7 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index bc8fbde4da0be1..0aff592c543da4 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:92 + image: ghcr.io/project-chip/chip-build-nrf-platform:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index e9b214f3e48868..63088ce8f78f53 100644 --- a/.github/workflows/examples-nuttx.yaml +++ b/.github/workflows/examples-nuttx.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nuttx:92 + image: ghcr.io/project-chip/chip-build-nuttx:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index 9348baa83350db..267045cca4d99d 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp:92 + image: ghcr.io/project-chip/chip-build-nxp:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -240,7 +240,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp-zephyr:92 + image: ghcr.io/project-chip/chip-build-nxp-zephyr:93 steps: - name: Checkout diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 4ff65c0c941a14..2727b81b868621 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:92 + image: ghcr.io/project-chip/chip-build-openiotsdk:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 64f66788182b7b..45e5b6a7436e68 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index dad94e5267993b..e2ec5288adf19f 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index c24b8f5565bb24..1b6fd20aa72260 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:92 + image: ghcr.io/project-chip/chip-build-telink:93 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -58,7 +58,7 @@ jobs: gh-context: ${{ toJson(github) }} # - name: Update Zephyr to specific revision (for developers purpose) - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 9ab2325bf76bc7bec92a3ff93fad80ec5d3eae7c" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 8b29ee6b118ebe6eeec3224dbe343474e11403d8" - name: Build example Telink (B92 retention) Air Quality Sensor App # Run test for master and s07641069 PRs diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index a16ad58ee06583..56a018d533bc0d 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:92 + image: ghcr.io/project-chip/chip-build-tizen:93 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 a020b78d7455b3..4beb8d101e24cd 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:92 + image: ghcr.io/project-chip/chip-build-android:93 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 97da04937e0648..2c8fa9d7f3d4c5 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:92 + image: ghcr.io/project-chip/chip-build:93 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 114f406f906e22..504cb865a9cc0b 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:92 + image: ghcr.io/project-chip/chip-build-java:93 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 9273dbe9912ae6..731d047f288e6e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 steps: - name: Checkout diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 682cf3de208528..f933cd69df5531 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:92 + image: ghcr.io/project-chip/chip-build-minimal:93 steps: - name: Checkout @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:92 + image: ghcr.io/project-chip/chip-build-minimal:93 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 187d4b8f0c6091..2a2d52f23a8c6c 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:92 + image: ghcr.io/project-chip/chip-build-esp32-qemu:93 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -79,7 +79,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen-qemu:92 + image: ghcr.io/project-chip/chip-build-tizen-qemu:93 options: --user root volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index a50d5260b52107..161d123d9ec495 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:92 + image: ghcr.io/project-chip/chip-build-esp32:93 steps: - name: Checkout @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:92 + image: ghcr.io/project-chip/chip-build-efr32:93 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index c3293e8eb947cd..114c072cbe30cd 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:92 + image: ghcr.io/project-chip/chip-build-android:93 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 384ebc59a93c1c..ceee20818defd8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -50,7 +50,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -457,7 +457,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 9b97c8d54e0ea2..449152bf21679c 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 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 649b867ba5ac0e..0cba8cb97c2d17 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:92 + image: ghcr.io/project-chip/chip-build:93 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 07f1bc4f2f51d0..6900886aed06bb 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:92 + image: ghcr.io/project-chip/chip-build:93 defaults: run: shell: sh diff --git a/config/ameba/chip.cmake b/config/ameba/chip.cmake index 47444055f66733..9cd2ab5511b3fb 100644 --- a/config/ameba/chip.cmake +++ b/config/ameba/chip.cmake @@ -32,6 +32,7 @@ list( -DMBEDTLS_CONFIG_FILE= -D_POSIX_REALTIME_SIGNALS -DCHIP_SHELL_MAX_TOKENS=11 + -DCONFIG_ENABLE_AMEBA_SNTP=1 ) list( diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index c220b5991f486a..3503aae4000f06 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -83,7 +83,7 @@ config HEAP_MEM_POOL_SIZE default 256 config COMMON_LIBC_MALLOC_ARENA_SIZE - default 20716 if SOC_RISCV_TELINK_TL321X + default 20716 if SOC_RISCV_TELINK_TL321X || SOC_SERIES_RISCV_TELINK_B9X_RETENTION default 12288 config NET_IPV6_MLD @@ -104,13 +104,11 @@ config NET_PKT_TX_COUNT default 8 config NET_BUF_RX_COUNT - default 16 if PM - default 12 if SOC_RISCV_TELINK_TL321X + default 12 if PM || SOC_RISCV_TELINK_TL321X default 32 config NET_BUF_TX_COUNT - default 16 if PM - default 12 if SOC_RISCV_TELINK_TL321X + default 12 if PM || SOC_RISCV_TELINK_TL321X default 32 config GPIO @@ -206,9 +204,12 @@ endif # SOC_SERIES_RISCV_TELINK_B9X || SOC_SERIES_RISCV_TELINK_TLX endif # BT # Board retention config +# Cut down the ram cost by matter's change,it can keep ramcode (driver). +# No need load the ramcode every time in thread mode (retention mode). +# If the ram is not enough , can change it back , initial setting is n. if BOARD_TLSR9528A_RETENTION || BOARD_TLSR9258A_RETENTION || BOARD_TLSR9518ADK80D_RETENTION config SOC_SERIES_RISCV_TELINK_B9X_NON_RETENTION_RAM_CODE - default y if PM + default n if PM config TELINK_B9X_MATTER_RETENTION_LAYOUT default y if PM diff --git a/docs/upgrading.md b/docs/upgrading.md index 5640c925aca5ec..de9ba38d23ab42 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -92,3 +92,12 @@ Replacements for methods are: `chip::app::AttributeAccessInterfaceRegistry::Instance().UnregisterAllForEndpoint` - `chip::app::GetAttributeAccessOverride` replaced by `chip::app::AttributeAccessInterfaceRegistry::Instance().Get` + +### `ServerInitParams::dataModelProvider` in `Server::Init` + +Server initialization requires a set data model provider to work rather than +auto-initializing ember-compatible code-generated data models. + +To preserve `codegen/zap` generated logic, use +`CodegenDataModelProviderInstance` (see changes in +). diff --git a/examples/air-purifier-app/ameba/chip_main.cmake b/examples/air-purifier-app/ameba/chip_main.cmake index 22a325bf6eddec..4811bda0d88f0b 100755 --- a/examples/air-purifier-app/ameba/chip_main.cmake +++ b/examples/air-purifier-app/ameba/chip_main.cmake @@ -145,6 +145,11 @@ endif (matter_enable_ota_requestor) list( APPEND ${list_chip_main_sources} + ${chip_dir}/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp + ${chip_dir}/examples/air-purifier-app/air-purifier-common/src/air-quality-sensor-manager.cpp + ${chip_dir}/examples/air-purifier-app/air-purifier-common/src/filter-delegates.cpp + ${chip_dir}/examples/air-purifier-app/air-purifier-common/src/thermostat-manager.cpp + ${chip_dir}/examples/air-purifier-app/ameba/main/chipinterface.cpp ${chip_dir}/examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp ${chip_dir}/examples/air-purifier-app/ameba/main/CHIPDeviceManager.cpp @@ -192,6 +197,7 @@ target_include_directories( ${chip_dir}/examples/air-purifier-app/air-purifier-common/include ${chip_dir}/examples/air-purifier-app/ameba/main/include ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/observer ${chip_dir}/examples/providers ${chip_dir_output}/gen/include ${chip_dir}/src/include/ diff --git a/examples/air-purifier-app/ameba/main/chipinterface.cpp b/examples/air-purifier-app/ameba/main/chipinterface.cpp index 0829bb041e4882..72563f987efdbe 100644 --- a/examples/air-purifier-app/ameba/main/chipinterface.cpp +++ b/examples/air-purifier-app/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" #include "Server.h" @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -133,12 +135,15 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); #if CONFIG_ENABLE_AMEBA_CRYPTO ChipLogProgress(DeviceLayer, "platform crypto enabled!"); static chip::AmebaPersistentStorageOperationalKeystore sAmebaPersistentStorageOpKeystore; VerifyOrDie((sAmebaPersistentStorageOpKeystore.Init(initParams.persistentStorageDelegate)) == CHIP_NO_ERROR); initParams.operationalKeystore = &sAmebaPersistentStorageOpKeystore; #endif + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); @@ -151,6 +156,7 @@ static void InitServer(intptr_t context) PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); } + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); InitAirPurifierManager(); } diff --git a/examples/air-purifier-app/cc32xx/main/AppTask.cpp b/examples/air-purifier-app/cc32xx/main/AppTask.cpp index 0b284254b0c80f..e7527ef338f05a 100644 --- a/examples/air-purifier-app/cc32xx/main/AppTask.cpp +++ b/examples/air-purifier-app/cc32xx/main/AppTask.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include @@ -164,6 +165,7 @@ int AppTask::Init() PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 53b4b6ce87db0e..828dd567da7ee0 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -27,11 +27,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:92 + $ docker pull ghcr.io/project-chip/chip-build-ameba:93 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:92 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:93 - Setup build environment: diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index 852673d07dd20c..cdcaab15651edf 100644 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -248,6 +248,7 @@ target_include_directories( ${chip_dir}/examples/energy-management-app/energy-management-common/energy-reporting/include ${chip_dir}/examples/all-clusters-app/ameba/main/include ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/observer ${chip_dir}/examples/platform/ameba/route_hook ${chip_dir}/examples/providers ${chip_dir_output}/gen/include diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index 7d06e72c094ecb..06ba9f01cd8256 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -149,6 +150,7 @@ static void InitServer(intptr_t context) initParams.appDelegate = &sAmebaObserver; initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); #if CONFIG_ENABLE_AMEBA_CRYPTO ChipLogProgress(DeviceLayer, "platform crypto enabled!"); diff --git a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index bb499d20098abc..3b127091f13277 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -25,6 +25,7 @@ #include "LEDWidget.h" #include #include +#include #include #include #include @@ -129,6 +130,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // We only have network commissioning on endpoint 0. diff --git a/examples/all-clusters-app/linux/fuzzing-main.cpp b/examples/all-clusters-app/linux/fuzzing-main.cpp index 2d8422d0d2eee6..5056f08cce65f4 100644 --- a/examples/all-clusters-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-app/linux/fuzzing-main.cpp @@ -16,6 +16,7 @@ */ #include "AppMain.h" +#include #include #include @@ -56,6 +57,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize) // ChipLinuxAppMainLoop blocks, and we don't want that here. static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); ApplicationInit(); diff --git a/examples/all-clusters-app/mbed/main/AppTask.cpp b/examples/all-clusters-app/mbed/main/AppTask.cpp index f67876b1da5b57..98b8597ba43e5f 100644 --- a/examples/all-clusters-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-app/mbed/main/AppTask.cpp @@ -72,7 +72,8 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - error = Server::GetInstance().Init(initParams); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); + error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Server initialization failed: %s", error.AsString()); diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 067e8113c4138a..9dcd4238240111 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -226,6 +227,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/all-clusters-app/nxp/mw320/main.cpp b/examples/all-clusters-app/nxp/mw320/main.cpp index 82d335cccbb6b3..bf0d6a282e9373 100644 --- a/examples/all-clusters-app/nxp/mw320/main.cpp +++ b/examples/all-clusters-app/nxp/mw320/main.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1068,6 +1069,7 @@ static void run_chip_srv(System::Layer * aSystemLayer, void * aAppState) static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); PRINTF("Done to call chip::Server() \r\n"); } diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index f50cfee5e474cc..947a9ed09f0eb0 100644 --- a/examples/all-clusters-minimal-app/ameba/README.md +++ b/examples/all-clusters-minimal-app/ameba/README.md @@ -27,13 +27,13 @@ The CHIP demo application is supported on - Pull docker image: ``` - $ docker pull ghcr.io/project-chip/chip-build-ameba:92 + $ docker pull ghcr.io/project-chip/chip-build-ameba:93 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:92 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:93 ``` - Setup build environment: diff --git a/examples/all-clusters-minimal-app/ameba/chip_main.cmake b/examples/all-clusters-minimal-app/ameba/chip_main.cmake index a2d1e364d63ee9..d60f4f58994951 100755 --- a/examples/all-clusters-minimal-app/ameba/chip_main.cmake +++ b/examples/all-clusters-minimal-app/ameba/chip_main.cmake @@ -128,9 +128,9 @@ endif (matter_enable_ota_requestor) list( APPEND ${list_chip_main_sources} - ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/bridged-actions-stub.cpp - ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/smco-stub.cpp - ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/static-supported-modes-manager.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp ${chip_dir}/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp ${chip_dir}/examples/all-clusters-minimal-app/ameba/main/DeviceCallbacks.cpp @@ -176,6 +176,7 @@ target_include_directories( ${chip_dir}/examples/all-clusters-app/all-clusters-common ${chip_dir}/examples/all-clusters-app/all-clusters-common/include ${chip_dir}/examples/all-clusters-minimal-app/ameba/main/include + ${chip_dir}/examples/platform/ameba/observer ${chip_dir_output}/gen/include ${chip_dir}/src/include/ ${chip_dir}/src/lib/ diff --git a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp index 61f7db147f807d..cec1c457e04f04 100644 --- a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" #include "Globals.h" @@ -26,6 +27,7 @@ #include #include +#include #include #include #include @@ -157,6 +159,11 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); + + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; + chip::Server::GetInstance().Init(initParams); // Initialize device attestation config @@ -173,6 +180,7 @@ static void InitServer(intptr_t context) PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); } Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); } extern "C" void ChipTest(void) 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 56327c56dd9b94..29ad68b74241f1 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -25,6 +25,7 @@ #include "LEDWidget.h" #include #include +#include #include #include #include @@ -127,6 +128,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // We only have network commissioning on endpoint 0. diff --git a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp index b1736826ef335a..ccd2ffa782b4dd 100644 --- a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp @@ -16,6 +16,7 @@ */ #include "AppMain.h" +#include #include using namespace chip; @@ -43,6 +44,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize) // ChipLinuxAppMainLoop blocks, and we don't want that here. static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); ApplicationInit(); diff --git a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp index eb1188b93aa759..e516aee49e6e74 100644 --- a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp @@ -19,9 +19,10 @@ #include "AppTask.h" #include "LEDWidget.h" #include -#include +#include #include +#include #include #include #include @@ -67,7 +68,8 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - error = Server::GetInstance().Init(initParams); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); + error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Server initialization failed: %s", error.AsString()); diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index be858eae561921..8d9771fa593204 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -22,6 +22,7 @@ #include "LEDUtil.h" #include "binding-handler.h" +#include #include #include @@ -173,6 +174,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/chef/ameba/chip_main.cmake b/examples/chef/ameba/chip_main.cmake index 87c8aa158db8bb..cea3b85b4f813f 100755 --- a/examples/chef/ameba/chip_main.cmake +++ b/examples/chef/ameba/chip_main.cmake @@ -66,6 +66,7 @@ target_include_directories( ${chip_dir}/examples/all-clusters-app/all-clusters-common/include ${chip_dir}/examples/all-clusters-app/ameba/main/include ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/observer ${chip_dir}/examples/providers ${chip_dir_output}/gen/include ${chip_dir}/src/include/ diff --git a/examples/chef/ameba/main/chipinterface.cpp b/examples/chef/ameba/main/chipinterface.cpp index f747cbbd886c42..6b772bdba6977b 100644 --- a/examples/chef/ameba/main/chipinterface.cpp +++ b/examples/chef/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" #include "Globals.h" @@ -27,6 +28,7 @@ #include #include +#include #include #include #include @@ -104,7 +106,13 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); + + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; + chip::Server::GetInstance().Init(initParams); + gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); @@ -115,6 +123,7 @@ static void InitServer(intptr_t context) // QR code will be used with CHIP Tool PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); } + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); } extern "C" void ChipTest(void) diff --git a/examples/chef/esp32/main/main.cpp b/examples/chef/esp32/main/main.cpp index b61fcf22bc1d19..ef5dd73dcabcf3 100644 --- a/examples/chef/esp32/main/main.cpp +++ b/examples/chef/esp32/main/main.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -159,6 +160,7 @@ void InitServer(intptr_t) // Start IM server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // Device Attestation & Onboarding codes diff --git a/examples/chef/nrfconnect/main.cpp b/examples/chef/nrfconnect/main.cpp index 1c7a3aa02aebf5..e7e706409ff421 100644 --- a/examples/chef/nrfconnect/main.cpp +++ b/examples/chef/nrfconnect/main.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -125,7 +126,8 @@ int main() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); - err = chip::Server::GetInstance().Init(initParams); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); + err = chip::Server::GetInstance().Init(initParams); if (err != CHIP_NO_ERROR) { return 1; diff --git a/examples/contact-sensor-app/nxp/k32w0/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w0/main/AppTask.cpp index 40ffd9d8bff252..5eb7696fc69b7d 100644 --- a/examples/contact-sensor-app/nxp/k32w0/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w0/main/AppTask.cpp @@ -18,6 +18,7 @@ */ #include "AppTask.h" #include "AppEvent.h" +#include #include #include #include @@ -298,6 +299,7 @@ void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); infoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/dishwasher-app/silabs/include/operational-state-delegate-impl.h b/examples/dishwasher-app/silabs/include/operational-state-delegate-impl.h index 8b8d24e11524d7..354dea9912873a 100644 --- a/examples/dishwasher-app/silabs/include/operational-state-delegate-impl.h +++ b/examples/dishwasher-app/silabs/include/operational-state-delegate-impl.h @@ -67,7 +67,7 @@ class OperationalStateDelegate : public Delegate void SetEndpointId(EndpointId endpointId); private: - const GenericOperationalState rvcOpStateList[4] = { + const GenericOperationalState dishwasherOpStateList[4] = { GenericOperationalState(to_underlying(OperationalStateEnum::kStopped)), GenericOperationalState(to_underlying(OperationalStateEnum::kRunning)), GenericOperationalState(to_underlying(OperationalStateEnum::kPaused)), @@ -76,7 +76,8 @@ class OperationalStateDelegate : public Delegate EndpointId mEndpointId; - DataModel::List mOperationalStateList = Span(rvcOpStateList); + DataModel::List mOperationalStateList = + Span(dishwasherOpStateList); const Span mOperationalPhaseList; }; diff --git a/examples/fabric-admin/README.md b/examples/fabric-admin/README.md index d9fb67de46799d..3ec2cb99671eba 100644 --- a/examples/fabric-admin/README.md +++ b/examples/fabric-admin/README.md @@ -23,13 +23,13 @@ For Raspberry Pi 4 example: ### Pull Docker Images ``` -docker pull ghcr.io/project-chip/chip-build-crosscompile:92 +docker pull ghcr.io/project-chip/chip-build-crosscompile:93 ``` ### Run docker ``` -docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:92 /bin/bash +docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:93 /bin/bash ``` ### Build diff --git a/examples/fabric-bridge-app/linux/README.md b/examples/fabric-bridge-app/linux/README.md index 75f510da971564..b8f1b4a68be295 100644 --- a/examples/fabric-bridge-app/linux/README.md +++ b/examples/fabric-bridge-app/linux/README.md @@ -100,13 +100,13 @@ defined: Pull Docker Images ``` - docker pull ghcr.io/project-chip/chip-build-crosscompile:92 + docker pull ghcr.io/project-chip/chip-build-crosscompile:93 ``` Run docker ``` - docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:92 /bin/bash + docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:93 /bin/bash ``` Build diff --git a/examples/fabric-sync/README.md b/examples/fabric-sync/README.md index bf4a3b0627cfbc..2ef7949245f611 100644 --- a/examples/fabric-sync/README.md +++ b/examples/fabric-sync/README.md @@ -92,13 +92,13 @@ defined: Pull Docker Images ```sh - docker pull ghcr.io/project-chip/chip-build-crosscompile:92 + docker pull ghcr.io/project-chip/chip-build-crosscompile:93 ``` Run docker ```sh - docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:92 /bin/bash + docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:93 /bin/bash ``` Build diff --git a/examples/fabric-sync/admin/BUILD.gn b/examples/fabric-sync/admin/BUILD.gn index 2ccc30ca2f7976..e53590388e6f76 100644 --- a/examples/fabric-sync/admin/BUILD.gn +++ b/examples/fabric-sync/admin/BUILD.gn @@ -44,8 +44,12 @@ source_set("fabric-admin-lib") { "FabricAdmin.h", "FabricSyncGetter.cpp", "FabricSyncGetter.h", + "IcdManager.cpp", + "IcdManager.h", "PairingManager.cpp", "PairingManager.h", + "StayActiveSender.cpp", + "StayActiveSender.h", "UniqueIdGetter.cpp", "UniqueIdGetter.h", ] @@ -53,6 +57,8 @@ source_set("fabric-admin-lib") { deps = [ "${chip_root}/examples/fabric-sync/bridge:fabric-bridge-lib", "${chip_root}/examples/platform/linux:app-main", + "${chip_root}/src/app/icd/client:handler", + "${chip_root}/src/app/icd/client:manager", "${chip_root}/src/lib", ] } diff --git a/examples/fabric-sync/admin/FabricAdmin.cpp b/examples/fabric-sync/admin/FabricAdmin.cpp index ed2126d34e2422..afc9456b2aa890 100644 --- a/examples/fabric-sync/admin/FabricAdmin.cpp +++ b/examples/fabric-sync/admin/FabricAdmin.cpp @@ -16,6 +16,9 @@ */ #include "FabricAdmin.h" +#include +#include +#include using namespace ::chip; @@ -28,16 +31,35 @@ constexpr uint32_t kCommissionPrepareTimeMs = 500; } // namespace FabricAdmin FabricAdmin::sInstance; +app::DefaultICDClientStorage FabricAdmin::sICDClientStorage; +app::CheckInHandler FabricAdmin::sCheckInHandler; FabricAdmin & FabricAdmin::Instance() { if (!sInstance.mInitialized) { - sInstance.Init(); + VerifyOrDie(sInstance.Init() == CHIP_NO_ERROR); } return sInstance; } +CHIP_ERROR FabricAdmin::Init() +{ + IcdManager::Instance().SetDelegate(&sInstance); + + ReturnLogErrorOnFailure(sICDClientStorage.Init(GetPersistentStorageDelegate(), GetSessionKeystore())); + + auto engine = chip::app::InteractionModelEngine::GetInstance(); + VerifyOrReturnError(engine != nullptr, CHIP_ERROR_INCORRECT_STATE); + ReturnLogErrorOnFailure(IcdManager::Instance().Init(&sICDClientStorage, engine)); + ReturnLogErrorOnFailure(sCheckInHandler.Init(Controller::DeviceControllerFactory::GetInstance().GetSystemState()->ExchangeMgr(), + &sICDClientStorage, &IcdManager::Instance(), engine)); + + mInitialized = true; + + return CHIP_NO_ERROR; +} + CHIP_ERROR FabricAdmin::OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams params, FabricIndex fabricIndex) { ScopedNodeId scopedNodeId(params.GetNodeId(), fabricIndex); @@ -116,6 +138,46 @@ CHIP_ERROR FabricAdmin::KeepActive(ScopedNodeId scopedNodeId, uint32_t stayActiv return CHIP_NO_ERROR; } +void FabricAdmin::OnCheckInCompleted(const app::ICDClientInfo & clientInfo) +{ + // Accessing mPendingCheckIn should only be done while holding ChipStackLock + assertChipStackLockedByCurrentThread(); + ScopedNodeId scopedNodeId = clientInfo.peer_node; + auto it = mPendingCheckIn.find(scopedNodeId); + VerifyOrReturn(it != mPendingCheckIn.end()); + + KeepActiveDataForCheckIn checkInData = it->second; + // Removed from pending map as check-in from this node has occured and we will handle the pending KeepActive + // request. + mPendingCheckIn.erase(scopedNodeId); + + auto timeNow = System::SystemClock().GetMonotonicTimestamp(); + if (timeNow > checkInData.mRequestExpiryTimestamp) + { + ChipLogError(NotSpecified, + "ICD check-in for device we have been waiting, came after KeepActive expiry. Request dropped for ID: " + "[%d:0x " ChipLogFormatX64 "]", + scopedNodeId.GetFabricIndex(), ChipLogValueX64(scopedNodeId.GetNodeId())); + return; + } + + // TODO https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/10448. Spec does + // not define what to do if we fail to send the StayActiveRequest. We are assuming that any + // further attempts to send a StayActiveRequest will result in a similar failure. Because + // there is no mechanism for us to communicate with the client that sent out the KeepActive + // command that there was a failure, we simply fail silently. After spec issue is + // addressed, we can implement what spec defines here. + auto onDone = [=](uint32_t promisedActiveDuration) { + bridge::FabricBridge::Instance().ActiveChanged(scopedNodeId, promisedActiveDuration); + }; + CHIP_ERROR err = StayActiveSender::SendStayActiveCommand(checkInData.mStayActiveDurationMs, clientInfo.peer_node, + app::InteractionModelEngine::GetInstance(), onDone); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to send StayActive command %s", err.AsString()); + } +} + void FabricAdmin::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) { if (mNodeId != deviceId) diff --git a/examples/fabric-sync/admin/FabricAdmin.h b/examples/fabric-sync/admin/FabricAdmin.h index f2634156ee67cc..85547373f1238b 100644 --- a/examples/fabric-sync/admin/FabricAdmin.h +++ b/examples/fabric-sync/admin/FabricAdmin.h @@ -18,7 +18,12 @@ #pragma once #include "DeviceManager.h" +#include "IcdManager.h" +#include "StayActiveSender.h" +#include +#include +#include #include #include #include @@ -37,10 +42,11 @@ struct ScopedNodeIdHasher } }; -class FabricAdmin final : public bridge::FabricAdminDelegate, public PairingDelegate +class FabricAdmin final : public bridge::FabricAdminDelegate, public PairingDelegate, public IcdManager::Delegate { public: static FabricAdmin & Instance(); + static chip::app::DefaultICDClientStorage & GetDefaultICDClientStorage() { return sICDClientStorage; } CHIP_ERROR OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams params, chip::FabricIndex fabricIndex) override; @@ -51,6 +57,8 @@ class FabricAdmin final : public bridge::FabricAdminDelegate, public PairingDele CHIP_ERROR KeepActive(chip::ScopedNodeId scopedNodeId, uint32_t stayActiveDurationMs, uint32_t timeoutMs) override; + void OnCheckInCompleted(const chip::app::ICDClientInfo & clientInfo) override; + void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) override; void ScheduleSendingKeepActiveOnCheckIn(chip::ScopedNodeId scopedNodeId, uint32_t stayActiveDurationMs, uint32_t timeoutMs); @@ -89,11 +97,13 @@ class FabricAdmin final : public bridge::FabricAdminDelegate, public PairingDele std::unordered_map mPendingCheckIn; static FabricAdmin sInstance; + static chip::app::DefaultICDClientStorage sICDClientStorage; + static chip::app::CheckInHandler sCheckInHandler; bool mInitialized = false; chip::NodeId mNodeId = chip::kUndefinedNodeId; - void Init() { mInitialized = true; } + CHIP_ERROR Init(); }; } // namespace admin diff --git a/examples/fabric-sync/admin/IcdManager.cpp b/examples/fabric-sync/admin/IcdManager.cpp new file mode 100644 index 00000000000000..75c49a7fd9707b --- /dev/null +++ b/examples/fabric-sync/admin/IcdManager.cpp @@ -0,0 +1,51 @@ +/* + * 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 "IcdManager.h" + +namespace admin { + +IcdManager IcdManager::sInstance; + +IcdManager & IcdManager::Instance() +{ + return sInstance; +} + +void IcdManager::OnCheckInComplete(const chip::app::ICDClientInfo & clientInfo) +{ + DefaultCheckInDelegate::OnCheckInComplete(clientInfo); + if (mDelegate) + { + mDelegate->OnCheckInCompleted(clientInfo); + } +} + +void IcdManager::SetDelegate(Delegate * delegate) +{ + // To keep IcdManager simple, there is an assumption that there is only ever + // one delegate set and it's lifetime is identical to IcdManager. In the + // future this assumption can change should there be a need, but that will + // require code changes to IcdManager. For now we will crash if someone tries + // to call SetDelegate for a second time or if delegate is non-null. + VerifyOrDie(delegate); + VerifyOrDie(!mDelegate); + mDelegate = delegate; +} + +} // namespace admin diff --git a/examples/fabric-sync/admin/IcdManager.h b/examples/fabric-sync/admin/IcdManager.h new file mode 100644 index 00000000000000..0700363bf5b411 --- /dev/null +++ b/examples/fabric-sync/admin/IcdManager.h @@ -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. + * + */ + +#pragma once + +#include + +namespace admin { + +/** + * @brief Manages check-ins from ICD devices. + * + * Intended to be used as a thin CheckInDelegate. This allows a delegate register + * themselves so they can be aware when ICD device checks-in allowing the + * delegate to interact with the ICD device during the short window that it is + * awake. + */ +class IcdManager : public chip::app::DefaultCheckInDelegate +{ +public: + class Delegate + { + public: + virtual ~Delegate() = default; + virtual void OnCheckInCompleted(const chip::app::ICDClientInfo & clientInfo) = 0; + }; + + static IcdManager & Instance(); + void OnCheckInComplete(const chip::app::ICDClientInfo & clientInfo) override; + + // There is an assumption delegate assigned only happens once and that it lives + // for the entirety of the lifetime of fabric admin. + void SetDelegate(Delegate * delegate); + +private: + static IcdManager sInstance; + Delegate * mDelegate = nullptr; +}; + +} // namespace admin diff --git a/examples/fabric-sync/admin/PairingManager.cpp b/examples/fabric-sync/admin/PairingManager.cpp index eeb8ad09ff2a76..63a2c67c842912 100644 --- a/examples/fabric-sync/admin/PairingManager.cpp +++ b/examples/fabric-sync/admin/PairingManager.cpp @@ -18,6 +18,7 @@ #include "PairingManager.h" #include "DeviceManager.h" #include "DeviceSynchronization.h" +#include "FabricAdmin.h" #include #include @@ -103,7 +104,7 @@ PairingManager::PairingManager() : CHIP_ERROR PairingManager::Init(Controller::DeviceCommissioner * commissioner) { VerifyOrReturnError(commissioner != nullptr, CHIP_ERROR_INCORRECT_STATE); - + FabricAdmin::Instance().GetDefaultICDClientStorage().UpdateFabricList(commissioner->GetFabricIndex()); mCommissioner = commissioner; return CHIP_NO_ERROR; @@ -294,10 +295,20 @@ void PairingManager::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err) // mCommissioner has a lifetime that is the entire life of the application itself // so it is safe to provide to StartDeviceSynchronization. - DeviceSynchronizer::Instance().StartDeviceSynchronization(mCommissioner, nodeId, false); + DeviceSynchronizer::Instance().StartDeviceSynchronization(mCommissioner, nodeId, mDeviceIsICD); } else { + // When ICD device commissioning fails, the ICDClientInfo stored in OnICDRegistrationComplete needs to be removed. + if (mDeviceIsICD) + { + CHIP_ERROR deleteEntryError = FabricAdmin::Instance().GetDefaultICDClientStorage().DeleteEntry( + ScopedNodeId(nodeId, mCommissioner->GetFabricIndex())); + if (deleteEntryError != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to delete ICD entry: %s", ErrorStr(err)); + } + } ChipLogProgress(NotSpecified, "Device commissioning Failure: %s", ErrorStr(err)); } } @@ -329,6 +340,49 @@ void PairingManager::OnReadCommissioningInfo(const Controller::ReadCommissioning info.icd.idleModeDuration, info.icd.activeModeDuration, info.icd.activeModeThreshold); } +void PairingManager::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icdCounter) +{ + char icdSymmetricKeyHex[Crypto::kAES_CCM128_Key_Length * 2 + 1]; + + Encoding::BytesToHex(mICDSymmetricKey.Value().data(), mICDSymmetricKey.Value().size(), icdSymmetricKeyHex, + sizeof(icdSymmetricKeyHex), Encoding::HexFlags::kNullTerminate); + + app::ICDClientInfo clientInfo; + clientInfo.peer_node = nodeId; + clientInfo.monitored_subject = mICDMonitoredSubject.Value(); + clientInfo.start_icd_counter = icdCounter; + auto & ICDClientStorage = FabricAdmin::Instance().GetDefaultICDClientStorage(); + + CHIP_ERROR err = ICDClientStorage.SetKey(clientInfo, mICDSymmetricKey.Value()); + if (err == CHIP_NO_ERROR) + { + err = ICDClientStorage.StoreEntry(clientInfo); + } + + if (err != CHIP_NO_ERROR) + { + ICDClientStorage.RemoveKey(clientInfo); + ChipLogError(NotSpecified, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", + ChipLogValueX64(nodeId.GetNodeId()), err.AsString()); + return; + } + + mDeviceIsICD = true; + + ChipLogProgress(NotSpecified, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId.GetNodeId())); + ChipLogProgress(NotSpecified, + "ICD Registration Complete for device " ChipLogFormatX64 " / Check-In NodeID: " ChipLogFormatX64 + " / Monitored Subject: " ChipLogFormatX64 " / Symmetric Key: %s / ICDCounter %u", + ChipLogValueX64(nodeId.GetNodeId()), ChipLogValueX64(mICDCheckInNodeId.Value()), + ChipLogValueX64(mICDMonitoredSubject.Value()), icdSymmetricKeyHex, icdCounter); +} + +void PairingManager::OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) +{ + ChipLogProgress(NotSpecified, "ICD Stay Active Complete for device " ChipLogFormatX64 " / promisedActiveDuration: %u", + ChipLogValueX64(deviceId.GetNodeId()), promisedActiveDuration); +} + void PairingManager::OnDiscoveredDevice(const Dnssd::CommissionNodeData & nodeData) { // Ignore nodes with closed commissioning window @@ -436,6 +490,39 @@ CommissioningParameters PairingManager::GetCommissioningParameters() params.SetSkipCommissioningComplete(false); params.SetDeviceAttestationDelegate(this); + if (mICDRegistration.ValueOr(false)) + { + params.SetICDRegistrationStrategy(ICDRegistrationStrategy::kBeforeComplete); + + if (!mICDSymmetricKey.HasValue()) + { + Crypto::DRBG_get_bytes(mRandomGeneratedICDSymmetricKey, sizeof(mRandomGeneratedICDSymmetricKey)); + mICDSymmetricKey.SetValue(ByteSpan(mRandomGeneratedICDSymmetricKey)); + } + if (!mICDCheckInNodeId.HasValue()) + { + mICDCheckInNodeId.SetValue(mCommissioner->GetNodeId()); + } + if (!mICDMonitoredSubject.HasValue()) + { + mICDMonitoredSubject.SetValue(mICDCheckInNodeId.Value()); + } + if (!mICDClientType.HasValue()) + { + mICDClientType.SetValue(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent); + } + // These Optionals must have values now. + // The commissioner will verify these values. + params.SetICDSymmetricKey(mICDSymmetricKey.Value()); + if (mICDStayActiveDurationMsec.HasValue()) + { + params.SetICDStayActiveDurationMsec(mICDStayActiveDurationMsec.Value()); + } + params.SetICDCheckInNodeId(mICDCheckInNodeId.Value()); + params.SetICDMonitoredSubject(mICDMonitoredSubject.Value()); + params.SetICDClientType(mICDClientType.Value()); + } + return params; } @@ -482,6 +569,7 @@ void PairingManager::OnCurrentFabricRemove(void * context, NodeId nodeId, CHIP_E void PairingManager::InitPairingCommand() { mCommissioner->RegisterPairingDelegate(this); + mDeviceIsICD = false; } CHIP_ERROR PairingManager::PairDeviceWithCode(NodeId nodeId, const char * payload) diff --git a/examples/fabric-sync/admin/PairingManager.h b/examples/fabric-sync/admin/PairingManager.h index 9d109911e195df..37e9aedec65bdb 100644 --- a/examples/fabric-sync/admin/PairingManager.h +++ b/examples/fabric-sync/admin/PairingManager.h @@ -149,6 +149,8 @@ class PairingManager : public chip::Controller::DevicePairingDelegate, void OnPairingDeleted(CHIP_ERROR error) override; void OnReadCommissioningInfo(const chip::Controller::ReadCommissioningInfo & info) override; void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR error) override; + void OnICDRegistrationComplete(chip::ScopedNodeId deviceId, uint32_t icdCounter) override; + void OnICDStayActiveComplete(chip::ScopedNodeId deviceId, uint32_t promisedActiveDuration) override; /////////// DeviceDiscoveryDelegate Interface ///////// void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; @@ -176,11 +178,20 @@ class PairingManager : public chip::Controller::DevicePairingDelegate, chip::ByteSpan mSalt; uint16_t mDiscriminator = 0; uint32_t mSetupPINCode = 0; + bool mDeviceIsICD = false; + uint8_t mRandomGeneratedICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length]; uint8_t mVerifierBuffer[chip::Crypto::kSpake2p_VerifierSerialized_Length]; uint8_t mSaltBuffer[chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length]; char mRemoteIpAddr[chip::Inet::IPAddress::kMaxStringLength]; char mOnboardingPayload[kMaxManualCodeLength + 1]; + chip::Optional mICDRegistration; + chip::Optional mICDCheckInNodeId; + chip::Optional mICDClientType; + chip::Optional mICDSymmetricKey; + chip::Optional mICDMonitoredSubject; + chip::Optional mICDStayActiveDurationMsec; + /** * Holds the unique_ptr to the current CommissioningWindowOpener. * Only one commissioning window opener can be active at a time. diff --git a/examples/fabric-sync/admin/StayActiveSender.cpp b/examples/fabric-sync/admin/StayActiveSender.cpp new file mode 100644 index 00000000000000..51927c4d598999 --- /dev/null +++ b/examples/fabric-sync/admin/StayActiveSender.cpp @@ -0,0 +1,103 @@ +/* + * 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 "StayActiveSender.h" + +#include +#include +#include +#include + +namespace admin { + +CHIP_ERROR StayActiveSender::SendStayActiveCommand(uint32_t stayActiveDurationMs, const chip::ScopedNodeId & peerNode, + chip::app::InteractionModelEngine * engine, OnDoneCallbackType onDone) +{ + ConstructorOnlyInternallyCallable internal; + auto stayActiveSender = chip::Platform::New(internal, stayActiveDurationMs, peerNode, + chip::app::InteractionModelEngine::GetInstance(), onDone); + VerifyOrReturnError(stayActiveSender != nullptr, CHIP_ERROR_NO_MEMORY); + CHIP_ERROR err = stayActiveSender->EstablishSessionToPeer(); + if (CHIP_NO_ERROR != err) + { + chip::Platform::Delete(stayActiveSender); + } + return err; +} + +StayActiveSender::StayActiveSender(const ConstructorOnlyInternallyCallable & _, uint32_t stayActiveDurationMs, + const chip::ScopedNodeId & peerNode, chip::app::InteractionModelEngine * engine, + OnDoneCallbackType onDone) : + mStayActiveDurationMs(stayActiveDurationMs), + mPeerNode(peerNode), mpImEngine(engine), mOnDone(onDone), mOnConnectedCallback(HandleDeviceConnected, this), + mOnConnectionFailureCallback(HandleDeviceConnectionFailure, this) +{} + +CHIP_ERROR StayActiveSender::SendStayActiveCommand(chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle) +{ + auto onSuccess = [&](const chip::app::ConcreteCommandPath & commandPath, const chip::app::StatusIB & status, + const auto & dataResponse) { + uint32_t promisedActiveDurationMs = dataResponse.promisedActiveDuration; + ChipLogProgress(ICD, "StayActive command succeeded with promised duration %u", promisedActiveDurationMs); + mOnDone(promisedActiveDurationMs); + chip::Platform::Delete(this); + }; + + auto onFailure = [&](CHIP_ERROR error) { + ChipLogError(ICD, "StayActive command failed: %" CHIP_ERROR_FORMAT, error.Format()); + chip::Platform::Delete(this); + }; + + chip::EndpointId endpointId = 0; + chip::app::Clusters::IcdManagement::Commands::StayActiveRequest::Type request; + request.stayActiveDuration = mStayActiveDurationMs; + return chip::Controller::InvokeCommandRequest(&exchangeMgr, sessionHandle, endpointId, request, onSuccess, onFailure); +} + +CHIP_ERROR StayActiveSender::EstablishSessionToPeer() +{ + ChipLogProgress(ICD, "Trying to establish a CASE session to extend the active period for lit icd device"); + auto * caseSessionManager = mpImEngine->GetCASESessionManager(); + VerifyOrReturnError(caseSessionManager != nullptr, CHIP_ERROR_INVALID_CASE_PARAMETER); + caseSessionManager->FindOrEstablishSession(mPeerNode, &mOnConnectedCallback, &mOnConnectionFailureCallback); + return CHIP_NO_ERROR; +} + +void StayActiveSender::HandleDeviceConnected(void * context, chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle) +{ + StayActiveSender * const _this = static_cast(context); + VerifyOrDie(_this != nullptr); + + CHIP_ERROR err = _this->SendStayActiveCommand(exchangeMgr, sessionHandle); + if (CHIP_NO_ERROR != err) + { + ChipLogError(ICD, "Failed to send stay active command"); + chip::Platform::Delete(_this); + } +} + +void StayActiveSender::HandleDeviceConnectionFailure(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR err) +{ + StayActiveSender * const _this = static_cast(context); + VerifyOrDie(_this != nullptr); + ChipLogError(ICD, "Failed to establish CASE for stay active command with error '%" CHIP_ERROR_FORMAT "'", err.Format()); + chip::Platform::Delete(_this); +} + +} // namespace admin diff --git a/examples/fabric-sync/admin/StayActiveSender.h b/examples/fabric-sync/admin/StayActiveSender.h new file mode 100644 index 00000000000000..dd4a66ddeda59e --- /dev/null +++ b/examples/fabric-sync/admin/StayActiveSender.h @@ -0,0 +1,111 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#include +#include +#include + +namespace admin { + +/** + * @brief StayActiveSender contains all the data and methods needed for active period extension of an ICD client. + * + * Lifetime of instance of StayActiveSender is entirely self managed. + */ +class StayActiveSender +{ +private: + // Ideally StayActiveSender would be a private constructor, unfortunately that is not possible as Platform::New + // does not have access to private constructors. As a workaround we have defined this private struct that can + // be forwarded by Platform::New that allows us to enforce that the only way StayActiveSender is constructed is + // if SendStayActiveCommand is called. + struct ConstructorOnlyInternallyCallable + { + }; + +public: + using OnDoneCallbackType = std::function; + + /** + * @brief Attempts to send a StayActiveRequest command + * + * @param[in] stayActiveDurationMs StayActiveRequest command parameter. + * @param[in] peerNode Peer node we sending StayActiveRequest command to + * @param[in] engine Interaction Model Engine instance for sending command. + * @param[in] onDone Upon this function returning success, it is expected that onDone will be called after we + * have successfully recieved a response + * + * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code. + */ + static CHIP_ERROR SendStayActiveCommand(uint32_t stayActiveDurationMs, const chip::ScopedNodeId & peerNode, + chip::app::InteractionModelEngine * engine, OnDoneCallbackType onDone); + + // Ideally this would be a private constructor, unfortunately that is not possible as Platform::New does not + // have access to private constructors. As a workaround we have defined a private struct that can be forwarded + // by Platform::New that allows us to enforce that the only way this is constructed is if SendStayActiveCommand + // is called. + StayActiveSender(const ConstructorOnlyInternallyCallable & _, uint32_t stayActiveDurationMs, + const chip::ScopedNodeId & peerNode, chip::app::InteractionModelEngine * engine, OnDoneCallbackType onDone); + +private: + /** + * @brief Sets up a CASE session with the peer to extend the client's active period with that peer. + * Returns error if we did not even manage to kick off a CASE attempt. + */ + CHIP_ERROR EstablishSessionToPeer(); + + // CASE session callbacks + /** + *@brief Callback received on successfully establishing a CASE session in order to keep the 'lit icd device' active + * + * @param[in] context - context of the client establishing the CASE session + * @param[in] exchangeMgr - exchange manager to use for the re-registration + * @param[in] sessionHandle - session handle to use for the re-registration + */ + static void HandleDeviceConnected(void * context, chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle); + /** + * @brief Callback received on failure to establish a CASE session + * + * @param[in] context - context of the client establishing the CASE session + * @param[in] peerId - Scoped Node ID of the peer node + * @param[in] err - failure reason + */ + static void HandleDeviceConnectionFailure(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR err); + + /** + * @brief Used to send a stayActive command to the peer + * + * @param[in] exchangeMgr - exchange manager to use for the re-registration + * @param[in] sessionHandle - session handle to use for the re-registration + */ + CHIP_ERROR SendStayActiveCommand(chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle); + + uint32_t mStayActiveDurationMs = 0; + chip::ScopedNodeId mPeerNode; + chip::app::InteractionModelEngine * mpImEngine = nullptr; + OnDoneCallbackType mOnDone; + + chip::Callback::Callback mOnConnectedCallback; + chip::Callback::Callback mOnConnectionFailureCallback; +}; + +} // namespace admin diff --git a/examples/fabric-sync/shell/BUILD.gn b/examples/fabric-sync/shell/BUILD.gn index 3aa56122254a4a..d5545087c97414 100644 --- a/examples/fabric-sync/shell/BUILD.gn +++ b/examples/fabric-sync/shell/BUILD.gn @@ -33,6 +33,8 @@ source_set("shell") { "AddDeviceCommand.h", "CommandRegistry.cpp", "CommandRegistry.h", + "PairDeviceCommand.cpp", + "PairDeviceCommand.h", "RemoveBridgeCommand.cpp", "RemoveBridgeCommand.h", "RemoveDeviceCommand.cpp", diff --git a/examples/fabric-sync/shell/PairDeviceCommand.cpp b/examples/fabric-sync/shell/PairDeviceCommand.cpp new file mode 100644 index 00000000000000..796c062a2d849c --- /dev/null +++ b/examples/fabric-sync/shell/PairDeviceCommand.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 "PairDeviceCommand.h" + +#include +#include + +using namespace ::chip; + +namespace commands { + +PairDeviceCommand::PairDeviceCommand(chip::NodeId nodeId, const char * payload) : mNodeId(nodeId), mPayload(payload) {} + +void PairDeviceCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) +{ + if (mNodeId != deviceId) + { + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, + "Failed to pair non-specified device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Commissioning complete for non-specified device: NodeId: " ChipLogFormatX64, + ChipLogValueX64(deviceId)); + } + return; + } + + if (err == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Successfully paired device: NodeId: " ChipLogFormatX64, ChipLogValueX64(mNodeId)); + + admin::DeviceManager::Instance().UpdateLastUsedNodeId(mNodeId); + } + else + { + ChipLogError(NotSpecified, "Failed to pair device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + + CommandRegistry::Instance().ResetActiveCommand(); +} + +CHIP_ERROR PairDeviceCommand::RunCommand() +{ + if (admin::DeviceManager::Instance().IsCurrentBridgeDevice(mNodeId)) + { + // print to console + fprintf(stderr, "The specified node ID has been reserved by the Fabric Bridge.\n"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ChipLogProgress(NotSpecified, "Running PairDeviceCommand with Node ID: %lu, Code: %s", mNodeId, mPayload); + + admin::PairingManager::Instance().SetPairingDelegate(this); + + return admin::PairingManager::Instance().PairDeviceWithCode(mNodeId, mPayload); +} + +} // namespace commands diff --git a/examples/fabric-sync/shell/PairDeviceCommand.h b/examples/fabric-sync/shell/PairDeviceCommand.h new file mode 100644 index 00000000000000..d917b5103ff597 --- /dev/null +++ b/examples/fabric-sync/shell/PairDeviceCommand.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include +#include + +namespace commands { + +class PairDeviceCommand : public Command, public admin::PairingDelegate +{ +public: + PairDeviceCommand(chip::NodeId nodeId, const char * payload); + void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) override; + CHIP_ERROR RunCommand() override; + +private: + chip::NodeId mNodeId; + const char * mPayload; +}; + +} // namespace commands diff --git a/examples/fabric-sync/shell/ShellCommands.cpp b/examples/fabric-sync/shell/ShellCommands.cpp index 4923823481635a..f117e9c7b99274 100644 --- a/examples/fabric-sync/shell/ShellCommands.cpp +++ b/examples/fabric-sync/shell/ShellCommands.cpp @@ -17,6 +17,7 @@ #include "ShellCommands.h" #include "AddBridgeCommand.h" #include "AddDeviceCommand.h" +#include "PairDeviceCommand.h" #include "RemoveBridgeCommand.h" #include "RemoveDeviceCommand.h" #include "SyncDeviceCommand.h" @@ -46,6 +47,7 @@ static CHIP_ERROR PrintAllCommands() streamer_printf(sout, " add-device Pair a device to local fabric. Usage: app add-device node-id setup-pin-code " "device-remote-ip device-remote-port\r\n"); + streamer_printf(sout, " pair-device Pair a device to local fabric. Usage: app pair-device node-id code\r\n"); streamer_printf(sout, " remove-device Remove a device from the local fabric. Usage: app remove-device node-id\r\n"); streamer_printf(sout, " sync-device Sync a device from other ecosystem. Usage: app sync-device endpointid\r\n"); streamer_printf(sout, "\r\n"); @@ -145,6 +147,36 @@ static CHIP_ERROR HandleAddDeviceCommand(int argc, char ** argv) return result; } +static CHIP_ERROR HandlePairDeviceCommand(int argc, char ** argv) +{ + if (argc != 3) + { + fprintf(stderr, "Invalid arguments. Usage: app pair-device node-id code\n"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Check if there is already an active command + if (commands::CommandRegistry::Instance().IsCommandActive()) + { + fprintf(stderr, "Another command is currently active. Please wait until it completes.\n"); + return CHIP_ERROR_BUSY; + } + + // Parse arguments + chip::NodeId nodeId = static_cast(strtoull(argv[1], nullptr, 10)); + const char * setUpCode = argv[2]; + + auto command = std::make_unique(nodeId, setUpCode); + + CHIP_ERROR result = command->RunCommand(); + if (result == CHIP_NO_ERROR) + { + commands::CommandRegistry::Instance().SetActiveCommand(std::move(command)); + } + + return result; +} + static CHIP_ERROR HandleRemoveDeviceCommand(int argc, char ** argv) { if (argc != 2) @@ -227,6 +259,10 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv) { return HandleAddDeviceCommand(argc, argv); } + else if (strcmp(argv[0], "pair-device") == 0) + { + return HandlePairDeviceCommand(argc, argv); + } else if (strcmp(argv[0], "remove-device") == 0) { return HandleRemoveDeviceCommand(argc, argv); diff --git a/examples/light-switch-app/ameba/README.md b/examples/light-switch-app/ameba/README.md index a499d29528e2fd..9df4fd68612de7 100644 --- a/examples/light-switch-app/ameba/README.md +++ b/examples/light-switch-app/ameba/README.md @@ -26,11 +26,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:92 + $ docker pull ghcr.io/project-chip/chip-build-ameba:93 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:92 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:93 - Setup build environment: diff --git a/examples/light-switch-app/ameba/chip_main.cmake b/examples/light-switch-app/ameba/chip_main.cmake index 629c423c0fe5ec..800f51a7040ec9 100755 --- a/examples/light-switch-app/ameba/chip_main.cmake +++ b/examples/light-switch-app/ameba/chip_main.cmake @@ -201,6 +201,7 @@ target_include_directories( ${chip_dir}/zzz_generated/app-common ${chip_dir}/examples/light-switch-app/ameba/main/include ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/observer ${chip_dir}/examples/providers ${chip_dir_output}/gen/include ${chip_dir}/src/include/ diff --git a/examples/light-switch-app/ameba/main/chipinterface.cpp b/examples/light-switch-app/ameba/main/chipinterface.cpp index 35d11da6342ba5..84fd4f86e31209 100644 --- a/examples/light-switch-app/ameba/main/chipinterface.cpp +++ b/examples/light-switch-app/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "BindingHandler.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" @@ -28,6 +29,7 @@ #include #include +#include #include #include #include @@ -103,12 +105,15 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); #if CONFIG_ENABLE_AMEBA_CRYPTO ChipLogProgress(DeviceLayer, "platform crypto enabled!"); static chip::AmebaPersistentStorageOperationalKeystore sAmebaPersistentStorageOpKeystore; VerifyOrDie((sAmebaPersistentStorageOpKeystore.Init(initParams.persistentStorageDelegate)) == CHIP_NO_ERROR); initParams.operationalKeystore = &sAmebaPersistentStorageOpKeystore; #endif + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); @@ -124,6 +129,7 @@ static void InitServer(intptr_t context) #if CONFIG_ENABLE_CHIP_SHELL InitBindingHandler(); #endif + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); } extern "C" void ChipTest(void) diff --git a/examples/light-switch-app/cc13x4_26x4/src/AppTask.cpp b/examples/light-switch-app/cc13x4_26x4/src/AppTask.cpp index 7dedcac6477629..3e2865b7b4c54b 100644 --- a/examples/light-switch-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/light-switch-app/cc13x4_26x4/src/AppTask.cpp @@ -24,6 +24,7 @@ #include "FreeRTOS.h" +#include #include #include #include @@ -324,6 +325,7 @@ int AppTask::Init() static DefaultTestEventTriggerDelegate sTestEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); // Initialize info provider sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/light-switch-app/genio/src/AppTask.cpp b/examples/light-switch-app/genio/src/AppTask.cpp index f820d05ef14b05..ed331c5c1c2fb1 100644 --- a/examples/light-switch-app/genio/src/AppTask.cpp +++ b/examples/light-switch-app/genio/src/AppTask.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -124,6 +125,7 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/light-switch-app/nrfconnect/main/AppTask.cpp b/examples/light-switch-app/nrfconnect/main/AppTask.cpp index fc1c947150dd95..c10da5aba96f81 100644 --- a/examples/light-switch-app/nrfconnect/main/AppTask.cpp +++ b/examples/light-switch-app/nrfconnect/main/AppTask.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -235,6 +236,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/light-switch-app/qpg/src/AppTask.cpp b/examples/light-switch-app/qpg/src/AppTask.cpp index 7cb0a41a452aca..2b1a49a51dd8a3 100644 --- a/examples/light-switch-app/qpg/src/AppTask.cpp +++ b/examples/light-switch-app/qpg/src/AppTask.cpp @@ -35,6 +35,7 @@ using namespace ::chip; #include #include #include +#include #include #include #include @@ -203,7 +204,6 @@ CHIP_ERROR AppTask::StartAppTask() void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); @@ -220,6 +220,7 @@ void AppTask::InitServer(intptr_t arg) VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR); VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sFaultTestEventTriggerHandler) == CHIP_NO_ERROR); (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; chip::Server::GetInstance().Init(initParams); diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index ea6092575df808..c4fe32b600c0c0 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -23,11 +23,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:92 + $ docker pull ghcr.io/project-chip/chip-build-ameba:93 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:92 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:93 - Setup build environment: diff --git a/examples/lighting-app/ameba/chip_main.cmake b/examples/lighting-app/ameba/chip_main.cmake index 11590553cf327d..f8f1c6b158d967 100755 --- a/examples/lighting-app/ameba/chip_main.cmake +++ b/examples/lighting-app/ameba/chip_main.cmake @@ -196,6 +196,7 @@ target_include_directories( ${chip_dir}/examples/lighting-app/lighting-common/include ${chip_dir}/examples/lighting-app/ameba/main/include ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/observer ${chip_dir}/examples/providers ${chip_dir_output}/gen/include ${chip_dir}/src/include/ diff --git a/examples/lighting-app/ameba/main/chipinterface.cpp b/examples/lighting-app/ameba/main/chipinterface.cpp index 76459b728a545b..c98545110e0acb 100644 --- a/examples/lighting-app/ameba/main/chipinterface.cpp +++ b/examples/lighting-app/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" #include "Globals.h" @@ -30,6 +31,7 @@ #include #include +#include #include #include #include @@ -123,12 +125,15 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); #if CONFIG_ENABLE_AMEBA_CRYPTO ChipLogProgress(DeviceLayer, "platform crypto enabled!"); static chip::AmebaPersistentStorageOperationalKeystore sAmebaPersistentStorageOpKeystore; VerifyOrDie((sAmebaPersistentStorageOpKeystore.Init(initParams.persistentStorageDelegate)) == CHIP_NO_ERROR); initParams.operationalKeystore = &sAmebaPersistentStorageOpKeystore; #endif + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); @@ -140,6 +145,7 @@ static void InitServer(intptr_t context) // QR code will be used with CHIP Tool PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); } + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); } extern "C" void ChipTest(void) diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index 91aad59a9d1edd..da48f6545dc2d8 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -315,6 +316,7 @@ int AppTask::Init() initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); // Initialize info provider sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lighting-app/genio/src/AppTask.cpp b/examples/lighting-app/genio/src/AppTask.cpp index d948087833c4dd..b07d4ee3d9a0b2 100644 --- a/examples/lighting-app/genio/src/AppTask.cpp +++ b/examples/lighting-app/genio/src/AppTask.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -324,6 +325,7 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp index 43a501ad7edb5c..0615b511888c3a 100644 --- a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include /* OTA related includes */ @@ -143,6 +144,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/lighting-app/mbed/main/AppTask.cpp b/examples/lighting-app/mbed/main/AppTask.cpp index 26403bdb5e5b28..ce4d45a3aa9758 100644 --- a/examples/lighting-app/mbed/main/AppTask.cpp +++ b/examples/lighting-app/mbed/main/AppTask.cpp @@ -20,6 +20,7 @@ #include "LEDWidget.h" #include "LightingManager.h" +#include #include #include #include @@ -116,6 +117,7 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) diff --git a/examples/lighting-app/nxp/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w0/main/AppTask.cpp index 2418ab85978eb2..191bfb9d0bf547 100644 --- a/examples/lighting-app/nxp/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w0/main/AppTask.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -282,6 +283,7 @@ void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); infoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp b/examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp index 5841f15264bad4..49649144b9666b 100644 --- a/examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp +++ b/examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp @@ -37,6 +37,7 @@ /*Matter includes*/ #include #include +#include #include #include #include @@ -152,6 +153,7 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); ReturnErrorOnFailure(mFactoryDataProvider.Init()); SetDeviceInstanceInfoProvider(&mFactoryDataProvider); SetCommissionableDataProvider(&mFactoryDataProvider); diff --git a/examples/lit-icd-app/nrfconnect/main/AppTask.cpp b/examples/lit-icd-app/nrfconnect/main/AppTask.cpp index 2fab2d91f83bb8..642947329579a5 100644 --- a/examples/lit-icd-app/nrfconnect/main/AppTask.cpp +++ b/examples/lit-icd-app/nrfconnect/main/AppTask.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -204,6 +205,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index 43d8f61ef1ab52..fd99c0c0c6990b 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -308,6 +309,7 @@ int AppTask::Init() initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); // Initialize info provider sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lock-app/cc32xx/main/AppTask.cpp b/examples/lock-app/cc32xx/main/AppTask.cpp index 28c0675b8c717a..d610325b54a3fe 100644 --- a/examples/lock-app/cc32xx/main/AppTask.cpp +++ b/examples/lock-app/cc32xx/main/AppTask.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include @@ -151,6 +152,7 @@ int AppTask::Init() PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/lock-app/genio/src/AppTask.cpp b/examples/lock-app/genio/src/AppTask.cpp index 1c2f0719790196..fad169f9100abd 100644 --- a/examples/lock-app/genio/src/AppTask.cpp +++ b/examples/lock-app/genio/src/AppTask.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -137,6 +138,7 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/lock-app/infineon/psoc6/src/AppTask.cpp b/examples/lock-app/infineon/psoc6/src/AppTask.cpp index 54178c21c98f65..65ea49e769f681 100644 --- a/examples/lock-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lock-app/infineon/psoc6/src/AppTask.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -155,6 +156,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/lock-app/mbed/main/AppTask.cpp b/examples/lock-app/mbed/main/AppTask.cpp index 2dd5a4463dcf74..bfa4ae73c0b258 100644 --- a/examples/lock-app/mbed/main/AppTask.cpp +++ b/examples/lock-app/mbed/main/AppTask.cpp @@ -20,6 +20,7 @@ #include "BoltLockManager.h" #include +#include #include #include #include @@ -119,6 +120,7 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 1025a045184aee..a495ca68334d39 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -229,6 +230,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp index 5880a6e07c784b..14e7128791b5db 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -191,6 +192,7 @@ void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); infoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index 8ae517dce2b7ad..74f6546f12ba04 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -202,6 +203,7 @@ void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); @@ -218,6 +220,7 @@ void AppTask::InitServer(intptr_t arg) VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR); VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sFaultTestEventTriggerHandler) == CHIP_NO_ERROR); (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; chip::Server::GetInstance().Init(initParams); diff --git a/examples/log-source-app/linux/main.cpp b/examples/log-source-app/linux/main.cpp index d39e4431e86525..fc46923f682143 100644 --- a/examples/log-source-app/linux/main.cpp +++ b/examples/log-source-app/linux/main.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -105,6 +106,7 @@ int main(int argc, char * argv[]) chip::DeviceLayer::ConfigurationMgr().LogDeviceConfig(); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/ota-requestor-app/ameba/README.md b/examples/ota-requestor-app/ameba/README.md index 1f69815a780e0a..c97609b7eb5070 100644 --- a/examples/ota-requestor-app/ameba/README.md +++ b/examples/ota-requestor-app/ameba/README.md @@ -6,11 +6,11 @@ A prototype application that demonstrates OTA Requestor capabilities. - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:92 + $ docker pull ghcr.io/project-chip/chip-build-ameba:93 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:92 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:93 - Setup build environment: diff --git a/examples/ota-requestor-app/ameba/chip_main.cmake b/examples/ota-requestor-app/ameba/chip_main.cmake index 28b2fb5d20431d..bc9b41c8fbe2d9 100644 --- a/examples/ota-requestor-app/ameba/chip_main.cmake +++ b/examples/ota-requestor-app/ameba/chip_main.cmake @@ -62,6 +62,7 @@ target_include_directories( ${chip_dir}/src/app/clusters/ota-requestor ${chip_dir}/examples/ota-requestor-app/ameba/main/include ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/observer ${chip_dir}/examples/providers ${sdk_root}/component/soc/realtek/amebad/fwlib/include ) diff --git a/examples/ota-requestor-app/ameba/main/chipinterface.cpp b/examples/ota-requestor-app/ameba/main/chipinterface.cpp index dfac5c97f2ecf6..6d0af83d5c8daf 100644 --- a/examples/ota-requestor-app/ameba/main/chipinterface.cpp +++ b/examples/ota-requestor-app/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" #include "chip_porting.h" @@ -76,11 +77,14 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); NetWorkCommissioningInstInit(); + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); } extern "C" void ChipTest(void) diff --git a/examples/ota-requestor-app/genio/src/AppTask.cpp b/examples/ota-requestor-app/genio/src/AppTask.cpp index ff78e703e4be81..424d7b20cb0694 100644 --- a/examples/ota-requestor-app/genio/src/AppTask.cpp +++ b/examples/ota-requestor-app/genio/src/AppTask.cpp @@ -18,6 +18,7 @@ */ #include #include +#include #include #include #include @@ -107,6 +108,7 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // We only have network commissioning on endpoint 0. diff --git a/examples/ota-requestor-app/mbed/main/AppTask.cpp b/examples/ota-requestor-app/mbed/main/AppTask.cpp index 0fa7df26f8d19c..90436d57296acd 100644 --- a/examples/ota-requestor-app/mbed/main/AppTask.cpp +++ b/examples/ota-requestor-app/mbed/main/AppTask.cpp @@ -19,6 +19,7 @@ #include "AppTask.h" #include +#include #include #include #include @@ -106,6 +107,7 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) diff --git a/examples/pigweed-app/ameba/README.md b/examples/pigweed-app/ameba/README.md index 66d7564c2c1420..1af7f586291b52 100644 --- a/examples/pigweed-app/ameba/README.md +++ b/examples/pigweed-app/ameba/README.md @@ -31,11 +31,11 @@ following features are available: - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:92 + $ docker pull ghcr.io/project-chip/chip-build-ameba:93 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:92 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:93 - Setup build environment: diff --git a/examples/all-clusters-app/ameba/main/include/AmebaObserver.h b/examples/platform/ameba/observer/AmebaObserver.h similarity index 100% rename from examples/all-clusters-app/ameba/main/include/AmebaObserver.h rename to examples/platform/ameba/observer/AmebaObserver.h diff --git a/examples/platform/asr/init_Matter.cpp b/examples/platform/asr/init_Matter.cpp index a80fea5b4ea1bc..8280618c2668e1 100644 --- a/examples/platform/asr/init_Matter.cpp +++ b/examples/platform/asr/init_Matter.cpp @@ -18,6 +18,7 @@ #include "AppConfig.h" #include +#include #include #include #include @@ -100,6 +101,7 @@ CHIP_ERROR MatterInitializer::Init_Matter_Server(void) chip::DeviceLayer::PlatformMgr().LockChipStack(); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); chip::Server::GetInstance().Init(initParams); diff --git a/examples/platform/beken/common/BekenAppServer.cpp b/examples/platform/beken/common/BekenAppServer.cpp index 50f68cf441b05f..7db986538189a7 100644 --- a/examples/platform/beken/common/BekenAppServer.cpp +++ b/examples/platform/beken/common/BekenAppServer.cpp @@ -19,6 +19,7 @@ #include "BekenAppServer.h" #include "CHIPDeviceManager.h" #include +#include #include #include #include @@ -38,6 +39,7 @@ void BekenAppServer::Init(AppDelegate * sAppDelegate) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); if (sAppDelegate != nullptr) { initParams.appDelegate = sAppDelegate; diff --git a/examples/platform/bouffalolab/common/plat/platform.cpp b/examples/platform/bouffalolab/common/plat/platform.cpp index 6a91567ab9b803..723df8fa0d59de 100644 --- a/examples/platform/bouffalolab/common/plat/platform.cpp +++ b/examples/platform/bouffalolab/common/plat/platform.cpp @@ -17,6 +17,7 @@ */ #include #include +#include #include #include #include @@ -245,6 +246,7 @@ CHIP_ERROR PlatformManagerImpl::PlatformInit(void) static CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); #if CHIP_DEVICE_CONFIG_ENABLE_THREAD chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams; diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp index 8740f39cdbc080..e05817bfe0676d 100644 --- a/examples/platform/esp32/common/Esp32AppServer.cpp +++ b/examples/platform/esp32/common/Esp32AppServer.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -151,6 +152,7 @@ void Esp32AppServer::Init(AppDelegate * sAppDelegate) initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; #endif // CONFIG_TEST_EVENT_TRIGGER_ENABLED && CONFIG_ENABLE_OTA_REQUESTOR (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); if (sAppDelegate != nullptr) { initParams.appDelegate = sAppDelegate; diff --git a/examples/platform/infineon/cyw30739/matter_config.cpp b/examples/platform/infineon/cyw30739/matter_config.cpp index c30d55e55bc623..42bc9f3d1dade5 100644 --- a/examples/platform/infineon/cyw30739/matter_config.cpp +++ b/examples/platform/infineon/cyw30739/matter_config.cpp @@ -37,6 +37,7 @@ #include "wiced_hal_i2c.h" #endif #include +#include #include #include #include @@ -216,6 +217,7 @@ void CYW30739MatterConfig::InitApp(void) // Create initParams with SDK example defaults here static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); SetDeviceInfoProvider(&sExampleDeviceInfoProvider); diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index e3b68e319e634e..ddd4d82420d026 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -532,6 +533,7 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) static chip::CommonCaseDeviceServerInitParams initParams; VerifyOrDie(initParams.InitializeStaticResourcesBeforeServerInit() == CHIP_NO_ERROR); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); #if defined(ENABLE_CHIP_SHELL) Engine::Root().Init(); diff --git a/examples/platform/linux/AppMain.h b/examples/platform/linux/AppMain.h index 94bf4d3e609da1..21ba04df7dabba 100644 --- a/examples/platform/linux/AppMain.h +++ b/examples/platform/linux/AppMain.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -90,7 +91,9 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl = nullptr); #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE +using chip::PersistentStorageDelegate; using chip::Controller::DeviceCommissioner; +using chip::Crypto::SessionKeystore; using chip::Transport::PeerAddress; CHIP_ERROR CommissionerPairOnNetwork(uint32_t pincode, uint16_t disc, PeerAddress address); @@ -98,6 +101,8 @@ CHIP_ERROR CommissionerPairUDC(uint32_t pincode, size_t index); DeviceCommissioner * GetDeviceCommissioner(); CommissionerDiscoveryController * GetCommissionerDiscoveryController(); +SessionKeystore * GetSessionKeystore(); +PersistentStorageDelegate * GetPersistentStorageDelegate(); #endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 30583ce7d0e399..5b5d307e4133c6 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -95,6 +95,7 @@ source_set("app-main") { ":energy-reporting-test-event-trigger", ":smco-test-event-trigger", ":water-heater-management-test-event-trigger", + "${chip_root}/src/app/codegen-data-model-provider:instance-header", "${chip_root}/src/controller:controller", "${chip_root}/src/controller:gen_check_chip_controller_headers", "${chip_root}/src/lib", diff --git a/examples/platform/linux/CommissionerMain.cpp b/examples/platform/linux/CommissionerMain.cpp index e8da5d70b25e8a..300d2466bcf02e 100644 --- a/examples/platform/linux/CommissionerMain.cpp +++ b/examples/platform/linux/CommissionerMain.cpp @@ -457,4 +457,14 @@ CommissionerDiscoveryController * GetCommissionerDiscoveryController() return &gCommissionerDiscoveryController; } +SessionKeystore * GetSessionKeystore() +{ + return &gSessionKeystore; +} + +PersistentStorageDelegate * GetPersistentStorageDelegate() +{ + return &gServerStorage; +} + #endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE diff --git a/examples/platform/linux/CommissionerMain.h b/examples/platform/linux/CommissionerMain.h index e241d436c4e71f..106e94b0edcb31 100644 --- a/examples/platform/linux/CommissionerMain.h +++ b/examples/platform/linux/CommissionerMain.h @@ -28,7 +28,9 @@ #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE +using chip::PersistentStorageDelegate; using chip::Controller::DeviceCommissioner; +using chip::Crypto::SessionKeystore; using chip::Transport::PeerAddress; CHIP_ERROR CommissionerPairOnNetwork(uint32_t pincode, uint16_t disc, PeerAddress address); @@ -39,5 +41,7 @@ void ShutdownCommissioner(); DeviceCommissioner * GetDeviceCommissioner(); CommissionerDiscoveryController * GetCommissionerDiscoveryController(); +SessionKeystore * GetSessionKeystore(); +PersistentStorageDelegate * GetPersistentStorageDelegate(); #endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE diff --git a/examples/platform/nxp/common/app_task/source/AppTaskBase.cpp b/examples/platform/nxp/common/app_task/source/AppTaskBase.cpp index 81907d21634318..00ccbb9ea31269 100644 --- a/examples/platform/nxp/common/app_task/source/AppTaskBase.cpp +++ b/examples/platform/nxp/common/app_task/source/AppTaskBase.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -185,6 +186,7 @@ void chip::NXP::App::AppTaskBase::InitServer(intptr_t arg) initParams.operationalKeystore = chip::NXP::App::OperationalKeystore::GetInstance(); #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); #if CONFIG_NET_L2_OPENTHREAD // Init ZCL Data Model and start server diff --git a/examples/platform/nxp/se05x/linux/AppMain.cpp b/examples/platform/nxp/se05x/linux/AppMain.cpp index bd13e249683fcb..5baf36112b31b2 100644 --- a/examples/platform/nxp/se05x/linux/AppMain.cpp +++ b/examples/platform/nxp/se05x/linux/AppMain.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -291,6 +292,7 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) static chip::CommonCaseDeviceServerInitParams initParams; VerifyOrDie(initParams.InitializeStaticResourcesBeforeServerInit() == CHIP_NO_ERROR); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); #if defined(ENABLE_CHIP_SHELL) Engine::Root().Init(); diff --git a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp index 56bb7c24902bbc..705f35e86b2b29 100644 --- a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp +++ b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp @@ -42,6 +42,7 @@ #include #ifdef USE_CHIP_DATA_MODEL +#include #include #include #include @@ -274,6 +275,7 @@ int openiotsdk_chip_run(void) ChipLogError(NotSpecified, "Initialize static resources before server init failed: %s", err.AsString()); return EXIT_FAILURE; } + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); initParams.operationalServicePort = CHIP_PORT; initParams.userDirectedCommissioningPort = CHIP_UDC_PORT; diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 8c0488f74c1bd0..c382a3ab1aa98f 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -56,6 +56,7 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #include #include #include +#include #ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED #include "SilabsTestEventTriggerDelegate.h" // nogncheck @@ -275,6 +276,7 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) // Initialize the remaining (not overridden) providers to the SDK example defaults (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); #if CHIP_ENABLE_OPENTHREAD // Set up OpenThread configuration when OpenThread is included diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 2d6d3574ea3506..02769a993c3087 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -189,6 +189,7 @@ source_set("siwx917-common") { public_deps += [ "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/app/codegen-data-model-provider:instance-header", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", ] diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index e0e7b45070d2fc..7b9dccf7ccaa06 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -214,6 +214,7 @@ source_set("efr32-common") { public_deps += [ "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/app/codegen-data-model-provider:instance-header", "${chip_root}/src/app/server", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index de5faa974a4847..479e746a4aac62 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -301,6 +302,7 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sOtaTestEventTriggerHandler) == CHIP_NO_ERROR); #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); initParams.appDelegate = &sCallbacks; initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index 0a7d6a26003221..bb5e212eeee511 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -309,6 +310,7 @@ int AppTask::Init() initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index d5f4c6dc760e0e..f8939268f3d111 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -205,6 +206,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index ac7eb545a18f0c..0a8de126a18965 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -38,6 +38,7 @@ #endif #include #include +#include #include #include #include @@ -301,6 +302,7 @@ int AppTask::Init() initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); ret = PlatformMgr().StartEventLoopTask(); diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index ca79a41160a9d2..eb4d194d2f14b6 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -190,6 +191,7 @@ CHIP_ERROR AppTask::Init() VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR); VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sOtaTestEventTriggerHandler) == CHIP_NO_ERROR); (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/shell/cc13x4_26x4/main/AppTask.cpp b/examples/shell/cc13x4_26x4/main/AppTask.cpp index 3f5ff1e659126c..cc6122cef027bc 100644 --- a/examples/shell/cc13x4_26x4/main/AppTask.cpp +++ b/examples/shell/cc13x4_26x4/main/AppTask.cpp @@ -22,6 +22,7 @@ #include "FreeRTOS.h" +#include #include #include #include @@ -161,6 +162,7 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); ret = PlatformMgr().StartEventLoopTask(); diff --git a/examples/shell/shell_common/cmd_server.cpp b/examples/shell/shell_common/cmd_server.cpp index 6c79aae789b541..80884b9c042233 100644 --- a/examples/shell/shell_common/cmd_server.cpp +++ b/examples/shell/shell_common/cmd_server.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -58,6 +59,7 @@ static CHIP_ERROR CmdAppServerStart(int argc, char ** argv) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); initParams.operationalServicePort = sServerPortOperational; initParams.userDirectedCommissioningPort = sServerPortCommissioning; diff --git a/examples/thermostat/genio/src/AppTask.cpp b/examples/thermostat/genio/src/AppTask.cpp index ac419e01f51b9b..3733b7f45989d2 100644 --- a/examples/thermostat/genio/src/AppTask.cpp +++ b/examples/thermostat/genio/src/AppTask.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -123,6 +124,7 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/thermostat/qpg/src/AppTask.cpp b/examples/thermostat/qpg/src/AppTask.cpp index 306661766a4af4..f91db8b689919c 100644 --- a/examples/thermostat/qpg/src/AppTask.cpp +++ b/examples/thermostat/qpg/src/AppTask.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -173,6 +174,7 @@ void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCommonCaseDeviceServerInitParamsProvider.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCommonCaseDeviceServerInitParamsProvider.h index d510a0ec48db2b..93b4edc783e431 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCommonCaseDeviceServerInitParamsProvider.h +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCommonCaseDeviceServerInitParamsProvider.h @@ -17,6 +17,8 @@ #include "core/Types.h" +#include + #ifndef MCCommonCaseDeviceServerInitParamsProvider_h #define MCCommonCaseDeviceServerInitParamsProvider_h @@ -35,6 +37,7 @@ class MCCommonCaseDeviceServerInitParamsProvider : public matter::casting::suppo CHIP_ERROR err = serverInitParams.InitializeStaticResourcesBeforeServerInit(); VerifyOrReturnValue(err == CHIP_NO_ERROR, nullptr, ChipLogError(AppServer, "Initialization of ServerInitParams failed %" CHIP_ERROR_FORMAT, err.Format())); + serverInitParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); return &serverInitParams; } }; diff --git a/examples/tv-casting-app/linux/main.cpp b/examples/tv-casting-app/linux/main.cpp index 0dde8a2f0d03eb..3a41f15d531c30 100644 --- a/examples/tv-casting-app/linux/main.cpp +++ b/examples/tv-casting-app/linux/main.cpp @@ -31,6 +31,7 @@ #include "LinuxCommissionableDataProvider.h" #include "Options.h" +#include #include #include #include @@ -140,6 +141,7 @@ int main(int argc, char * argv[]) // Enter commissioning mode, open commissioning window static chip::CommonCaseDeviceServerInitParams initParams; VerifyOrDie(CHIP_NO_ERROR == initParams.InitializeStaticResourcesBeforeServerInit()); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); VerifyOrDie(CHIP_NO_ERROR == chip::Server::GetInstance().Init(initParams)); if (argc > 1) diff --git a/examples/tv-casting-app/linux/simple-app.cpp b/examples/tv-casting-app/linux/simple-app.cpp index 41f3391da73e78..5526d6a3f6df07 100644 --- a/examples/tv-casting-app/linux/simple-app.cpp +++ b/examples/tv-casting-app/linux/simple-app.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -83,6 +84,7 @@ class CommonCaseDeviceServerInitParamsProvider : public ServerInitParamsProvider CHIP_ERROR err = serverInitParams.InitializeStaticResourcesBeforeServerInit(); VerifyOrReturnValue(err == CHIP_NO_ERROR, nullptr, ChipLogError(AppServer, "Initialization of ServerInitParams failed %" CHIP_ERROR_FORMAT, err.Format())); + serverInitParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); return &serverInitParams; } }; diff --git a/examples/window-app/nrfconnect/main/AppTask.cpp b/examples/window-app/nrfconnect/main/AppTask.cpp index 5f971b67f9f9bf..21438b76e9661b 100644 --- a/examples/window-app/nrfconnect/main/AppTask.cpp +++ b/examples/window-app/nrfconnect/main/AppTask.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -208,6 +209,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index eba19f43d5f315..238b47b0fc5fb2 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" 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:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" # 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:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -38,7 +38,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" env: - PW_ENVIRONMENT_ROOT=/pwenv args: diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index 22b3d377d8c83a..41a221d048ea06 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:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" 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:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" # 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:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" 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:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" id: NRFConnect env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -66,7 +66,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" id: EFR32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -88,7 +88,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" id: Linux env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -141,7 +141,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:92" + - name: "ghcr.io/project-chip/chip-build-vscode:93" 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 6df5517b7ead14..29c26fda8e1678 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -92 : [Telink] Update Docker image (Zephyr update) +93 : [Telink] Update Docker image (Zephyr update) diff --git a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile index b286bb8a74888b..e028e0b9f64142 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=d88a47760dd4c7e57dfcc83e7c5856a9cea88fc1 +ARG ZEPHYR_REVISION=8b29ee6b118ebe6eeec3224dbe343474e11403d8 WORKDIR /opt/telink/zephyrproject RUN set -x \ && python3 -m pip install --break-system-packages -U --no-cache-dir west \ diff --git a/scripts/setup/constraints.txt b/scripts/setup/constraints.txt index 1b5244314196d6..874d46f6f1a526 100644 --- a/scripts/setup/constraints.txt +++ b/scripts/setup/constraints.txt @@ -32,8 +32,6 @@ cbor2==5.4.6 # via -r requirements.zephyr.txt certifi==2022.12.7 # via requests -cffi==1.15.1 - # via cryptography charset-normalizer==3.0.1 # via requests click==8.1.3 diff --git a/scripts/setup/requirements.all.txt b/scripts/setup/requirements.all.txt index 346abfa3936888..4a7672a08f639d 100644 --- a/scripts/setup/requirements.all.txt +++ b/scripts/setup/requirements.all.txt @@ -43,6 +43,8 @@ mypy-protobuf==3.5.0 protobuf==4.24.4 types-protobuf==4.24.0.2 +cffi==1.15.0; python_version < "3.13" +cffi==1.17.1; python_version >= "3.13" cryptography # python unit tests diff --git a/scripts/tools/telink/requirements.txt b/scripts/tools/telink/requirements.txt index 58b519dc924bfa..e76b1423e4ded9 100644 --- a/scripts/tools/telink/requirements.txt +++ b/scripts/tools/telink/requirements.txt @@ -1,5 +1,6 @@ cryptography==43.0.1 -cffi==1.15.0 +cffi==1.15.0; python_version < "3.13" +cffi==1.17.1; python_version >= "3.13" future==0.18.3 pycparser==2.21 pypng==0.0.21 diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 6976ef2ea2e2fc..e5e54c586d93aa 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -201,7 +201,10 @@ static_library("interaction-model") { "reporting/reporting.h", ] - deps = [ "${chip_root}/src/app:events" ] + deps = [ + "${chip_root}/src/app:events", + "${chip_root}/src/app:global-attributes", + ] # Temporary dependency: codegen data provider instance should be provided # by the application diff --git a/src/app/codegen-data-model-provider/CodegenDataModelProvider.h b/src/app/codegen-data-model-provider/CodegenDataModelProvider.h index 57bf3df8a0e5c1..eb394558720321 100644 --- a/src/app/codegen-data-model-provider/CodegenDataModelProvider.h +++ b/src/app/codegen-data-model-provider/CodegenDataModelProvider.h @@ -16,10 +16,10 @@ */ #pragma once -#include "app/ConcreteCommandPath.h" #include #include +#include #include #include diff --git a/src/app/codegen-data-model-provider/CodegenDataModelProvider_Read.cpp b/src/app/codegen-data-model-provider/CodegenDataModelProvider_Read.cpp index a558b8e986298a..88989b52071810 100644 --- a/src/app/codegen-data-model-provider/CodegenDataModelProvider_Read.cpp +++ b/src/app/codegen-data-model-provider/CodegenDataModelProvider_Read.cpp @@ -104,33 +104,6 @@ DataModel::ActionReturnStatus CodegenDataModelProvider::ReadAttribute(const Data ChipLogValueMEI(request.path.mClusterId), request.path.mEndpointId, ChipLogValueMEI(request.path.mAttributeId), request.path.mExpanded); - // ACL check for non-internal requests - if (!request.operationFlags.Has(DataModel::OperationFlags::kInternal)) - { - VerifyOrReturnError(request.subjectDescriptor != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - - Access::RequestPath requestPath{ .cluster = request.path.mClusterId, - .endpoint = request.path.mEndpointId, - .requestType = Access::RequestType::kAttributeReadRequest, - .entityId = request.path.mAttributeId }; - CHIP_ERROR err = Access::GetAccessControl().Check(*request.subjectDescriptor, requestPath, - RequiredPrivilege::ForReadAttribute(request.path)); - if (err != CHIP_NO_ERROR) - { - VerifyOrReturnError((err == CHIP_ERROR_ACCESS_DENIED) || (err == CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL), err); - - // Implementation of 8.4.3.2 of the spec for path expansion - if (request.path.mExpanded) - { - return CHIP_NO_ERROR; - } - - // access denied and access restricted have specific codes for IM - return err == CHIP_ERROR_ACCESS_DENIED ? CHIP_IM_GLOBAL_STATUS(UnsupportedAccess) - : CHIP_IM_GLOBAL_STATUS(AccessRestricted); - } - } - auto metadata = Ember::FindAttributeMetadata(request.path); // Explicit failure in finding a suitable metadata diff --git a/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp index 8ce369b7bd8220..c9b2a1b99a375c 100644 --- a/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp +++ b/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp @@ -1321,20 +1321,6 @@ TEST(TestCodegenModelViaMocks, CommandHandlerInterfaceAcceptedCommands) EXPECT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint1, MockClusterId(1), 33)).has_value()); } -TEST(TestCodegenModelViaMocks, EmberAttributeReadAclDeny) -{ - UseMockNodeConfig config(gTestNodeConfig); - CodegenDataModelProviderWithContext model; - ScopedMockAccessControl accessControl; - - ReadOperation testRequest(kMockEndpoint1, MockClusterId(1), MockAttributeId(10)); - testRequest.SetSubjectDescriptor(kDenySubjectDescriptor); - - std::unique_ptr encoder = testRequest.StartEncoding(); - - ASSERT_EQ(model.ReadAttribute(testRequest.GetRequest(), *encoder), Status::UnsupportedAccess); -} - TEST(TestCodegenModelViaMocks, ReadForInvalidGlobalAttributePath) { UseMockNodeConfig config(gTestNodeConfig); @@ -1392,24 +1378,6 @@ TEST(TestCodegenModelViaMocks, EmberAttributeInvalidRead) } } -TEST(TestCodegenModelViaMocks, EmberAttributePathExpansionAccessDeniedRead) -{ - UseMockNodeConfig config(gTestNodeConfig); - CodegenDataModelProviderWithContext model; - ScopedMockAccessControl accessControl; - - ReadOperation testRequest(kMockEndpoint1, MockClusterId(1), MockAttributeId(10)); - testRequest.SetSubjectDescriptor(kDenySubjectDescriptor); - testRequest.SetPathExpanded(true); - - std::unique_ptr encoder = testRequest.StartEncoding(); - - // For expanded paths, access control failures succeed without encoding anything - // This is temporary until ACL checks are moved inside the IM/ReportEngine - ASSERT_EQ(model.ReadAttribute(testRequest.GetRequest(), *encoder), CHIP_NO_ERROR); - ASSERT_FALSE(encoder->TriedEncode()); -} - TEST(TestCodegenModelViaMocks, AccessInterfaceUnsupportedRead) { UseMockNodeConfig config(gTestNodeConfig); diff --git a/src/app/data-model-provider/Provider.h b/src/app/data-model-provider/Provider.h index cc8b3612335c85..f043a069bba824 100644 --- a/src/app/data-model-provider/Provider.h +++ b/src/app/data-model-provider/Provider.h @@ -59,15 +59,7 @@ class Provider : public ProviderMetadataTree virtual InteractionModelContext CurrentContext() const { return mContext; } /// 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 (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 - /// be discarded. - /// > Else if reading from the attribute in the path requires a privilege that is not - /// granted to access the cluster in the path, then the path SHALL be discarded. + /// ReadAttribute is REQUIRED to respond to GlobalAttribute read requests /// /// Return value notes: /// ActionReturnStatus::IsOutOfSpaceEncodingResponse diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index ea4c0014e71397..63d71bfc92db7a 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -16,17 +16,24 @@ * limitations under the License. */ +#include +#include #include #include +#include #include #include #include +#include #include #include #include #include #include +#include #include +#include +#include #include #if CHIP_CONFIG_ENABLE_ICD_SERVER @@ -52,9 +59,81 @@ Status EventPathValid(DataModel::Provider * model, const ConcreteEventPath & eve return Status::Success; } -DataModel::ActionReturnStatus RetrieveClusterData(DataModel::Provider * dataModel, - const Access::SubjectDescriptor & subjectDescriptor, bool isFabricFiltered, - AttributeReportIBs::Builder & reportBuilder, +/// Returns the status of ACL validation. +/// If the return value has a status set, that means the ACL check failed, +/// the read must not be performed, and the returned status (which may +/// be success, when dealing with non-concrete paths) should be used +/// as the status for the read. +/// +/// If the returned value is std::nullopt, that means the ACL check passed and the +/// read should proceed. +std::optional ValidateReadAttributeACL(DataModel::Provider * dataModel, const SubjectDescriptor & subjectDescriptor, + const ConcreteReadAttributePath & path) +{ + + RequestPath requestPath{ .cluster = path.mClusterId, + .endpoint = path.mEndpointId, + .requestType = RequestType::kAttributeReadRequest, + .entityId = path.mAttributeId }; + + std::optional info = dataModel->GetAttributeInfo(path); + + // If the attribute exists, we know whether it is readable (readPrivilege has value) + // and what the required access privilege is. However for attributes missing from the metatada + // (e.g. global attributes) or completely missing attributes we do not actually know of a required + // privilege and default to kView (this is correct for global attributes and a reasonable check + // for others) + Privilege requiredPrivilege = Privilege::kView; + if (info.has_value() && info->readPrivilege.has_value()) + { + // attribute exists and is readable, set the correct read privilege + requiredPrivilege = *info->readPrivilege; + } + + CHIP_ERROR err = GetAccessControl().Check(subjectDescriptor, requestPath, requiredPrivilege); + if (err == CHIP_NO_ERROR) + { + if (IsSupportedGlobalAttributeNotInMetadata(path.mAttributeId)) + { + // Global attributes passing a kView check is ok + return std::nullopt; + } + + // We want to return "success" (i.e. nulopt) IF AND ONLY IF the attribute exists and is readable (has read privilege). + // Since the Access control check above may have passed with kView, we do another check here: + // - Attribute exists (info has value) + // - Attribute is readable (readProvilege has value) and not "write only" + // If the attribute exists and is not readable, we will return UnsupportedRead (spec 8.4.3.2: "Else if the path indicates + // attribute data that is not readable, an AttributeStatusIB SHALL be generated with the UNSUPPORTED_READ Status Code.") + // + // TODO:: https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/9024 requires interleaved ordering that + // is NOT implemented here. Spec requires: + // - check cluster access check (done here as kView at least) + // - unsupported endpoint/cluster/attribute check (NOT done here) when the attribute is missing. + // this SHOULD be done here when info does not have a value. This was not done as a first pass to + // minimize amount of delta in the initial PR. + // - "write-only" attributes should return UNSUPPORTED_READ (this is done here) + if (info.has_value() && !info->readPrivilege.has_value()) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedRead); + } + + return std::nullopt; + } + VerifyOrReturnError((err == CHIP_ERROR_ACCESS_DENIED) || (err == CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL), err); + + // Implementation of 8.4.3.2 of the spec for path expansion + if (path.mExpanded) + { + return CHIP_NO_ERROR; + } + + // access denied and access restricted have specific codes for IM + return err == CHIP_ERROR_ACCESS_DENIED ? CHIP_IM_GLOBAL_STATUS(UnsupportedAccess) : CHIP_IM_GLOBAL_STATUS(AccessRestricted); +} + +DataModel::ActionReturnStatus RetrieveClusterData(DataModel::Provider * dataModel, const SubjectDescriptor & subjectDescriptor, + bool isFabricFiltered, AttributeReportIBs::Builder & reportBuilder, const ConcreteReadAttributePath & path, AttributeEncodeState * encoderState) { ChipLogDetail(DataManagement, " Cluster %" PRIx32 ", Attribute %" PRIx32 " is dirty", path.mClusterId, @@ -64,10 +143,7 @@ DataModel::ActionReturnStatus RetrieveClusterData(DataModel::Provider * dataMode DataModel::ReadAttributeRequest readRequest; - if (isFabricFiltered) - { - readRequest.readFlags.Set(DataModel::ReadFlags::kFabricFiltered); - } + readRequest.readFlags.Set(DataModel::ReadFlags::kFabricFiltered, isFabricFiltered); readRequest.subjectDescriptor = &subjectDescriptor; readRequest.path = path; @@ -84,9 +160,17 @@ DataModel::ActionReturnStatus RetrieveClusterData(DataModel::Provider * dataMode TLV::TLVWriter checkpoint; reportBuilder.Checkpoint(checkpoint); + DataModel::ActionReturnStatus status(CHIP_NO_ERROR); AttributeValueEncoder attributeValueEncoder(reportBuilder, subjectDescriptor, path, version, isFabricFiltered, encoderState); - DataModel::ActionReturnStatus status = dataModel->ReadAttribute(readRequest, attributeValueEncoder); + if (auto access_status = ValidateReadAttributeACL(dataModel, subjectDescriptor, path); access_status.has_value()) + { + status = *access_status; + } + else + { + status = dataModel->ReadAttribute(readRequest, attributeValueEncoder); + } if (status.IsSuccess()) { @@ -435,13 +519,13 @@ CHIP_ERROR Engine::CheckAccessDeniedEventPaths(TLV::TLVWriter & aWriter, bool & aHasEncodedData = true; } - Access::RequestPath requestPath{ .cluster = current->mValue.mClusterId, - .endpoint = current->mValue.mEndpointId, - .requestType = RequestType::kEventReadRequest, - .entityId = current->mValue.mEventId }; - Access::Privilege requestPrivilege = RequiredPrivilege::ForReadEvent(path); + RequestPath requestPath{ .cluster = current->mValue.mClusterId, + .endpoint = current->mValue.mEndpointId, + .requestType = RequestType::kEventReadRequest, + .entityId = current->mValue.mEventId }; + Privilege requestPrivilege = RequiredPrivilege::ForReadEvent(path); - err = Access::GetAccessControl().Check(apReadHandler->GetSubjectDescriptor(), requestPath, requestPrivilege); + err = GetAccessControl().Check(apReadHandler->GetSubjectDescriptor(), requestPath, requestPrivilege); if ((err != CHIP_ERROR_ACCESS_DENIED) && (err != CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL)) { ReturnErrorOnFailure(err); @@ -580,13 +664,13 @@ CHIP_ERROR Engine::BuildSingleReportDataEventReports(ReportDataMessage::Builder CHIP_ERROR Engine::BuildAndSendSingleReportData(ReadHandler * apReadHandler) { CHIP_ERROR err = CHIP_NO_ERROR; - chip::System::PacketBufferTLVWriter reportDataWriter; + System::PacketBufferTLVWriter reportDataWriter; ReportDataMessage::Builder reportDataBuilder; - chip::System::PacketBufferHandle bufHandle = nullptr; - uint16_t reservedSize = 0; - bool hasMoreChunks = false; - bool needCloseReadHandler = false; - size_t reportBufferMaxSize = 0; + System::PacketBufferHandle bufHandle = nullptr; + uint16_t reservedSize = 0; + bool hasMoreChunks = false; + bool needCloseReadHandler = false; + size_t reportBufferMaxSize = 0; // Reserved size for the MoreChunks boolean flag, which takes up 1 byte for the control tag and 1 byte for the context tag. const uint32_t kReservedSizeForMoreChunksFlag = 1 + 1; @@ -623,7 +707,7 @@ CHIP_ERROR Engine::BuildAndSendSingleReportData(ReadHandler * apReadHandler) // Always limit the size of the generated packet to fit within the max size returned by the ReadHandler regardless // of the available buffer capacity. // Also, we need to reserve some extra space for the MIC field. - reportDataWriter.ReserveBuffer(static_cast(reservedSize + chip::Crypto::CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES)); + reportDataWriter.ReserveBuffer(static_cast(reservedSize + Crypto::CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES)); // Create a report data. err = reportDataBuilder.Init(&reportDataWriter); diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 03a52ddc32e7e4..5f9d188d89e43c 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -127,6 +127,15 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) VerifyOrExit(initParams.opCertStore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(initParams.reportScheduler != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); + // Extra log since this is an incremental requirement and existing applications may not be aware + if (initParams.dataModelProvider == nullptr) + { + ChipLogError(AppServer, "Application Server requires a `initParams.dataModelProvider` value."); + ChipLogError(AppServer, "For backwards compatibility, you likely can use `CodegenDataModelProviderInstance()`"); + } + + VerifyOrExit(initParams.dataModelProvider != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); + // TODO(16969): Remove chip::Platform::MemoryInit() call from Server class, it belongs to outer code chip::Platform::MemoryInit(); @@ -168,6 +177,17 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) // TODO: this should eventually become a `SetDataModelProvider` that is based on `initParams` (void) chip::app::InteractionModelEngine::GetInstance()->GetDataModelProvider(); + // SetDataModelProvider() actually initializes/starts the provider. We need + // to preserve the following ordering guarantees: + // + // 1) Provider initialization (under SetDataModelProvider) happens after + // SetSafeAttributePersistenceProvider, since the provider can then use + // the safe persistence provider to implement and initialize its own attribute persistence logic. + // 2) For now, provider initialization happens before InitDataModelHandler(), which depends + // on atttribute persistence being already set up before it runs. Longer-term, the logic from + // InitDataModelHandler should just move into the codegen provider. + chip::app::InteractionModelEngine::GetInstance()->SetDataModelProvider(initParams.dataModelProvider); + { FabricTable::InitParams fabricTableInitParams; fabricTableInitParams.storage = mDeviceStorage; diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 63619e14c1f67b..470cb877ba18fc 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -194,6 +194,11 @@ struct ServerInitParams // 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; #endif // CHIP_CONFIG_ENABLE_ICD_CIP + + // MUST NOT be null during initialization: every application must define the + // data model it wants to use. Backwards-compatibility can use `CodegenDataModelProviderInstance` + // for ember/zap-generated models. + chip::app::DataModel::Provider * dataModelProvider = nullptr; }; /** diff --git a/src/app/server/java/AndroidAppServerWrapper.cpp b/src/app/server/java/AndroidAppServerWrapper.cpp index 3bc1919de740fc..5e205b7d82fb8a 100644 --- a/src/app/server/java/AndroidAppServerWrapper.cpp +++ b/src/app/server/java/AndroidAppServerWrapper.cpp @@ -18,6 +18,7 @@ #include "AndroidAppServerWrapper.h" +#include #include #include #include @@ -51,6 +52,7 @@ CHIP_ERROR ChipAndroidAppInit(AppDelegate * appDelegate) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); if (appDelegate != nullptr) { initParams.appDelegate = appDelegate; diff --git a/src/app/server/java/BUILD.gn b/src/app/server/java/BUILD.gn index c25548eb112549..98012409b1ee56 100644 --- a/src/app/server/java/BUILD.gn +++ b/src/app/server/java/BUILD.gn @@ -36,6 +36,7 @@ static_library("jni") { ] deps = [ + "${chip_root}/src/app/codegen-data-model-provider:instance-header", "${chip_root}/src/app/server", "${chip_root}/src/inet", "${chip_root}/src/lib", diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index 4535a51dff4b1e..363b43ccb4d5cf 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -1554,6 +1554,43 @@ TEST_F(TestCommandInteraction, TestCommandSenderCommandAsyncSuccessResponseFlow) EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } +TEST_F(TestCommandInteraction, CommandSenderDeletedWhenResponseIsPending) +{ + + mockCommandSenderDelegate.ResetCounter(); + app::CommandSender * commandSender = Platform::New(&mockCommandSenderDelegate, &GetExchangeManager()); + + AddInvokeRequestData(commandSender); + asyncCommand = true; + + EXPECT_EQ(commandSender->SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + + DrainAndServiceIO(); + + EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); + EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 0); + EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 0); + EXPECT_EQ(GetNumActiveCommandResponderObjects(), 1u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 2u); + + // This is NOT deleting CommandSender in one of the callbacks, so we are not violating + // the API contract. CommandSender is deleted when no message is being processed which + // is a time that deleting CommandSender is considered safe. + Platform::Delete(commandSender); + + // Decrease CommandHandler refcount and send response + asyncCommandHandle = nullptr; + + DrainAndServiceIO(); + + EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); + EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 0); + EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 0); + + EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); +} + TEST_F(TestCommandInteraction, TestCommandSenderCommandSpecificResponseFlow) { diff --git a/src/app/tests/TestCommissioningWindowManager.cpp b/src/app/tests/TestCommissioningWindowManager.cpp index 297a95e299a30b..7a2e127324348c 100644 --- a/src/app/tests/TestCommissioningWindowManager.cpp +++ b/src/app/tests/TestCommissioningWindowManager.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -113,6 +114,7 @@ class TestCommissioningWindowManager : public ::testing::Test static chip::SimpleTestEventTriggerDelegate sSimpleTestEventTriggerDelegate; initParams.testEventTriggerDelegate = &sSimpleTestEventTriggerDelegate; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(); // Use whatever server port the kernel decides to give us. initParams.operationalServicePort = 0; diff --git a/src/app/tests/suites/certification/Test_TC_IDM_4_2.yaml b/src/app/tests/suites/certification/Test_TC_IDM_4_2.yaml deleted file mode 100644 index 21beac03a85b00..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_IDM_4_2.yaml +++ /dev/null @@ -1,774 +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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: - 32.4.2. [TC-IDM-4.2] Subscription Response Messages from DUT Test Cases. - [DUT as Server] - -PICS: - - MCORE.IDM.S - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: "Notes/Testing Considerations" - verification: | - 1. The Cluster and Commands should be based on the cluster implementation on the DUT. - 2. The cluster used in the below test steps is an example, User can use any supported chip cluster/attribute/command. - disabled: true - - - label: "Pre condition" - verification: | - Please use Interactive mode to Verify subscription test cases - Here the command to enter interactive mode:-- ./chip-tool interactive start - disabled: true - - - label: "Step 0a: SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT = 60 mins" - PICS: " !ICDM.S " - verification: | - When the ICDM feature is not supported or enabled, the SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT is set to 60 minutes. - disabled: true - - - label: "Step 0b: CR1 reads from the DUT the IdleModeDuration attribute." - PICS: ICDM.S - verification: | - CR1 reads from the DUT the IdleModeDuration attribute by sending below mentioned command - - icdmanagement read idle-mode-interval 1 0 - - Please note down the value of IdleModeDuration as SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT for use in the next step validations. - - [1692870543.225457][7160:7162] CHIP:DMG: SuppressResponse = true, - [1692870543.225495][7160:7162] CHIP:DMG: InteractionModelRevision = 10 - [1692870543.225528][7160:7162] CHIP:DMG: } - [1692870543.225723][7160:7162] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0000 DataVersion: 4022467249 - [1692870543.225795][7160:7162] CHIP:TOO: IdleModeDuration: 2000 - [1692870543.225992][7160:7162] CHIP:EM: <<< [E:52837i S:57653 M:52559591 (Ack:263018291)] (S) Msg TX to 1:0000000000000001 [853D] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true - - - label: - "Step 1: CR1 sends a subscription message to the DUT with - MaxIntervalCeiling set to a value greater than - SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT. 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." - verification: | - Please run the following command on the TH to test the subscription feature and verify that the value of MaxIntervalCeiling is set correctly(set the value greater than SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT) - - onoff subscribe on-off 100 600 1 1 --keepSubscriptions true - - On the CR1( chip-tool), verify a report data message is received and verify it contains the following data : - 1. Verify Report Data Message Received: - Check if a report data message is received on the CR1. - - 2. Verify Report Data Contents: - Confirm that the received report data message contains the data of the attribute/event that was previously requested. - - 3. Verify Subscribe Response Fields: - Examine the Subscribe Response to ensure it includes the following fields: - SubscriptionId: Verify that it is of type uint32. - Verify MaxInterval Field: - - 4. Check for an additional field in the Subscribe Response: - MaxInterval: Verify that it is of type uint32. - - 5. Verify MaxInterval against MaxIntervalCeiling: - Compare the MaxInterval value received in the Subscribe Response to the MaxIntervalCeiling value to verify that MaxInterval is less than or equal to MaxIntervalCeiling. - - [1693221742.765461][22261:22263] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0006 Attribute 0x0000_0000 DataVersion: 523169586 - [1693221742.765473][22261:22263] CHIP:TOO: OnOff: FALSE - [1693221742.765495][22261:22263] CHIP:DMG: MoveToState ReadClient[0x7f6070027e40]: Moving to [AwaitingSu] - [1693221742.765530][22261:22263] CHIP:EM: <<< [E:26388i S:13043 M:192043500 (Ack:11734613)] (S) Msg TX to 1:0000000000000001 [3DC0] --- Type 0001:01 (IM:StatusResponse) - [1693221742.765542][22261:22263] CHIP:IN: (S) Sending msg 192043500 on secure session with LSID: 13043 - [1693221742.765587][22261:22263] CHIP:DL: HandlePlatformSpecificBLEEvent 32793 - [1693221742.765594][22261:22263] CHIP:DL: HandlePlatformSpecificBLEEvent 32793 - [1693221742.765981][22261:22263] CHIP:EM: >>> [E:26388i S:13043 M:11734614 (Ack:192043500)] (S) Msg RX from 1:0000000000000001 [3DC0] --- Type 0001:04 (IM:SubscribeResponse) - [1693221742.765991][22261:22263] CHIP:EM: Found matching exchange: 26388i, Delegate: 0x7f6070027e50 - [1693221742.766002][22261:22263] CHIP:EM: Rxd Ack; Removing MessageCounter:192043500 from Retrans Table on exchange 26388i - [1693221742.766012][22261:22263] CHIP:DMG: SubscribeResponse is received - [1693221742.766025][22261:22263] CHIP:DMG: SubscribeResponseMessage = - [1693221742.766031][22261:22263] CHIP:DMG: { - [1693221742.766038][22261:22263] CHIP:DMG: SubscriptionId = 0x15e2f82f, - [1693221742.766045][22261:22263] CHIP:DMG: MaxInterval = 0x64, - [1693221742.766051][22261:22263] CHIP:DMG: InteractionModelRevision = 10 - [1693221742.766057][22261:22263] CHIP:DMG: } - [1693221742.766068][22261:22263] CHIP:DMG: Subscription established with SubscriptionID = 0x15e2f82f MinInterval = 100s MaxInterval = 100s Peer = 01:0000000000000001 - disabled: true - - - label: - "Step 2: CR1 sends a subscription message to the DUT with - MaxIntervalCeiling set to a value less than - SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT. 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." - verification: | - Please run the following command on the TH to test the subscription feature and verify that the value of MaxIntervalCeiling is set correctly( set the value less than SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT) - - - basicinformation subscribe location 10 400 1 0 --keepSubscriptions true - - On the CR1(chip-tool), verify a report data message is received and verify it contains the following data : - 1. Verify Report Data Message Received: - Check if a report data message is received on the CR1 (target hardware). - - 2. Verify Report Data Contents: - Confirm that the received report data message contains the data of the attribute/event that was previously requested. - - 3. Verify Subscribe Response Fields: - Examine the Subscribe Response to ensure it includes the following fields: - SubscriptionId: Verify that it is of type uint32. - MaxInterval: Verify that it is of type uint32. - - 4. Verify MaxInterval against SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT: - Compare the MaxInterval value received in the Subscribe Response to the value of SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT. - Verify that the MaxInterval value is less than or equal to SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT. - - [1693221766.862968][22261:22263] CHIP:DMG: } - [1693221766.863028][22261:22263] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0028 Attribute 0x0000_0006 DataVersion: 1552486032 - [1693221766.863045][22261:22263] CHIP:TOO: Location: XX - [1693221766.863068][22261:22263] CHIP:DMG: MoveToState ReadClient[0x7f6070027b50]: Moving to [AwaitingSu] - [1693221766.863114][22261:22263] CHIP:EM: <<< [E:26389i S:13043 M:192043503 (Ack:11734615)] (S) Msg TX to 1:0000000000000001 [3DC0] --- Type 0001:01 (IM:StatusResponse) - [1693221766.863130][22261:22263] CHIP:IN: (S) Sending msg 192043503 on secure session with LSID: 13043 - [1693221766.863196][22261:22263] CHIP:DL: HandlePlatformSpecificBLEEvent 32793 - [1693221766.863207][22261:22263] CHIP:DL: HandlePlatformSpecificBLEEvent 32793 - [1693221766.863559][22261:22263] CHIP:EM: >>> [E:26389i S:13043 M:11734616 (Ack:192043503)] (S) Msg RX from 1:0000000000000001 [3DC0] --- Type 0001:04 (IM:SubscribeResponse) - [1693221766.863569][22261:22263] CHIP:EM: Found matching exchange: 26389i, Delegate: 0x7f6070027b60 - [1693221766.863584][22261:22263] CHIP:EM: Rxd Ack; Removing MessageCounter:192043503 from Retrans Table on exchange 26389i - [1693221766.863603][22261:22263] CHIP:DMG: SubscribeResponse is received - [1693221766.863620][22261:22263] CHIP:DMG: SubscribeResponseMessage = - [1693221766.863629][22261:22263] CHIP:DMG: { - [1693221766.863639][22261:22263] CHIP:DMG: SubscriptionId = 0x83e461d9, - [1693221766.863651][22261:22263] CHIP:DMG: MaxInterval = 0xa, - [1693221766.863661][22261:22263] CHIP:DMG: InteractionModelRevision = 10 - [1693221766.863667][22261:22263] CHIP:DMG: } - [1693221766.863677][22261:22263] CHIP:DMG: Subscription established with SubscriptionID = 0x83e461d9 MinInterval = 10s MaxInterval = 10s Peer = 01:0000000000000001 - disabled: true - - - label: - "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. AttributePath = - [[Attribute = Attribute, Cluster = ClusterID, Endpoint = EndpointID - ]]." - verification: | - To ensure that CR1 and CR2 are on the same fabric and that CR1 grants access to CR2, Please send the below mentioned command, it will configure TH2 without access to a specific cluster, we send the ACL command, allowing access only to the Level Control cluster (cluster ID: 8); any attempts to subscribe to or use commands from other clusters will result in a status of 'INVALID_ACTION - - accesscontrol write acl '[{"privilege":5, "authMode":2, "subjects":[112233], "targets":null, "fabricIndex": 1},{"privilege":3, "authMode":2, "subjects":[4], "targets":[{"cluster":8, "endpoint":null, "deviceType":null}]}]' 1 0 - - [1689933254.566655][48781:48783] CHIP:EM: Rxd Ack; Removing MessageCounter:156974239 from Retrans Table on exchange 6316i - [1689933254.566660][48781:48783] CHIP:DMG: WriteClient moving to [ResponseRe] - [1689933254.566671][48781:48783] CHIP:DMG: WriteResponseMessage = - [1689933254.566675][48781:48783] CHIP:DMG: { - [1689933254.566677][48781:48783] CHIP:DMG: AttributeStatusIBs = - [1689933254.566682][48781:48783] CHIP:DMG: [ - [1689933254.566684][48781:48783] CHIP:DMG: AttributeStatusIB = - [1689933254.566688][48781:48783] CHIP:DMG: { - [1689933254.566691][48781:48783] CHIP:DMG: AttributePathIB = - [1689933254.566695][48781:48783] CHIP:DMG: { - [1689933254.566698][48781:48783] CHIP:DMG: Endpoint = 0x0, - [1689933254.566702][48781:48783] CHIP:DMG: Cluster = 0x1f, - [1689933254.566705][48781:48783] CHIP:DMG: Attribute = 0x0000_0000, - [1689933254.566708][48781:48783] CHIP:DMG: } - [1689933254.566713][48781:48783] CHIP:DMG: - [1689933254.566716][48781:48783] CHIP:DMG: StatusIB = - [1689933254.566720][48781:48783] CHIP:DMG: { - [1689933254.566723][48781:48783] CHIP:DMG: status = 0x00 (SUCCESS), - [1689933254.566726][48781:48783] CHIP:DMG: }, - [1689933254.566730][48781:48783] CHIP:DMG: - [1689933254.566732][48781:48783] CHIP:DMG: }, - [1689933254.566739][48781:48783] CHIP:DMG: - [1689933254.566741][48781:48783] CHIP:DMG: AttributeStatusIB = - [1689933254.566744][48781:48783] CHIP:DMG: { - [1689933254.566747][48781:48783] CHIP:DMG: AttributePathIB = - [1689933254.566750][48781:48783] CHIP:DMG: { - [1689933254.566752][48781:48783] CHIP:DMG: Endpoint = 0x0, - [1689933254.566756][48781:48783] CHIP:DMG: Cluster = 0x1f, - [1689933254.566760][48781:48783] CHIP:DMG: Attribute = 0x0000_0000, - [1689933254.566763][48781:48783] CHIP:DMG: ListIndex = Null, - [1689933254.566766][48781:48783] CHIP:DMG: } - [1689933254.566770][48781:48783] CHIP:DMG: - [1689933254.566773][48781:48783] CHIP:DMG: StatusIB = - [1689933254.566776][48781:48783] CHIP:DMG: { - [1689933254.566779][48781:48783] CHIP:DMG: status = 0x00 (SUCCESS), - [1689933254.566782][48781:48783] CHIP:DMG: }, - [1689933254.566786][48781:48783] CHIP:DMG: - [1689933254.566789][48781:48783] CHIP:DMG: }, - [1689933254.566794][48781:48783] CHIP:DMG: - [1689933254.566797][48781:48783] CHIP:DMG: AttributeStatusIB = - [1689933254.566800][48781:48783] CHIP:DMG: { - [1689933254.566802][48781:48783] CHIP:DMG: AttributePathIB = - [1689933254.566805][48781:48783] CHIP:DMG: { - [1689933254.566808][48781:48783] CHIP:DMG: Endpoint = 0x0, - [1689933254.566811][48781:48783] CHIP:DMG: Cluster = 0x1f, - [1689933254.566815][48781:48783] CHIP:DMG: Attribute = 0x0000_0000, - [1689933254.566818][48781:48783] CHIP:DMG: ListIndex = Null, - [1689933254.566821][48781:48783] CHIP:DMG: } - [1689933254.566825][48781:48783] CHIP:DMG: - [1689933254.566828][48781:48783] CHIP:DMG: StatusIB = - [1689933254.566831][48781:48783] CHIP:DMG: { - [1689933254.566834][48781:48783] CHIP:DMG: status = 0x00 (SUCCESS), - [1689933254.566837][48781:48783] CHIP:DMG: }, - [1689933254.566840][48781:48783] CHIP:DMG: - [1689933254.566843][48781:48783] CHIP:DMG: }, - [1689933254.566847][48781:48783] CHIP:DMG: - [1689933254.566849][48781:48783] CHIP:DMG: ], - [1689933254.566857][48781:48783] CHIP:DMG: - [1689933254.566859][48781:48783] CHIP:DMG: InteractionModelRevision = 1 - [1689933254.566862][48781:48783] CHIP:DMG: } - [1689933254.566897][48781:48783] CHIP:DMG: WriteClient moving to [AwaitingDe] - [1689933254.566916][48781:48783] CHIP:EM: <<< [E:6316i S:13964 M:156974240 (Ack:46397313)] (S) Msg TX to 1:0000000000000001 [B15F] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689933254.566922][48781:48783] CHIP:IN: (S) Sending msg 156974240 on secure session with LSID: 13964 - - If CR2 attempts to subscribe to an attribute on a cluster (ClusterID) for which it does not have access, the AttributePath used for the subscription would be in the form [[Attribute = AttributeName, Cluster = ClusterID, Endpoint = EndpointID]], but this action will be denied, and CR2 will not be able to access the attribute due to the restricted access. - - below provided the example command used to subscribe location attribute from basicinformation cluster from node id(4) that have access to the “levelcontrol” cluster - - basicinformation subscribe location 10 2400 1 0 --commissioner-nodeid 4 - [1689933387.304826][48781:48783] CHIP:EM: Rxd Ack; Removing MessageCounter:42350588 from Retrans Table on exchange 6319i - [1689933387.304834][48781:48783] CHIP:DMG: StatusResponseMessage = - [1689933387.304838][48781:48783] CHIP:DMG: { - [1689933387.304841][48781:48783] CHIP:DMG: Status = 0x80 (INVALID_ACTION), - [1689933387.304845][48781:48783] CHIP:DMG: InteractionModelRevision = 1 - [1689933387.304846][48781:48783] CHIP:DMG: } - [1689933387.304850][48781:48783] CHIP:IM: Received status response, status is 0x80 (INVALID_ACTION) - [1689933387.304864][48781:48783] CHIP:EM: <<< [E:6319i S:13965 M:42350589 (Ack:227168589)] (S) Msg TX to 2:0000000000000001 [B15F] --- Type 0001:01 (IM:StatusResponse) - [1689933387.304869][48781:48783] CHIP:IN: (S) Sending msg 42350589 on secure session with LSID: 13965 - [1689933387.304882][48781:48783] CHIP:DMG: MoveToState ReadClient[0x7fd404019110]: Moving to [ Idle] - - With the ACL command in step-2, we are overwriting the default privilege that chip-tool has an admin. After this step-3 you need to send below mentioned command to Grant access to all clusters again. - accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode":2, "subjects":[112233,4], "targets":null}]' 1 0 - disabled: true - - - label: - "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. - AttributePath = [[Cluster = ClusterID, Endpoint = EndpointID ]]." - verification: | - To ensure that CR1 and CR2 are on the same fabric and that CR1 grants access to CR2, Please send the below mentioned command, it will configure CR2 without access to a specific cluster on Specific endpoint, we send the ACL command, allowing access only to the Level Control cluster (cluster ID: 8) on endpoint 1 ; any attempts to subscribe to or use commands from other clusters will result in a status of 'INVALID_ACTION - - accesscontrol write acl '[{"privilege":5, "authMode":2, "subjects":[112233], "targets":null, "fabricIndex": 1},{"privilege":3, "authMode":2, "subjects":[4], "targets":[{"cluster":8, "endpoint":1, "deviceType":null}]}]' 1 0 - - [1687418564.590285][167960:167962] CHIP:DMG: WriteResponseMessage = - [1687418564.590290][167960:167962] CHIP:DMG: { - [1687418564.590294][167960:167962] CHIP:DMG: AttributeStatusIBs = - [1687418564.590304][167960:167962] CHIP:DMG: [ - [1687418564.590313][167960:167962] CHIP:DMG: AttributeStatusIB = - [1687418564.590321][167960:167962] CHIP:DMG: { - [1687418564.590327][167960:167962] CHIP:DMG: AttributePathIB = - [1687418564.590336][167960:167962] CHIP:DMG: { - [1687418564.590346][167960:167962] CHIP:DMG: Endpoint = 0x0, - [1687418564.590355][167960:167962] CHIP:DMG: Cluster = 0x1f, - [1687418564.590366][167960:167962] CHIP:DMG: Attribute = 0x0000_0000, - [1687418564.590374][167960:167962] CHIP:DMG: } - [1687418564.590385][167960:167962] CHIP:DMG: - [1687418564.590392][167960:167962] CHIP:DMG: StatusIB = - [1687418564.590406][167960:167962] CHIP:DMG: { - [1687418564.590415][167960:167962] CHIP:DMG: status = 0x00 (SUCCESS), - [1687418564.590423][167960:167962] CHIP:DMG: }, - [1687418564.590433][167960:167962] CHIP:DMG: - [1687418564.590444][167960:167962] CHIP:DMG: }, - [1687418564.590462][167960:167962] CHIP:DMG: - [1687418564.590469][167960:167962] CHIP:DMG: AttributeStatusIB = - [1687418564.590477][167960:167962] CHIP:DMG: { - [1687418564.590484][167960:167962] CHIP:DMG: AttributePathIB = - [1687418564.590493][167960:167962] CHIP:DMG: { - [1687418564.590502][167960:167962] CHIP:DMG: Endpoint = 0x0, - [1687418564.590512][167960:167962] CHIP:DMG: Cluster = 0x1f, - [1687418564.590521][167960:167962] CHIP:DMG: Attribute = 0x0000_0000, - [1687418564.590530][167960:167962] CHIP:DMG: ListIndex = Null, - [1687418564.590539][167960:167962] CHIP:DMG: } - [1687418564.590552][167960:167962] CHIP:DMG: - [1687418564.590559][167960:167962] CHIP:DMG: StatusIB = - [1687418564.590567][167960:167962] CHIP:DMG: { - [1687418564.590576][167960:167962] CHIP:DMG: status = 0x00 (SUCCESS), - [1687418564.590584][167960:167962] CHIP:DMG: }, - [1687418564.590593][167960:167962] CHIP:DMG: - [1687418564.590601][167960:167962] CHIP:DMG: }, - [1687418564.590616][167960:167962] CHIP:DMG: - [1687418564.590623][167960:167962] CHIP:DMG: AttributeStatusIB = - [1687418564.590631][167960:167962] CHIP:DMG: { - [1687418564.590638][167960:167962] CHIP:DMG: AttributePathIB = - [1687418564.590647][167960:167962] CHIP:DMG: { - [1687418564.590656][167960:167962] CHIP:DMG: Endpoint = 0x0, - [1687418564.590665][167960:167962] CHIP:DMG: Cluster = 0x1f, - [1687418564.590675][167960:167962] CHIP:DMG: Attribute = 0x0000_0000, - [1687418564.590683][167960:167962] CHIP:DMG: ListIndex = Null, - [1687418564.590691][167960:167962] CHIP:DMG: } - [1687418564.590704][167960:167962] CHIP:DMG: - [1687418564.590712][167960:167962] CHIP:DMG: StatusIB = - [1687418564.590720][167960:167962] CHIP:DMG: { - [1687418564.590729][167960:167962] CHIP:DMG: status = 0x00 (SUCCESS), - [1687418564.590738][167960:167962] CHIP:DMG: }, - [1687418564.590747][167960:167962] CHIP:DMG: - [1687418564.590754][167960:167962] CHIP:DMG: }, - [1687418564.590768][167960:167962] CHIP:DMG: - [1687418564.590776][167960:167962] CHIP:DMG: ], - [1687418564.590796][167960:167962] CHIP:DMG: - [1687418564.590804][167960:167962] CHIP:DMG: InteractionModelRevision = 1 - [1687418564.590811][167960:167962] CHIP:DMG: } - [1687418564.590882][167960:167962] CHIP:DMG: WriteClient moving to [AwaitingDe] - - If CR2 attempts to subscribe to an attribute on a cluster (ClusterID) for which it does not have access, the AttributePath used for the subscription would be in the form AttributePath = [[Cluster = ClusterID, Endpoint = EndpointID ]]., but this action will be denied, and CR2 will not be able to access the attribute due to the restricted access. - - below provided the example command to subscribe all attributes onto endpoint 1 for onoff cluster from node id(4) that have access to the “levelcontrol” cluster onto endpoint 1 - - - - onoff subscribe-by-id 0xFFFFFFFF 5 100 1 1 --commissioner-nodeid 4 - [1687418591.903193][167960:167962] CHIP:EM: Found matching exchange: 3641i, Delegate: 0x7fc81c00bbd0 - [1687418591.903197][167960:167962] CHIP:EM: Rxd Ack; Removing MessageCounter:104560060 from Retrans Table on exchange 3641i - [1687418591.903206][167960:167962] CHIP:DMG: StatusResponseMessage = - [1687418591.903209][167960:167962] CHIP:DMG: { - [1687418591.903211][167960:167962] CHIP:DMG: Status = 0x80 (INVALID_ACTION), - [1687418591.903213][167960:167962] CHIP:DMG: InteractionModelRevision = 1 - [1687418591.903215][167960:167962] CHIP:DMG: } - [1687418591.903220][167960:167962] CHIP:IM: Received status response, status is 0x80 (INVALID_ACTION) - [1687418591.903236][167960:167962] CHIP:EM: <<< [E:3641i S:26604 M:104560061 (Ack:37058090)] (S) Msg TX to 2:0000000000000001 [2DB4] --- Type 0001:01 (IM:StatusResponse) - [1687418591.903241][167960:167962] CHIP:IN: (S) Sending msg 104560061 on secure session with LSID: 26604 - [1687418591.903262][167960:167962] CHIP:DMG: MoveToState ReadClient[0x7fc81c00bbc0]: Moving to - - With the ACL command in step-2, we are overwriting the default privilege that chip-tool has an admin. After this step-3 you need to send below mentioned command to Grant access to all clusters again. - - accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode":2, "subjects":[112233,4], "targets":null}]' 1 0 - disabled: true - - - label: - "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. - AttributePath = [[ Endpoint = EndpointID ]]." - verification: | - To ensure that CR1 and CR2 are on the same fabric and that CR1 grants access to CR2, Please send the below mentioned command, it will configure CR2 without access to a specific endpoint, we send the ACL command, allowing access only to the endpoint 1 ; any attempts to subscribe to or use commands from other clusters will result in a status of 'INVALID_ACTION - - accesscontrol write acl '[{"privilege":5, "authMode":2, "subjects":[112233], "targets":null, "fabricIndex": 1},{"privilege":3, "authMode":2, "subjects":[4], "targets":[{"cluster":null, "endpoint":1, "deviceType":null}]}]' 1 0 - - [1687418943.852982][167960:167962] CHIP:DMG: WriteResponseMessage = - [1687418943.852989][167960:167962] CHIP:DMG: { - [1687418943.852996][167960:167962] CHIP:DMG: AttributeStatusIBs = - [1687418943.853006][167960:167962] CHIP:DMG: [ - [1687418943.853012][167960:167962] CHIP:DMG: AttributeStatusIB = - [1687418943.853018][167960:167962] CHIP:DMG: { - [1687418943.853024][167960:167962] CHIP:DMG: AttributePathIB = - [1687418943.853034][167960:167962] CHIP:DMG: { - [1687418943.853042][167960:167962] CHIP:DMG: Endpoint = 0x0, - [1687418943.853053][167960:167962] CHIP:DMG: Cluster = 0x1f, - [1687418943.853060][167960:167962] CHIP:DMG: Attribute = 0x0000_0000, - [1687418943.853067][167960:167962] CHIP:DMG: } - [1687418943.853080][167960:167962] CHIP:DMG: - [1687418943.853087][167960:167962] CHIP:DMG: StatusIB = - [1687418943.853095][167960:167962] CHIP:DMG: { - [1687418943.853103][167960:167962] CHIP:DMG: status = 0x00 (SUCCESS), - [1687418943.853109][167960:167962] CHIP:DMG: }, - [1687418943.853117][167960:167962] CHIP:DMG: - [1687418943.853123][167960:167962] CHIP:DMG: }, - [1687418943.853136][167960:167962] CHIP:DMG: - [1687418943.853142][167960:167962] CHIP:DMG: AttributeStatusIB = - [1687418943.853148][167960:167962] CHIP:DMG: { - [1687418943.853154][167960:167962] CHIP:DMG: AttributePathIB = - [1687418943.853161][167960:167962] CHIP:DMG: { - [1687418943.853167][167960:167962] CHIP:DMG: Endpoint = 0x0, - [1687418943.853175][167960:167962] CHIP:DMG: Cluster = 0x1f, - [1687418943.853182][167960:167962] CHIP:DMG: Attribute = 0x0000_0000, - [1687418943.853189][167960:167962] CHIP:DMG: ListIndex = Null, - [1687418943.853196][167960:167962] CHIP:DMG: } - [1687418943.853205][167960:167962] CHIP:DMG: - [1687418943.853211][167960:167962] CHIP:DMG: StatusIB = - [1687418943.853218][167960:167962] CHIP:DMG: { - [1687418943.853227][167960:167962] CHIP:DMG: status = 0x00 (SUCCESS), - [1687418943.853233][167960:167962] CHIP:DMG: }, - [1687418943.853240][167960:167962] CHIP:DMG: - [1687418943.853246][167960:167962] CHIP:DMG: }, - [1687418943.853258][167960:167962] CHIP:DMG: - [1687418943.853264][167960:167962] CHIP:DMG: AttributeStatusIB = - [1687418943.853274][167960:167962] CHIP:DMG: { - [1687418943.853280][167960:167962] CHIP:DMG: AttributePathIB = - [1687418943.853290][167960:167962] CHIP:DMG: { - [1687418943.853296][167960:167962] CHIP:DMG: Endpoint = 0x0, - [1687418943.853304][167960:167962] CHIP:DMG: Cluster = 0x1f, - [1687418943.853311][167960:167962] CHIP:DMG: Attribute = 0x0000_0000, - [1687418943.853318][167960:167962] CHIP:DMG: ListIndex = Null, - [1687418943.853323][167960:167962] CHIP:DMG: } - [1687418943.853332][167960:167962] CHIP:DMG: - [1687418943.853338][167960:167962] CHIP:DMG: StatusIB = - [1687418943.853345][167960:167962] CHIP:DMG: { - [1687418943.853352][167960:167962] CHIP:DMG: status = 0x00 (SUCCESS), - [1687418943.853359][167960:167962] CHIP:DMG: }, - [1687418943.853368][167960:167962] CHIP:DMG: - [1687418943.853374][167960:167962] CHIP:DMG: }, - [1687418943.853383][167960:167962] CHIP:DMG: - [1687418943.853389][167960:167962] CHIP:DMG: ], - [1687418943.853405][167960:167962] CHIP:DMG: - [1687418943.853411][167960:167962] CHIP:DMG: InteractionModelRevision = 1 - [1687418943.853418][167960:167962] CHIP:DMG: } - [1687418943.853488][167960:167962] CHIP:DMG: WriteClient moving to [AwaitingDe] - - If CR2 attempts to subscribe to an attribute on a cluster (ClusterID) for which it does not have access, the AttributePath used for the subscription would be in the form AttributePath = [[ Endpoint = EndpointID ]], but this action will be denied, and CR2 will not be able to access the attribute due to the restricted access. - - below provided the example command to subscribe to all attributes onto endpoint 0 for cluster 6 from a node id that have access to everything onto endpoint 1 - - - onoff subscribe-by-id 0xFFFFFFFF 5 100 1 0 --commissioner-nodeid 4 - [1687418974.537572][167960:167962] CHIP:EM: Rxd Ack; Removing MessageCounter:104560062 from Retrans Table on exchange 3650i - [1687418974.537610][167960:167962] CHIP:DMG: StatusResponseMessage = - [1687418974.537622][167960:167962] CHIP:DMG: { - [1687418974.537631][167960:167962] CHIP:DMG: Status = 0x80 (INVALID_ACTION), - [1687418974.537640][167960:167962] CHIP:DMG: InteractionModelRevision = 1 - [1687418974.537648][167960:167962] CHIP:DMG: } - [1687418974.537658][167960:167962] CHIP:IM: Received status response, status is 0x80 (INVALID_ACTION) - [1687418974.537725][167960:167962] CHIP:EM: <<< [E:3650i S:26604 M:104560063 (Ack:37058092)] (S) Msg TX to 2:0000000000000001 [2DB4] --- Type 0001:01 (IM:StatusResponse) - [1687418974.537743][167960:167962] CHIP:IN: (S) Sending msg 104560063 on secure session with LSID: 26604 - - - With the ACL command in step-2, we are overwriting the default privilege that chip-tool has an admin. After this step-3 you need to send below mentioned command to Grant access to all clusters again. - accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode":2, "subjects":[112233,4], "targets":null}]' 1 0 - disabled: true - - - label: - "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. - AttributePath = [[ ]]." - verification: | - sending a command along with unregistered commissioner node id (5) - - any subscribe-by-id 0xFFFFFFFF 0xFFFFFFFF 10 100 1 0XFFFF --commissioner-nodeid 5 - On CR2, Verify that the DUT returns a "INVALID_ACTION" status response. - - [1695815340.162063][2522:2524] CHIP:EM: Rxd Ack; Removing MessageCounter:187875065 from Retrans Table on exchange 10455i - [1695815340.162181][2522:2524] CHIP:DMG: StatusResponseMessage = - [1695815340.162244][2522:2524] CHIP:DMG: { - [1695815340.162298][2522:2524] CHIP:DMG: Status = 0x80 (INVALID_ACTION), - [1695815340.162357][2522:2524] CHIP:DMG: InteractionModelRevision = 11 - [1695815340.162412][2522:2524] CHIP:DMG: } - [1695815340.162501][2522:2524] CHIP:IM: Received status response, status is 0x80 (INVALID_ACTION) - disabled: true - - - label: - "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." - verification: | - Chip-Tool support required to validate this step : SDK Issue - https://github.com/project-chip/connectedhomeip/issues/28363 - - Not Testable - disabled: true - - - label: - "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." - verification: | - Please send the following command from CR1 (the subscription requester) to DUT (the device under test) to activate the subscription for the "on-time" attribute, setting the MinIntervalFloor and MaxIntervalCeiling values to be the same (in this case, 100 seconds): - - onoff subscribe on-time 100 100 1 1 --keepSubscriptions true - On the CR1(chip-tool) verify the SubscribeResponse is received successfully - [1690540281.061350][9488:9490] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0006 Attribute 0x0000_4001 DataVersion: 3310786904 - [1690540281.061363][9488:9490] CHIP:TOO: OnTime: 0 - [1690540281.061379][9488:9490] CHIP:DMG: MoveToState ReadClient[0x7faef8013880]: Moving to [AwaitingSu] - [1690540281.061427][9488:9490] CHIP:EM: <<< [E:49945i S:38251 M:151709012 (Ack:20807554)] (S) Msg TX to 1:0000000000000001 [8B98] --- Type 0001:01 (IM:StatusResponse) - [1690540281.061441][9488:9490] CHIP:IN: (S) Sending msg 151709012 on secure session with LSID: 38251 - [1690540281.061758][9488:9490] CHIP:EM: >>> [E:49945i S:38251 M:20807555 (Ack:151709012)] (S) Msg RX from 1:0000000000000001 [8B98] --- Type 0001:04 (IM:SubscribeResponse) - [1690540281.061771][9488:9490] CHIP:EM: Found matching exchange: 49945i, Delegate: 0x7faef8013890 - [1690540281.061786][9488:9490] CHIP:EM: Rxd Ack; Removing MessageCounter:151709012 from Retrans Table on exchange 49945i - [1690540281.061800][9488:9490] CHIP:DMG: SubscribeResponse is received - [1690540281.061816][9488:9490] CHIP:DMG: SubscribeResponseMessage = - [1690540281.061825][9488:9490] CHIP:DMG: { - [1690540281.061833][9488:9490] CHIP:DMG: SubscriptionId = 0x3ef5dc34, - [1690540281.061844][9488:9490] CHIP:DMG: MaxInterval = 0x64, - [1690540281.061853][9488:9490] CHIP:DMG: InteractionModelRevision = 1 - [1690540281.061862][9488:9490] CHIP:DMG: } - [1690540281.061875][9488:9490] CHIP:DMG: Subscription established with SubscriptionID = 0x3ef5dc34 MinInterval = 100s MaxInterval = 100s Peer = 01:0000000000000001 - - - - After activating the subscription between TH and DUT, please send the following command to modify the 'on-time' attribute value: - - >>> onoff write on-time 1 1 1 - On CR1(chip-tool), verify that the DUT sends a report data containing the current 'ontime' attribute value after the MinIntervalFloor time has elapsed - - [1690540304.761997][9488:9488] CHIP:TOO: Command: onoff write on-time 1 1 1 - [1690540304.762298][9488:9490] CHIP:TOO: Sending command to node 0x1 - [1690540304.762462][9488:9490] CHIP:CSM: FindOrEstablishSession: PeerId = [1:0000000000000001] - [1690540304.762474][9488:9490] CHIP:CSM: FindOrEstablishSession: No existing OperationalSessionSetup instance found - [1690540304.762493][9488:9490] CHIP:DIS: Found an existing secure session to [1:0000000000000001]! - [1690540304.762501][9488:9490] CHIP:DIS: OperationalSessionSetup[1:0000000000000001]: State change 1 --> 5 - [1690540304.762534][9488:9490] CHIP:TOO: cluster 0x0000_0006, attribute: 0x0000_4001, endpoint 1 - [1690540304.762585][9488:9490] CHIP:DMG: WriteClient moving to [AddAttribu] - [1690540304.762673][9488:9490] CHIP:EM: <<< [E:49946i S:38251 M:151709014] (S) Msg TX to 1:0000000000000001 [8B98] --- Type 0001:06 (IM:WriteRequest) - [1690540304.762693][9488:9490] CHIP:IN: (S) Sending msg 151709014 on secure session with LSID: 38251 - [1690540304.762788][9488:9490] CHIP:DMG: WriteClient moving to [AwaitingRe] - [1690540304.763448][9488:9490] CHIP:EM: >>> [E:49946i S:38251 M:20807556 (Ack:151709014)] (S) Msg RX from 1:0000000000000001 [8B98] --- Type 0001:07 (IM:WriteResponse) - [1690540304.763464][9488:9490] CHIP:EM: Found matching exchange: 49946i, Delegate: 0x7faef800a5e0 - [1690540304.763478][9488:9490] CHIP:EM: Rxd Ack; Removing MessageCounter:151709014 from Retrans Table on exchange 49946i - [1690540304.763493][9488:9490] CHIP:DMG: WriteClient moving to [ResponseRe] - [1690540304.763518][9488:9490] CHIP:DMG: WriteResponseMessage = - [1690540304.763527][9488:9490] CHIP:DMG: { - [1690540304.763534][9488:9490] CHIP:DMG: AttributeStatusIBs = - [1690540304.763546][9488:9490] CHIP:DMG: [ - [1690540304.763553][9488:9490] CHIP:DMG: AttributeStatusIB = - [1690540304.763562][9488:9490] CHIP:DMG: { - [1690540304.763570][9488:9490] CHIP:DMG: AttributePathIB = - [1690540304.763579][9488:9490] CHIP:DMG: { - [1690540304.763589][9488:9490] CHIP:DMG: Endpoint = 0x1, - [1690540304.763597][9488:9490] CHIP:DMG: Cluster = 0x6, - [1690540304.763606][9488:9490] CHIP:DMG: Attribute = 0x0000_4001, - [1690540304.763614][9488:9490] CHIP:DMG: } - [1690540304.763626][9488:9490] CHIP:DMG: - [1690540304.763634][9488:9490] CHIP:DMG: StatusIB = - [1690540304.763646][9488:9490] CHIP:DMG: { - [1690540304.763654][9488:9490] CHIP:DMG: status = 0x00 (SUCCESS), - [1690540304.763662][9488:9490] CHIP:DMG: }, - [1690540304.763671][9488:9490] CHIP:DMG: - [1690540304.763677][9488:9490] CHIP:DMG: }, - [1690540304.763688][9488:9490] CHIP:DMG: - [1690540304.763694][9488:9490] CHIP:DMG: ], - [1690540304.763706][9488:9490] CHIP:DMG: - [1690540304.763713][9488:9490] CHIP:DMG: InteractionModelRevision = 1 - [1690540304.763719][9488:9490] CHIP:DMG: } - [1690540304.763753][9488:9490] CHIP:DMG: WriteClient moving to [AwaitingDe] - [1690540304.763793][9488:9490] CHIP:EM: <<< [E:49946i S:38251 M:151709015 (Ack:20807556)] (S) Msg TX to 1:0000000000000001 [8B98] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1690540304.763810][9488:9490] CHIP:IN: (S) Sending msg 151709015 on secure session with LSID: 38251 - [1690540304.763846][9488:9490] CHIP:EM: Flushed pending ack for MessageCounter:20807556 on exchange 49946i - [1690540325.496486][9488:9490] CHIP:EM: >>> [E:48664r S:38251 M:20807557] (S) Msg RX from 1:0000000000000001 [8B98] --- Type 0001:05 (IM:ReportData) - [1690540325.496520][9488:9490] CHIP:EM: Handling via exchange: 48664r, Delegate: 0x5639a50ebc68 - [1690540325.496552][9488:9490] CHIP:DMG: ReportDataMessage = - [1690540325.496565][9488:9490] CHIP:DMG: { - [1690540325.496576][9488:9490] CHIP:DMG: SubscriptionId = 0x3a11136b, - [1690540325.496587][9488:9490] CHIP:DMG: InteractionModelRevision = 1 - [1690540325.496595][9488:9490] CHIP:DMG: } - [1690540325.496632][9488:9490] CHIP:DMG: Refresh LivenessCheckTime for 804224 milliseconds with SubscriptionId = 0x3a11136b Peer = 01:0000000000000001 - [1690540325.496682][9488:9490] CHIP:EM: <<< [E:48664r S:38251 M:151709016 (Ack:20807557)] (S) Msg TX to 1:0000000000000001 [8B98] --- Type 0001:01 (IM:StatusResponse) - [1690540325.496697][9488:9490] CHIP:IN: (S) Sending msg 151709016 on secure session with LSID: 38251 - [1690540325.497211][9488:9490] CHIP:EM: >>> [E:48664r S:38251 M:20807558 (Ack:151709016)] (S) Msg RX from 1:0000000000000001 [8B98] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1690540325.497237][9488:9490] CHIP:EM: Found matching exchange: 48664r, Delegate: (nil) - [1690540325.497258][9488:9490] CHIP:EM: Rxd Ack; Removing MessageCounter:151709016 from Retrans Table on exchange 48664r - [1690540381.062201][9488:9490] CHIP:EM: >>> [E:48665r S:38251 M:20807559] (S) Msg RX from 1:0000000000000001 [8B98] --- Type 0001:05 (IM:ReportData) - [1690540381.062234][9488:9490] CHIP:EM: Handling via exchange: 48665r, Delegate: 0x5639a50ebc68 - [1690540381.062272][9488:9490] CHIP:DMG: ReportDataMessage = - [1690540381.062281][9488:9490] CHIP:DMG: { - [1690540381.062289][9488:9490] CHIP:DMG: SubscriptionId = 0x3ef5dc34, - [1690540381.062296][9488:9490] CHIP:DMG: AttributeReportIBs = - [1690540381.062308][9488:9490] CHIP:DMG: [ - [1690540381.062315][9488:9490] CHIP:DMG: AttributeReportIB = - [1690540381.062325][9488:9490] CHIP:DMG: { - [1690540381.062332][9488:9490] CHIP:DMG: AttributeDataIB = - [1690540381.062338][9488:9490] CHIP:DMG: { - [1690540381.062346][9488:9490] CHIP:DMG: DataVersion = 0xc5569959, - [1690540381.062354][9488:9490] CHIP:DMG: AttributePathIB = - [1690540381.062367][9488:9490] CHIP:DMG: { - [1690540381.062375][9488:9490] CHIP:DMG: Endpoint = 0x1, - [1690540381.062383][9488:9490] CHIP:DMG: Cluster = 0x6, - [1690540381.062392][9488:9490] CHIP:DMG: Attribute = 0x0000_4001, - [1690540381.062399][9488:9490] CHIP:DMG: } - [1690540381.062409][9488:9490] CHIP:DMG: - [1690540381.062417][9488:9490] CHIP:DMG: Data = 1, - [1690540381.062423][9488:9490] CHIP:DMG: }, - [1690540381.062433][9488:9490] CHIP:DMG: - [1690540381.062439][9488:9490] CHIP:DMG: }, - [1690540381.062447][9488:9490] CHIP:DMG: - [1690540381.062453][9488:9490] CHIP:DMG: ], - [1690540381.062463][9488:9490] CHIP:DMG: - [1690540381.062470][9488:9490] CHIP:DMG: InteractionModelRevision = 1 - [1690540381.062476][9488:9490] CHIP:DMG: } - [1690540381.062543][9488:9490] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0006 Attribute 0x0000_4001 DataVersion: 3310786905 - [1690540381.062558][9488:9490] CHIP:TOO: OnTime: 1 - [1690540381.062580][9488:9490] CHIP:DMG: Refresh LivenessCheckTime for 104224 milliseconds with SubscriptionId = 0x3ef5dc34 Peer = 01:0000000000000001 - [1690540381.062627][9488:9490] CHIP:EM: <<< [E:48665r S:38251 M:151709017 (Ack:20807559)] (S) Msg TX to 1:0000000000000001 [8B98] --- Type 0001:01 (IM:StatusResponse) - [1690540381.062641][9488:9490] CHIP:IN: (S) Sending msg 151709017 on secure session with LSID: 38251 - [1690540381.063237][9488:9490] CHIP:EM: >>> [E:48665r S:38251 M:20807560 (Ack:151709017)] (S) Msg RX from 1:0000000000000001 [8B98] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1690540381.063261][9488:9490] CHIP:EM: Found matching exchange: 48665r, Delegate: (nil) - [1690540381.063276][9488:9490] CHIP:EM: Rxd Ack; Removing MessageCounter:151709017 from Retrans Table on exchange 48665r - disabled: true - - - label: - "Step 9: CR1 sends a subscription request action for an attribute and - set the MinIntervalFloor value to be greater than MaxIntervalCeiling." - verification: | - Please send the following command from CR1 (the subscription requester) to DUT (the device under test) to activate the subscription for the "on-time" attribute, setting the MinIntervalFloor value to be greater than MaxIntervalCeiling: - - - onoff subscribe on-time 500 100 1 1 --keepSubscriptions true - - On CR1 (chip-tool), verify that the DUT sends an error message, confirming that the subscription is not established successfully - - [1661754615.089845][103654:103659] CHIP:DMG: StatusResponseMessage = - [1661754615.089857][103654:103659] CHIP:DMG: { - [1661754615.089868][103654:103659] CHIP:DMG: Status = 0x80 (INVALID_ACTION), - [1661754615.089879][103654:103659] CHIP:DMG: InteractionModelRevision = 1 - [1661754615.089889][103654:103659] CHIP:DMG: } - [1661754615.089901][103654:103659] CHIP:IM: Received status response, status is 0x80 (INVALID_ACTION) - [1661754615.089927][103654:103659] CHIP:EM: Piggybacking Ack for MessageCounter:223396916 on exchange: 6193i - disabled: true - - - label: - "Step 10: CR1 sends a subscription request to subscribe to a specific - global attribute from all clusters on all endpoints. AttributePath = - [[Attribute = Global Attribute]]. +" - verification: | - any subscribe-by-id 0xFFFFFFFF 0xFFFD 10 300 1 0xFFFF --keepSubscriptions true - - The following log is an example of the output obtained for Attribute 0x0000_FFFD on Endpoint 0 - Pls repeat this for every cluster on every endpoint. The log represents the attributes of clusters found on different endpoints. - - Verify the presence of mandatory global attribute ClusterRevision for every cluster on every endpoint: - - - Verification Instructions: - Please use the provided example log as a guide to verify the attributes for other clusters and endpoints in a similar manner. - [1690541617.461279][9488:9490] CHIP:DMG: } - [1690541617.461374][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 124546948 - [1690541617.461379][9488:9490] CHIP:TOO: ClusterRevision: 4 - [1690541617.461388][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0004 Attribute 0x0000_FFFD DataVersion: 1468663600 - [1690541617.461391][9488:9490] CHIP:TOO: ClusterRevision: 4 - [1690541617.461399][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001D Attribute 0x0000_FFFD DataVersion: 2536415407 - [1690541617.461402][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690541617.461410][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001E Attribute 0x0000_FFFD DataVersion: 1723648967 - [1690541617.461413][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690541617.461421][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFFD DataVersion: 659240739 - [1690541617.461424][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690541617.461432][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0028 Attribute 0x0000_FFFD DataVersion: 3950349597 - [1690541617.461435][9488:9490] CHIP:TOO: ClusterRevision: 2 - [1690541617.461443][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002A Attribute 0x0000_FFFD DataVersion: 1224601682 - [1690541617.461446][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690541617.461454][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002B Attribute 0x0000_FFFD DataVersion: 2744454868 - [1690541617.461456][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690541617.461464][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002C Attribute 0x0000_FFFD DataVersion: 463823876 - [1690541617.461467][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690541617.461475][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002D Attribute 0x0000_FFFD DataVersion: 115397017 - [1690541617.461477][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690541617.461485][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_FFFD DataVersion: 85684249 - [1690541617.461488][9488:9490] CHIP:TOO: ClusterRevision: 2 - [1690541617.461496][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0030 Attribute 0x0000_FFFD DataVersion: 75615160 - [1690541617.461498][9488:9490] CHIP:TOO: ClusterRevision: 1 - disabled: true - - - label: - "Step 11: CR1 sends a subscription request to subscribe to a global - attribute on an endpoint on all clusters. AttributePath = [[Attribute - = Global Attribute, Endpoint = EndpointID ]]. +" - verification: | - any subscribe-by-id 0xFFFFFFFF 0xFFFD 10 300 1 0 --keepSubscriptions true - The following log is an example of the output obtained for Attribute 0x0000_FFFD on Endpoint 0 - Pls repeat this for every cluster on endpoint 0. The log represents the attribute of clusters found on endpoint 0. - - Verify the presence of mandatory global attribute ClusterRevision for every cluster on every endpoint: - - - Verification Instructions: - Please use the provided example log as a guide to verify the attributes for other clusters and endpoints in a similar manner. - - [1690542041.905545][9488:9490] CHIP:DMG: InteractionModelRevision = 1 - [1690542041.905546][9488:9490] CHIP:DMG: } - [1690542041.905621][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 124546948 - [1690542041.905625][9488:9490] CHIP:TOO: ClusterRevision: 4 - [1690542041.905634][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0004 Attribute 0x0000_FFFD DataVersion: 1468663600 - [1690542041.905637][9488:9490] CHIP:TOO: ClusterRevision: 4 - [1690542041.905646][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001D Attribute 0x0000_FFFD DataVersion: 2536415407 - [1690542041.905649][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905657][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001E Attribute 0x0000_FFFD DataVersion: 1723648967 - [1690542041.905659][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905667][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFFD DataVersion: 659240739 - [1690542041.905670][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905678][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0028 Attribute 0x0000_FFFD DataVersion: 3950349597 - [1690542041.905680][9488:9490] CHIP:TOO: ClusterRevision: 2 - [1690542041.905688][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002A Attribute 0x0000_FFFD DataVersion: 1224601682 - [1690542041.905691][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905699][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002B Attribute 0x0000_FFFD DataVersion: 2744454868 - [1690542041.905701][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905710][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002C Attribute 0x0000_FFFD DataVersion: 463823876 - [1690542041.905712][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905720][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002D Attribute 0x0000_FFFD DataVersion: 115397017 - [1690542041.905722][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905730][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_FFFD DataVersion: 85684249 - [1690542041.905733][9488:9490] CHIP:TOO: ClusterRevision: 2 - [1690542041.905741][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0030 Attribute 0x0000_FFFD DataVersion: 75615160 - [1690542041.905743][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905751][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0031 Attribute 0x0000_FFFD DataVersion: 1962336111 - [1690542041.905753][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905761][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0032 Attribute 0x0000_FFFD DataVersion: 465381371 - [1690542041.905763][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905772][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0033 Attribute 0x0000_FFFD DataVersion: 2781452270 - [1690542041.905774][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905782][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0034 Attribute 0x0000_FFFD DataVersion: 3343308905 - [1690542041.905784][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905792][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0035 Attribute 0x0000_FFFD DataVersion: 1933667935 - [1690542041.905794][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905803][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0036 Attribute 0x0000_FFFD DataVersion: 1917440631 - [1690542041.905806][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905814][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0037 Attribute 0x0000_FFFD DataVersion: 2059544742 - [1690542041.905816][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905824][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0038 Attribute 0x0000_FFFD DataVersion: 292367345 - [1690542041.905826][9488:9490] CHIP:TOO: ClusterRevision: 2 - [1690542041.905835][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_003C Attribute 0x0000_FFFD DataVersion: 4275836516 - [1690542041.905837][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905845][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_003E Attribute 0x0000_FFFD DataVersion: 2334789054 - [1690542041.905848][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905856][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_003F Attribute 0x0000_FFFD DataVersion: 2215403935 - [1690542041.905858][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905866][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0040 Attribute 0x0000_FFFD DataVersion: 1171006049 - [1690542041.905868][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905877][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0041 Attribute 0x0000_FFFD DataVersion: 1339481925 - [1690542041.905879][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905887][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_FFFD DataVersion: 2155717858 - [1690542041.905889][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.905897][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0405 Attribute 0x0000_FFFD DataVersion: 2620361579 - [1690542041.906830][9488:9490] CHIP:TOO: ClusterRevision: 3 - [1690542041.906854][9488:9490] CHIP:TOO: Endpoint: 0 Cluster: 0xFFF1_FC06 Attribute 0x0000_FFFD DataVersion: 2161647034 - [1690542041.906860][9488:9490] CHIP:TOO: ClusterRevision: 1 - [1690542041.906886][9488:9490] CHIP:DMG: MoveToState ReadClient[0x7faef801d0f0]: Moving to [AwaitingSu] - [1690542041.906910][9488:9490] CHIP:EM: <<< [E:49949i S:38251 M:151709045 (Ack:20807605)] (S) Msg TX to 1:0000000000000001 [8B98] --- Type 0001:01 (IM:StatusResponse) - [1690542041.906915][9488:9490] CHIP:IN: (S) Sending msg 151709045 on secure session with LSID: 38251 - [1690542041.907098][9488:9490] CHIP:EM: >>> [E:49949i S:38251 M:20807606 (Ack:151709045)] (S) Msg RX from 1:0000000000000001 [8B98] --- Type 0001:04 (IM:SubscribeResponse) - [1690542041.907107][9488:9490] CHIP:EM: Found matching exchange: 49949i, Delegate: 0x7faef801d100 - [1690542041.907113][9488:9490] CHIP:EM: Rxd Ack; Removing MessageCounter:151709045 from Retrans Table on exchange 49949i - [1690542041.907119][9488:9490] CHIP:DMG: SubscribeResponse is received - [1690542041.907126][9488:9490] CHIP:DMG: SubscribeResponseMessage = - [1690542041.907128][9488:9490] CHIP:DMG: { - [1690542041.907131][9488:9490] CHIP:DMG: SubscriptionId = 0x9488dc04, - [1690542041.907134][9488:9490] CHIP:DMG: MaxInterval = 0x12c, - [1690542041.907137][9488:9490] CHIP:DMG: InteractionModelRevision = 1 - [1690542041.907139][9488:9490] CHIP:DMG: } - [1690542041.907144][9488:9490] CHIP:DMG: Subscription established with SubscriptionID = 0x9488dc04 MinInterval = 10s MaxInterval = 300s Peer = 01:0000000000000001 - disabled: true - - - label: - "Step 12: CR1 sends a subscription request to the DUT with both - AttributeRequests and EventRequests as empty" - verification: | - Please send the following command from TH (the subscription requester) to DUT (the device under test) to activate the subscription with both AttributeRequests and EventRequests as empty - - any subscribe-none 10 100 1 --keepSubscriptions 1 - - On CR1 (chip-tool), verify that the DUT sends an error message, confirming that the subscription is not established successfully - [1690884829.708780][84191:84193] CHIP:EM: Rxd Ack; Removing MessageCounter:136461510 from Retrans Table on exchange 23099i - [1690884829.708861][84191:84193] CHIP:DMG: StatusResponseMessage = - [1690884829.708907][84191:84193] CHIP:DMG: { - [1690884829.708947][84191:84193] CHIP:DMG: Status = 0x80 (INVALID_ACTION), - [1690884829.708988][84191:84193] CHIP:DMG: InteractionModelRevision = 1 - [1690884829.709026][84191:84193] CHIP:DMG: } - [1690884829.709064][84191:84193] CHIP:IM: Received status response, status is 0x80 (INVALID_ACTION) - [1690884829.709196][84191:84193] CHIP:EM: <<< [E:23099i S:5058 M:136461511 (Ack:90075666)] (S) Msg TX to 1:0000000000000001 [EAE3] --- Type 0001:01 (IM:StatusResponse) - [1690884829.709252][84191:84193] CHIP:IN: (S) Sending msg 136461511 on secure session with LSID: 5058 - [1690884829.709420][84191:84193] CHIP:DMG: MoveToState ReadClient[0xffff9c005e90]: Moving to [ Idle] - disabled: true diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index bee33964dfac50..0e6e045b8ea7f6 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -124,7 +124,6 @@ "Test_TC_IDM_3_1", "Test_TC_IDM_3_2", "Test_TC_IDM_4_1", - "Test_TC_IDM_4_2", "Test_TC_IDM_4_3", "Test_TC_IDM_4_4", "Test_TC_IDM_5_1", diff --git a/src/app/util/mock/BUILD.gn b/src/app/util/mock/BUILD.gn index db566aad578793..0b99d827403047 100644 --- a/src/app/util/mock/BUILD.gn +++ b/src/app/util/mock/BUILD.gn @@ -56,4 +56,5 @@ source_set("mock_codegen_data_model") { public_configs = [ ":mock_include" ] public_deps += [ ":mock_ember" ] + deps = [ "${chip_root}/src/app/util/persistence:persistence" ] } 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 54fe73d5f0df74..84b5720e165fe1 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 @@ -203,7 +203,7 @@ limitations under the License. CLIENT_LIST PARTS_LIST - + REACHABLE @@ -2069,7 +2069,7 @@ limitations under the License. - + diff --git a/src/controller/python/chip/server/ServerInit.cpp b/src/controller/python/chip/server/ServerInit.cpp index 39edd7a2ad6b2c..83bb8acefecd89 100644 --- a/src/controller/python/chip/server/ServerInit.cpp +++ b/src/controller/python/chip/server/ServerInit.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -161,6 +162,7 @@ PyChipError pychip_server_native_init() // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; PyReturnErrorOnFailure(ToPyChipError(initParams.InitializeStaticResourcesBeforeServerInit())); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); initParams.operationalServicePort = CHIP_PORT; initParams.userDirectedCommissioningPort = CHIP_UDC_PORT; diff --git a/src/platform/Ameba/SystemTimeSupport.cpp b/src/platform/Ameba/SystemTimeSupport.cpp index acf451d49858ab..8a5f59131d6632 100644 --- a/src/platform/Ameba/SystemTimeSupport.cpp +++ b/src/platform/Ameba/SystemTimeSupport.cpp @@ -58,26 +58,32 @@ Milliseconds64 ClockImpl::GetMonotonicMilliseconds64(void) CHIP_ERROR ClockImpl::GetClock_RealTime(Clock::Microseconds64 & curTime) { - // TODO(19081): This platform does not properly error out if wall clock has - // not been set. For now, short circuit this. - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; -#if 0 - time_t seconds; - struct rtkTimeVal tv; +#if CONFIG_ENABLE_AMEBA_SNTP + time_t seconds = 0, uSeconds = 0; - seconds = matter_rtc_read(); - - tv.tv_sec = (uint32_t) seconds; - tv.tv_usec = 0; + if (matter_sntp_rtc_is_sync()) // if RTC is already sync with SNTP, read directly from RTC + { + seconds = matter_rtc_read(); // ameba rtc precission is in seconds only + } + else // read from SNTP and sync RTC with SNTP + { + matter_sntp_get_current_time(&seconds, &uSeconds); + } - if (tv.tv_sec < CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD) + if (seconds < CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD) { return CHIP_ERROR_REAL_TIME_NOT_SYNCED; } - static_assert(CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD >= 0, "We might be letting through negative tv_sec values!"); - curTime = Microseconds64((static_cast(tv.tv_sec) * UINT64_C(1000000)) + static_cast(tv.tv_usec)); + if (uSeconds < 0) + { + return CHIP_ERROR_REAL_TIME_NOT_SYNCED; + } + static_assert(CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD >= 0, "We might be letting through negative uSeconds values!"); + curTime = Microseconds64((static_cast(seconds) * UINT64_C(1000000)) + static_cast(uSeconds)); return CHIP_NO_ERROR; +#else + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; #endif } @@ -105,9 +111,16 @@ CHIP_ERROR InitClock_RealTime() Clock::Microseconds64((static_cast(CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD) * UINT64_C(1000000))); // Use CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD as the initial value of RealTime. // Then the RealTime obtained from GetClock_RealTime will be always valid. - // - // TODO(19081): This is broken because it causes the platform to report - // that it does have wall clock time when it actually doesn't. +#if CONFIG_ENABLE_AMEBA_SNTP + time_t seconds = 0, uSeconds = 0; + + matter_sntp_init(); + matter_sntp_get_current_time(&seconds, &uSeconds); // try to read from SNTP and sync RTC with SNTP + if ((seconds > CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD) && (uSeconds > 0)) + { + curTime = Microseconds64((static_cast(seconds) * UINT64_C(1000000)) + static_cast(uSeconds)); + } +#endif return System::SystemClock().SetClock_RealTime(curTime); } diff --git a/src/platform/nxp/common/DnssdImpl.cpp b/src/platform/nxp/common/DnssdImpl.cpp index 5b35693534059f..65061aa80c4266 100644 --- a/src/platform/nxp/common/DnssdImpl.cpp +++ b/src/platform/nxp/common/DnssdImpl.cpp @@ -99,7 +99,7 @@ CHIP_ERROR ChipDnssdBrowse(const char * type, DnssdServiceProtocol protocol, chi chip::Inet::InterfaceId interface, DnssdBrowseCallback callback, void * context, intptr_t * browseIdentifier) { - if (ConnectivityMgr().IsWiFiStationConnected()) //|| ESP32Utils::HasIPv6LinkLocalAddress(ESP32Utils::kDefaultEthernetNetifKey)) + if (ConnectivityMgr().IsWiFiStationConnected()) { ReturnErrorOnFailure(NxpChipDnssdBrowse(type, protocol, addressType, interface, callback, context, browseIdentifier)); } @@ -119,7 +119,7 @@ CHIP_ERROR ChipDnssdStopBrowse(intptr_t browseIdentifier) CHIP_ERROR ChipDnssdResolve(DnssdService * service, chip::Inet::InterfaceId interface, DnssdResolveCallback callback, void * context) { - if (ConnectivityMgr().IsWiFiStationConnected()) //|| ESP32Utils::HasIPv6LinkLocalAddress(ESP32Utils::kDefaultEthernetNetifKey)) + if (ConnectivityMgr().IsWiFiStationConnected()) { ReturnErrorOnFailure(NxpChipDnssdResolve(service, interface, callback, context)); } diff --git a/src/platform/nxp/common/DnssdImplBr.cpp b/src/platform/nxp/common/DnssdImplBr.cpp index 5eab86fe197963..e65ae2d5ef331b 100644 --- a/src/platform/nxp/common/DnssdImplBr.cpp +++ b/src/platform/nxp/common/DnssdImplBr.cpp @@ -28,6 +28,8 @@ #include #include +#include + using namespace ::chip::DeviceLayer; using namespace chip::DeviceLayer::Internal; @@ -363,6 +365,11 @@ CHIP_ERROR NxpChipDnssdBrowse(const char * type, DnssdServiceProtocol protocol, if (type == nullptr || callback == nullptr) return CHIP_ERROR_INVALID_ARGUMENT; + if (mBrowseContext != nullptr) + { + NxpChipDnssdStopBrowse(reinterpret_cast(mBrowseContext)); + } + mBrowseContext = Platform::New(context, callback); VerifyOrReturnError(mBrowseContext != nullptr, CHIP_ERROR_NO_MEMORY); @@ -412,7 +419,8 @@ CHIP_ERROR NxpChipDnssdStopBrowse(intptr_t browseIdentifier) // that has been freed in DispatchBrowseEmpty. if ((true == bBrowseInProgress) && (browseContext)) { - browseContext->error = MapOpenThreadError(otMdnsStopBrowser(thrInstancePtr, &browseContext->mBrowseInfo)); + error = otMdnsStopBrowser(thrInstancePtr, &browseContext->mBrowseInfo); + browseContext->error = MapOpenThreadError(error); // browse context will be freed in DispatchBrowseEmpty DispatchBrowseEmpty(reinterpret_cast(browseContext)); @@ -430,6 +438,13 @@ CHIP_ERROR NxpChipDnssdResolve(DnssdService * browseResult, Inet::InterfaceId in otInstance * thrInstancePtr = ThreadStackMgrImpl().OTInstance(); + if (mResolveContext != nullptr) + { + // In case there is an ongoing query and NxpChipDnssdResolveNoLongerNeeded has not been called yet + // free the allocated context and do a proper cleanup of the previous transaction + NxpChipDnssdResolveNoLongerNeeded(mResolveContext->mMdnsService.mName); + } + mResolveContext = Platform::New(context, callback); VerifyOrReturnError(mResolveContext != nullptr, CHIP_ERROR_NO_MEMORY); @@ -450,12 +465,16 @@ CHIP_ERROR NxpChipDnssdResolve(DnssdService * browseResult, Inet::InterfaceId in mResolveContext->mSrvInfo.mServiceInstance = mResolveContext->mMdnsService.mName; mResolveContext->mSrvInfo.mServiceType = mResolveContext->mServiceType; - return MapOpenThreadError(otMdnsStartSrvResolver(thrInstancePtr, &mResolveContext->mSrvInfo)); + error = MapOpenThreadError(otMdnsStartSrvResolver(thrInstancePtr, &mResolveContext->mSrvInfo)); } - else + + if (error != CHIP_NO_ERROR) { - return error; + Platform::Delete(mResolveContext); + mResolveContext = nullptr; } + + return error; } void NxpChipDnssdResolveNoLongerNeeded(const char * instanceName) { diff --git a/src/platform/nxp/k32w0/KeyValueStoreManagerImpl.cpp b/src/platform/nxp/k32w0/KeyValueStoreManagerImpl.cpp index 34666e491ab43e..0ba86d0c4bb967 100644 --- a/src/platform/nxp/k32w0/KeyValueStoreManagerImpl.cpp +++ b/src/platform/nxp/k32w0/KeyValueStoreManagerImpl.cpp @@ -130,35 +130,19 @@ CHIP_ERROR KeyValueStoreManagerImpl::Init() CHIP_ERROR err = CHIP_NO_ERROR; err = sKeysStorage.Init(Internal::RamStorage::kRamBufferInitialSize); - if (err != CHIP_NO_ERROR) - { - ChipLogProgress(DeviceLayer, "Cannot init KVS keys storage with id: %d. Error: %s", kNvmId_KvsKeys, ErrorStr(err)); - } + ReturnErrorOnFailure(err); err = sValuesStorage.Init(Internal::RamStorage::kRamBufferInitialSize, true); - if (err != CHIP_NO_ERROR) - { - ChipLogProgress(DeviceLayer, "Cannot init KVS values storage with id: %d. Error: %s", kNvmId_KvsValues, ErrorStr(err)); - } + ReturnErrorOnFailure(err); err = sSubscriptionStorage.Init(Internal::RamStorage::kRamBufferInitialSize); - if (err != CHIP_NO_ERROR) - { - ChipLogProgress(DeviceLayer, "Cannot init KVS subscription storage with id: %d. Error: %s", kNvmId_KvsSubscription, - ErrorStr(err)); - } + ReturnErrorOnFailure(err); err = sGroupsStorage.Init(Internal::RamStorage::kRamBufferInitialSize, true); - if (err != CHIP_NO_ERROR) - { - ChipLogProgress(DeviceLayer, "Cannot init KVS groups storage with id: %d. Error: %s", kNvmId_KvsGroups, ErrorStr(err)); - } + ReturnErrorOnFailure(err); err = sAclStorage.Init(Internal::RamStorage::kRamBufferInitialSize, true); - if (err != CHIP_NO_ERROR) - { - ChipLogProgress(DeviceLayer, "Cannot init KVS acl storage with id: %d. Error: %s", kNvmId_KvsAcl, ErrorStr(err)); - } + ReturnErrorOnFailure(err); #if CONFIG_CHIP_K32W0_KVS_MOVE_KEYS_TO_SPECIFIC_STORAGE ChipLogProgress(DeviceLayer, "Moving some keys to dedicated storage"); diff --git a/src/platform/telink/CHIPDevicePlatformConfig.h b/src/platform/telink/CHIPDevicePlatformConfig.h index 3123d1464e3081..655ac128953bee 100644 --- a/src/platform/telink/CHIPDevicePlatformConfig.h +++ b/src/platform/telink/CHIPDevicePlatformConfig.h @@ -108,7 +108,7 @@ #define CHIP_DEVICE_CONFIG_ENABLE_ETHERNET 0 #endif // CHIP_DEVICE_CONFIG_ENABLE_ETHERNET -#ifdef CONFIG_SOC_RISCV_TELINK_TL321X +#if defined(CONFIG_SOC_RISCV_TELINK_TL321X) || defined(CONFIG_SOC_SERIES_RISCV_TELINK_B9X_RETENTION) #define CHIP_DEVICE_CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE (256) #define CHIP_DEVICE_CONFIG_EVENT_LOGGING_INFO_BUFFER_SIZE (256) #define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (256) diff --git a/src/platform/telink/SystemPlatformConfig.h b/src/platform/telink/SystemPlatformConfig.h index 462260e6d1d0bd..9f77a54b223169 100644 --- a/src/platform/telink/SystemPlatformConfig.h +++ b/src/platform/telink/SystemPlatformConfig.h @@ -44,7 +44,7 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME 1 #endif // CHIP_SYSTEM_CONFIG_USE_POSIX_TIME_FUNCTS -#ifdef CONFIG_SOC_RISCV_TELINK_TL321X +#if defined(CONFIG_SOC_RISCV_TELINK_TL321X) || defined(CONFIG_SOC_SERIES_RISCV_TELINK_B9X_RETENTION) #define CHIP_SYSTEM_PACKETBUFFER_FROM_CHIP_HEAP 1 #define CHIP_SYSTEM_PACKETBUFFER_FROM_CHIP_POOL 0 #define CHIP_SYSTEM_CONFIG_POOL_USE_HEAP 1