diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index dad1d2c6463644..6052e01c70078e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,12 +1,18 @@ -> !!!!!!!!!! Please delete the instructions below and replace with PR description +> !!!!!!!!!! Please delete the instructions below and replace with PR +> description > -> If you have an issue number, please use a syntax of -> `Fixes #12345` and a brief change description +> If you have an issue number, please use a syntax of `Fixes #12345` and a brief +> change description > -> If you do not have an issue number, please have a good description of -> the problem and the fix. Help the reviewer understand what to expect. +> If you do not have an issue number, please have a good description of the +> problem and the fix. Help the reviewer understand what to expect. +> +> Complete/append to the `### Testing` section below, to describe how testing +> was done. See +> > > Make sure you delete these instructions (to prove you have read them). > > !!!!!!!!!! Instructions end +#### Testing diff --git a/.github/labeler.yml b/.github/labeler.yml index 68d976ecd5b0df..cb4d0839816965 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -119,15 +119,6 @@ test driver: - src/test_driver/* - src/test_driver/**/* -# Cert tests touched: add current milestone delta-tracking label. -# TODO: Change after Aug 15, 2024 -matter-1.4-te2-script-change: - - changed-files: - - any-glob-to-any-file: - - src/python_testing/* - - src/python_testing/**/* - - src/app/tests/suites/certification/* - ############################################################ # Source Code ############################################################ diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 08de9d63fb523c..92667ddebec3dd 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:94 + image: ghcr.io/project-chip/chip-build:97 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 47536167563dbb..d8a5a049631e96 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:94 + image: ghcr.io/project-chip/chip-build:97 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:94 + image: ghcr.io/project-chip/chip-build:97 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:94 + image: ghcr.io/project-chip/chip-build:97 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:94 + image: ghcr.io/project-chip/chip-build:97 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:94 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index b31ce2273360e8..be8a6421f6776b 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:94 + image: ghcr.io/project-chip/chip-build:97 options: --user root steps: @@ -57,7 +57,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:94 + image: ghcr.io/project-chip/chip-build-esp32:97 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:94 + image: ghcr.io/project-chip/chip-build-nrf-platform:97 options: --user root steps: @@ -99,7 +99,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:94 + image: ghcr.io/project-chip/chip-build-telink:97 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 ffdbfe7560c0b628e03ab487ab110eeed9bdc8c7" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py c05c461b1119782cc839cf436fa04ec5e1fb2c8c" - name: CI Examples Telink shell: bash run: | diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 11afa765111972..c712ffed71a1fc 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:94 + image: ghcr.io/project-chip/chip-build-doxygen:97 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 421a9516b0ed47..ed978476c251e6 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:94 + image: ghcr.io/project-chip/chip-build-ameba:97 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index 07641d9b5893cf..bac2f05f7ff65e 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:94 + image: ghcr.io/project-chip/chip-build-asr:97 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 7ff1c1c019a141..5dd2cb413ed854 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:94 + image: ghcr.io/project-chip/chip-build-bouffalolab:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -58,7 +58,7 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target bouffalolab-bl602dk-light-mfd-littlefs-rpc-115200 \ + --target bouffalolab-bl602dk-light-wifi-littlefs-mfd-rpc \ build \ --copy-artifacts-to out/artifacts \ " @@ -66,7 +66,7 @@ jobs: run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ bl602 bl602+mfd+littlefs+rpc lighting-app \ - out/artifacts/bouffalolab-bl602dk-light-mfd-littlefs-rpc-115200/chip-bl602-lighting-example.out \ + out/artifacts/bouffalolab-bl602dk-light-wifi-littlefs-mfd-rpc/chip-bl602-lighting-example.out \ /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out @@ -77,7 +77,7 @@ jobs: "./scripts/build/build_examples.py \ --target bouffalolab-bl706dk-light-ethernet-easyflash \ --target bouffalolab-bl706dk-light-wifi-littlefs \ - --target bouffalolab-bl706dk-light-mfd-rpc-littlefs-115200 \ + --target bouffalolab-bl706dk-light-thread-littlefs-mfd-rpc \ build \ --copy-artifacts-to out/artifacts \ " @@ -93,7 +93,7 @@ jobs: /tmp/bloat_reports/ .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ bl702 bl706+mfd+rpc+littlefs lighting-app \ - out/artifacts/bouffalolab-bl706dk-light-mfd-rpc-littlefs-115200/chip-bl702-lighting-example.out \ + out/artifacts/bouffalolab-bl706dk-light-thread-littlefs-mfd-rpc/chip-bl702-lighting-example.out \ /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out @@ -103,7 +103,7 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target bouffalolab-bl704ldk-light-mfd-littlefs \ + --target bouffalolab-bl704ldk-light-thread-littlefs-mfd \ build \ --copy-artifacts-to out/artifacts \ " @@ -111,7 +111,7 @@ jobs: run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ bl702l bl702l+mfd+littlefs lighting-app \ - out/artifacts/bouffalolab-bl704ldk-light-mfd-littlefs/chip-bl702l-lighting-example.out \ + out/artifacts/bouffalolab-bl704ldk-light-thread-littlefs-mfd/chip-bl702l-lighting-example.out \ /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index c6f41822bd366a..793a27a0287aeb 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:94 + image: ghcr.io/project-chip/chip-build-ti:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index cebb38ccc52d39..703fea73afb882 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:94 + image: ghcr.io/project-chip/chip-build-ti:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index cd6a5f1225e9da..b41db0b4609ee4 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:94 + image: ghcr.io/project-chip/chip-build-esp32:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -132,7 +132,7 @@ jobs: if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif' container: - image: ghcr.io/project-chip/chip-build-esp32:94 + image: ghcr.io/project-chip/chip-build-esp32:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 7ee9f4554545ae..616b3a5bc4d7b6 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:94 + image: ghcr.io/project-chip/chip-build-infineon:97 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 b4c9ceb210e2dc..6c0d7418103152 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:94 + image: ghcr.io/project-chip/chip-build-crosscompile:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index dfcb78bb52b41f..bc02b0e726268a 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:94 + image: ghcr.io/project-chip/chip-build-imx:97 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index a27921cc1f68d2..9f03f103cfdf6e 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:94 + image: ghcr.io/project-chip/chip-build:97 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 780ceadc14d5c3..5d082fb194815e 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:94 + image: ghcr.io/project-chip/chip-build:97 steps: - name: Checkout diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 9611cd79d97dfa..6e820e8faa0273 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:94 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index cd0d7c87d12547..77a8ec626ba56a 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:94 + image: ghcr.io/project-chip/chip-build-nrf-platform:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index ad93f339eb2e7e..274a18ecd202b3 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:94 + image: ghcr.io/project-chip/chip-build-nuttx:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index 2e97e891bf6ac3..d74f01bc813ccb 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:94 + image: ghcr.io/project-chip/chip-build-nxp:96 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -203,7 +203,6 @@ jobs: scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ --target nxp-rw61x-freertos-all-clusters-wifi \ - --target nxp-rw61x-freertos-all-clusters-wifi-ota-cmake \ build \ --copy-artifacts-to out/artifacts \ " @@ -240,7 +239,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp-zephyr:94 + image: ghcr.io/project-chip/chip-build-nxp-zephyr:97 steps: - name: Checkout diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 6071dc358d96e8..eb13238550630e 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:94 + image: ghcr.io/project-chip/chip-build-openiotsdk:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index e09b90dc94137b..d1701e03de5db5 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:94 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 6e21c0c01a3b18..5f1e859c750a38 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:94 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index b3730809abe90d..a493982513ca0a 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:94 + image: ghcr.io/project-chip/chip-build-telink:97 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 ffdbfe7560c0b628e03ab487ab110eeed9bdc8c7" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py c05c461b1119782cc839cf436fa04ec5e1fb2c8c" - name: Build example Telink (B92 retention) Air Quality Sensor App # Run test for master and s07641069 PRs @@ -180,6 +180,19 @@ jobs: - name: clean out build output (keep tools) run: rm -rf ./out/telink* + - name: Build example Telink (tl721x) Lighting App with OTA, Shell, Factory Data + # Run test for master and all PRs + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --target 'telink-tl7218x-light-ota-shell-factory-data' build" + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + telink tl7218x light-app-ota-shell-factory-data \ + out/telink-tl7218x-light-ota-shell-factory-data/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + + - name: clean out build output (keep tools) + run: rm -rf ./out/telink* + - name: Build example Telink (B92) Light Switch App with OTA (LZMA), Shell, Factory Data # Run test for master and all PRs run: | diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 968acafa93a829..11093d4ffc1d0b 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:94 + image: ghcr.io/project-chip/chip-build-tizen:97 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 6abedd95f7bb65..d672632edfc6e2 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:94 + image: ghcr.io/project-chip/chip-build-android:97 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 9d756b1e99b229..b236d1bbb6af02 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:94 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index dcee14f5659329..7d5170c39bc5a3 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:94 + image: ghcr.io/project-chip/chip-build-java:97 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -94,6 +94,7 @@ jobs: --target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-java-matter-controller \ --target linux-x64-lit-icd-ipv6only \ + --target linux-x64-ota-requestor \ build \ " - name: Build Kotlin Matter Controller @@ -259,10 +260,20 @@ jobs: --tool-args "onnetwork-long --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ --factoryreset \ ' + - name: Run Pairing ICD Onnetwork and OTA test + # Generally completes in seconds + timeout-minutes: 2 + run: | + scripts/run_in_python_env.sh out/venv \ + './scripts/tests/run_java_test.py \ + --app out/linux-x64-ota-requestor/chip-ota-requestor-app \ + --app-args "--discriminator 3840 --interface-id -1" \ + --tool-path out/linux-x64-java-matter-controller \ + --tool-cluster "ota" \ + --tool-args "onnetwork-long-ota-over-bdx --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ + --factoryreset \ + ' - name: Run Pairing Onnetwork and get diagnostic log Test - # TODO: test below is disabled because it seems flaky (crashes on pool not being empty on app exit) - # See: https://github.com/project-chip/connectedhomeip/issues/36734 - if: false run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d15e6875285c9d..786fee684002a3 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:94 + image: ghcr.io/project-chip/chip-build:97 steps: - name: Checkout diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 9a2d132284e65b..03766a639f7387 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:94 + image: ghcr.io/project-chip/chip-build-minimal:97 steps: - name: Checkout @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:94 + image: ghcr.io/project-chip/chip-build-minimal:97 steps: - name: Checkout diff --git a/.github/workflows/pr-validation.yaml b/.github/workflows/pr-validation.yaml new file mode 100644 index 00000000000000..d34867f7accec3 --- /dev/null +++ b/.github/workflows/pr-validation.yaml @@ -0,0 +1,69 @@ +name: PR validity + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + check_testing_header: + runs-on: ubuntu-latest + steps: + - name: Check for `### Testing` section in PR + id: check-testing + continue-on-error: true + run: | + cat >/tmp/pr-summary.txt << "EndMarkerForPrSummary" + ${{ github.event.pull_request.body }} + EndMarkerForPrSummary + + python -c 'import sys; pr_summary = open("/tmp/pr-summary.txt", "rt").read(); sys.exit(0 if "### Testing" in pr_summary else 1)' + + - name: Check for PR starting instructions + id: check-instructions + continue-on-error: true + run: | + cat >/tmp/pr-summary.txt << "EndMarkerForPrSummary" + ${{ github.event.pull_request.body }} + EndMarkerForPrSummary + + python -c 'import sys; pr_summary = open("/tmp/pr-summary.txt", "rt").read(); sys.exit(1 if "Make sure you delete these instructions" in pr_summary else 0)' + + # NOTE: comments disabled for now as separate permissions are required + # failing CI step may be sufficient to start (although it contains less information about why it failed) + + # - name: Add comment (missing instructions) + # if: steps.check-instructions.outcome == 'failure' + # uses: actions/github-script@v6 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # script: | + # github.rest.issues.createComment({ + # issue_number: context.issue.number, + # owner: context.repo.owner, + # repo: context.repo.repo, + # body: 'Please make sure to delete starter instructions from your PR summary and replace them with a descriptive summary.' + # }) + + - name: Fail if PR instructions were not deleted + if: steps.check-instructions.outcome == 'failure' + run: | + python -c 'import sys; print("PR instructions were not replaced"); sys.exit(1)' + + # - name: Add comment (missing testing) + # if: steps.check-testing.outcome == 'failure' + # uses: actions/github-script@v6 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # script: | + # github.rest.issues.createComment({ + # issue_number: context.issue.number, + # owner: context.repo.owner, + # repo: context.repo.repo, + # body: 'Please add a `### Testing` section to your PR summary describing the testing performed. See https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#pull-requests' + # }) + + - name: Fail if `### Testing` section not in PR + if: steps.check-testing.outcome == 'failure' + run: | + python -c 'import sys; print("Testing section missing (test failed)"); sys.exit(1)' + diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index f5868fa184ed24..15f04eb82d6d07 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:94 + image: ghcr.io/project-chip/chip-build-esp32-qemu:97 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:94 + image: ghcr.io/project-chip/chip-build-tizen-qemu:97 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 9fcd2d43e38707..6df4cdefc7a190 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:94 + image: ghcr.io/project-chip/chip-build-esp32:97 steps: - name: Checkout @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:94 + image: ghcr.io/project-chip/chip-build-efr32:97 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 1f4bb250ef3c96..58226ceb4839de 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:94 + image: ghcr.io/project-chip/chip-build-android:97 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index df1cdb03745a99..1ed2a01bdbc018 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:94 + image: ghcr.io/project-chip/chip-build:97 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -111,6 +111,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/boolean-state-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/actions-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml \ + src/app/zap-templates/zcl/data-model/chip/camera-av-settings-user-level-management-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/chip-ota.xml \ src/app/zap-templates/zcl/data-model/chip/chip-types.xml \ @@ -185,6 +186,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/switch-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/temperature-measurement-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/test-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/thermostat-user-interface-configuration-cluster.xml \ @@ -457,7 +459,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:94 + image: ghcr.io/project-chip/chip-build:97 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 29fc366d899162..08296b1a00b7ff 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:94 + image: ghcr.io/project-chip/chip-build:97 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 83a3cde53ad882..f861a31d29d0a6 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:94 + image: ghcr.io/project-chip/chip-build:97 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 512295899e3aee..51e4a78c8fb651 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:94 + image: ghcr.io/project-chip/chip-build:97 defaults: run: shell: sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a71219f560671b..68e28dae951fde 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -160,6 +160,99 @@ This will trigger the continuous-integration checks. You can view the results in the respective services. Note that the integration checks will report failures on occasion. +#### Pull requests + +Aim to make pull requests easy to read both when viewed in a list (title only) +as well as clear in content within the description. + +##### Title formatting + +Describe the change as a one-line in some descriptive manner. Add sufficient +context for a reader to understand what is improved. If platform-specific +consider adding the platform as a prefix, like `[Android]` or any other tags may +be useful for quick filtering like `[TC-ABC-1.2]` to tag test changes. + +Examples of descriptive titles: + +- `[Silabs] Fix compile of SiWx917 if LED and BUTTON are disabled` +- `[Telink] Update build Dockerfile with new Zeprhy SHA: c05c4.....` +- `General Commissioning Cluster: use AttributeAccessInterface/CommandHandlerInterface for processing` +- `Scenes Management/CopyScene: set access as manage instead of default to match the spec` +- `Fix build errors due to ChipDeviceEvent default constructor not being available` +- `Fix crash during DNSSD processing due to malformed packet` +- `[NRF] Fix crash due to stack overflow during logging for PW-RPC builds` +- `[TC-ABC-2.3] added new python test case based on test plan` +- `[TC-ABC] migrate tests from yaml to python` + +Examples of titles that are vague (not clear what the change is, one would need +to open the pull request for details or open additional issue in GitHub) + +- `Work on issue 1234` +- `Fix android JniTypeWrappers` +- `Fix segfault in BLE` +- `Fix TC-ABC-1.2` +- `Update Readme` + +##### Summary contents + +Ensure that there is sufficient detail in issue summaries to make the content of +the PR clear: + +- a `TLDR` of the change content. This is a judgment call on details, + generally you should include a what was changed and why. The change is + trivial/short, this can be very short (i.e. "fixed typos" is perfectly + acceptable, however if changing 100-1000s of line, the areas of changes + should be explained) +- If a crash/error is fixed, explain the root cause and if the fix is not + obvious (again, judgment call), explain why the given approach was taken. +- Help the reviewer out with any notable information (specific platform + issues, extra thoughts or requests for feedback or gotchas on tricky code, + followup work or PR dependencies) +- TIP: use the syntax of `Fixes #....` to mark issues completed on PR merge or + use `#...` to reference issues that are addressed. +- TIP: prefer adding some brief description (especially about the content of + the changes) instead of just referencing an issue (helps reviewers get + context faster without extra clicks). + +##### Testing section + +All Pull Requests **MUST** contain a `#### Testing` section that describes how +the pull request was tested. Ideally every test should have automated testing, +however for platform specific changes or hardware-specific issues we may not be +able to have such tests (e.g. we may not BLE or NFC capability in CI). As such, +manual testing is acceptable, however the description has to be detailed +intentionally to avoid a bias towards marking pull requests as "manually tested" +out of convenience. + +- Automated testing + + **AWESOME**. You can say "unit tests added/updated" or "Integration tests + updated to cover functionality" or "existing tests already cover this" (make + sure they do. Integration tests often only cover happy paths). + + Add any notes on not covered things. It is a judgment call on how much can + be covered as 100% sounds great however not always possible. + +- Manual testing + + Describe why automated testing is impossible in the current CI environment + or difficult to add. If adding later, reference the issue to add automation + and a timeline for adding such automation. + + Describe in **DETAIL** how manual testing was done: what environment, what + builds were used (`build-example` names are ok such as + `flashed qpg-qpg6105-light` and `used linux-x64-chip-tool-clang`). Describe + commands ran (often chip-tool) and physical interaction and what was + observed. + +- Trivial/obvious change + + In rare cases the change is trivial (e.g. fixing a typo in a `Readme.md`). + Scripts still require a `#### Testing` section however you can be brief like + `N/A` or `checked new URL opens`. Note that these cases are rare - e.g. + fixing a typo in an ID still requires some description on how you checked + that the new ID takes effect. + ### Review Requirements #### Documentation Best Practices diff --git a/config/bouffalolab/toolchain/riscv_toolchain.gni b/config/bouffalolab/toolchain/riscv_toolchain.gni index db46fc1a98f4fa..9035a6c0b48831 100644 --- a/config/bouffalolab/toolchain/riscv_toolchain.gni +++ b/config/bouffalolab/toolchain/riscv_toolchain.gni @@ -17,13 +17,18 @@ import("//build_overrides/chip.gni") import("//build_overrides/bouffalolab_iot_sdk.gni") import("${build_root}/toolchain/gcc_toolchain.gni") +import("${chip_root}/src/platform/device.gni") template("riscv_toolchain") { gcc_toolchain(target_name) { _tool_name_root = "" if ("linux" == host_os) { - _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-" + if (chip_device_platform == "bl616") { + _tool_name_root = "${bouffalolab_sdk_root}/toolchain/t-head-riscv/gcc_t-head_v2.6.1/bin/riscv64-unknown-elf-" + } else { + _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-" + } } else if ("mac" == host_os || "darwin" == host_os) { _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-" } diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index 3503aae4000f06..e50aa413b90fa6 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -84,6 +84,7 @@ config HEAP_MEM_POOL_SIZE config COMMON_LIBC_MALLOC_ARENA_SIZE default 20716 if SOC_RISCV_TELINK_TL321X || SOC_SERIES_RISCV_TELINK_B9X_RETENTION + default 16384 if SOC_RISCV_TELINK_TL721X default 12288 config NET_IPV6_MLD @@ -165,13 +166,11 @@ config BT_GATT_CACHING #endif config BT_RX_STACK_SIZE - default 1352 if BT_B9X - default 1010 if BT_TLX + default 1352 if BT_B9X || BT_TLX default 2048 if BT_W91 config BT_HCI_TX_STACK_SIZE - default 640 if BT_B9X - default 640 if BT_TLX + default 640 if BT_B9X || BT_TLX default 2048 if BT_W91 config BT_DEVICE_NAME_GATT_WRITABLE @@ -221,7 +220,7 @@ endif # Board non-retention config if BOARD_TLSR9118BDK40D || BOARD_TLSR9118BDK40D_V1 || \ - BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D || BOARD_TL3218X + BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D || BOARD_TL3218X || BOARD_TL7218X config PWM default y endif diff --git a/docs/ids_and_codes/zap_clusters.md b/docs/ids_and_codes/zap_clusters.md index b37e8b2b8b7781..a805a9436c29dd 100644 --- a/docs/ids_and_codes/zap_clusters.md +++ b/docs/ids_and_codes/zap_clusters.md @@ -131,6 +131,7 @@ Generally regenerate using one of: | 1296 | 0x510 | ContentAppObserver | | 1360 | 0x550 | ZoneManagement | | 1361 | 0x551 | CameraAvStreamManagement | +| 1362 | 0x552 | CameraAvSettingsUserLevelManagement | | 1363 | 0x553 | WebRTCTransportProvider | | 1364 | 0x554 | WebRTCTransportRequestor | | 1366 | 0x556 | Chime | diff --git a/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp new file mode 100644 index 00000000000000..8bdf305b6d60a5 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp @@ -0,0 +1,68 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::DeviceLayer; + +namespace { + +void SetTestEventTrigger_SoftwareFaultOccurred() +{ + Clusters::SoftwareDiagnostics::Events::SoftwareFault::Type softwareFault; + char threadName[kMaxThreadNameLength + 1]; + + softwareFault.id = static_cast(getpid()); + Platform::CopyString(threadName, std::to_string(softwareFault.id).c_str()); + + softwareFault.name.SetValue(CharSpan::fromCharString(threadName)); + + std::time_t result = std::time(nullptr); + // Using size of 50 as it is double the expected 25 characters "Www Mmm dd hh:mm:ss yyyy\n". + char timeChar[50]; + if (std::strftime(timeChar, sizeof(timeChar), "%c", std::localtime(&result))) + { + softwareFault.faultRecording.SetValue(ByteSpan(Uint8::from_const_char(timeChar), strlen(timeChar))); + } + + Clusters::SoftwareDiagnosticsServer::Instance().OnSoftwareFaultDetect(softwareFault); +} + +} // namespace + +bool HandleSoftwareDiagnosticsTestEventTrigger(uint64_t eventTrigger) +{ + SoftwareDiagnosticsTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case SoftwareDiagnosticsTrigger::kSoftwareFault: + ChipLogProgress(Support, "[Software-Diagnostics-Test-Event] => Software Fault occurred"); + SetTestEventTrigger_SoftwareFaultOccurred(); + break; + default: + + return false; + } + + return true; +} diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 540f3281205022..cfe8e68f69202f 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:94 + $ docker pull ghcr.io/project-chip/chip-build-ameba:97 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:94 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:97 - Setup build environment: diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 4de95821692fae..d13c51a6502cba 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -56,6 +56,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/rvc-operational-state-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp", diff --git a/examples/all-clusters-app/linux/args.gni b/examples/all-clusters-app/linux/args.gni index 92d01ea3358b30..d98ceaa0eca989 100644 --- a/examples/all-clusters-app/linux/args.gni +++ b/examples/all-clusters-app/linux/args.gni @@ -30,3 +30,4 @@ matter_log_json_payload_hex = true chip_enable_smoke_co_trigger = true chip_enable_boolean_state_configuration_trigger = true chip_enable_water_heater_management_trigger = true +chip_enable_software_diagnostics_trigger = true diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index 3b1600b3d7b705..731168b86a60c9 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:94 + $ docker pull ghcr.io/project-chip/chip-build-ameba:97 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:94 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:97 ``` - Setup build environment: diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt index fb8141e72d33a8..09c3f85a454963 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt @@ -76,6 +76,7 @@ class SelectActionFragment : Fragment() { binding.groupSettingBtn.setOnClickListener { handleGroupSettingClicked() } binding.otaProviderBtn.setOnClickListener { handleOTAProviderClicked() } binding.icdBtn.setOnClickListener { handleICDClicked() } + binding.modeSelectBtn.setOnClickListener { handleModeSelectClicked() } return binding.root } @@ -255,6 +256,10 @@ class SelectActionFragment : Fragment() { showFragment(ICDFragment.newInstance()) } + private fun handleModeSelectClicked() { + showFragment(ModeSelectClientFragment.newInstance()) + } + companion object { @JvmStatic fun newInstance() = SelectActionFragment() diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/ModeSelectClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/ModeSelectClientFragment.kt new file mode 100644 index 00000000000000..e19e0fe0a58682 --- /dev/null +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/ModeSelectClientFragment.kt @@ -0,0 +1,297 @@ +package com.google.chip.chiptool.clusterclient + +import android.os.Bundle +import android.util.Log +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ArrayAdapter +import android.widget.EditText +import android.widget.TextView +import android.widget.Toast +import androidx.fragment.app.Fragment +import androidx.lifecycle.lifecycleScope +import chip.devicecontroller.ChipClusters +import chip.devicecontroller.ChipDeviceController +import chip.devicecontroller.ClusterIDMapping +import chip.devicecontroller.ClusterIDMapping.ModeSelect +import chip.devicecontroller.ReportCallback +import chip.devicecontroller.WriteAttributesCallback +import chip.devicecontroller.cluster.structs.ModeSelectClusterModeOptionStruct +import chip.devicecontroller.model.AttributeState +import chip.devicecontroller.model.AttributeWriteRequest +import chip.devicecontroller.model.ChipAttributePath +import chip.devicecontroller.model.ChipEventPath +import chip.devicecontroller.model.ChipPathId +import chip.devicecontroller.model.NodeState +import chip.devicecontroller.model.Status +import com.google.chip.chiptool.ChipClient +import com.google.chip.chiptool.R +import com.google.chip.chiptool.databinding.ModeSelectFragmentBinding +import java.util.Optional +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch +import matter.tlv.AnonymousTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ModeSelectClientFragment : Fragment() { + private val deviceController: ChipDeviceController + get() = ChipClient.getDeviceController(requireContext()) + + private lateinit var scope: CoroutineScope + + private lateinit var addressUpdateFragment: AddressUpdateFragment + + private var _binding: ModeSelectFragmentBinding? = null + + private val startUpMode: UInt + get() = binding.startUpModeEd.text.toString().toUIntOrNull() ?: 0U + + private val onMode: UInt + get() = binding.onModeEd.text.toString().toUIntOrNull() ?: 0U + + private val currentMode: Int + get() = binding.supportedModesSp.selectedItem.toString().split("-")[0].toInt() + + private val binding + get() = _binding!! + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = ModeSelectFragmentBinding.inflate(inflater, container, false) + scope = viewLifecycleOwner.lifecycleScope + + addressUpdateFragment = + childFragmentManager.findFragmentById(R.id.addressUpdateFragment) as AddressUpdateFragment + + binding.readAttributeBtn.setOnClickListener { scope.launch { readAttributeBtnClick() } } + binding.changeToModeBtn.setOnClickListener { scope.launch { changeToModeBtnClick() } } + binding.onModeWriteBtn.setOnClickListener { + scope.launch { writeAttributeBtnClick(ClusterIDMapping.ModeSelect.Attribute.OnMode, onMode) } + } + binding.startUpModeWriteBtn.setOnClickListener { + scope.launch { + writeAttributeBtnClick(ClusterIDMapping.ModeSelect.Attribute.StartUpMode, startUpMode) + } + } + + return binding.root + } + + private suspend fun readAttributeBtnClick() { + val endpointId = addressUpdateFragment.endpointId + val clusterId = ModeSelect.ID + val attributeId = ChipPathId.forWildcard().id + val path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.readAttributePath( + object : ReportCallback { + override fun onError( + attributePath: ChipAttributePath?, + eventPath: ChipEventPath?, + e: Exception + ) { + requireActivity().runOnUiThread { + Toast.makeText( + requireActivity(), + R.string.ota_provider_invalid_attribute, + Toast.LENGTH_SHORT + ) + .show() + } + } + + override fun onReport(nodeState: NodeState?) { + val attributeStates = + nodeState?.getEndpointState(endpointId)?.getClusterState(clusterId)?.attributeStates + ?: return + + requireActivity().runOnUiThread { + val description = attributeStates[ClusterIDMapping.ModeSelect.Attribute.Description.id] + binding.descriptionEd.setText(description?.value?.toString()) + + val standardNamespace = + attributeStates[ClusterIDMapping.ModeSelect.Attribute.StandardNamespace.id] + binding.standardNamespaceEd.setText(standardNamespace?.value?.toString()) + + val currentMode = attributeStates[ClusterIDMapping.ModeSelect.Attribute.CurrentMode.id] + binding.currentModeEd.setText(currentMode?.value?.toString()) + + setVisibility( + attributeStates[ClusterIDMapping.ModeSelect.Attribute.StartUpMode.id], + binding.startUpModeEd, + binding.startUpModeTv, + binding.startUpModeWriteBtn + ) + setVisibility( + attributeStates[ClusterIDMapping.ModeSelect.Attribute.OnMode.id], + binding.onModeEd, + binding.onModeTv, + binding.onModeWriteBtn + ) + + val supportedModesTlv = + attributeStates[ClusterIDMapping.ModeSelect.Attribute.SupportedModes.id]?.tlv + + supportedModesTlv?.let { + setSupportedModeSpinner(it, currentMode?.value?.toString()?.toUInt()) + } + } + } + }, + devicePtr, + listOf(path), + 0 + ) + } + + private fun setVisibility( + attribute: AttributeState?, + modeEd: EditText, + modeTv: TextView, + writeBtn: TextView + ) { + val modeVisibility = + if (attribute != null) { + modeEd.setText(attribute.value?.toString() ?: "NULL") + View.VISIBLE + } else { + View.GONE + } + modeEd.visibility = modeVisibility + modeTv.visibility = modeVisibility + writeBtn.visibility = modeVisibility + } + + private fun setSupportedModeSpinner(supportedModesTlv: ByteArray, currentModeValue: UInt?) { + var pos = 0 + var currentItemId = 0 + val modeOptionStructList: List + TlvReader(supportedModesTlv).also { + modeOptionStructList = buildList { + it.enterArray(AnonymousTag) + while (!it.isEndOfContainer()) { + val struct = ModeSelectClusterModeOptionStruct.fromTlv(AnonymousTag, it) + add(struct) + if (currentModeValue != null && struct.mode == currentModeValue) { + currentItemId = pos + } + pos++ + } + it.exitContainer() + } + binding.supportedModesSp.adapter = + ArrayAdapter( + requireContext(), + android.R.layout.simple_spinner_dropdown_item, + modeOptionStructList.map { it.show() } + ) + binding.supportedModesSp.setSelection(currentItemId) + binding.currentModeEd.setText(binding.supportedModesSp.selectedItem.toString()) + } + } + + private suspend fun changeToModeBtnClick() { + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + ChipClusters.ModeSelectCluster(devicePtr, addressUpdateFragment.endpointId) + .changeToMode( + object : ChipClusters.DefaultClusterCallback { + override fun onError(error: java.lang.Exception?) { + Log.d(TAG, "onError", error) + showMessage("Error : ${error.toString()}") + } + + override fun onSuccess() { + showMessage("Change Success") + scope.launch { readAttributeBtnClick() } + } + }, + currentMode + ) + } + + private suspend fun writeAttributeBtnClick(attribute: ModeSelect.Attribute, value: UInt) { + val clusterId = ModeSelect.ID + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.write( + object : WriteAttributesCallback { + override fun onError(attributePath: ChipAttributePath?, ex: java.lang.Exception?) { + showMessage("Write ${attribute.name} failure $ex") + Log.e(TAG, "Write ${attribute.name} failure", ex) + } + + override fun onResponse(attributePath: ChipAttributePath, status: Status) { + showMessage("Write ${attribute.name} response: $status") + } + }, + devicePtr, + listOf( + AttributeWriteRequest.newInstance( + addressUpdateFragment.endpointId, + clusterId, + attribute.id, + TlvWriter().put(AnonymousTag, value).getEncoded(), + Optional.empty() + ) + ), + 0, + 0 + ) + } + + private fun ModeSelectClusterModeOptionStruct.show(): String { + val value = this + return StringBuilder() + .apply { + append("${value.mode}-${value.label}") + append("[") + for (semanticTag in value.semanticTags) { + append("${semanticTag.value}:${semanticTag.mfgCode}") + append(",") + } + append("]") + } + .toString() + } + + override fun onDestroyView() { + super.onDestroyView() + deviceController.finishOTAProvider() + _binding = null + } + + private fun showMessage(msg: String) { + requireActivity().runOnUiThread { binding.commandStatusTv.text = msg } + } + + companion object { + private const val TAG = "ModeSelectClientFragment" + + fun newInstance(): ModeSelectClientFragment = ModeSelectClientFragment() + } +} diff --git a/examples/android/CHIPTool/app/src/main/res/layout/mode_select_fragment.xml b/examples/android/CHIPTool/app/src/main/res/layout/mode_select_fragment.xml new file mode 100644 index 00000000000000..3f13ca9b654d36 --- /dev/null +++ b/examples/android/CHIPTool/app/src/main/res/layout/mode_select_fragment.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/android/CHIPTool/app/src/main/res/layout/select_action_fragment.xml b/examples/android/CHIPTool/app/src/main/res/layout/select_action_fragment.xml index db999600999741..e2f5ce8f1d7db0 100644 --- a/examples/android/CHIPTool/app/src/main/res/layout/select_action_fragment.xml +++ b/examples/android/CHIPTool/app/src/main/res/layout/select_action_fragment.xml @@ -143,6 +143,14 @@ android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:text="@string/icd_btn_text" /> + +