diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3fe075a1e9a3f5..d7503bcf6d0e62 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "BUILD_VERSION": "0.5.64" + "BUILD_VERSION": "0.5.73" } }, "remoteUser": "vscode", diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 9ad4eadcc4a478..64df9420feb075 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -985,6 +985,7 @@ PlatformManagerImpl plt png PollControl +pollInterval polymorphism POSIX PosixConfig diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 1e6676d33221d5..381b8d82499aca 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -30,10 +30,10 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.64 + image: connectedhomeip/chip-build:0.5.73 steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 06254986dc8f18..7e73b5855f8e37 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -47,7 +47,7 @@ jobs: env: CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} run: echo "$CONCURRENCY_CONTEXT" - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -122,7 +122,7 @@ jobs: env: CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} run: echo "$CONCURRENCY_CONTEXT" - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -252,7 +252,7 @@ jobs: env: CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} run: echo "$CONCURRENCY_CONTEXT" - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -284,7 +284,7 @@ jobs: if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index f13e34ae2b71ea..71c283c9d072a4 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -38,7 +38,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: connectedhomeip/chip-build-cirque:0.5.64 + # image: connectedhomeip/chip-build-cirque:0.5.73 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" @@ -48,7 +48,7 @@ jobs: # options: "--privileged" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 1dce0f78719ff0..b8face5cb0aeaa 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -41,7 +41,7 @@ jobs: runs-on: macos-latest steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -89,6 +89,7 @@ jobs: --target darwin-x64-chip-tool-darwin-${BUILD_VARIANT} \ --target darwin-x64-all-clusters-${BUILD_VARIANT} \ --target darwin-x64-lock-${BUILD_VARIANT} \ + --target darwin-x64-tv-app-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -98,11 +99,12 @@ jobs: ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ --chip-tool ./out/darwin-x64-chip-tool-darwin-${BUILD_VARIANT}/chip-tool-darwin \ - --target-skip-glob '{TestGroupMessaging,TV_*}' \ + --target-skip-glob '{TestGroupMessaging}' \ run \ --iterations 1 \ --all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ --lock-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-lock-app \ + --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ " - name: Uploading core files uses: actions/upload-artifact@v2 diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index e36b5b6cabf187..40c160b50b1f7c 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -32,7 +32,7 @@ jobs: runs-on: macos-latest steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/docker_img.yaml b/.github/workflows/docker_img.yaml index 0057b7e007e3cb..9ea7ae9c7ea06a 100644 --- a/.github/workflows/docker_img.yaml +++ b/.github/workflows/docker_img.yaml @@ -53,7 +53,7 @@ jobs: #- "-vscode" - "-zap" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 1e02316fa72a0d..0497a6b062824f 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -82,14 +82,14 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-doxygen:0.5.64 + image: connectedhomeip/chip-build-doxygen:0.5.73 if: github.actor != 'restyled-io[bot]' steps: - name: "Print Actor" run: echo ${{github.actor}} - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index ff422551ed5f5e..8547806bc4cc24 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -32,11 +32,11 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-ameba:0.5.64 + image: connectedhomeip/chip-build-ameba:0.5.73 options: --user root steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml index e91451fa89dd1b..26d8caad09da2b 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -38,7 +38,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-cyw30739.yaml b/.github/workflows/examples-cyw30739.yaml index 0c2c45f75bb4e7..458833b33bdfec 100644 --- a/.github/workflows/examples-cyw30739.yaml +++ b/.github/workflows/examples-cyw30739.yaml @@ -35,7 +35,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 18d4cfc29083bf..2523c517f08e74 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -35,11 +35,11 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-efr32:0.5.64 + image: connectedhomeip/chip-build-efr32:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 88b2854b42eb5e..2390e8f1204b3a 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -32,12 +32,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.5.64 + image: connectedhomeip/chip-build-esp32:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -118,12 +118,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.5.64 + image: connectedhomeip/chip-build-esp32:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index e0a80ca037928d..3b90873ed47309 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -32,10 +32,10 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-infineon:0.5.64 + image: connectedhomeip/chip-build-infineon:0.5.73 steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index 82cea2ee96b051..97ebd1c3e5dc2b 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -34,11 +34,11 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-k32w:0.5.64 + image: connectedhomeip/chip-build-k32w:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 2d5ea3bccc1935..f05e3b43c17376 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -31,12 +31,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-crosscompile:0.5.64 + image: connectedhomeip/chip-build-crosscompile:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 20b9a8841c4c67..490ce002c2cc60 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -31,10 +31,10 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-imx:0.5.64 + image: connectedhomeip/chip-build-imx:0.5.73 steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index abb78f1306bc30..579925e138a236 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -34,12 +34,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.64 + image: connectedhomeip/chip-build:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 438fc8e666f6a1..ad290680e685d4 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -37,12 +37,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-mbed-os:0.5.64 + image: connectedhomeip/chip-build-mbed-os:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 96b09cb932add4..20d7320a87ee2b 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -34,12 +34,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-nrf-platform:0.5.64 + image: connectedhomeip/chip-build-nrf-platform:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 956b672340f7da..e70587189d495f 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -34,11 +34,11 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.64 + image: connectedhomeip/chip-build:0.5.73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 84213f751cb705..25a214790985a6 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -37,7 +37,7 @@ jobs: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 663596a1dd27a7..5d0fb65e736460 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -32,14 +32,14 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-tizen:0.5.71 + image: connectedhomeip/chip-build-tizen:0.5.73 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" - "/tmp/output_binaries:/tmp/output_binaries" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/fixit_rotation.yaml b/.github/workflows/fixit_rotation.yaml index 27a31a3f90f8ed..09ccbf08fe2a26 100644 --- a/.github/workflows/fixit_rotation.yaml +++ b/.github/workflows/fixit_rotation.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 85b03709e85045..810106c167c835 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -34,12 +34,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-android:0.5.64 + image: connectedhomeip/chip-build-android:0.5.73 volumes: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 8b7c5593b68aeb..c89e21bcc0ef63 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -31,12 +31,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.64 + image: connectedhomeip/chip-build:0.5.73 volumes: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -86,7 +86,7 @@ jobs: if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 55e84c7009c1e2..b5c296573021d7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index f79e74be44f011..094b405df96bc3 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -34,12 +34,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32-qemu:0.5.64 + image: connectedhomeip/chip-build-esp32-qemu:0.5.73 volumes: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/rebase.yaml b/.github/workflows/rebase.yaml index 4763b50e663d4b..6e4e361310ba5b 100644 --- a/.github/workflows/rebase.yaml +++ b/.github/workflows/rebase.yaml @@ -8,7 +8,7 @@ jobs: if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 665e9a72c873ee..53eccf10f8e2d1 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -29,10 +29,10 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-esp32:0.5.64 + image: connectedhomeip/chip-build-esp32:0.5.73 steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -75,9 +75,9 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-efr32:0.5.64 + image: connectedhomeip/chip-build-efr32:0.5.73 steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 80af7c2f6a9797..b06b9867718971 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -34,12 +34,12 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-android:0.5.64 + image: connectedhomeip/chip-build-android:0.5.73 volumes: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/spell.yml b/.github/workflows/spell.yml index c098ed8eff5199..98af5202d43748 100644 --- a/.github/workflows/spell.yml +++ b/.github/workflows/spell.yml @@ -28,7 +28,7 @@ jobs: check-reviewdog: runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -42,7 +42,7 @@ jobs: check-spellcheck: runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a4425d2e98cb9e..b6ab370a4c6849 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -43,12 +43,12 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.64 + image: connectedhomeip/chip-build:0.5.73 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 @@ -132,7 +132,7 @@ jobs: runs-on: macos-latest steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/todos.yaml b/.github/workflows/todos.yaml index d18cb08c293971..e6d31a6b3d8642 100644 --- a/.github/workflows/todos.yaml +++ b/.github/workflows/todos.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 4cacf016263359..2fa7a93afa6dff 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -37,13 +37,13 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.64 + image: connectedhomeip/chip-build:0.5.73 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 745b26f3d731e9..2d61c4e3e47c15 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -28,14 +28,14 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-zap:0.5.64 + image: connectedhomeip/chip-build-zap:0.5.73 defaults: run: shell: sh if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index f0696ab9e1604d..30b739f918ec12 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -29,14 +29,14 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-zap:0.5.70 + image: connectedhomeip/chip-build-zap:0.5.73 defaults: run: shell: sh if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.11 + - uses: Wandalen/wretry.action@v1.0.15 name: Checkout with: action: actions/checkout@v3 diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index 8d587a795608fa..73216d9dbfc9c2 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -169,7 +169,7 @@ config BT_BUF_ACL_TX_SIZE config BT_RX_STACK_SIZE int - default 1120 + default 1200 # Enable NFC support @@ -185,6 +185,11 @@ config CHIP_QSPI_NOR bool default y +# Enable extended discovery +config CHIP_EXTENDED_DISCOVERY + bool + default y + # Enable OpenThread config NET_L2_OPENTHREAD diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index b47aa808439ea2..38ba76183c4f2c 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -244,6 +244,12 @@ config CHIP_OTA_IMAGE_INCLUDE_MCUBOOT endif +config CHIP_EXTENDED_DISCOVERY + bool "Enable extended discovery" + help + Enables the device to advertise commissionable service when not in the + commissioning mode. + module = MATTER module-str = Matter source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 5ee9a255e1bc8a..52139ef1338da2 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -17,15 +17,13 @@ import("//build_overrides/chip.gni") import("${build_root}/config/compiler/compiler.gni") import("${chip_root}/src/lib/lib.gni") +import("${chip_root}/src/platform/device.gni") source_set("chip-all-clusters-common") { sources = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/examples/lock-app/linux/src/LockEndpoint.cpp", - "${chip_root}/examples/lock-app/linux/src/LockManager.cpp", - "${chip_root}/examples/lock-app/linux/src/ZCLDoorLockCallbacks.cpp", "AppOptions.cpp", "include/tv-callbacks.cpp", "include/tv-callbacks.h", @@ -39,10 +37,8 @@ source_set("chip-all-clusters-common") { "${chip_root}/src/lib", ] - include_dirs = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/lock-app/linux/include", - ] + include_dirs = + [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] cflags = [ "-Wconversion" ] @@ -51,12 +47,27 @@ source_set("chip-all-clusters-common") { } } +source_set("chip-lock-app-common") { + sources = [ + "${chip_root}/examples/lock-app/linux/src/LockEndpoint.cpp", + "${chip_root}/examples/lock-app/linux/src/LockManager.cpp", + "${chip_root}/examples/lock-app/linux/src/ZCLDoorLockCallbacks.cpp", + ] + + deps = [ "${chip_root}/examples/all-clusters-app/all-clusters-common" ] + + include_dirs = [ "${chip_root}/examples/lock-app/linux/include" ] + + cflags = [ "-Wconversion" ] +} + if (is_libfuzzer) { executable("chip-all-clusters-app-fuzzing") { sources = [ "fuzzing-main.cpp" ] deps = [ ":chip-all-clusters-common", + ":chip-lock-app-common", "${chip_root}/examples/platform/linux:app-main", ] @@ -70,6 +81,7 @@ if (is_libfuzzer) { deps = [ ":chip-all-clusters-common", + ":chip-lock-app-common", "${chip_root}/examples/platform/linux:app-main", ] @@ -80,6 +92,23 @@ if (is_libfuzzer) { output_dir = root_out_dir } + + if (chip_device_platform == "darwin") { + action("codesign") { + script = "entitlements/codesign.py" + public_deps = [ ":chip-all-clusters-app" ] + + args = [ + "--target_path", + rebase_path("${root_build_dir}/chip-all-clusters-app", root_build_dir), + "--log_path", + rebase_path("${root_build_dir}/codesign_log.txt", root_build_dir), + ] + + output_name = "codesign_log.txt" + outputs = [ "${root_build_dir}/${output_name}" ] + } + } } group("linux") { diff --git a/examples/all-clusters-app/linux/entitlements/codesign.py b/examples/all-clusters-app/linux/entitlements/codesign.py new file mode 100644 index 00000000000000..f14ed2e7d68d79 --- /dev/null +++ b/examples/all-clusters-app/linux/entitlements/codesign.py @@ -0,0 +1,65 @@ +#!/usr/bin/env -S python3 -B + +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import subprocess +import re + + +def run_command(command): + print("Running {}".format(command)) + return str(subprocess.check_output(command.split())) + + +def get_identity(): + command = "/usr/bin/security find-identity -v -p codesigning" + command_result = run_command(command) + + failure_str = "Error: 0 valid identities found" + if failure_str in command_result: + print( + "No valid identity has been found. Application will run without entitlements.") + exit(0) + + identity = re.search(r'\b[0-9a-fA-F]{40}\b', command_result) + if identity is None: + print( + "No valid identity has been found. Application will run without entitlements.") + exit(0) + + return identity.group() + + +def codesign(args): + command = "codesign --force -d --sign {identity} {target}".format( + identity=get_identity(), + target=args.target_path) + command_result = run_command(command) + + print("Codesign Result: {}".format(command_result)) + with open(args.log_path, "w") as f: + f.write(command_result) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description='Codesign the binary') + parser.add_argument( + '--log_path', help='Output log file destination', required=True) + parser.add_argument('--target_path', help='Binary to sign', required=True) + + args = parser.parse_args() + codesign(args) diff --git a/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h index 59863c6a38949e..7a2941f28621df 100644 --- a/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -31,5 +31,3 @@ #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 #define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 - -#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/chef/nrfconnect/CHIPProjectConfig.h b/examples/chef/nrfconnect/CHIPProjectConfig.h index 58bb5cb20597c4..2bd41247a382f9 100644 --- a/examples/chef/nrfconnect/CHIPProjectConfig.h +++ b/examples/chef/nrfconnect/CHIPProjectConfig.h @@ -35,5 +35,3 @@ #define CHIP_CONFIG_ENABLE_ARG_PARSER 1 #define CHIP_DEVICE_CONFIG_DISABLE_SHELL_PING 1 - -#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/chip-tool-darwin/commands/common/CHIPCommandBridge.mm b/examples/chip-tool-darwin/commands/common/CHIPCommandBridge.mm index fc1072b3cc789e..2ccb4ba0bb65ac 100644 --- a/examples/chip-tool-darwin/commands/common/CHIPCommandBridge.mm +++ b/examples/chip-tool-darwin/commands/common/CHIPCommandBridge.mm @@ -55,15 +55,14 @@ constexpr const char * identities[] = { kIdentityAlpha, kIdentityBeta, kIdentityGamma }; for (size_t i = 0; i < ArraySize(identities); ++i) { - auto controllerParams = [[CHIPDeviceControllerStartupParams alloc] initWithKeypair:nocSigner ipk:ipk]; - controllerParams.vendorId = chip::VendorId::TestVendor1; - controllerParams.fabricId = i + 1; + auto controllerParams = [[CHIPDeviceControllerStartupParams alloc] initWithKeypair:nocSigner fabricId:(i + 1) ipk:ipk]; // We're not sure whether we're creating a new fabric or using an // existing one, so just try both. auto controller = [factory startControllerOnExistingFabric:controllerParams]; if (controller == nil) { // Maybe we didn't have this fabric yet. + controllerParams.vendorId = @(chip::VendorId::TestVendor1); controller = [factory startControllerOnNewFabric:controllerParams]; } if (controller == nil) { diff --git a/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h b/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h index a1746542a7896d..7c22d254bf1cf2 100644 --- a/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h +++ b/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h @@ -19,6 +19,7 @@ #pragma once #include "../common/CHIPCommandBridge.h" +#include #include #include #include @@ -58,6 +59,7 @@ class TestCommandBridge : public CHIPCommandBridge, public ValueChecker, public ConstraintsChecker, public PICSChecker, + public DelayCommands, public SystemCommands { public: TestCommandBridge(const char * _Nonnull commandName) @@ -104,31 +106,24 @@ class TestCommandBridge : public CHIPCommandBridge, NextTest(); } - /////////// DelayCommands-like Interface ///////// - void WaitForMs(unsigned int ms) + void UserPrompt(const char * _Nullable identity, const chip::app::Clusters::LogCommands::Commands::UserPrompt::Type & value) { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = ms; - WaitForMs(nil, value); + NextTest(); } - void WaitForMs(const char * _Nullable identity, const chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type & value) + /////////// DelayCommands Interface ///////// + void OnWaitForMs() override { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, value.ms * NSEC_PER_MSEC), mCallbackQueue, ^{ + dispatch_async(mCallbackQueue, ^{ NextTest(); }); } - void UserPrompt(const char * _Nullable identity, const chip::app::Clusters::LogCommands::Commands::UserPrompt::Type & value) - { - NextTest(); - } - - void WaitForCommissionee( - const char * _Nullable identity, const chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type & value) + CHIP_ERROR WaitForCommissionee(const char * _Nullable identity, + const chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type & value) override { CHIPDeviceController * controller = GetCommissioner(identity); - VerifyOrReturn(controller != nil, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + VerifyOrReturnError(controller != nil, CHIP_ERROR_INCORRECT_STATE); SetIdentity(identity); @@ -152,6 +147,7 @@ class TestCommandBridge : public CHIPCommandBridge, mConnectedDevices[identity] = device; NextTest(); }]; + return CHIP_NO_ERROR; } /////////// CommissionerCommands-like Interface ///////// @@ -183,8 +179,9 @@ class TestCommandBridge : public CHIPCommandBridge, CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) override { if (CHIP_NO_ERROR == err) { - WaitForMs(0); - + dispatch_async(mCallbackQueue, ^{ + NextTest(); + }); } else { Exit(chip::ErrorStr(err), err); } diff --git a/examples/chip-tool-darwin/templates/tests/commands.zapt b/examples/chip-tool-darwin/templates/tests/commands.zapt index d93d95b2b0f424..5a3f1c07707024 100644 --- a/examples/chip-tool-darwin/templates/tests/commands.zapt +++ b/examples/chip-tool-darwin/templates/tests/commands.zapt @@ -5,7 +5,6 @@ #if CONFIG_ENABLE_YAML_TESTS #include -#include #include #include diff --git a/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt b/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt index 3453a12282b4ae..3c373686aabec4 100644 --- a/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt @@ -91,7 +91,7 @@ class {{filename}}: public TestCommandBridge } // Go on to the next test. - WaitForMs(0); + ContinueOnChipMainThread(CHIP_NO_ERROR); } chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr({{chip_tests_config_get_default_value "timeout"}})); } @@ -272,14 +272,6 @@ class {{filename}}: public TestCommandBridge {{/if}} {{#if async}} NextTest(); - {{else}} - {{#*inline "minCommandTimeout"~}} - {{#if (isTestOnlyCluster cluster)~}} - {{#if (isStrEqual command "WaitForMs")~}} - {{#chip_tests_item_parameters}}{{#if (isStrEqual name "ms")}}({{definedValue}} / 1000) + {{/if}}{{/chip_tests_item_parameters}} - {{~/if}} - {{~/if}} - {{~/inline}} {{/if}} return CHIP_NO_ERROR; } diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 066eedc914bd60..1bd88ad2082426 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -52,7 +52,6 @@ static_library("chip-tool-utils") { "commands/common/CHIPCommand.cpp", "commands/common/CHIPCommand.h", "commands/common/Command.cpp", - "commands/common/CommandInvoker.h", "commands/common/Commands.cpp", "commands/common/CredentialIssuerCommands.h", "commands/discover/DiscoverCommand.cpp", diff --git a/examples/chip-tool/commands/clusters/ClusterCommand.h b/examples/chip-tool/commands/clusters/ClusterCommand.h index ecba5aefb01f02..f9092d141fa7ac 100644 --- a/examples/chip-tool/commands/clusters/ClusterCommand.h +++ b/examples/chip-tool/commands/clusters/ClusterCommand.h @@ -18,16 +18,16 @@ #pragma once -#include -#include +#include #include "DataModelLogger.h" #include "ModelCommand.h" -class ClusterCommand : public ModelCommand, public chip::app::CommandSender::Callback +class ClusterCommand : public InteractionModelCommands, public ModelCommand, public chip::app::CommandSender::Callback { public: - ClusterCommand(CredentialIssuerCommands * credsIssuerConfig) : ModelCommand("command-by-id", credsIssuerConfig) + ClusterCommand(CredentialIssuerCommands * credsIssuerConfig) : + InteractionModelCommands(this), ModelCommand("command-by-id", credsIssuerConfig) { AddArgument("cluster-id", 0, UINT32_MAX, &mClusterId); AddArgument("command-id", 0, UINT32_MAX, &mCommandId); @@ -40,7 +40,7 @@ class ClusterCommand : public ModelCommand, public chip::app::CommandSender::Cal } ClusterCommand(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) : - ModelCommand("command-by-id", credsIssuerConfig), mClusterId(clusterId) + InteractionModelCommands(this), ModelCommand("command-by-id", credsIssuerConfig), mClusterId(clusterId) { AddArgument("command-id", 0, UINT32_MAX, &mCommandId); AddArgument("payload", &mPayload); @@ -52,7 +52,7 @@ class ClusterCommand : public ModelCommand, public chip::app::CommandSender::Cal } ClusterCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) : - ModelCommand(commandName, credsIssuerConfig) + InteractionModelCommands(this), ModelCommand(commandName, credsIssuerConfig) { AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs); AddArgument("suppressResponse", 0, 1, &mSuppressResponse); @@ -64,12 +64,28 @@ class ClusterCommand : public ModelCommand, public chip::app::CommandSender::Cal CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override { - return ClusterCommand::SendCommand(device, endpointIds.at(0), mClusterId, mCommandId, mPayload); + return InteractionModelCommands::SendCommand(device, endpointIds.at(0), mClusterId, mCommandId, mPayload, + mTimedInteractionTimeoutMs, mRepeatCount, mRepeatDelayInMs, mSuppressResponse); + } + + template + CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, + chip::CommandId commandId, const T & value) + { + return InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value, mTimedInteractionTimeoutMs, + mRepeatCount, mRepeatDelayInMs, mSuppressResponse); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return ClusterCommand::SendGroupCommand(groupId, fabricIndex, mClusterId, mCommandId, mPayload); + return InteractionModelCommands::SendGroupCommand(groupId, fabricIndex, mClusterId, mCommandId, mPayload); + } + + template + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex, chip::ClusterId clusterId, + chip::CommandId commandId, const T & value) + { + return InteractionModelCommands::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, value); } /////////// CommandSender Callback Interface ///////// @@ -125,54 +141,6 @@ class ClusterCommand : public ModelCommand, public chip::app::CommandSender::Cal } } - template - CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, - chip::CommandId commandId, const T & value) - { - uint16_t repeatCount = mRepeatCount.ValueOr(1); - while (repeatCount--) - { - chip::app::CommandPathParams commandPath = { endpointId, 0 /* groupId */, clusterId, commandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - auto commandSender = std::make_unique(this, device->GetExchangeManager(), - mTimedInteractionTimeoutMs.HasValue()); - VerifyOrReturnError(commandSender != nullptr, CHIP_ERROR_NO_MEMORY); - ReturnErrorOnFailure(commandSender->AddRequestDataNoTimedCheck(commandPath, value, mTimedInteractionTimeoutMs, - mSuppressResponse.ValueOr(false))); - - ReturnErrorOnFailure(commandSender->SendCommandRequest(device->GetSecureSession().Value())); - mCommandSender.push_back(std::move(commandSender)); - - if (mRepeatDelayInMs.HasValue()) - { - chip::test_utils::SleepMillis(mRepeatDelayInMs.Value()); - } - } - return CHIP_NO_ERROR; - } - - template - CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex, chip::ClusterId clusterId, - chip::CommandId commandId, const T & value) - { - chip::app::CommandPathParams commandPath = { 0 /* endpoint */, groupId, clusterId, commandId, - (chip::app::CommandPathFlags::kGroupIdValid) }; - - chip::Messaging::ExchangeManager * exchangeManager = chip::app::InteractionModelEngine::GetInstance()->GetExchangeManager(); - - auto commandSender = - chip::Platform::MakeUnique(this, exchangeManager, mTimedInteractionTimeoutMs.HasValue()); - VerifyOrReturnError(commandSender != nullptr, CHIP_ERROR_NO_MEMORY); - ReturnErrorOnFailure(commandSender->AddRequestDataNoTimedCheck(commandPath, value, mTimedInteractionTimeoutMs)); - - chip::Transport::OutgoingGroupSession session(groupId, fabricIndex); - ReturnErrorOnFailure(commandSender->SendGroupCommandRequest(chip::SessionHandle(session))); - commandSender.release(); - - return CHIP_NO_ERROR; - } - private: chip::ClusterId mClusterId; chip::CommandId mCommandId; @@ -183,5 +151,4 @@ class ClusterCommand : public ModelCommand, public chip::app::CommandSender::Cal CHIP_ERROR mError = CHIP_NO_ERROR; CustomArgument mPayload; - std::vector> mCommandSender; }; diff --git a/examples/chip-tool/commands/clusters/ReportCommand.h b/examples/chip-tool/commands/clusters/ReportCommand.h index 216551f7321ed3..58d997cc4f61ee 100644 --- a/examples/chip-tool/commands/clusters/ReportCommand.h +++ b/examples/chip-tool/commands/clusters/ReportCommand.h @@ -18,18 +18,16 @@ #pragma once -#include +#include #include "DataModelLogger.h" #include "ModelCommand.h" -constexpr uint8_t kMaxAllowedPaths = 10; - -class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callback +class ReportCommand : public InteractionModelReports, public ModelCommand, public chip::app::ReadClient::Callback { public: ReportCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) : - ModelCommand(commandName, credsIssuerConfig), mBufferedReadAdapter(*this) + InteractionModelReports(this), ModelCommand(commandName, credsIssuerConfig) {} virtual void OnSubscription(){}; @@ -100,219 +98,13 @@ class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callbac void OnDone() override { - mReadClient.reset(); + InteractionModelReports::Shutdown(); SetCommandExitStatus(mError); } void OnSubscriptionEstablished(uint64_t subscriptionId) override { OnSubscription(); } protected: - CHIP_ERROR ReportAttribute(chip::DeviceProxy * device, std::vector endpointIds, - std::vector clusterIds, std::vector attributeIds, - chip::app::ReadClient::InteractionType interactionType, uint16_t minInterval = 0, - uint16_t maxInterval = 0, - const chip::Optional> & dataVersions = chip::NullOptional) - { - const size_t clusterCount = clusterIds.size(); - const size_t attributeCount = attributeIds.size(); - const size_t endpointCount = endpointIds.size(); - const size_t dataVersionsCount = dataVersions.HasValue() ? dataVersions.Value().size() : 0; - - VerifyOrReturnError(clusterCount > 0 && clusterCount <= kMaxAllowedPaths, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(attributeCount > 0 && attributeCount <= kMaxAllowedPaths, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(endpointCount > 0 && endpointCount <= kMaxAllowedPaths, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(dataVersionsCount <= kMaxAllowedPaths, CHIP_ERROR_INVALID_ARGUMENT); - - const bool hasSameIdsCount = (clusterCount == attributeCount) && (clusterCount == endpointCount) && - (dataVersionsCount == 0 || clusterCount == dataVersionsCount); - const bool multipleClusters = - clusterCount > 1 && attributeCount == 1 && endpointCount == 1 && (dataVersionsCount == 0 || dataVersionsCount == 1); - const bool multipleAttributes = - attributeCount > 1 && clusterCount == 1 && endpointCount == 1 && (dataVersionsCount == 0 || dataVersionsCount == 1); - const bool multipleEndpoints = - endpointCount > 1 && clusterCount == 1 && attributeCount == 1 && (dataVersionsCount == 0 || dataVersionsCount == 1); - const bool multipleDataVersions = dataVersionsCount > 1 && clusterCount == 1 && attributeCount == 1 && endpointCount == 1; - - size_t pathsCount = 0; - if (hasSameIdsCount) - { - pathsCount = clusterCount; - } - else if (multipleClusters) - { - pathsCount = clusterCount; - } - else if (multipleAttributes) - { - pathsCount = attributeCount; - } - else if (multipleEndpoints) - { - pathsCount = endpointCount; - } - else if (multipleDataVersions) - { - pathsCount = dataVersionsCount; - } - else - { - ChipLogError( - chipTool, - "\n%sAttribute commands targetting multiple paths needs to have: \n \t * One element with multiple ids (for " - "example 1 cluster id, 1 attribute id, 2 endpoint ids)\n\t * Or the same " - "number of ids (for examples 2 cluster ids, 2 attribute ids and 2 endpoint ids).\n The current command has %u " - "cluster ids, %u attribute ids, %u endpoint ids.", - interactionType == chip::app::ReadClient::InteractionType::Subscribe ? "Subscribe" : "Read", - static_cast(clusterCount), static_cast(attributeCount), - static_cast(endpointCount)); - return CHIP_ERROR_INVALID_ARGUMENT; - } - - ChipLogProgress(chipTool, "Sending %sAttribute to:", - interactionType == chip::app::ReadClient::InteractionType::Subscribe ? "Subscribe" : "Read"); - - chip::app::AttributePathParams attributePathParams[kMaxAllowedPaths]; - chip::app::DataVersionFilter dataVersionFilter[kMaxAllowedPaths]; - for (size_t i = 0; i < pathsCount; i++) - { - chip::ClusterId clusterId = clusterIds.at((hasSameIdsCount || multipleClusters) ? i : 0); - chip::AttributeId attributeId = attributeIds.at((hasSameIdsCount || multipleAttributes) ? i : 0); - chip::EndpointId endpointId = endpointIds.at((hasSameIdsCount || multipleEndpoints) ? i : 0); - - ChipLogProgress(chipTool, "\tcluster " ChipLogFormatMEI ", attribute: " ChipLogFormatMEI ", endpoint %u", - ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId), endpointId); - attributePathParams[i].mClusterId = clusterId; - attributePathParams[i].mAttributeId = attributeId; - attributePathParams[i].mEndpointId = endpointId; - - if (dataVersions.HasValue()) - { - chip::DataVersion dataVersion = dataVersions.Value().at((hasSameIdsCount || multipleDataVersions) ? i : 0); - dataVersionFilter[i].mEndpointId = endpointId; - dataVersionFilter[i].mClusterId = clusterId; - dataVersionFilter[i].mDataVersion.SetValue(dataVersion); - } - } - - chip::app::ReadPrepareParams params(device->GetSecureSession().Value()); - params.mpEventPathParamsList = nullptr; - params.mEventPathParamsListSize = 0; - params.mpAttributePathParamsList = attributePathParams; - params.mAttributePathParamsListSize = pathsCount; - - if (mFabricFiltered.HasValue()) - { - params.mIsFabricFiltered = mFabricFiltered.Value(); - } - - if (dataVersions.HasValue()) - { - params.mpDataVersionFilterList = dataVersionFilter; - params.mDataVersionFilterListSize = pathsCount; - } - - if (interactionType == chip::app::ReadClient::InteractionType::Subscribe) - { - params.mMinIntervalFloorSeconds = minInterval; - params.mMaxIntervalCeilingSeconds = maxInterval; - if (mKeepSubscriptions.HasValue()) - { - params.mKeepSubscriptions = mKeepSubscriptions.Value(); - } - } - - mReadClient = std::make_unique(chip::app::InteractionModelEngine::GetInstance(), - device->GetExchangeManager(), mBufferedReadAdapter, interactionType); - return mReadClient->SendRequest(params); - } - - CHIP_ERROR ReportEvent(chip::DeviceProxy * device, std::vector endpointIds, - std::vector clusterIds, std::vector eventIds, - chip::app::ReadClient::InteractionType interactionType, uint16_t minInterval = 0, - uint16_t maxInterval = 0) - { - const size_t clusterCount = clusterIds.size(); - const size_t eventCount = eventIds.size(); - const size_t endpointCount = endpointIds.size(); - - VerifyOrReturnError(clusterCount > 0 && clusterCount <= kMaxAllowedPaths, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(eventCount > 0 && eventCount <= kMaxAllowedPaths, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(endpointCount > 0 && endpointCount <= kMaxAllowedPaths, CHIP_ERROR_INVALID_ARGUMENT); - - const bool hasSameIdsCount = (clusterCount == eventCount) && (clusterCount == endpointCount); - const bool multipleClusters = clusterCount > 1 && eventCount == 1 && endpointCount == 1; - const bool multipleEvents = eventCount > 1 && clusterCount == 1 && endpointCount == 1; - const bool multipleEndpoints = endpointCount > 1 && clusterCount == 1 && eventCount == 1; - - size_t pathsCount = 0; - if (hasSameIdsCount) - { - pathsCount = clusterCount; - } - else if (multipleClusters) - { - pathsCount = clusterCount; - } - else if (multipleEvents) - { - pathsCount = eventCount; - } - else if (multipleEndpoints) - { - pathsCount = endpointCount; - } - else - { - ChipLogError(chipTool, - "\n%sEvent command targetting multiple paths needs to have: \n \t * One element with multiple ids (for " - "example 1 cluster id, 1 event id, 2 endpoint ids)\n\t * Or the same " - "number of ids (for examples 2 cluster ids, 2 event ids and 2 endpoint ids).\n The current command has %u " - "cluster ids, %u event ids, %u endpoint ids.", - interactionType == chip::app::ReadClient::InteractionType::Subscribe ? "Subscribe" : "Read", - static_cast(clusterCount), static_cast(eventCount), - static_cast(endpointCount)); - return CHIP_ERROR_INVALID_ARGUMENT; - } - - chip::app::EventPathParams eventPathParams[kMaxAllowedPaths]; - - ChipLogProgress(chipTool, "Sending %sEvent to:", - interactionType == chip::app::ReadClient::InteractionType::Subscribe ? "Subscribe" : "Read"); - for (size_t i = 0; i < pathsCount; i++) - { - chip::ClusterId clusterId = clusterIds.at((hasSameIdsCount || multipleClusters) ? i : 0); - chip::EventId eventId = eventIds.at((hasSameIdsCount || multipleEvents) ? i : 0); - chip::EndpointId endpointId = endpointIds.at((hasSameIdsCount || multipleEndpoints) ? i : 0); - - ChipLogProgress(chipTool, "\tcluster " ChipLogFormatMEI ", event: " ChipLogFormatMEI ", endpoint %u", - ChipLogValueMEI(clusterId), ChipLogValueMEI(eventId), endpointId); - eventPathParams[i].mClusterId = clusterId; - eventPathParams[i].mEventId = eventId; - eventPathParams[i].mEndpointId = endpointId; - } - - chip::app::ReadPrepareParams params(device->GetSecureSession().Value()); - params.mpEventPathParamsList = eventPathParams; - params.mEventPathParamsListSize = pathsCount; - params.mEventNumber = mEventNumber; - params.mpAttributePathParamsList = nullptr; - params.mAttributePathParamsListSize = 0; - - if (interactionType == chip::app::ReadClient::InteractionType::Subscribe) - { - params.mMinIntervalFloorSeconds = minInterval; - params.mMaxIntervalCeilingSeconds = maxInterval; - if (mKeepSubscriptions.HasValue()) - { - params.mKeepSubscriptions = mKeepSubscriptions.Value(); - } - } - - mReadClient = std::make_unique(chip::app::InteractionModelEngine::GetInstance(), - device->GetExchangeManager(), mBufferedReadAdapter, interactionType); - return mReadClient->SendRequest(params); - } - // Use a 3x-longer-than-default timeout because wildcard reads can take a // while. chip::System::Clock::Timeout GetWaitDuration() const override @@ -320,18 +112,6 @@ class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callbac return mTimeout.HasValue() ? chip::System::Clock::Seconds16(mTimeout.Value()) : (ModelCommand::GetWaitDuration() * 3); } - std::unique_ptr mReadClient; - chip::app::BufferedReadCallback mBufferedReadAdapter; - - // mFabricFiltered is really only used by the attribute commands, but we end - // up needing it in our class's shared code. - chip::Optional mFabricFiltered; - - // mKeepSubscriptions is really only used by the subscribe commands, but we end - // up needing it in our class's shared code. - chip::Optional mKeepSubscriptions; - chip::Optional mEventNumber; - CHIP_ERROR mError = CHIP_NO_ERROR; }; @@ -371,13 +151,13 @@ class ReadAttribute : public ReportCommand CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override { - return ReportCommand::ReportAttribute(device, endpointIds, mClusterIds, mAttributeIds, - chip::app::ReadClient::InteractionType::Read, 0, 0, mDataVersion); + return ReportCommand::ReadAttribute(device, endpointIds, mClusterIds, mAttributeIds, mFabricFiltered, mDataVersion); } private: std::vector mClusterIds; std::vector mAttributeIds; + chip::Optional mFabricFiltered; chip::Optional> mDataVersion; }; @@ -426,9 +206,8 @@ class SubscribeAttribute : public ReportCommand CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override { - return ReportCommand::ReportAttribute(device, endpointIds, mClusterIds, mAttributeIds, - chip::app::ReadClient::InteractionType::Subscribe, mMinInterval, mMaxInterval, - mDataVersion); + return ReportCommand::SubscribeAttribute(device, endpointIds, mClusterIds, mAttributeIds, mMinInterval, mMaxInterval, + mFabricFiltered, mDataVersion, mKeepSubscriptions); } void OnSubscription() override @@ -441,7 +220,7 @@ class SubscribeAttribute : public ReportCommand auto * command = reinterpret_cast(arg); if (!command->IsInteractive()) { - command->mReadClient.reset(); + command->InteractionModelReports::Shutdown(); } command->SetCommandExitStatus(CHIP_NO_ERROR); }, @@ -454,7 +233,9 @@ class SubscribeAttribute : public ReportCommand uint16_t mMinInterval; uint16_t mMaxInterval; + chip::Optional mFabricFiltered; chip::Optional> mDataVersion; + chip::Optional mKeepSubscriptions; }; class ReadEvent : public ReportCommand @@ -490,13 +271,13 @@ class ReadEvent : public ReportCommand CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override { - return ReportCommand::ReportEvent(device, endpointIds, mClusterIds, mEventIds, - chip::app::ReadClient::InteractionType::Read); + return ReportCommand::ReadEvent(device, endpointIds, mClusterIds, mEventIds, mEventNumber); } private: std::vector mClusterIds; std::vector mEventIds; + chip::Optional mEventNumber; }; class SubscribeEvent : public ReportCommand @@ -544,8 +325,8 @@ class SubscribeEvent : public ReportCommand CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override { - return ReportCommand::ReportEvent(device, endpointIds, mClusterIds, mEventIds, - chip::app::ReadClient::InteractionType::Subscribe, mMinInterval, mMaxInterval); + return ReportCommand::SubscribeEvent(device, endpointIds, mClusterIds, mEventIds, mMinInterval, mMaxInterval, mEventNumber, + mKeepSubscriptions); } void OnSubscription() override @@ -558,7 +339,7 @@ class SubscribeEvent : public ReportCommand auto * command = reinterpret_cast(arg); if (!command->IsInteractive()) { - command->mReadClient.reset(); + command->InteractionModelReports::Shutdown(); } command->SetCommandExitStatus(CHIP_NO_ERROR); }, @@ -571,4 +352,6 @@ class SubscribeEvent : public ReportCommand uint16_t mMinInterval; uint16_t mMaxInterval; + chip::Optional mKeepSubscriptions; + chip::Optional mEventNumber; }; diff --git a/examples/chip-tool/commands/clusters/WriteAttributeCommand.h b/examples/chip-tool/commands/clusters/WriteAttributeCommand.h index dea6b9c5e159ee..8d2e8797c8b40a 100644 --- a/examples/chip-tool/commands/clusters/WriteAttributeCommand.h +++ b/examples/chip-tool/commands/clusters/WriteAttributeCommand.h @@ -18,15 +18,16 @@ #pragma once -#include +#include #include "DataModelLogger.h" #include "ModelCommand.h" -class WriteAttribute : public ModelCommand, public chip::app::WriteClient::Callback +class WriteAttribute : public InteractionModelWriter, public ModelCommand, public chip::app::WriteClient::Callback { public: - WriteAttribute(CredentialIssuerCommands * credsIssuerConfig) : ModelCommand("write-by-id", credsIssuerConfig) + WriteAttribute(CredentialIssuerCommands * credsIssuerConfig) : + InteractionModelWriter(this), ModelCommand("write-by-id", credsIssuerConfig) { AddArgument("cluster-id", 0, UINT32_MAX, &mClusterId); AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId); @@ -38,7 +39,7 @@ class WriteAttribute : public ModelCommand, public chip::app::WriteClient::Callb } WriteAttribute(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) : - ModelCommand("write-by-id", credsIssuerConfig), mClusterId(clusterId) + InteractionModelWriter(this), ModelCommand("write-by-id", credsIssuerConfig), mClusterId(clusterId) { AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId); AddArgument("attribute-value", &mAttributeValue); @@ -49,7 +50,7 @@ class WriteAttribute : public ModelCommand, public chip::app::WriteClient::Callb } WriteAttribute(const char * attributeName, CredentialIssuerCommands * credsIssuerConfig) : - ModelCommand("write", credsIssuerConfig) + InteractionModelWriter(this), ModelCommand("write", credsIssuerConfig) { AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs); AddArgument("data-version", 0, UINT32_MAX, &mDataVersion); @@ -88,7 +89,7 @@ class WriteAttribute : public ModelCommand, public chip::app::WriteClient::Callb void OnDone(chip::app::WriteClient * client) override { - mWriteClient.reset(); + InteractionModelWriter::Shutdown(); SetCommandExitStatus(mError); } @@ -98,45 +99,17 @@ class WriteAttribute : public ModelCommand, public chip::app::WriteClient::Callb { ChipLogProgress(chipTool, "Sending WriteAttribute to cluster " ChipLogFormatMEI " on endpoint %u", ChipLogValueMEI(clusterId), endpointId); - chip::app::AttributePathParams attributePathParams; - if (!device->GetSecureSession().Value()->IsGroupSession()) - { - attributePathParams.mEndpointId = endpointId; - } - attributePathParams.mClusterId = clusterId; - attributePathParams.mAttributeId = attributeId; - - mWriteClient = std::make_unique(device->GetExchangeManager(), this, mTimedInteractionTimeoutMs, - mSuppressResponse.ValueOr(false)); - - ReturnErrorOnFailure(mWriteClient->EncodeAttribute(attributePathParams, value, mDataVersion)); - - return mWriteClient->SendWriteRequest(device->GetSecureSession().Value()); + return InteractionModelWriter::WriteAttribute(device, endpointId, clusterId, attributeId, value, mTimedInteractionTimeoutMs, + mSuppressResponse, mDataVersion); } template CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex, chip::ClusterId clusterId, chip::AttributeId attributeId, const T & value) { - - chip::app::AttributePathParams attributePathParams; - attributePathParams.mClusterId = clusterId; - attributePathParams.mAttributeId = attributeId; - - chip::Messaging::ExchangeManager * exchangeManager = chip::app::InteractionModelEngine::GetInstance()->GetExchangeManager(); - ChipLogDetail(chipTool, "Sending Write Attribute to Group %u, on Fabric %x, for cluster %u with attributeId %u", groupId, fabricIndex, clusterId, attributeId); - - auto writeClient = chip::Platform::MakeUnique(exchangeManager, this, mTimedInteractionTimeoutMs); - VerifyOrReturnError(writeClient != nullptr, CHIP_ERROR_NO_MEMORY); - ReturnErrorOnFailure(writeClient->EncodeAttribute(attributePathParams, value, mDataVersion)); - - chip::Transport::OutgoingGroupSession session(groupId, fabricIndex); - ReturnErrorOnFailure(writeClient->SendWriteRequest(chip::SessionHandle(session))); - writeClient.release(); - - return CHIP_NO_ERROR; + return InteractionModelWriter::WriteGroupAttribute(groupId, fabricIndex, clusterId, attributeId, value, mDataVersion); } private: @@ -147,5 +120,4 @@ class WriteAttribute : public ModelCommand, public chip::app::WriteClient::Callb chip::Optional mDataVersion = chip::NullOptional; chip::Optional mSuppressResponse; CustomArgument mAttributeValue; - std::unique_ptr mWriteClient; }; diff --git a/examples/chip-tool/commands/common/CommandInvoker.h b/examples/chip-tool/commands/common/CommandInvoker.h deleted file mode 100644 index 74284f2515517a..00000000000000 --- a/examples/chip-tool/commands/common/CommandInvoker.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace chip { -namespace Controller { -namespace detail { -template -class ResponseReceiver : public app::CommandSender::Callback -{ -public: - using SuccessCallback = void (*)(void * context, const ResponseType & data); - using FailureCallback = void (*)(void * context, CHIP_ERROR err); - using DoneCallback = void (*)(void * context); - - virtual ~ResponseReceiver() {} - -protected: - ResponseReceiver(void * aContext, SuccessCallback aOnSuccess, FailureCallback aOnError, DoneCallback aOnDone) : - mContext(aContext), mOnSuccess(aOnSuccess), mOnError(aOnError), mOnDone(aOnDone) - {} - - inline void OnResponse(app::CommandSender * aCommandSender, const app::ConcreteCommandPath & aPath, - const app::StatusIB & aStatus, TLV::TLVReader * aData) override; - - void OnError(const app::CommandSender * aCommandSender, CHIP_ERROR aError) override { mOnError(mContext, aError); } - - void OnDone(app::CommandSender * aCommandSender) override - { - if (mOnDone != nullptr) - { - mOnDone(mContext); - } - - Platform::Delete(aCommandSender); - Platform::Delete(this); - } - -private: - void * mContext; - SuccessCallback mOnSuccess; - FailureCallback mOnError; - DoneCallback mOnDone = nullptr; -}; - -template -class CommandInvoker final : public ResponseReceiver -{ - using Super = ResponseReceiver; - -public: - CommandInvoker(void * aContext, typename Super::SuccessCallback aOnSuccess, typename Super::FailureCallback aOnError, - typename Super::DoneCallback aOnDone) : - Super(aContext, aOnSuccess, aOnError, aOnDone) - {} - - /** - * Use of CommandInvoker looks as follows: - * - * auto invoker = CommandInvoker::Alloc(args); - * VerifyOrReturnError(invoker != nullptr, CHIP_ERROR_NO_MEMORY); - * ReturnErrorOnFailure(invoker->InvokeCommand(args)); - * invoker.release(); // The invoker will deallocate itself now. - */ - static auto Alloc(void * aContext, typename Super::SuccessCallback aOnSuccess, typename Super::FailureCallback aOnError, - typename Super::DoneCallback aOnDone) - { - return Platform::MakeUnique(aContext, aOnSuccess, aOnError, aOnDone); - } - - CHIP_ERROR InvokeCommand(DeviceProxy * aDevice, EndpointId aEndpoint, const RequestType & aRequestData, - const Optional & aTimedInvokeTimeoutMs) - { - app::CommandPathParams commandPath = { aEndpoint, 0 /* groupId */, RequestType::GetClusterId(), RequestType::GetCommandId(), - (app::CommandPathFlags::kEndpointIdValid) }; - auto commandSender = - Platform::MakeUnique(this, aDevice->GetExchangeManager(), aTimedInvokeTimeoutMs.HasValue()); - VerifyOrReturnError(commandSender != nullptr, CHIP_ERROR_NO_MEMORY); - - ReturnErrorOnFailure(commandSender->AddRequestDataNoTimedCheck(commandPath, aRequestData, aTimedInvokeTimeoutMs)); - ReturnErrorOnFailure(commandSender->SendCommandRequest(aDevice->GetSecureSession().Value())); - commandSender.release(); - return CHIP_NO_ERROR; - } - - CHIP_ERROR InvokeGroupCommand(Messaging::ExchangeManager * exchangeManager, FabricIndex fabric, GroupId groupId, - const RequestType & aRequestData) - { - app::CommandPathParams commandPath = { 0 /* endpoint */, groupId, RequestType::GetClusterId(), RequestType::GetCommandId(), - (app::CommandPathFlags::kGroupIdValid) }; - - auto commandSender = Platform::MakeUnique(this, exchangeManager); - VerifyOrReturnError(commandSender != nullptr, CHIP_ERROR_NO_MEMORY); - - ReturnErrorOnFailure(commandSender->AddRequestData(commandPath, aRequestData)); - - Transport::OutgoingGroupSession session(groupId, fabric); - - // this (invoker) and commandSender will be deleted by the onDone call before the return of SendGroupCommandRequest - // this (invoker) should not be used after the SendGroupCommandRequest call - ReturnErrorOnFailure(commandSender->SendGroupCommandRequest(SessionHandle(session))); - - // this (invoker) and commandSender are already deleted and are not to be used - commandSender.release(); - - return CHIP_NO_ERROR; - } -}; - -template -void ResponseReceiver::OnResponse(app::CommandSender * aCommandSender, const app::ConcreteCommandPath & aPath, - const app::StatusIB & aStatus, TLV::TLVReader * aData) -{ - ResponseType response; - CHIP_ERROR err = CHIP_NO_ERROR; - - // - // We're expecting response data in this variant of OnResponse. Consequently, aReader should always be - // non-null. If it is, it means we received a success status code instead, which is not what was expected. - // - VerifyOrExit(aData != nullptr, err = CHIP_ERROR_SCHEMA_MISMATCH); - - // - // Validate that the data response we received matches what we expect in terms of its cluster and command IDs. - // - VerifyOrExit(aPath.mClusterId == ResponseType::GetClusterId() && aPath.mCommandId == ResponseType::GetCommandId(), - err = CHIP_ERROR_SCHEMA_MISMATCH); - - err = app::DataModel::Decode(*aData, response); - SuccessOrExit(err); - - mOnSuccess(mContext, response); - -exit: - if (err != CHIP_NO_ERROR) - { - mOnError(mContext, err); - } -} - -template <> -inline void ResponseReceiver::OnResponse(app::CommandSender * aCommandSender, - const app::ConcreteCommandPath & aPath, - const app::StatusIB & aStatus, TLV::TLVReader * aData) -{ - // - // If we got a valid reader, it means we received response data that we were not expecting to receive. - // - if (aData != nullptr) - { - mOnError(mContext, CHIP_ERROR_SCHEMA_MISMATCH); - return; - } - - app::DataModel::NullObjectType nullResp; - mOnSuccess(mContext, nullResp); -} - -} // namespace detail - -template -CHIP_ERROR InvokeCommand(DeviceProxy * aDevice, void * aContext, - typename detail::CommandInvoker::SuccessCallback aSuccessCallback, - typename detail::CommandInvoker::FailureCallback aFailureCallback, EndpointId aEndpoint, - const RequestType & aRequestData, const Optional & aTimedInvokeTimeoutMs) -{ - auto invoker = - detail::CommandInvoker::Alloc(aContext, aSuccessCallback, aFailureCallback, nullptr /* aDoneCallback */); - VerifyOrReturnError(invoker != nullptr, CHIP_ERROR_NO_MEMORY); - ReturnErrorOnFailure(invoker->InvokeCommand(aDevice, aEndpoint, aRequestData, aTimedInvokeTimeoutMs)); - invoker.release(); - return CHIP_NO_ERROR; -} - -template -CHIP_ERROR InvokeCommand(DeviceProxy * aDevice, void * aContext, - typename detail::CommandInvoker::SuccessCallback aSuccessCallback, - typename detail::CommandInvoker::FailureCallback aFailureCallback, EndpointId aEndpoint, - const RequestType & aRequestData, uint16_t aTimedInvokeTimeoutMs) -{ - return InvokeCommand(aDevice, aContext, aSuccessCallback, aFailureCallback, aEndpoint, aRequestData, - MakeOptional(aTimedInvokeTimeoutMs)); -} - -template = 0> -CHIP_ERROR InvokeCommand(DeviceProxy * aDevice, void * aContext, - typename detail::CommandInvoker::SuccessCallback aSuccessCallback, - typename detail::CommandInvoker::FailureCallback aFailureCallback, EndpointId aEndpoint, - const RequestType & aRequestData) -{ - return InvokeCommand(aDevice, aContext, aSuccessCallback, aFailureCallback, aEndpoint, aRequestData, NullOptional); -} - -// Group commands can't do timed invoke in a meaningful way. -template = 0> -CHIP_ERROR InvokeGroupCommand(DeviceProxy * aDevice, void * aContext, - typename detail::CommandInvoker::SuccessCallback aSuccessCallback, - typename detail::CommandInvoker::FailureCallback aFailureCallback, - typename detail::CommandInvoker::DoneCallback aDoneCallback, GroupId groupId, - const RequestType & aRequestData) -{ - auto invoker = detail::CommandInvoker::Alloc(aContext, aSuccessCallback, aFailureCallback, aDoneCallback); - VerifyOrReturnError(invoker != nullptr, CHIP_ERROR_NO_MEMORY); - - // invoker will be deleted by the onDone call before the return of InvokeGroupCommand - // invoker should not be used after the InvokeGroupCommand call - // - // We assume the aDevice already has a Case session which is way we can use he established Secure Session - ReturnErrorOnFailure(invoker->InvokeGroupCommand(aDevice->GetExchangeManager(), - aDevice->GetSecureSession().Value()->GetFabricIndex(), groupId, aRequestData)); - - // invoker is already deleted and is not to be used - invoker.release(); - return CHIP_NO_ERROR; -} - -} // namespace Controller -} // namespace chip diff --git a/examples/chip-tool/templates/tests/commands.zapt b/examples/chip-tool/templates/tests/commands.zapt index a28cadf9606a3f..4c73a5675ac12c 100644 --- a/examples/chip-tool/templates/tests/commands.zapt +++ b/examples/chip-tool/templates/tests/commands.zapt @@ -5,7 +5,6 @@ #if CONFIG_ENABLE_YAML_TESTS #include -#include #include #include #include diff --git a/examples/chip-tool/templates/tests/partials/test_step.zapt b/examples/chip-tool/templates/tests/partials/test_step.zapt index 9558b8a6c9d203..00ba070d86276b 100644 --- a/examples/chip-tool/templates/tests/partials/test_step.zapt +++ b/examples/chip-tool/templates/tests/partials/test_step.zapt @@ -77,8 +77,8 @@ {{else if isSubscribeAttribute}} {{>attributeArguments}}, {{minInterval}}, {{maxInterval}}{{>maybeFabricFiltered~}} {{else if isWriteGroupAttribute}} {{>groupAttributeArguments}}, value{{>maybeTimedInteractionTimeout~}} {{else if isWriteAttribute}} {{>attributeArguments}}, value{{>maybeTimedInteractionTimeout~}} -{{else if isReadEvent}} {{>eventArguments}}{{>maybeFabricFiltered}} -{{else if isSubscribeEvent}} {{>eventArguments}}, {{minInterval}}, {{maxInterval}}{{>maybeFabricFiltered~}} +{{else if isReadEvent}} {{>eventArguments~}} +{{else if isSubscribeEvent}} {{>eventArguments}}, {{minInterval}}, {{maxInterval~}} {{else if isGroupCommand}} {{>groupCommandArguments}}, value{{>maybeTimedInteractionTimeout~}} {{else if isCommand}} {{>commandArguments}}, value{{>maybeTimedInteractionTimeout~}} {{/if}} diff --git a/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h index 3360f4cb60d62e..5361319e42ecfe 100644 --- a/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -31,4 +31,3 @@ #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 #define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 -#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h index b410dbd0a77827..7f6a313e145f87 100644 --- a/examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -30,5 +30,3 @@ // Use a default pairing code if one hasn't been provisioned in flash. #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h index 1eb34c2c8eb0bb..3a6d7ab9f27f28 100644 --- a/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -32,5 +32,3 @@ #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 #define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 - -#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/ota-provider-app/linux/README.md b/examples/ota-provider-app/linux/README.md index af21d26be9e773..4a1e65dc2f4467 100644 --- a/examples/ota-provider-app/linux/README.md +++ b/examples/ota-provider-app/linux/README.md @@ -26,6 +26,7 @@ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug c | -u, --userConsentState \ | The user consent state for the first QueryImageResponse. For all subsequent responses, the value of granted will be used.
Note that --queryImageStatus overrides this option.
  • granted: Status field in the first QueryImageResponse is set to updateAvailable
  • denied: Status field in the first QueryImageResponse is set to updateNotAvailable
  • deferred: Status field in the first QueryImageResponse is set to busy | | -x, --ignoreQueryImage \ | The number of times to ignore the QueryImage Command and not send a response | | -y, --ignoreApplyUpdate \ | The number of times to ignore the ApplyUpdate Request and not send a response | +| -P, --pollInterval | Poll interval for the BDX transfer. | **Using `--filepath` and `--otaImageList`** diff --git a/examples/ota-provider-app/linux/main.cpp b/examples/ota-provider-app/linux/main.cpp index f2a526a4bb9e55..aefd9e39224fc7 100644 --- a/examples/ota-provider-app/linux/main.cpp +++ b/examples/ota-provider-app/linux/main.cpp @@ -54,6 +54,7 @@ constexpr uint16_t kOptionDelayedQueryActionTimeSec = 't'; constexpr uint16_t kOptionUserConsentState = 'u'; constexpr uint16_t kOptionIgnoreQueryImage = 'x'; constexpr uint16_t kOptionIgnoreApplyUpdate = 'y'; +constexpr uint16_t kOptionPollInterval = 'P'; OTAProviderExample gOtaProvider; chip::ota::DefaultOTAProviderUserConsent gUserConsentProvider; @@ -70,6 +71,7 @@ static chip::ota::UserConsentState gUserConsentState = chip::ota::UserConsentSta static bool gUserConsentNeeded = false; static uint32_t gIgnoreQueryImageCount = 0; static uint32_t gIgnoreApplyUpdateCount = 0; +static uint32_t gPollInterval = 0; // Parses the JSON filepath and extracts DeviceSoftwareVersionModel parameters static bool ParseJsonFileAndPopulateCandidates(const char * filepath, @@ -241,6 +243,10 @@ bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, case kOptionUserConsentNeeded: gUserConsentNeeded = true; break; + case kOptionPollInterval: + gPollInterval = static_cast(strtoul(aValue, NULL, 0)); + break; + default: PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName); retval = false; @@ -262,6 +268,7 @@ OptionDef cmdLineOptionsDef[] = { { "userConsentState", chip::ArgParser::kArgumentRequired, kOptionUserConsentState }, { "ignoreQueryImage", chip::ArgParser::kArgumentRequired, kOptionIgnoreQueryImage }, { "ignoreApplyUpdate", chip::ArgParser::kArgumentRequired, kOptionIgnoreApplyUpdate }, + { "pollInterval", chip::ArgParser::kArgumentRequired, kOptionPollInterval }, {}, }; @@ -300,7 +307,9 @@ OptionSet cmdLineOptions = { HandleOptions, cmdLineOptionsDef, "PROGRAM OPTIONS" " -x, --ignoreQueryImage \n" " The number of times to ignore the QueryImage Command and not send a response.\n" " -y, --ignoreApplyUpdate \n" - " The number of times to ignore the ApplyUpdateRequest Command and not send a response.\n" }; + " The number of times to ignore the ApplyUpdateRequest Command and not send a response.\n" + " -P, --pollInterval