diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index c9d72a3179beee..2136de4b058c49 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -156,6 +156,7 @@ BTP btvirt buildwithmatter burndown +ButtonIsr BytesMain bz bzip @@ -300,6 +301,7 @@ cxx CY CYW DAC +dadbdcdddedf DAP DAPLINK DataFrame @@ -358,6 +360,7 @@ DevKitC DevKitM devtype df +dfe dfu DgDxsfHx dhclient @@ -542,6 +545,7 @@ Gradle gradlew GroupId GroupKeyManagement +groupsettings gtk GUA Gv @@ -601,6 +605,7 @@ Infineon ini init inlined +InputLoop installDebug instantiation integrations @@ -646,10 +651,12 @@ kBusy kCase Kconfig KeypadInput +keyset kGroup kInvalidCommandId KitProg kManage +kNewButton kNodeIdNotSpecified knownissues kOperate @@ -1076,6 +1083,8 @@ sdl SED SEGGER semver +SendButton +SendNewInputEvent sendto SERIALDEVICE SerialNumber @@ -1184,6 +1193,7 @@ TestEmptyString TestGenExample TestGroupDemoConfig TestMultiRead +TestName TESTPASSWD TestPICS TESTSSID @@ -1302,6 +1312,7 @@ vous VPN VSC VSCode +WaitNewInputEvent WakeOnLan WantedBy webpage @@ -1326,6 +1337,7 @@ WS WSL WSTK xa +xAAAA xab xaver xb @@ -1358,6 +1370,8 @@ xfffff xFFFFFFFD xffffffffe xfffffffff +xffffffffffff +xffffffffffffXXXX xtensa xwayland XXXX @@ -1401,3 +1415,14 @@ kManage kOperate kView xFFFFFFFD +ClusterObjectTests +TestTimedRequestTimeout +datamodel +appliable +commissionee +configs +NAMESERVER +UTF +localedef +nameserver +nmcli diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 43db1458ebbc30..a984010b631ec6 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.56 + image: connectedhomeip/chip-build:0.5.58 steps: - uses: Wandalen/wretry.action@v1.0.11 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 853eebb3143726..84b0c28d9873e5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -99,7 +99,7 @@ jobs: timeout-minutes: 20 run: scripts/run_in_build_env.sh "ninja -C ./out" build_linux: - name: Build on Linux (fake, gcc_release, clang, mbedtls, simulated) + name: Build on Linux (fake, gcc_release, clang, simulated) timeout-minutes: 120 runs-on: ubuntu-latest @@ -157,12 +157,10 @@ jobs: - name: Setup Build, Run Build and Run Tests timeout-minutes: 90 run: | - for BUILD_TYPE in fake gcc_release clang mbedtls; do + for BUILD_TYPE in gcc_release clang; do case $BUILD_TYPE in - "fake") GN_ARGS='chip_device_platform="fake"';; "gcc_release") GN_ARGS='is_debug=false';; "clang") GN_ARGS='is_clang=true pw_command_launcher="`pwd`/../scripts/helpers/clang-tidy-launcher.py"';; - "mbedtls") GN_ARGS='chip_crypto="mbedtls"';; esac scripts/build/gn_gen.sh --args="$GN_ARGS" @@ -191,18 +189,14 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --no-log-timestamps \ - --target linux-x64-all-clusters \ --target linux-x64-all-clusters-ipv6only \ - --target linux-x64-chip-tool \ --target linux-x64-chip-tool-ipv6only \ --target linux-x64-minmdns-ipv6only \ --target linux-x64-rpc-console \ - --target linux-x64-thermostat-ipv6only \ - --target linux-x64-tv-app-ipv6only \ build \ " - - name: Run fake linux tests + - name: Run fake linux tests with build_examples timeout-minutes: 15 run: | ./scripts/run_in_build_env.sh \ @@ -271,6 +265,7 @@ jobs: run: | scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/chip-0.0-cp37-abi3-linux_x86_64.whl' scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' + build_darwin: name: Build on Darwin (clang, python_lib, simulated) timeout-minutes: 200 diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 5ae9f998e3a2f4..0e2b322b53ab85 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.56 + # image: connectedhomeip/chip-build-cirque:0.5.58 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index d590aa14d11c79..7ee9a70bef94e3 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -82,7 +82,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-doxygen:0.5.56 + image: connectedhomeip/chip-build-doxygen:0.5.58 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index d6e2a301589ca3..fb3041de2a2637 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-ameba:0.5.56 + image: connectedhomeip/chip-build-ameba:0.5.58 options: --user root steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 0fe116557d4521..e51905bf3be69b 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-efr32:0.5.56 + image: connectedhomeip/chip-build-efr32:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 1194f2377d718d..598995649776ba 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.5.56 + image: connectedhomeip/chip-build-esp32:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -117,7 +117,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.5.56 + image: connectedhomeip/chip-build-esp32:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 6014c3fcab3340..5ae45be76bc6d5 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-infineon:0.5.56 + image: connectedhomeip/chip-build-infineon:0.5.58 steps: - uses: Wandalen/wretry.action@v1.0.11 diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index 7a5d31dff732d2..834d513b9e2019 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-k32w:0.5.56 + image: connectedhomeip/chip-build-k32w:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 3b36392e97ee07..670e583372032d 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -31,7 +31,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-crosscompile:0.5.56 + image: connectedhomeip/chip-build-crosscompile:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 45889941e10133..1db324083dc0b5 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -31,7 +31,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-imx:0.5.56 + image: connectedhomeip/chip-build-imx:0.5.58 steps: - uses: Wandalen/wretry.action@v1.0.11 diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 61190ae5a84c10..bcfa353c6c5aee 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.56 + image: connectedhomeip/chip-build:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 27a5a8f34fe54f..3fea27e287a92a 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-mbed-os:0.5.56 + image: connectedhomeip/chip-build-mbed-os:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index bfb3c55b3faa41..48db1803792002 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-nrf-platform:0.5.56 + image: connectedhomeip/chip-build-nrf-platform:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index ee00a4e33aa5e7..dc63cba81e7fe5 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.56 + image: connectedhomeip/chip-build:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index d81227c5075253..a69ff40dc10263 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-telink:0.5.56 + image: connectedhomeip/chip-build-telink:0.5.58 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index a09586a084b122..1b3a0994e7fbff 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-tizen:0.5.56 + image: connectedhomeip/chip-build-tizen:0.5.58 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 00c0064c1bdaac..76b58c8d179f6a 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-android:0.5.56 + image: connectedhomeip/chip-build-android:0.5.58 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 9e70e2db45ccaa..96a5dca9e2c73b 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -31,7 +31,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.56 + image: connectedhomeip/chip-build:0.5.58 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -124,7 +124,7 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target darwin-x64-all-clusters-no-ble-asan-libfuzzer \ + --target darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang \ build \ --copy-artifacts-to objdir-clone \ " diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index ac1a11fd9216a2..0e3388aa302ae9 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32-qemu:0.5.56 + image: connectedhomeip/chip-build-esp32-qemu:0.5.58 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 2784be1e92667b..0bc5de482902f0 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-esp32:0.5.56 + image: connectedhomeip/chip-build-esp32:0.5.58 steps: - uses: Wandalen/wretry.action@v1.0.11 @@ -75,7 +75,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-efr32:0.5.56 + image: connectedhomeip/chip-build-efr32:0.5.58 steps: - uses: Wandalen/wretry.action@v1.0.11 name: Checkout diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index d3cfac36604c0f..b3c6c3c3e787db 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-android:0.5.56 + image: connectedhomeip/chip-build-android:0.5.58 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 0cfbfabdda8c28..6dab37ab7a264e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -32,7 +32,7 @@ jobs: strategy: matrix: - build_variant: [no-ble-tsan] + build_variant: [no-ble-tsan-clang] chip_tool: ["", -same-event-loop] env: BUILD_VARIANT: ${{matrix.build_variant}} @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.56 + image: connectedhomeip/chip-build:0.5.58 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -79,8 +79,8 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target linux-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT} \ - --target linux-x64-all-clusters-${BUILD_VARIANT}-test-group \ + --target linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \ + --target linux-x64-all-clusters-test-group-${BUILD_VARIANT} \ --target linux-x64-door-lock-${BUILD_VARIANT} \ --target linux-x64-tv-app-${BUILD_VARIANT} \ build \ @@ -91,10 +91,10 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ - --chip-tool ./out/linux-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT}/chip-tool \ + --chip-tool ./out/linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT}/chip-tool \ run \ --iterations 1 \ - --all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}-test-group/chip-all-clusters-app \ + --all-clusters-app ./out/linux-x64-all-clusters-test-group-${BUILD_VARIANT}/chip-all-clusters-app \ --door-lock-app ./out/linux-x64-door-lock-${BUILD_VARIANT}/chip-door-lock-app \ --tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ " @@ -120,7 +120,7 @@ jobs: strategy: matrix: - build_variant: [no-ble-tsan, no-ble-asan] + build_variant: [no-ble-tsan-clang, no-ble-asan-clang] chip_tool: ["", -same-event-loop] env: BUILD_VARIANT: ${{matrix.build_variant}} @@ -174,8 +174,10 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target darwin-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT} \ + --target darwin-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \ --target darwin-x64-all-clusters-${BUILD_VARIANT} \ + --target darwin-x64-door-lock-${BUILD_VARIANT} \ + --target darwin-x64-tv-app-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -184,11 +186,13 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ - --chip-tool ./out/darwin-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT}/chip-tool \ - --target-skip-glob '{TestGroupMessaging,DL_*,TV_*}' \ + --chip-tool ./out/darwin-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT}/chip-tool \ + --target-skip-glob '{TestGroupMessaging}' \ run \ --iterations 1 \ --all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ + --door-lock-app ./out/darwin-x64-door-lock-${BUILD_VARIANT}/chip-door-lock-app \ + --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ " - name: Uploading core files uses: actions/upload-artifact@v2 @@ -212,3 +216,169 @@ jobs: path: objdir-clone/ # objdirs are big; don't hold on to them too long. retention-days: 5 + repl_tests_linux: + name: REPL Tests - Linux + timeout-minutes: 120 + + strategy: + matrix: + build_variant: [no-ble-no-wifi-tsan-clang] + + env: + BUILD_VARIANT: ${{matrix.build_variant}} + TSAN_OPTIONS: "halt_on_error=1 suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" + + if: github.actor != 'restyled-io[bot]' + runs-on: ubuntu-latest + + container: + image: connectedhomeip/chip-build:0.5.56 + options: + --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + - name: + Try to ensure the directories for core dumping exist and we + can write them. + run: | + mkdir /tmp/cores || true + sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true + mkdir objdir-clone || true + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: + bootstrap-logs-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Python REPL and example apps + timeout-minutes: 50 + run: | + scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env' + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-x64-all-clusters-${BUILD_VARIANT} \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Run Tests + timeout-minutes: 30 + run: | + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset -- -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout' + - name: Uploading core files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-core-linux-python-repl + path: /tmp/cores/ + # Cores are big; don't hold on to them too long. + retention-days: 5 + - name: Uploading objdir for debugging + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-objdir-linux-python-repl + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 + + repl_tests_darwin: + name: REPL Tests - Darwin + timeout-minutes: 120 + + strategy: + matrix: + build_variant: [no-ble-no-wifi-tsan-clang] + env: + BUILD_VARIANT: ${{matrix.build_variant}} + TSAN_OPTIONS: "halt_on_error=1" + + if: github.actor != 'restyled-io[bot]' && false + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + - name: Setup Environment + # coreutils for stdbuf + run: brew install openssl pkg-config coreutils + - name: + Try to ensure the directories for core dumping and diagnostic + log collection exist and we can write them. + run: | + sudo chown ${USER} /cores || true + mkdir -p ~/Library/Logs/DiagnosticReports || true + mkdir objdir-clone || true + - name: Fix pkgconfig link + working-directory: /usr/local/lib/pkgconfig + run: | + pwd + ls -la /usr/local/Cellar/ + ls -la /usr/local/Cellar/openssl@1.1 + OPEN_SSL_VERSION=`ls -la /usr/local/Cellar/openssl@1.1 | cat | tail -n1 | awk '{print $NF}'` + ln -s /usr/local/Cellar/openssl@1.1/$OPEN_SSL_VERSION/lib/pkgconfig/* . + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: + bootstrap-logs-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Python REPL and example apps + timeout-minutes: 50 + run: | + scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env' + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target darwin-x64-all-clusters-${BUILD_VARIANT} \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Run Tests + timeout-minutes: 30 + run: | + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset --app-params "--discriminator 3840 --interface-id -1" -- -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout' + - name: Uploading core files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-core-darwin-python-repl + path: /cores/ + # Cores are big; don't hold on to them too long. + retention-days: 5 + - name: Uploading diagnostic logs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-log-darwin-python-repl + path: ~/Library/Logs/DiagnosticReports/ + - name: Uploading objdir for debugging + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-objdir-darwin-python-repl + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index a15dbf43eb22d6..f112c6af536a2e 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.56 + image: connectedhomeip/chip-build:0.5.58 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" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 323c2d2b463b97..464880a2ff03d9 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-zap:0.5.56 + image: connectedhomeip/chip-build-zap:0.5.58 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 3e867d3e82f7ff..28fc0d986ae38c 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-zap:0.5.56 + image: connectedhomeip/chip-build-zap:0.5.58 defaults: run: shell: sh diff --git a/.gitignore b/.gitignore index 878192f2bddb6d..6f9bc786ed260a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,9 @@ out/ /src/test_driver/nrfconnect/build/ /src/darwin/Framework/build/ -# Environment directory +# Pigweed Environment .environment/ +build_overrides/pigweed_environment.gni # Temporary Directories .tmp/ diff --git a/config/nrfconnect/.nrfconnect-recommended-revision b/config/nrfconnect/.nrfconnect-recommended-revision index 295e37c0ec4eeb..ba1e8bf0bd53b5 100644 --- a/config/nrfconnect/.nrfconnect-recommended-revision +++ b/config/nrfconnect/.nrfconnect-recommended-revision @@ -1 +1 @@ -v1.9.0 +v1.9.1 diff --git a/docs/guides/matter-repl.md b/docs/guides/matter-repl.md index c9a6aa86ce1684..52e0c31ba271c2 100644 --- a/docs/guides/matter-repl.md +++ b/docs/guides/matter-repl.md @@ -163,3 +163,85 @@ launched into the playground: [Multi Fabric Commissioning](https://deepnote.com/viewer/github/project-chip/connectedhomeip/blob/master/docs/guides/repl/Matter%20-%20Multi%20Fabric%20Commissioning.ipynb) [Access Control](https://deepnote.com/viewer/github/project-chip/connectedhomeip/blob/master/docs/guides/repl/Matter%20-%20Access%20Control.ipynb) + +## Testing + +We also provide `mobile-device-test.py` for testing your accessories, you can +run it manually or using a wrapper script. + +### Usage + +mobile-device-test.py provides the following options for running the tests: + +``` + --controller-nodeid INTEGER NodeId of the controller. + --device-nodeid INTEGER NodeId of the device. + -a, --address TEXT Skip commissionee discovery, commission the + device with the IP directly. + + -t, --timeout INTEGER The program will return with timeout after + specified seconds. + + --discriminator INTEGER Discriminator of the device. + --setup-pin INTEGER Setup pincode of the device. + --enable-test TEXT The tests to be executed. By default, all + tests will be executed, use this option to + run a specific set of tests. Use --print- + test-list for a list of appliable tests. + + --disable-test TEXT The tests to be excluded from the set of + enabled tests. Use --print-test-list for a + list of appliable tests. + + --log-level [ERROR|WARN|INFO|DEBUG] + The log level of the test. + --log-format TEXT Override logging format + --print-test-list Print a list of test cases and test sets + that can be toggled via --enable-test and + --disable-test, then exit + + --help Show this message and exit. +``` + +By default, all tests will be executed, however, you can exclude one or more +tests or only include a few tests if you want. + +For example, if you are working for commissioning, then you may want to exclude +the data model test cases by adding `--disable-test datamodel` to disable all +data model tests. + +Some tests provides the option to exclude them. For example, you can use +`--disable-test ClusterObjectTests.TestTimedRequestTimeout` to exclude the +"TestTimedRequestTimeout" test case. + +It is recommanded to use the test wrapper to run mobile-device-test.py, for +example, you can run: + +``` +./scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset +``` + +It provides some extra options, for example: + +``` + --app TEXT Local application to use, omit to use external apps, use + a path for a specific binary or use a filename to search + under the current matter checkout. + + --factoryreset Remove app config and repl configs (/tmp/chip* and + /tmp/repl*) before running the tests. + + --app-params TEXT The extra parameters passed to the device. + --script PATH Test script to use. + --help Show this message and exit. +``` + +You can pass your own flags for mobile-device-test.py by appending them to the +command line with two dashes, for example: + +``` +./scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset -- -t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout +``` + +will pass `-t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout` to +`mobile-device-test.py` diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index d39ad6fc0abb11..25d61d6adee3a2 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -230,11 +230,11 @@ server cluster BinaryInputBasic = 15 { server cluster Binding = 30 { struct TargetStruct { - FABRIC_IDX fabricIndex = 0; optional NODE_ID node = 1; optional GROUP_ID group = 2; optional ENDPOINT_NO endpoint = 3; optional CLUSTER_ID cluster = 4; + FABRIC_IDX fabricIndex = 254; } attribute TargetStruct binding[] = 0; @@ -963,6 +963,12 @@ server cluster DoorLock = 257 { kForcedDoorOpenUnderDoorLockedCondition = 0x40; } + bitmap DlCredentialRuleMask : BITMAP8 { + kSingle = 0x1; + kDual = 0x2; + kTri = 0x4; + } + bitmap DlCredentialRulesSupport : BITMAP8 { kSingle = 0x1; kDual = 0x2; @@ -1154,13 +1160,13 @@ server cluster DoorLock = 257 { readonly attribute int8u minPINCodeLength = 24; readonly attribute int8u maxRFIDCodeLength = 25; readonly attribute int8u minRFIDCodeLength = 26; - readonly attribute bitmap8 credentialRulesSupport = 27; + readonly attribute DlCredentialRuleMask credentialRulesSupport = 27; attribute char_string<3> language = 33; attribute int32u autoRelockTime = 35; attribute int8u soundVolume = 36; attribute DlOperatingMode operatingMode = 37; - readonly attribute bitmap16 supportedOperatingModes = 38; - readonly attribute bitmap16 defaultConfigurationRegister = 39; + readonly attribute DlSupportedOperatingModes supportedOperatingModes = 38; + readonly attribute DlDefaultConfigurationRegister defaultConfigurationRegister = 39; attribute boolean enableOneTouchLocking = 41; attribute boolean enableInsideStatusLED = 42; attribute boolean enablePrivacyModeButton = 43; @@ -1462,16 +1468,16 @@ server cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } struct GroupKeySetStruct { @@ -2312,18 +2318,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; @@ -2881,7 +2887,6 @@ server cluster TestCluster = 1295 { } struct TestFabricScoped { - fabric_idx fabricIndex = 0; INT8U fabricSensitiveInt8u = 1; optional INT8U optionalFabricSensitiveInt8u = 2; nullable INT8U nullableFabricSensitiveInt8u = 3; @@ -2889,6 +2894,7 @@ server cluster TestCluster = 1295 { CHAR_STRING fabricSensitiveCharString = 5; SimpleStruct fabricSensitiveStruct = 6; INT8U fabricSensitiveInt8uList[] = 7; + fabric_idx fabricIndex = 254; } struct NestedStructList { @@ -2917,7 +2923,7 @@ server cluster TestCluster = 1295 { } info event TestFabricScopedEvent = 2 { - fabric_idx arg1 = 1; + fabric_idx arg1 = 254; } attribute boolean boolean = 0; diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 11935f85c0ce31..8d54480789d9de 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -253,6 +253,7 @@ target_compile_options(${COMPONENT_LIB} PRIVATE "-DPW_RPC_LIGHTING_SERVICE=1" "-DPW_RPC_LOCKING_SERVICE=1" "-DPW_RPC_TRACING_SERVICE=1" - "-DPW_RPC_WIFI_SERVICE=1") + "-DPW_RPC_WIFI_SERVICE=1" + "-DPW_TRACE_BACKEND_SET=1") endif (CONFIG_ENABLE_PW_RPC) diff --git a/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp b/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp index 9de9620fa17fad..b47ce31364f672 100644 --- a/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp @@ -181,6 +181,21 @@ class EditAttributeListModel : public TouchesMatterStackModel ESP_LOGI(TAG, "Humidity changed to : %d", n); app::Clusters::RelativeHumidityMeasurement::Attributes::MeasuredValue::Set(1, static_cast(n * 100)); } + else if (name == "OccupiedCoolingSetpoint") + { + ESP_LOGI(TAG, "OccupiedCoolingSetpoint changed to : %d", n); + app::Clusters::Thermostat::Attributes::OccupiedCoolingSetpoint::Set(1, static_cast(n * 100)); + } + else if (name == "OccupiedHeatingSetpoint") + { + ESP_LOGI(TAG, "OccupiedHeatingSetpoint changed to : %d", n); + app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::Set(1, static_cast(n * 100)); + } + else if (name == "SystemMode") + { + ESP_LOGI(TAG, "SystemMode changed to : %d", n); + app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::Set(1, n); + } value = buffer; } else if (IsBooleanAttribute()) diff --git a/examples/all-clusters-app/linux/README.md b/examples/all-clusters-app/linux/README.md index c7e72959cbc11b..d029d6eff5f14d 100644 --- a/examples/all-clusters-app/linux/README.md +++ b/examples/all-clusters-app/linux/README.md @@ -8,13 +8,13 @@ This example supports compilation with libfuzzer enabled. To compile with libfuzzer enabled on Mac, run: - $ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target darwin-x64-all-clusters-no-ble-asan-libfuzzer build" + $ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang build" at the top level of the Matter tree. Similarly, to compile on Linux run: - $ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target linux-x64-all-clusters-no-ble-asan-libfuzzer build" + $ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target linux-x64-all-clusters-no-ble-asan-libfuzzer-clang build" ### Running libfuzzer-enabled binaries @@ -22,11 +22,11 @@ Similarly, to compile on Linux run: To run the resulting binary with no particular inputs do: - $ ./out/darwin-x64-all-clusters-no-ble-asan-libfuzzer/chip-all-clusters-app-fuzzing + $ ./out/darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing or - $ ./out/linux-x64-all-clusters-no-ble-asan-libfuzzer/chip-all-clusters-app-fuzzing + $ ./out/linux-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing If this crashes, it will output the input that caused the crash in a variety of formats, looking something like this: @@ -44,11 +44,11 @@ To run the binary with a specific input, place the input bytes in a file (which a crashing run of the fuzzer does automatically). If `$(INPUT_FILE)` is the name of that file, then run: - $ ./out/darwin-x64-all-clusters-no-ble-asan-libfuzzer/chip-all-clusters-app-fuzzing $(INPUT_FILE) + $ ./out/darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing $(INPUT_FILE) or - $ ./out/linux-x64-all-clusters-no-ble-asan-libfuzzer/chip-all-clusters-app-fuzzing $(INPUT_FILE) + $ ./out/linux-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing $(INPUT_FILE) #### Additional execution options. diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 3db133026cabeb..e7590fd6d575b9 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -63,6 +63,7 @@ constexpr uint32_t kOff_ms{ 950 }; } // namespace StatusLed } // namespace LedConsts +using namespace ::chip; using namespace ::chip::Credentials; using namespace ::chip::DeviceLayer; @@ -277,17 +278,11 @@ void AppTask::FunctionHandler(AppEvent * aEvent) } } -void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) +void AppTask::StartBLEAdvertisementHandler(AppEvent *) { - if (!aEvent) - return; - if (aEvent->ButtonEvent.PinNo != BLE_ADVERTISEMENT_START_BUTTON) - return; - - // Don't allow on starting Matter service BLE advertising after Thread provisioning. - if (ConnectivityMgr().IsThreadProvisioned()) + if (Server::GetInstance().GetFabricTable().FabricCount() != 0) { - LOG_INF("Matter service BLE advertising not started - device is commissioned to a Thread network."); + LOG_INF("Matter service BLE advertising not started - device is already commissioned"); return; } @@ -297,7 +292,7 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) + if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) { LOG_ERR("OpenBasicCommissioningWindow() failed"); } diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index 312e99cd554b5b..097b604c564f99 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -28,11 +28,11 @@ client cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ client cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -90,11 +90,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -104,24 +104,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -692,18 +692,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index e90072970abc15..c44e830e299595 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -120,6 +120,45 @@ The endpoint id must be between 1 and 240. The client will send a single command packet and then exit. +## Configuring the client for Group Commands + +Prior to sending a Group command, both the end device and the Client (Chip-tool) +must be configured appropriately. + +To configure the client please use the groupsettings option + + $ chip-tool groupsettings + +A group with a valid encryption key needs to be set. The groupid and the +encryption key must match the one configured on the end device. + +To add a group + + $ chip-tool groupsettings add-group TestName 0x1010 + +To add a keyset + + $ chip-tool groupsettings add-keyset 0xAAAA 0 0x000000000021dfe0 hex:d0d1d2d3d4d5d6d7d8d9dadbdcdddedf + +Take note that the epoch key must be in hex form with the 'hex:' prefix + +Finally to bind the keyset to the group + + $ chip-tool groupsettings bind-keyset 0x1010 0xAAAA + +## Using the Client to Send Group (Multicast) Matter Commands + +To use the Client to send Matter commands, run the built executable and pass it +the target cluster name, the target command name, the Group Id in Node Id form +(0xffffffffffffXXXX) and an unused endpoint Id. Take note that Only commands and +attributes write can be send with Group Id. + +E.G. sending to group Id 0x0025 + + $ chip-tool onoff on 0xffffffffffff0025 1 + +The client will send a single multicast command packet and then exit. + ### How to get the list of supported clusters To get the list of supported clusters, run the built executable without any diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index bb34584bf2ec72..856dbbeee6ed16 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -61,7 +61,7 @@ CHIP_ERROR CHIPCommand::Run() ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityGamma, kIdentityGammaFabricId, trustStore)); // Initialize Group Data - ReturnLogErrorOnFailure(chip::GroupTesting::InitProvider()); + ReturnLogErrorOnFailure(chip::GroupTesting::InitProvider(mDefaultStorage)); for (auto it = mCommissioners.begin(); it != mCommissioners.end(); it++) { chip::FabricInfo * fabric = it->second->GetFabricInfo(); diff --git a/examples/chip-tool/commands/group/Commands.h b/examples/chip-tool/commands/group/Commands.h new file mode 100644 index 00000000000000..7f5b838566c145 --- /dev/null +++ b/examples/chip-tool/commands/group/Commands.h @@ -0,0 +1,372 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include "../common/CHIPCommand.h" +#include "../common/Command.h" + +#include + +class ShowControllerGroups : public CHIPCommand +{ +public: + ShowControllerGroups(CredentialIssuerCommands * credsIssuerConfig) : CHIPCommand("show-groups", credsIssuerConfig) {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(5); } + + bool FindKeySetId(chip::FabricIndex fabricIndex, chip::GroupId groupId, chip::KeysetId & keysetId) + { + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + auto iter = groupDataProvider->IterateGroupKeys(fabricIndex); + chip::Credentials::GroupDataProvider::GroupKey groupKey; + while (iter->Next(groupKey)) + { + if (groupKey.group_id == groupId) + { + keysetId = groupKey.keyset_id; + iter->Release(); + return true; + } + } + iter->Release(); + return false; + } + + CHIP_ERROR RunCommand() override + { + fprintf(stderr, "\n"); + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + fprintf(stderr, " | Available Groups : |\n"); + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + fprintf(stderr, " | Group Id | KeySet Id | Group Name |\n"); + chip::FabricIndex fabricIndex; + CurrentCommissioner().GetFabricIndex(&fabricIndex); + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + auto it = groupDataProvider->IterateGroupInfo(fabricIndex); + chip::Credentials::GroupDataProvider::GroupInfo group; + if (it) + { + while (it->Next(group)) + { + chip::KeysetId keysetId; + if (FindKeySetId(fabricIndex, group.group_id, keysetId)) + { + fprintf(stderr, " | 0x%-12x 0x%-13x %-50s |\n", group.group_id, keysetId, group.name); + } + else + { + fprintf(stderr, " | 0x%-12x %-15s %-50s |\n", group.group_id, "None", group.name); + } + } + it->Release(); + } + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } +}; + +class AddGroup : public CHIPCommand +{ +public: + AddGroup(CredentialIssuerCommands * credsIssuerConfig) : CHIPCommand("add-group", credsIssuerConfig) + { + AddArgument("groupName", &groupName); + AddArgument("groupId", chip::kUndefinedGroupId, UINT16_MAX, &groupId); + } + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(20); } + + CHIP_ERROR RunCommand() override + { + if (strlen(groupName) > CHIP_CONFIG_MAX_GROUP_NAME_LENGTH || groupId == chip::kUndefinedGroupId) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + chip::FabricIndex fabricIndex; + CurrentCommissioner().GetFabricIndex(&fabricIndex); + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + chip::Credentials::GroupDataProvider::GroupInfo group; + + group.SetName(groupName); + group.group_id = groupId; + ReturnErrorOnFailure(groupDataProvider->SetGroupInfo(fabricIndex, group)); + + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } + +private: + char * groupName; + chip::GroupId groupId; +}; + +class RemoveGroup : public CHIPCommand +{ +public: + RemoveGroup(CredentialIssuerCommands * credsIssuerConfig) : CHIPCommand("remove-group", credsIssuerConfig) + { + AddArgument("groupId", chip::kUndefinedGroupId, UINT16_MAX, &groupId); + } + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(5); } + + CHIP_ERROR RunCommand() override + { + if (groupId == chip::kUndefinedGroupId) + { + ChipLogError(chipTool, "Invalid group Id : 0x%x", groupId); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + chip::FabricIndex fabricIndex; + CurrentCommissioner().GetFabricIndex(&fabricIndex); + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + ReturnErrorOnFailure(groupDataProvider->RemoveGroupInfo(fabricIndex, groupId)); + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } + +private: + chip::GroupId groupId; +}; + +class ShowKeySets : public CHIPCommand +{ +public: + ShowKeySets(CredentialIssuerCommands * credsIssuerConfig) : CHIPCommand("show-keysets", credsIssuerConfig) {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(5); } + + CHIP_ERROR RunCommand() override + { + chip::FabricIndex fabricIndex; + CurrentCommissioner().GetFabricIndex(&fabricIndex); + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + chip::Credentials::GroupDataProvider::KeySet keySet; + + fprintf(stderr, "\n"); + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + fprintf(stderr, " | Available KeySets : |\n"); + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + fprintf(stderr, " | KeySet Id | Key Policy |\n"); + + auto it = groupDataProvider->IterateKeySets(fabricIndex); + if (it) + { + while (it->Next(keySet)) + { + fprintf(stderr, " | 0x%-12x %-66s |\n", keySet.keyset_id, + (keySet.policy == chip::Credentials::GroupDataProvider::SecurityPolicy::kCacheAndSync) ? "Cache and Sync" + : "Trust First"); + } + it->Release(); + } + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } +}; + +class BindKeySet : public CHIPCommand +{ +public: + BindKeySet(CredentialIssuerCommands * credsIssuerConfig) : CHIPCommand("bind-keyset", credsIssuerConfig) + { + AddArgument("groupId", chip::kUndefinedGroupId, UINT16_MAX, &groupId); + AddArgument("keysetId", 0, UINT16_MAX, &keysetId); + } + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(5); } + + CHIP_ERROR RunCommand() override + { + size_t current_count = 0; + chip::FabricIndex fabricIndex; + CurrentCommissioner().GetFabricIndex(&fabricIndex); + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + + auto iter = groupDataProvider->IterateGroupKeys(fabricIndex); + current_count = iter->Count(); + iter->Release(); + + ReturnErrorOnFailure(groupDataProvider->SetGroupKeyAt(fabricIndex, current_count, + chip::Credentials::GroupDataProvider::GroupKey(groupId, keysetId))); + + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } + +private: + chip::GroupId groupId; + chip::KeysetId keysetId; +}; + +class UnbindKeySet : public CHIPCommand +{ +public: + UnbindKeySet(CredentialIssuerCommands * credsIssuerConfig) : CHIPCommand("unbind-keyset", credsIssuerConfig) + { + AddArgument("groupId", chip::kUndefinedGroupId, UINT16_MAX, &groupId); + AddArgument("keysetId", 0, UINT16_MAX, &keysetId); + } + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(5); } + + CHIP_ERROR RunCommand() override + { + size_t index = 0; + chip::FabricIndex fabricIndex; + CurrentCommissioner().GetFabricIndex(&fabricIndex); + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + auto iter = groupDataProvider->IterateGroupKeys(fabricIndex); + size_t maxCount = iter->Count(); + chip::Credentials::GroupDataProvider::GroupKey groupKey; + while (iter->Next(groupKey)) + { + if (groupKey.group_id == groupId && groupKey.keyset_id == keysetId) + { + break; + } + index++; + } + iter->Release(); + if (index >= maxCount) + { + return CHIP_ERROR_INTERNAL; + } + + ReturnErrorOnFailure(groupDataProvider->RemoveGroupKeyAt(fabricIndex, index)); + + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } + +private: + chip::GroupId groupId; + chip::KeysetId keysetId; +}; + +class AddKeySet : public CHIPCommand +{ +public: + AddKeySet(CredentialIssuerCommands * credsIssuerConfig) : CHIPCommand("add-keysets", credsIssuerConfig) + { + AddArgument("keysetId", 0, UINT16_MAX, &keysetId); + AddArgument("keyPolicy", 0, UINT16_MAX, &keyPolicy); + AddArgument("validityTime", 0, UINT64_MAX, &validityTime); + AddArgument("EpochKey", &epochKey); + } + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(5); } + + CHIP_ERROR RunCommand() override + { + chip::FabricIndex fabricIndex; + CurrentCommissioner().GetFabricIndex(&fabricIndex); + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + uint8_t compressed_fabric_id[sizeof(uint64_t)]; + chip::MutableByteSpan compressed_fabric_id_span(compressed_fabric_id); + ReturnLogErrorOnFailure(CurrentCommissioner().GetFabricInfo()->GetCompressedId(compressed_fabric_id_span)); + + if ((keyPolicy != chip::Credentials::GroupDataProvider::SecurityPolicy::kCacheAndSync && + keyPolicy != chip::Credentials::GroupDataProvider::SecurityPolicy::kTrustFirst) || + (epochKey.size()) != chip::Credentials::GroupDataProvider::EpochKey::kLengthBytes) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + chip::Credentials::GroupDataProvider::KeySet keySet(keysetId, keyPolicy, 1); + chip::Credentials::GroupDataProvider::EpochKey epoch_key; + epoch_key.start_time = validityTime; + memcpy(epoch_key.key, epochKey.data(), chip::Credentials::GroupDataProvider::EpochKey::kLengthBytes); + + memcpy(keySet.epoch_keys, &epoch_key, sizeof(chip::Credentials::GroupDataProvider::EpochKey)); + ReturnErrorOnFailure(groupDataProvider->SetKeySet(fabricIndex, compressed_fabric_id_span, keySet)); + + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } + +private: + chip::KeysetId keysetId; + chip::Credentials::GroupDataProvider::SecurityPolicy keyPolicy; + uint64_t validityTime; + chip::ByteSpan epochKey; +}; + +class RemoveKeySet : public CHIPCommand +{ +public: + RemoveKeySet(CredentialIssuerCommands * credsIssuerConfig) : CHIPCommand("remove-keyset", credsIssuerConfig) + { + AddArgument("keysetId", 0, UINT16_MAX, &keysetId); + } + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(5); } + + CHIP_ERROR RunCommand() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + chip::FabricIndex fabricIndex; + CurrentCommissioner().GetFabricIndex(&fabricIndex); + chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider(); + + // Unbind all group + size_t index = 0; + auto iter = groupDataProvider->IterateGroupKeys(fabricIndex); + chip::Credentials::GroupDataProvider::GroupKey groupKey; + while (iter->Next(groupKey)) + { + if (groupKey.keyset_id == keysetId) + { + err = groupDataProvider->RemoveGroupKeyAt(fabricIndex, index); + if (err != CHIP_NO_ERROR) + { + break; + } + } + index++; + } + iter->Release(); + + if (err == CHIP_NO_ERROR) + { + return err; + } + ReturnErrorOnFailure(groupDataProvider->RemoveKeySet(fabricIndex, keysetId)); + + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } + +private: + chip::KeysetId keysetId; +}; + +void registerCommandsGroup(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + const char * clusterName = "GroupSettings"; + + commands_list clusterCommands = { + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + }; + + commands.Register(clusterName, clusterCommands); +} diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index fb7b1c27d27339..cb5369ae2f62c3 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -206,6 +206,9 @@ void PairingCommand::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err) void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) { + // Ignore nodes with closed comissioning window + VerifyOrReturn(nodeData.commissioningMode != 0); + const uint16_t port = nodeData.port; char buf[chip::Inet::IPAddress::kMaxStringLength]; nodeData.ipAddress[0].ToString(buf); diff --git a/examples/chip-tool/main.cpp b/examples/chip-tool/main.cpp index 88d7adff4e800b..10e6b7440fb09c 100644 --- a/examples/chip-tool/main.cpp +++ b/examples/chip-tool/main.cpp @@ -20,6 +20,7 @@ #include "commands/example/ExampleCredentialIssuerCommands.h" #include "commands/discover/Commands.h" +#include "commands/group/Commands.h" #include "commands/pairing/Commands.h" #include "commands/payload/Commands.h" @@ -37,6 +38,7 @@ int main(int argc, char * argv[]) registerCommandsPayload(commands); registerCommandsPairing(commands, &credIssuerCommands); registerCommandsTests(commands, &credIssuerCommands); + registerCommandsGroup(commands, &credIssuerCommands); registerClusters(commands, &credIssuerCommands); return commands.Run(argc, argv); diff --git a/examples/chip-tool/templates/tests/partials/test_cluster.zapt b/examples/chip-tool/templates/tests/partials/test_cluster.zapt index 0a9dfe5b0c8fab..27616a54ed9c2e 100644 --- a/examples/chip-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/tests/partials/test_cluster.zapt @@ -318,8 +318,17 @@ class {{filename}}Suite: public TestCommand { chip::app::StatusIB status(error); {{#if response.error}} + {{#if optional}} + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute){ + {{#unless async}}NextTest();{{/unless}} + } else { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), {{response.error}})); + {{#unless async}}NextTest();{{/unless}} + } + {{else}} VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), {{response.error}})); {{#unless async}}NextTest();{{/unless}} + {{/if}} {{else}} {{#if optional}}(status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : {{/if}}ThrowFailureResponse(); {{/if}} diff --git a/examples/door-lock-app/door-lock-common/door-lock-app.matter b/examples/door-lock-app/door-lock-common/door-lock-app.matter index cd3a9880e1b3cb..689514dcd63d1c 100644 --- a/examples/door-lock-app/door-lock-common/door-lock-app.matter +++ b/examples/door-lock-app/door-lock-common/door-lock-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -382,6 +382,12 @@ server cluster DoorLock = 257 { kForcedDoorOpenUnderDoorLockedCondition = 0x40; } + bitmap DlCredentialRuleMask : BITMAP8 { + kSingle = 0x1; + kDual = 0x2; + kTri = 0x4; + } + bitmap DlCredentialRulesSupport : BITMAP8 { kSingle = 0x1; kDual = 0x2; @@ -569,12 +575,12 @@ server cluster DoorLock = 257 { readonly attribute int8u minPINCodeLength = 24; readonly attribute int8u maxRFIDCodeLength = 25; readonly attribute int8u minRFIDCodeLength = 26; - readonly attribute bitmap8 credentialRulesSupport = 27; + readonly attribute DlCredentialRuleMask credentialRulesSupport = 27; attribute char_string<3> language = 33; attribute int32u autoRelockTime = 35; attribute int8u soundVolume = 36; attribute DlOperatingMode operatingMode = 37; - readonly attribute bitmap16 supportedOperatingModes = 38; + readonly attribute DlSupportedOperatingModes supportedOperatingModes = 38; attribute boolean enableOneTouchLocking = 41; attribute boolean enablePrivacyModeButton = 43; attribute int8u wrongCodeEntryLimit = 48; @@ -1051,18 +1057,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/light-switch-app/efr32/BUILD.gn b/examples/light-switch-app/efr32/BUILD.gn index 495edd87749b0f..412917bba38279 100644 --- a/examples/light-switch-app/efr32/BUILD.gn +++ b/examples/light-switch-app/efr32/BUILD.gn @@ -57,9 +57,10 @@ declare_args() { use_rs911x_sockets = false sl_wfx_config_softap = false sl_wfx_config_scan = true -} -show_qr_code = true + # Enables LCD Qr Code on supported devices + show_qr_code = true +} # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { @@ -149,7 +150,6 @@ efr32_executable("light_switch_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.cpp", "src/AppTask.cpp", "src/LightingManager.cpp", "src/ZclCallbacks.cpp", @@ -157,6 +157,10 @@ efr32_executable("light_switch_app") { "src/main.cpp", ] + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) { + sources += [ "${examples_plat_dir}/uart.cpp" ] + } + deps = [ ":sdk", "${chip_root}/examples/common/QRCode", diff --git a/examples/light-switch-app/efr32/README.md b/examples/light-switch-app/efr32/README.md index d73a2ab2fc9b63..641b6ddd55882b 100644 --- a/examples/light-switch-app/efr32/README.md +++ b/examples/light-switch-app/efr32/README.md @@ -271,6 +271,11 @@ combination with JLinkRTTClient as follows: - 'switch groups onoff off' : Sends On group command to bound group - 'switch groups onoff toggle' : Sends On group command to bound group + **_Binding Cluster_** + + - 'switch binding unicast ' : Creates a unicast binding + - 'switch binding group ' : Creates a group binding + * You can provision and control the Chip device using the python controller, [CHIPTool](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md) standalone, Android or iOS app @@ -280,7 +285,7 @@ combination with JLinkRTTClient as follows: ``` chip-tool pairing ble-thread 1 hex: 20202021 3840 - chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": [1], "targets": null }]' 0 + chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [], "targets": null }{"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": [1], "targets": null }]' 0 chip-tool binding write binding '[{"fabricIndex": 1, "node": , "endpoint": 1, "cluster":6}]' 1 1 ``` @@ -304,6 +309,13 @@ combination with JLinkRTTClient as follows: chip-tool binding write binding '[{"fabricIndex": 1, "group": 257},{"fabricIndex": 1, "node": , "endpoint": 1, "cluster":6} ]' 1 1 ``` + To acquire the chip-tool node id, read the acl table right after + commissioning + + ``` + ./connectedhomeip/out/chip-tool/chip-tool accesscontrol read acl 0 + ``` + ### Notes - Depending on your network settings your router might not provide native ipv6 diff --git a/examples/light-switch-app/efr32/include/binding-handler.h b/examples/light-switch-app/efr32/include/binding-handler.h index 367b8962771b46..aed08be25eb5bc 100644 --- a/examples/light-switch-app/efr32/include/binding-handler.h +++ b/examples/light-switch-app/efr32/include/binding-handler.h @@ -22,6 +22,7 @@ CHIP_ERROR InitBindingHandler(); void SwitchWorkerFunction(intptr_t context); +void BindingWorkerFunction(intptr_t context); struct BindingCommandData { diff --git a/examples/light-switch-app/efr32/src/binding-handler.cpp b/examples/light-switch-app/efr32/src/binding-handler.cpp index 24fc87e5b9a7fa..d58484e1b6dcc0 100644 --- a/examples/light-switch-app/efr32/src/binding-handler.cpp +++ b/examples/light-switch-app/efr32/src/binding-handler.cpp @@ -23,6 +23,7 @@ #include "app/server/Server.h" #include "controller/InvokeInteraction.h" #include "platform/CHIPDeviceLayer.h" +#include #include #if defined(ENABLE_CHIP_SHELL) @@ -41,9 +42,11 @@ using Shell::streamer_printf; Engine sShellSwitchSubCommands; Engine sShellSwitchOnOffSubCommands; -Engine sShellSwitchGroupsSubCommands; +Engine sShellSwitchGroupsSubCommands; Engine sShellSwitchGroupsOnOffSubCommands; + +Engine sShellSwitchBindingSubCommands; #endif // defined(ENABLE_CHIP_SHELL) namespace { @@ -202,6 +205,57 @@ CHIP_ERROR ToggleSwitchCommandHandler(int argc, char ** argv) return CHIP_NO_ERROR; } +/******************************************************** + * bind switch shell functions + *********************************************************/ + +CHIP_ERROR BindingHelpHandler(int argc, char ** argv) +{ + sShellSwitchBindingSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR BindingSwitchCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return BindingHelpHandler(argc, argv); + } + + return sShellSwitchBindingSubCommands.ExecCommand(argc, argv); +} + +CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) +{ + VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); + + EmberBindingTableEntry * entry = Platform::New(); + entry->type = EMBER_MULTICAST_BINDING; + entry->fabricIndex = atoi(argv[0]); + entry->groupId = atoi(argv[1]); + entry->local = 1; // Hardcoded to endpoint 1 for now + entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now + + DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast(entry)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) +{ + VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); + + EmberBindingTableEntry * entry = Platform::New(); + entry->type = EMBER_UNICAST_BINDING; + entry->fabricIndex = atoi(argv[0]); + entry->nodeId = atoi(argv[1]); + entry->local = 1; // Hardcoded to endpoint 1 for now + entry->remote = atoi(argv[2]); + entry->clusterId.SetValue(6)); // Hardcode to OnOff cluster for now + + DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast(entry)); + return CHIP_NO_ERROR; +} + /******************************************************** * Groups switch shell functions *********************************************************/ @@ -285,7 +339,7 @@ static void RegisterSwitchCommands() { &SwitchHelpHandler, "help", "Usage: switch " }, { &OnOffSwitchCommandHandler, "onoff", " Usage: switch onoff " }, { &GroupsSwitchCommandHandler, "groups", "Usage: switch groups " }, - + { &BindingSwitchCommandHandler, "binding", "Usage: switch binding " } }; static const shell_command_t sSwitchOnOffSubCommands[] = { @@ -299,19 +353,26 @@ static void RegisterSwitchCommands() { &GroupsOnOffSwitchCommandHandler, "onoff", "Usage: switch groups onoff " } }; - static const shell_command_t sSwichGroupsOnOffSubCommands[] = { + static const shell_command_t sSwitchGroupsOnOffSubCommands[] = { { &GroupsOnOffHelpHandler, "help", "Usage: switch groups onoff " }, { &GroupOnSwitchCommandHandler, "on", "Sends on command to bound group" }, { &GroupOffSwitchCommandHandler, "off", "Sends off command to bound group" }, { &GroupToggleSwitchCommandHandler, "toggle", "Sends toggle command to group" } }; + static const shell_command_t sSwitchBindingSubCommands[] = { + { &BindingHelpHandler, "help", "Usage: switch binding " }, + { &BindingGroupBindCommandHandler, "group", "Usage: switch binding group " }, + { &BindingUnicastBindCommandHandler, "unicast", "Usage: switch binding group " } + }; + static const shell_command_t sSwitchCommand = { &SwitchCommandHandler, "switch", "Light-switch commands. Usage: switch " }; - sShellSwitchGroupsOnOffSubCommands.RegisterCommands(sSwichGroupsOnOffSubCommands, ArraySize(sSwichGroupsOnOffSubCommands)); + sShellSwitchGroupsOnOffSubCommands.RegisterCommands(sSwitchGroupsOnOffSubCommands, ArraySize(sSwitchGroupsOnOffSubCommands)); sShellSwitchOnOffSubCommands.RegisterCommands(sSwitchOnOffSubCommands, ArraySize(sSwitchOnOffSubCommands)); sShellSwitchGroupsSubCommands.RegisterCommands(sSwitchGroupsSubCommands, ArraySize(sSwitchGroupsSubCommands)); + sShellSwitchBindingSubCommands.RegisterCommands(sSwitchBindingSubCommands, ArraySize(sSwitchBindingSubCommands)); sShellSwitchSubCommands.RegisterCommands(sSwitchSubCommands, ArraySize(sSwitchSubCommands)); Engine::Root().RegisterCommands(&sSwitchCommand, 1); @@ -342,6 +403,16 @@ void SwitchWorkerFunction(intptr_t context) Platform::Delete(data); } +void BindingWorkerFunction(intptr_t context) +{ + VerifyOrReturn(context != 0, ChipLogError(NotSpecified, "BindingWorkerFunction - Invalid work data")); + + EmberBindingTableEntry * entry = reinterpret_cast(context); + AddBindingEntry(*entry); + + Platform::Delete(entry); +} + CHIP_ERROR InitBindingHandler() { // The initialization of binding manager will try establishing connection with unicast peers diff --git a/examples/light-switch-app/efr32/src/main.cpp b/examples/light-switch-app/efr32/src/main.cpp index 0fd41ca3b1ad0b..7ca14521d301e5 100644 --- a/examples/light-switch-app/efr32/src/main.cpp +++ b/examples/light-switch-app/efr32/src/main.cpp @@ -155,8 +155,9 @@ int main(void) #else // CHIP_DEVICE_CONFIG_THREAD_FTD #if CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#else // CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED #endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index 6dfb199c86a493..dc41ec7b1a2417 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -142,11 +142,11 @@ server cluster Basic = 40 { server cluster Binding = 30 { struct TargetStruct { - FABRIC_IDX fabricIndex = 0; optional NODE_ID node = 1; optional GROUP_ID group = 2; optional ENDPOINT_NO endpoint = 3; optional CLUSTER_ID cluster = 4; + FABRIC_IDX fabricIndex = 254; } attribute TargetStruct binding[] = 0; @@ -615,16 +615,16 @@ server cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } struct GroupKeySetStruct { @@ -1121,18 +1121,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 7f8f3bd1295f7d..ab64c2f757c2a4 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -57,9 +57,10 @@ declare_args() { use_rs911x_sockets = false sl_wfx_config_softap = false sl_wfx_config_scan = true -} -show_qr_code = true + # Enables LCD Qr Code on supported devices + show_qr_code = true +} # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { @@ -148,13 +149,16 @@ efr32_executable("lighting_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.cpp", "src/AppTask.cpp", "src/LightingManager.cpp", "src/ZclCallbacks.cpp", "src/main.cpp", ] + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) { + sources += [ "${examples_plat_dir}/uart.cpp" ] + } + deps = [ ":sdk", "${chip_root}/examples/common/QRCode", diff --git a/examples/lighting-app/efr32/src/main.cpp b/examples/lighting-app/efr32/src/main.cpp index da9282fa5bc574..e0f1a4bc26fc1c 100644 --- a/examples/lighting-app/efr32/src/main.cpp +++ b/examples/lighting-app/efr32/src/main.cpp @@ -159,8 +159,9 @@ int main(void) #else // CHIP_DEVICE_CONFIG_THREAD_FTD #if CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#else // CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED #endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 2f7b48080c2e60..c8ae34b64befca 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -628,16 +628,16 @@ server cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } struct GroupKeySetStruct { @@ -1212,18 +1212,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index 4755a2b9ec961b..1656937b0b050a 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -235,7 +235,8 @@ target_compile_options(app PRIVATE "-DPW_RPC_DEVICE_SERVICE=1" "-DPW_RPC_LIGHTING_SERVICE=1" "-DPW_RPC_THREAD_SERVICE=1" - "-DPW_RPC_TRACING_SERVICE=1") + "-DPW_RPC_TRACING_SERVICE=1" + "-DPW_TRACE_BACKEND_SET=1") target_link_libraries(app PRIVATE attributes_service.nanopb_rpc diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index c8df2ab10cdd21..8aae4a4487aeb5 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -417,15 +417,11 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) } } -void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) +void AppTask::StartBLEAdvertisementHandler(AppEvent *) { - if (aEvent->ButtonEvent.PinNo != BLE_ADVERTISEMENT_START_BUTTON) - return; - - // Don't allow on starting Matter service BLE advertising after Thread provisioning. - if (ConnectivityMgr().IsThreadProvisioned()) + if (Server::GetInstance().GetFabricTable().FabricCount() != 0) { - LOG_INF("NFC Tag emulation and Matter service BLE advertising not started - device is commissioned to a Thread network."); + LOG_INF("Matter service BLE advertising not started - device is already commissioned"); return; } @@ -435,7 +431,7 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) + if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) { LOG_ERR("OpenBasicCommissioningWindow() failed"); } diff --git a/examples/lighting-app/qpg/.gn b/examples/lighting-app/qpg/.gn index 438f76dfea04e8..3d48789e30ab3d 100644 --- a/examples/lighting-app/qpg/.gn +++ b/examples/lighting-app/qpg/.gn @@ -23,7 +23,6 @@ check_system_includes = true default_args = { target_cpu = "arm" target_os = "freertos" - chip_openthread_ftd = false import("//args.gni") } diff --git a/examples/lighting-app/qpg/args.gni b/examples/lighting-app/qpg/args.gni index 748cff2ce4a916..d62d91402aa283 100644 --- a/examples/lighting-app/qpg/args.gni +++ b/examples/lighting-app/qpg/args.gni @@ -20,6 +20,7 @@ qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") declare_args() { chip_enable_ota_requestor = true + chip_openthread_ftd = true # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index b6db7044c681df..870737f8047f42 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -56,9 +56,10 @@ declare_args() { use_rs911x_sockets = false sl_wfx_config_softap = false sl_wfx_config_scan = true -} -show_qr_code = true + # Enables LCD Qr Code on supported devices + show_qr_code = true +} # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { @@ -147,13 +148,16 @@ efr32_executable("lock_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.cpp", "src/AppTask.cpp", "src/BoltLockManager.cpp", "src/ZclCallbacks.cpp", "src/main.cpp", ] + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) { + sources += [ "${examples_plat_dir}/uart.cpp" ] + } + deps = [ ":sdk", "${chip_root}/examples/common/QRCode", diff --git a/examples/lock-app/efr32/src/main.cpp b/examples/lock-app/efr32/src/main.cpp index f59e2640e6f9ea..2ed647b327aa72 100644 --- a/examples/lock-app/efr32/src/main.cpp +++ b/examples/lock-app/efr32/src/main.cpp @@ -155,8 +155,9 @@ int main(void) #else // CHIP_DEVICE_CONFIG_THREAD_FTD #if CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#else // CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED #endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 209fd9de61d73d..2bf1813fef2ddb 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -684,18 +684,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 09919a72fad01f..6ca2aa26d525e4 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -393,15 +393,11 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) } } -void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) +void AppTask::StartBLEAdvertisementHandler(AppEvent *) { - if (aEvent->ButtonEvent.PinNo != BLE_ADVERTISEMENT_START_BUTTON) - return; - - // Don't allow on starting Matter service BLE advertising after Thread provisioning. - if (ConnectivityMgr().IsThreadProvisioned()) + if (Server::GetInstance().GetFabricTable().FabricCount() != 0) { - LOG_INF("NFC Tag emulation and Matter service BLE advertising not started - device is commissioned to a Thread network."); + LOG_INF("Matter service BLE advertising not started - device is already commissioned"); return; } @@ -411,7 +407,7 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) + if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) { LOG_ERR("OpenBasicCommissioningWindow() failed"); } diff --git a/examples/lock-app/qpg/args.gni b/examples/lock-app/qpg/args.gni index 748cff2ce4a916..e6c39ccee5331a 100644 --- a/examples/lock-app/qpg/args.gni +++ b/examples/lock-app/qpg/args.gni @@ -20,6 +20,7 @@ qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") declare_args() { chip_enable_ota_requestor = true + chip_openthread_ftd = false # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/log-source-app/log-source-common/log-source-app.matter b/examples/log-source-app/log-source-common/log-source-app.matter index 330f5efdd38344..47f00086b6a32e 100644 --- a/examples/log-source-app/log-source-common/log-source-app.matter +++ b/examples/log-source-app/log-source-common/log-source-app.matter @@ -23,11 +23,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -37,24 +37,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -304,12 +304,12 @@ server cluster OperationalCredentials = 62 { } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute FabricDescriptor fabrics[] = 1; diff --git a/examples/minimal-mdns/AllInterfaceListener.h b/examples/minimal-mdns/AllInterfaceListener.h index 4744583a7f0762..23a26592f90706 100644 --- a/examples/minimal-mdns/AllInterfaceListener.h +++ b/examples/minimal-mdns/AllInterfaceListener.h @@ -95,7 +95,7 @@ class AllInterfaces : public mdns::Minimal::ListenIterator return false; // nothing to try. } - if (!mIterator.IsUp() || !mIterator.SupportsMulticast()) + if (!mIterator.IsUp()) { return true; // not a usable interface } diff --git a/examples/minimal-mdns/advertiser.cpp b/examples/minimal-mdns/advertiser.cpp index 78b811f6ee64cd..b006dc38903c13 100644 --- a/examples/minimal-mdns/advertiser.cpp +++ b/examples/minimal-mdns/advertiser.cpp @@ -45,7 +45,7 @@ struct Options // commissionable node / commissioner params Optional vendorId; Optional productId; - Optional deviceType; + Optional deviceType; Optional deviceName; // commissionable node params @@ -134,7 +134,7 @@ bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, } return true; case kOptionCommissioningDeviceType: - gOptions.deviceType = Optional::Value(static_cast(atoi(aValue))); + gOptions.deviceType = Optional::Value(static_cast(atoi(aValue))); return true; case kOptionCommissioningDeviceName: gOptions.deviceName = Optional::Value(static_cast(aValue)); diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter index 1aaab805e740e9..ee4f44c3c02043 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter @@ -28,11 +28,11 @@ client cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ client cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -90,11 +90,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -104,24 +104,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -442,18 +442,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/ota-requestor-app/efr32/BUILD.gn b/examples/ota-requestor-app/efr32/BUILD.gn index 4804dcea5facb1..5a860287976351 100644 --- a/examples/ota-requestor-app/efr32/BUILD.gn +++ b/examples/ota-requestor-app/efr32/BUILD.gn @@ -44,9 +44,10 @@ declare_args() { # Monitor & log memory usage at runtime. enable_heap_monitoring = false -} -show_qr_code = true + # Enables LCD Qr Code on supported devices + show_qr_code = true +} # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { @@ -89,13 +90,16 @@ efr32_executable("ota_requestor_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.cpp", "src/AppTask.cpp", "src/LightingManager.cpp", "src/ZclCallbacks.cpp", "src/main.cpp", ] + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) { + sources += [ "${examples_plat_dir}/uart.cpp" ] + } + deps = [ ":sdk", "${chip_root}/examples/common/QRCode", diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index 454db06ddecb04..b02cae2c49ac3f 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -181,8 +181,6 @@ bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, void ApplicationInit() { - chip::Dnssd::Resolver::Instance().Init(chip::DeviceLayer::UDPEndPointManager()); - // Initialize all OTA download components InitOTARequestor(); } diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index d66db472b19f94..74d69916fafaca 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -484,18 +484,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/persistent-storage/qpg/args.gni b/examples/persistent-storage/qpg/args.gni index 69c0b0040eacc4..a21c418f1f82b0 100644 --- a/examples/persistent-storage/qpg/args.gni +++ b/examples/persistent-storage/qpg/args.gni @@ -17,6 +17,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/examples/platform/qpg/args.gni") qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false +chip_openthread_ftd = false chip_system_config_use_open_thread_udp = false declare_args() { diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 9b8ea2a04e399c..50edd770cf023d 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -1251,12 +1251,12 @@ client cluster OperationalCredentials = 62 { } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute FabricDescriptor fabrics[] = 1; @@ -1333,12 +1333,12 @@ server cluster OperationalCredentials = 62 { } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute FabricDescriptor fabrics[] = 1; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index e39670fda270d1..05aa5808d5dde1 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -1188,12 +1188,12 @@ client cluster OperationalCredentials = 62 { } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute FabricDescriptor fabrics[] = 1; @@ -1270,12 +1270,12 @@ server cluster OperationalCredentials = 62 { } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute FabricDescriptor fabrics[] = 1; diff --git a/examples/platform/qpg/args.gni b/examples/platform/qpg/args.gni index e785d562c628d0..d5ec8fbf4dabed 100644 --- a/examples/platform/qpg/args.gni +++ b/examples/platform/qpg/args.gni @@ -17,7 +17,6 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/platform/qpg/args.gni") chip_enable_openthread = true -chip_openthread_ftd = false openthread_project_core_config_file = "OpenThreadConfig.h" openthread_core_config_deps = [] openthread_core_config_deps = [ diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index 109daba8afddb0..4e8b9012b14406 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -388,15 +388,11 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) } } -void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) +void AppTask::StartBLEAdvertisementHandler(AppEvent *) { - if (aEvent->ButtonEvent.PinNo != BLE_ADVERTISEMENT_START_BUTTON) - return; - - // Don't allow on starting Matter service BLE advertising after Thread provisioning. - if (ConnectivityMgr().IsThreadProvisioned()) + if (Server::GetInstance().GetFabricTable().FabricCount() != 0) { - LOG_INF("NFC Tag emulation and Matter service BLE advertising not started - device is commissioned to a Thread network."); + LOG_INF("Matter service BLE advertising not started - device is already commissioned"); return; } @@ -406,7 +402,7 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) + if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) { LOG_ERR("OpenBasicCommissioningWindow() failed"); } diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index efb7faa268a6e9..50371acb5cb5b1 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -369,16 +369,16 @@ server cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } struct GroupKeySetStruct { @@ -939,18 +939,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index 8898f065036add..1c7d92c9c0dd3d 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -385,15 +385,11 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) } } -void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) +void AppTask::StartBLEAdvertisementHandler(AppEvent *) { - if (aEvent->ButtonEvent.PinNo != BLE_ADVERTISEMENT_START_BUTTON) - return; - - // Don't allow on starting Matter service BLE advertising after Thread provisioning. - if (ConnectivityMgr().IsThreadProvisioned()) + if (Server::GetInstance().GetFabricTable().FabricCount() != 0) { - LOG_INF("NFC Tag emulation and Matter service BLE advertising not started - device is commissioned to a Thread network."); + LOG_INF("Matter service BLE advertising not started - device is already commissioned"); return; } @@ -403,7 +399,7 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) + if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) { LOG_ERR("OpenBasicCommissioningWindow() failed"); } diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index 5e93a038dcae22..137685388f093f 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -366,16 +366,16 @@ server cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } struct GroupKeySetStruct { @@ -829,18 +829,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/shell/efr32/BUILD.gn b/examples/shell/efr32/BUILD.gn index ea683bed9362cf..e01ce36bfecb77 100644 --- a/examples/shell/efr32/BUILD.gn +++ b/examples/shell/efr32/BUILD.gn @@ -58,10 +58,13 @@ efr32_executable("shell_app") { sources = [ "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.cpp", "src/main.cpp", ] + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) { + sources += [ "${examples_plat_dir}/uart.cpp" ] + } + deps = [ ":sdk", "${chip_root}/examples/shell/shell_common:shell_common", diff --git a/examples/shell/qpg/args.gni b/examples/shell/qpg/args.gni index 0548eccffd74e6..aa5f8f16d9ed27 100644 --- a/examples/shell/qpg/args.gni +++ b/examples/shell/qpg/args.gni @@ -25,3 +25,5 @@ chip_build_libshell = true # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder chip_stack_lock_tracking = "none" + +chip_openthread_ftd = false diff --git a/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter index 8f6a97fdf9993c..6b01d8725d68dd 100644 --- a/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter +++ b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -505,18 +505,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 21e61114ca0084..732fe2dd2c02de 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -142,11 +142,11 @@ server cluster Basic = 40 { server cluster Binding = 30 { struct TargetStruct { - FABRIC_IDX fabricIndex = 0; optional NODE_ID node = 1; optional GROUP_ID group = 2; optional ENDPOINT_NO endpoint = 3; optional CLUSTER_ID cluster = 4; + FABRIC_IDX fabricIndex = 254; } attribute TargetStruct binding[] = 0; @@ -385,16 +385,16 @@ server cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } attribute GroupKeyMapStruct groupKeyMap[] = 0; @@ -746,18 +746,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index b5af48262dbb83..6a970795f21c2e 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -272,11 +272,11 @@ server cluster Basic = 40 { client cluster Binding = 30 { struct TargetStruct { - FABRIC_IDX fabricIndex = 0; optional NODE_ID node = 1; optional GROUP_ID group = 2; optional ENDPOINT_NO endpoint = 3; optional CLUSTER_ID cluster = 4; + FABRIC_IDX fabricIndex = 254; } attribute TargetStruct binding[] = 0; @@ -285,11 +285,11 @@ client cluster Binding = 30 { server cluster Binding = 30 { struct TargetStruct { - FABRIC_IDX fabricIndex = 0; optional NODE_ID node = 1; optional GROUP_ID group = 2; optional ENDPOINT_NO endpoint = 3; optional CLUSTER_ID cluster = 4; + FABRIC_IDX fabricIndex = 254; } attribute TargetStruct binding[] = 0; @@ -745,16 +745,16 @@ server cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } attribute GroupKeyMapStruct groupKeyMap[] = 0; @@ -1441,18 +1441,18 @@ client cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; @@ -1539,18 +1539,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index 9dc39d2c85a8b0..deb1be465cf2ad 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -271,11 +271,11 @@ server cluster BinaryInputBasic = 15 { server cluster Binding = 30 { struct TargetStruct { - FABRIC_IDX fabricIndex = 0; optional NODE_ID node = 1; optional GROUP_ID group = 2; optional ENDPOINT_NO endpoint = 3; optional CLUSTER_ID cluster = 4; + FABRIC_IDX fabricIndex = 254; } attribute TargetStruct binding[] = 0; @@ -922,6 +922,12 @@ server cluster DoorLock = 257 { kForcedDoorOpenUnderDoorLockedCondition = 0x40; } + bitmap DlCredentialRuleMask : BITMAP8 { + kSingle = 0x1; + kDual = 0x2; + kTri = 0x4; + } + bitmap DlCredentialRulesSupport : BITMAP8 { kSingle = 0x1; kDual = 0x2; @@ -1110,13 +1116,13 @@ server cluster DoorLock = 257 { readonly attribute int8u numberOfHolidaySchedulesSupported = 22; readonly attribute int8u maxPINCodeLength = 23; readonly attribute int8u minPINCodeLength = 24; - readonly attribute bitmap8 credentialRulesSupport = 27; + readonly attribute DlCredentialRuleMask credentialRulesSupport = 27; attribute char_string<3> language = 33; attribute int32u autoRelockTime = 35; attribute int8u soundVolume = 36; attribute DlOperatingMode operatingMode = 37; - readonly attribute bitmap16 supportedOperatingModes = 38; - readonly attribute bitmap16 defaultConfigurationRegister = 39; + readonly attribute DlSupportedOperatingModes supportedOperatingModes = 38; + readonly attribute DlDefaultConfigurationRegister defaultConfigurationRegister = 39; attribute boolean enableOneTouchLocking = 41; attribute boolean enableInsideStatusLED = 42; attribute boolean enablePrivacyModeButton = 43; @@ -1399,16 +1405,16 @@ server cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } attribute GroupKeyMapStruct groupKeyMap[] = 0; @@ -2240,18 +2246,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; @@ -2600,7 +2606,7 @@ server cluster TestCluster = 1295 { } info event TestFabricScopedEvent = 2 { - fabric_idx arg1 = 1; + fabric_idx arg1 = 254; } attribute boolean boolean = 0; diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index 25a387ec364270..5456c1c3a93ea5 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -28,11 +28,11 @@ server cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -526,18 +526,18 @@ server cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 4cb40bbc93f1f5..6b1b894c73a0ba 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -50,9 +50,10 @@ declare_args() { use_rs911x_sockets = false sl_wfx_config_softap = false sl_wfx_config_scan = true -} -show_qr_code = true + # Enables LCD Qr Code on supported devices + show_qr_code = true +} # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { @@ -137,13 +138,16 @@ efr32_executable("window_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.cpp", "${project_dir}/common/src/WindowApp.cpp", "${project_dir}/common/src/ZclCallbacks.cpp", "src/WindowAppImpl.cpp", "src/main.cpp", ] + if (chip_build_libshell || enable_openthread_cli) { + sources += [ "${examples_plat_dir}/uart.cpp" ] + } + if (chip_enable_ota_requestor) { defines += [ "EFR32_OTA_ENABLED" ] sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] diff --git a/examples/window-app/efr32/src/main.cpp b/examples/window-app/efr32/src/main.cpp index c79ffddc1be254..cfffc9dc071d87 100644 --- a/examples/window-app/efr32/src/main.cpp +++ b/examples/window-app/efr32/src/main.cpp @@ -132,8 +132,9 @@ int main(void) #else // CHIP_DEVICE_CONFIG_THREAD_FTD #if CHIP_DEVICE_CONFIG_ENABLE_SED err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#else // CHIP_DEVICE_CONFIG_ENABLE_SED err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED #endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (err != CHIP_NO_ERROR) { diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index 150066e422877b..e50bc2895f4e94 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -1,5 +1,5 @@ steps: - - name: "connectedhomeip/chip-build-vscode:0.5.56" + - name: "connectedhomeip/chip-build-vscode:0.5.58" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -12,7 +12,7 @@ steps: path: /pwenv timeout: 900s - - name: "connectedhomeip/chip-build-vscode:0.5.56" + - name: "connectedhomeip/chip-build-vscode:0.5.58" id: ESP32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -28,7 +28,7 @@ steps: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.5.56" + - name: "connectedhomeip/chip-build-vscode:0.5.58" id: NRFConnect env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -45,7 +45,7 @@ steps: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.5.56" + - name: "connectedhomeip/chip-build-vscode:0.5.58" id: EFR32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -62,7 +62,7 @@ steps: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.5.56" + - name: "connectedhomeip/chip-build-vscode:0.5.58" id: Linux env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -79,7 +79,7 @@ steps: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.5.56" + - name: "connectedhomeip/chip-build-vscode:0.5.58" id: Android env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -99,7 +99,7 @@ steps: logsBucket: matter-build-automation-build-logs # Global timeout for all steps -timeout: 7200s +timeout: 9000s artifacts: objects: @@ -109,4 +109,5 @@ artifacts: # Using higher CPU machines generally speeds up builds by > 4x (faster as we spend more time # building instead of docker download/checkout/bootstrap) options: - machineType: "E2_HIGHCPU_8" + machineType: "E2_HIGHCPU_32" + diskSizeGb: 200 diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index d0c3763e06070d..fdfcc8a8a071b6 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -112,21 +112,104 @@ def Accept(self, name: str): return False -class HostBuildVariant: - def __init__(self, name: str, validator=AcceptAnyName(), conflicts: List[str] = [], **buildargs): +class BuildVariant: + def __init__(self, name: str, validator=AcceptAnyName(), conflicts: List[str] = [], requires: List[str] = [], **buildargs): self.name = name self.validator = validator self.conflicts = conflicts self.buildargs = buildargs + self.requires = requires -def HasConflicts(items: List[HostBuildVariant]) -> bool: +def HasConflicts(items: List[BuildVariant]) -> bool: for a, b in combinations(items, 2): if (a.name in b.conflicts) or (b.name in a.conflicts): return True return False +def AllRequirementsMet(items: List[BuildVariant]) -> bool: + """ + Check that item.requires is satisfied for all items in the given list + """ + available = set([item.name for item in items]) + + for item in items: + for requirement in item.requires: + if not requirement in available: + return False + + return True + + +class VariantBuilder: + """Handles creating multiple build variants based on a starting target. + """ + + def __init__(self, targets: List[Target] = []): + # note the clone in case the default arg is used + self.targets = targets[:] + self.variants = [] + self.glob_whitelist = [] + + def WhitelistVariantNameForGlob(self, name): + """ + Whitelist the specified variant to be allowed for globbing. + + By default we do not want a 'build all' to select all variants, so + variants are generally glob-blacklisted. + """ + self.glob_whitelist.append(name) + + def AppendVariant(self, **args): + """ + Add another variant to accepted variants. Arguments are construction + variants to BuildVariant. + + Example usage: + + builder.AppendVariant(name="ipv6only", enable_ipv4=False) + """ + self.variants.append(BuildVariant(**args)) + + def AllVariants(self): + """ + Yields a list of acceptable variants for the given targets. + + Handles conflict resolution between build variants and globbing whiltelist + targets. + """ + for target in self.targets: + yield target + + # skip variants that do not work for this target + ok_variants = [ + v for v in self.variants if v.validator.Accept(target.name)] + + # Build every possible variant + for variant_count in range(1, len(ok_variants) + 1): + for subgroup in combinations(ok_variants, variant_count): + if HasConflicts(subgroup): + continue + + if not AllRequirementsMet(subgroup): + continue + + # Target ready to be created - no conflicts + variant_target = target.Clone() + for option in subgroup: + variant_target = variant_target.Extend( + option.name, **option.buildargs) + + # Only a few are whitelisted for globs + if '-'.join([o.name for o in subgroup]) not in self.glob_whitelist: + if not variant_target.glob_blacklist_reason: + variant_target = variant_target.GlobBlacklist( + 'Reduce default build variants') + + yield variant_target + + def HostTargets(): target = Target(HostBoard.NATIVE.PlatformName(), HostBuilder) targets = [ @@ -154,51 +237,39 @@ def HostTargets(): app_targets.append(target.Extend('minmdns', app=HostApp.MIN_MDNS)) app_targets.append(target.Extend('door-lock', app=HostApp.LOCK)) app_targets.append(target.Extend('shell', app=HostApp.SHELL)) + app_targets.append(target.Extend( + 'ota-provider', app=HostApp.OTA_PROVIDER, enable_ble=False)) + app_targets.append(target.Extend( + 'ota-requestor', app=HostApp.OTA_REQUESTOR, enable_ble=False)) + + builder = VariantBuilder() # Possible build variants. Note that number of potential # builds is exponential here - variants = [ - HostBuildVariant(name="ipv6only", enable_ipv4=False), - HostBuildVariant(name="no-ble", enable_ble=False), - HostBuildVariant(name="tsan", conflicts=['asan'], use_tsan=True), - HostBuildVariant(name="asan", conflicts=['tsan'], use_asan=True), - HostBuildVariant(name="libfuzzer", use_libfuzzer=True, use_clang=True), - HostBuildVariant(name="test-group", - validator=AcceptNameWithSubstrings(['-all-clusters', '-chip-tool']), test_group=True), - HostBuildVariant(name="same-event-loop", - validator=AcceptNameWithSubstrings(['-chip-tool']), separate_event_loop=False), - ] - - glob_whitelist = set(['ipv6only']) + builder.AppendVariant(name="test-group", validator=AcceptNameWithSubstrings( + ['-all-clusters', '-chip-tool']), test_group=True), + builder.AppendVariant(name="same-event-loop", validator=AcceptNameWithSubstrings( + ['-chip-tool']), separate_event_loop=False), + builder.AppendVariant(name="ipv6only", enable_ipv4=False), + builder.AppendVariant(name="no-ble", enable_ble=False), + builder.AppendVariant(name="no-wifi", enable_wifi=False), + builder.AppendVariant(name="tsan", conflicts=['asan'], use_tsan=True), + builder.AppendVariant(name="asan", conflicts=['tsan'], use_asan=True), + builder.AppendVariant(name="libfuzzer", requires=[ + "clang"], use_libfuzzer=True), + builder.AppendVariant(name="clang", use_clang=True), + + builder.WhitelistVariantNameForGlob('ipv6only') for target in app_targets: - yield target - if 'rpc-console' in target.name: # rpc console has only one build variant right now - continue - - # skip variants that do not work for this target - ok_variants = [v for v in variants if v.validator.Accept(target.name)] - - # Build every possible variant - for variant_count in range(1, len(ok_variants) + 1): - for subgroup in combinations(ok_variants, variant_count): - if HasConflicts(subgroup): - continue - - # Target ready to be created - no conflicts - variant_target = target.Clone() - for option in subgroup: - variant_target = variant_target.Extend( - option.name, **option.buildargs) - - # Only a few are whitelisted for globs - if '-'.join([o.name for o in subgroup]) not in glob_whitelist: - variant_target = variant_target.GlobBlacklist( - 'Reduce default build variants') + yield target + else: + builder.targets.append(target) - yield variant_target + for target in builder.AllVariants(): + yield target # Without extra build variants yield targets[0].Extend('chip-cert', app=HostApp.CERT_TOOL) @@ -257,19 +328,29 @@ def Efr32Targets(): 'only user requested') ] + builder = VariantBuilder() + for board_target in board_targets: - yield board_target.Extend('window-covering', app=Efr32App.WINDOW_COVERING) - yield board_target.Extend('switch', app=Efr32App.SWITCH) - yield board_target.Extend('unit-test', app=Efr32App.UNIT_TEST) + builder.targets.append(board_target.Extend( + 'window-covering', app=Efr32App.WINDOW_COVERING)) + builder.targets.append(board_target.Extend( + 'switch', app=Efr32App.SWITCH)) + builder.targets.append(board_target.Extend( + 'unit-test', app=Efr32App.UNIT_TEST)) + builder.targets.append( + board_target.Extend('light', app=Efr32App.LIGHT)) + builder.targets.append(board_target.Extend('lock', app=Efr32App.LOCK)) + + # Possible build variants. Note that number of potential + # builds is exponential here + builder.AppendVariant(name="rpc", validator=AcceptNameWithSubstrings( + ['-light', '-lock']), enable_rpcs=True) + builder.AppendVariant(name="with-ota-requestor", enable_ota_requestor=True) - rpc_aware_targets = [ - board_target.Extend('light', app=Efr32App.LIGHT), - board_target.Extend('lock', app=Efr32App.LOCK) - ] + builder.WhitelistVariantNameForGlob('rpc') - for target in rpc_aware_targets: - yield target - yield target.Extend('rpc', enable_rpcs=True) + for target in builder.AllVariants(): + yield target def NrfTargets(): diff --git a/scripts/build/builders/efr32.py b/scripts/build/builders/efr32.py index 4cf64311fda02c..0f8abe07cb6865 100644 --- a/scripts/build/builders/efr32.py +++ b/scripts/build/builders/efr32.py @@ -110,19 +110,23 @@ def __init__(self, runner, app: Efr32App = Efr32App.LIGHT, board: Efr32Board = Efr32Board.BRD4161A, - enable_rpcs: bool = False): + enable_rpcs: bool = False, + enable_ota_requestor: bool = False, + ): super(Efr32Builder, self).__init__( root=app.BuildRoot(root), runner=runner) self.app = app - self.board = board - self.enable_rpcs = enable_rpcs + self.extra_gn_options = ['efr32_board="%s"' % board.GnArgName()] + + if enable_rpcs: + self.extra_gn_options.append('import("//with_pw_rpc.gni")') + + if enable_ota_requestor: + self.extra_gn_options.append('chip_enable_ota_requestor=true') def GnBuildArgs(self): - args = ['efr32_board="%s"' % self.board.GnArgName()] - if self.enable_rpcs: - args.append('import("//with_pw_rpc.gni")') - return args + return self.extra_gn_options def build_outputs(self): items = {} diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index 67fa96f008ac0a..a97b44c0df873c 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -32,6 +32,8 @@ class HostApp(Enum): TESTS = auto() SHELL = auto() CERT_TOOL = auto() + OTA_PROVIDER = auto() + OTA_REQUESTOR = auto() def ExamplePath(self): if self == HostApp.ALL_CLUSTERS: @@ -56,6 +58,10 @@ def ExamplePath(self): return 'shell/standalone' elif self == HostApp.CERT_TOOL: return '..' + elif self == HostApp.OTA_PROVIDER: + return 'ota-provider-app/linux' + elif self == HostApp.OTA_REQUESTOR: + return 'ota-requestor-app/linux' else: raise Exception('Unknown app type: %r' % self) @@ -95,6 +101,12 @@ def OutputNames(self): elif self == HostApp.CERT_TOOL: yield 'chip-cert' yield 'chip-cert.map' + elif self == HostApp.OTA_PROVIDER: + yield 'chip-ota-provider-app' + yield 'chip-ota-provider-app.map' + elif self == HostApp.OTA_REQUESTOR: + yield 'chip-ota-requestor-app' + yield 'chip-ota-requestor-app.map' else: raise Exception('Unknown app type: %r' % self) @@ -142,10 +154,9 @@ def PlatformName(self): class HostBuilder(GnBuilder): def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True, - enable_ble=True, use_tsan=False, use_asan=False, separate_event_loop=True, + enable_ble=True, enable_wifi=True, use_tsan=False, use_asan=False, separate_event_loop=True, test_group=False, use_libfuzzer=False, use_clang=False, - use_platform_mdns=False - ): + use_platform_mdns=False): super(HostBuilder, self).__init__( root=os.path.join(root, 'examples', app.ExamplePath()), runner=runner) @@ -160,6 +171,9 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip if not enable_ble: self.extra_gn_options.append('chip_config_network_layer_ble=false') + if not enable_wifi: + self.extra_gn_options.append('chip_enable_wifi=false') + if use_tsan: self.extra_gn_options.append('is_tsan=true') diff --git a/scripts/build/testdata/all_targets_except_host.txt b/scripts/build/testdata/all_targets_except_host.txt index ffa302f036543c..fb15d34c857dcb 100644 --- a/scripts/build/testdata/all_targets_except_host.txt +++ b/scripts/build/testdata/all_targets_except_host.txt @@ -20,60 +20,116 @@ cyw30739-cyw930739m2evb_01-ota-requestor (NOGLOB: Running out of XIP flash space cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging efr32-brd4161a-light efr32-brd4161a-light-rpc +efr32-brd4161a-light-rpc-with-ota-requestor (NOGLOB: Reduce default build variants) +efr32-brd4161a-light-with-ota-requestor (NOGLOB: Reduce default build variants) efr32-brd4161a-lock efr32-brd4161a-lock-rpc +efr32-brd4161a-lock-rpc-with-ota-requestor (NOGLOB: Reduce default build variants) +efr32-brd4161a-lock-with-ota-requestor (NOGLOB: Reduce default build variants) efr32-brd4161a-switch +efr32-brd4161a-switch-with-ota-requestor (NOGLOB: Reduce default build variants) efr32-brd4161a-unit-test +efr32-brd4161a-unit-test-with-ota-requestor (NOGLOB: Reduce default build variants) efr32-brd4161a-window-covering +efr32-brd4161a-window-covering-with-ota-requestor (NOGLOB: Reduce default build variants) efr32-brd4163a-light (NOGLOB: only user requested) efr32-brd4163a-light-rpc (NOGLOB: only user requested) +efr32-brd4163a-light-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4163a-light-with-ota-requestor (NOGLOB: only user requested) efr32-brd4163a-lock (NOGLOB: only user requested) efr32-brd4163a-lock-rpc (NOGLOB: only user requested) +efr32-brd4163a-lock-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4163a-lock-with-ota-requestor (NOGLOB: only user requested) efr32-brd4163a-switch (NOGLOB: only user requested) +efr32-brd4163a-switch-with-ota-requestor (NOGLOB: only user requested) efr32-brd4163a-unit-test (NOGLOB: only user requested) +efr32-brd4163a-unit-test-with-ota-requestor (NOGLOB: only user requested) efr32-brd4163a-window-covering (NOGLOB: only user requested) +efr32-brd4163a-window-covering-with-ota-requestor (NOGLOB: only user requested) efr32-brd4164a-light (NOGLOB: only user requested) efr32-brd4164a-light-rpc (NOGLOB: only user requested) +efr32-brd4164a-light-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4164a-light-with-ota-requestor (NOGLOB: only user requested) efr32-brd4164a-lock (NOGLOB: only user requested) efr32-brd4164a-lock-rpc (NOGLOB: only user requested) +efr32-brd4164a-lock-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4164a-lock-with-ota-requestor (NOGLOB: only user requested) efr32-brd4164a-switch (NOGLOB: only user requested) +efr32-brd4164a-switch-with-ota-requestor (NOGLOB: only user requested) efr32-brd4164a-unit-test (NOGLOB: only user requested) +efr32-brd4164a-unit-test-with-ota-requestor (NOGLOB: only user requested) efr32-brd4164a-window-covering (NOGLOB: only user requested) +efr32-brd4164a-window-covering-with-ota-requestor (NOGLOB: only user requested) efr32-brd4166a-light (NOGLOB: only user requested) efr32-brd4166a-light-rpc (NOGLOB: only user requested) +efr32-brd4166a-light-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4166a-light-with-ota-requestor (NOGLOB: only user requested) efr32-brd4166a-lock (NOGLOB: only user requested) efr32-brd4166a-lock-rpc (NOGLOB: only user requested) +efr32-brd4166a-lock-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4166a-lock-with-ota-requestor (NOGLOB: only user requested) efr32-brd4166a-switch (NOGLOB: only user requested) +efr32-brd4166a-switch-with-ota-requestor (NOGLOB: only user requested) efr32-brd4166a-unit-test (NOGLOB: only user requested) +efr32-brd4166a-unit-test-with-ota-requestor (NOGLOB: only user requested) efr32-brd4166a-window-covering (NOGLOB: only user requested) +efr32-brd4166a-window-covering-with-ota-requestor (NOGLOB: only user requested) efr32-brd4170a-light (NOGLOB: only user requested) efr32-brd4170a-light-rpc (NOGLOB: only user requested) +efr32-brd4170a-light-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4170a-light-with-ota-requestor (NOGLOB: only user requested) efr32-brd4170a-lock (NOGLOB: only user requested) efr32-brd4170a-lock-rpc (NOGLOB: only user requested) +efr32-brd4170a-lock-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4170a-lock-with-ota-requestor (NOGLOB: only user requested) efr32-brd4170a-switch (NOGLOB: only user requested) +efr32-brd4170a-switch-with-ota-requestor (NOGLOB: only user requested) efr32-brd4170a-unit-test (NOGLOB: only user requested) +efr32-brd4170a-unit-test-with-ota-requestor (NOGLOB: only user requested) efr32-brd4170a-window-covering (NOGLOB: only user requested) +efr32-brd4170a-window-covering-with-ota-requestor (NOGLOB: only user requested) efr32-brd4186a-light (NOGLOB: only user requested) efr32-brd4186a-light-rpc (NOGLOB: only user requested) +efr32-brd4186a-light-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4186a-light-with-ota-requestor (NOGLOB: only user requested) efr32-brd4186a-lock (NOGLOB: only user requested) efr32-brd4186a-lock-rpc (NOGLOB: only user requested) +efr32-brd4186a-lock-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4186a-lock-with-ota-requestor (NOGLOB: only user requested) efr32-brd4186a-switch (NOGLOB: only user requested) +efr32-brd4186a-switch-with-ota-requestor (NOGLOB: only user requested) efr32-brd4186a-unit-test (NOGLOB: only user requested) +efr32-brd4186a-unit-test-with-ota-requestor (NOGLOB: only user requested) efr32-brd4186a-window-covering (NOGLOB: only user requested) +efr32-brd4186a-window-covering-with-ota-requestor (NOGLOB: only user requested) efr32-brd4187a-light (NOGLOB: only user requested) efr32-brd4187a-light-rpc (NOGLOB: only user requested) +efr32-brd4187a-light-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4187a-light-with-ota-requestor (NOGLOB: only user requested) efr32-brd4187a-lock (NOGLOB: only user requested) efr32-brd4187a-lock-rpc (NOGLOB: only user requested) +efr32-brd4187a-lock-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4187a-lock-with-ota-requestor (NOGLOB: only user requested) efr32-brd4187a-switch (NOGLOB: only user requested) +efr32-brd4187a-switch-with-ota-requestor (NOGLOB: only user requested) efr32-brd4187a-unit-test (NOGLOB: only user requested) +efr32-brd4187a-unit-test-with-ota-requestor (NOGLOB: only user requested) efr32-brd4187a-window-covering (NOGLOB: only user requested) +efr32-brd4187a-window-covering-with-ota-requestor (NOGLOB: only user requested) efr32-brd4304a-light (NOGLOB: only user requested) efr32-brd4304a-light-rpc (NOGLOB: only user requested) +efr32-brd4304a-light-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4304a-light-with-ota-requestor (NOGLOB: only user requested) efr32-brd4304a-lock (NOGLOB: only user requested) efr32-brd4304a-lock-rpc (NOGLOB: only user requested) +efr32-brd4304a-lock-rpc-with-ota-requestor (NOGLOB: only user requested) +efr32-brd4304a-lock-with-ota-requestor (NOGLOB: only user requested) efr32-brd4304a-switch (NOGLOB: only user requested) +efr32-brd4304a-switch-with-ota-requestor (NOGLOB: only user requested) efr32-brd4304a-unit-test (NOGLOB: only user requested) +efr32-brd4304a-unit-test-with-ota-requestor (NOGLOB: only user requested) efr32-brd4304a-window-covering (NOGLOB: only user requested) +efr32-brd4304a-window-covering-with-ota-requestor (NOGLOB: only user requested) esp32-c3devkit-all-clusters esp32-devkitc-all-clusters esp32-devkitc-all-clusters-ipv6only diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index 771dac9f31b454..114bc8ac4ab4f2 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -184,168 +184,336 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa # Generating efr32-brd4161a-light-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4161A" import("//with_pw_rpc.gni")' {out}/efr32-brd4161a-light-rpc +# Generating efr32-brd4161a-light-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4161A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4161a-light-rpc-with-ota-requestor + +# Generating efr32-brd4161a-light-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4161A" chip_enable_ota_requestor=true' {out}/efr32-brd4161a-light-with-ota-requestor + # Generating efr32-brd4161a-lock gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-lock # Generating efr32-brd4161a-lock-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4161A" import("//with_pw_rpc.gni")' {out}/efr32-brd4161a-lock-rpc +# Generating efr32-brd4161a-lock-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4161A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4161a-lock-rpc-with-ota-requestor + +# Generating efr32-brd4161a-lock-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4161A" chip_enable_ota_requestor=true' {out}/efr32-brd4161a-lock-with-ota-requestor + # Generating efr32-brd4161a-switch gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-switch +# Generating efr32-brd4161a-switch-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4161A" chip_enable_ota_requestor=true' {out}/efr32-brd4161a-switch-with-ota-requestor + # Generating efr32-brd4161a-unit-test gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-unit-test +# Generating efr32-brd4161a-unit-test-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4161A" chip_enable_ota_requestor=true' {out}/efr32-brd4161a-unit-test-with-ota-requestor + # Generating efr32-brd4161a-window-covering gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-window-covering +# Generating efr32-brd4161a-window-covering-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4161A" chip_enable_ota_requestor=true' {out}/efr32-brd4161a-window-covering-with-ota-requestor + # Generating efr32-brd4163a-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4163A"' {out}/efr32-brd4163a-light # Generating efr32-brd4163a-light-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4163A" import("//with_pw_rpc.gni")' {out}/efr32-brd4163a-light-rpc +# Generating efr32-brd4163a-light-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4163A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4163a-light-rpc-with-ota-requestor + +# Generating efr32-brd4163a-light-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4163A" chip_enable_ota_requestor=true' {out}/efr32-brd4163a-light-with-ota-requestor + # Generating efr32-brd4163a-lock gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4163A"' {out}/efr32-brd4163a-lock # Generating efr32-brd4163a-lock-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4163A" import("//with_pw_rpc.gni")' {out}/efr32-brd4163a-lock-rpc +# Generating efr32-brd4163a-lock-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4163A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4163a-lock-rpc-with-ota-requestor + +# Generating efr32-brd4163a-lock-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4163A" chip_enable_ota_requestor=true' {out}/efr32-brd4163a-lock-with-ota-requestor + # Generating efr32-brd4163a-switch gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4163A"' {out}/efr32-brd4163a-switch +# Generating efr32-brd4163a-switch-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4163A" chip_enable_ota_requestor=true' {out}/efr32-brd4163a-switch-with-ota-requestor + # Generating efr32-brd4163a-unit-test gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4163A"' {out}/efr32-brd4163a-unit-test +# Generating efr32-brd4163a-unit-test-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4163A" chip_enable_ota_requestor=true' {out}/efr32-brd4163a-unit-test-with-ota-requestor + # Generating efr32-brd4163a-window-covering gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4163A"' {out}/efr32-brd4163a-window-covering +# Generating efr32-brd4163a-window-covering-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4163A" chip_enable_ota_requestor=true' {out}/efr32-brd4163a-window-covering-with-ota-requestor + # Generating efr32-brd4164a-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4164A"' {out}/efr32-brd4164a-light # Generating efr32-brd4164a-light-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4164A" import("//with_pw_rpc.gni")' {out}/efr32-brd4164a-light-rpc +# Generating efr32-brd4164a-light-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4164A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4164a-light-rpc-with-ota-requestor + +# Generating efr32-brd4164a-light-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4164A" chip_enable_ota_requestor=true' {out}/efr32-brd4164a-light-with-ota-requestor + # Generating efr32-brd4164a-lock gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4164A"' {out}/efr32-brd4164a-lock # Generating efr32-brd4164a-lock-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4164A" import("//with_pw_rpc.gni")' {out}/efr32-brd4164a-lock-rpc +# Generating efr32-brd4164a-lock-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4164A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4164a-lock-rpc-with-ota-requestor + +# Generating efr32-brd4164a-lock-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4164A" chip_enable_ota_requestor=true' {out}/efr32-brd4164a-lock-with-ota-requestor + # Generating efr32-brd4164a-switch gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4164A"' {out}/efr32-brd4164a-switch +# Generating efr32-brd4164a-switch-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4164A" chip_enable_ota_requestor=true' {out}/efr32-brd4164a-switch-with-ota-requestor + # Generating efr32-brd4164a-unit-test gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4164A"' {out}/efr32-brd4164a-unit-test +# Generating efr32-brd4164a-unit-test-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4164A" chip_enable_ota_requestor=true' {out}/efr32-brd4164a-unit-test-with-ota-requestor + # Generating efr32-brd4164a-window-covering gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4164A"' {out}/efr32-brd4164a-window-covering +# Generating efr32-brd4164a-window-covering-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4164A" chip_enable_ota_requestor=true' {out}/efr32-brd4164a-window-covering-with-ota-requestor + # Generating efr32-brd4166a-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4166A"' {out}/efr32-brd4166a-light # Generating efr32-brd4166a-light-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4166A" import("//with_pw_rpc.gni")' {out}/efr32-brd4166a-light-rpc +# Generating efr32-brd4166a-light-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4166A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4166a-light-rpc-with-ota-requestor + +# Generating efr32-brd4166a-light-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4166A" chip_enable_ota_requestor=true' {out}/efr32-brd4166a-light-with-ota-requestor + # Generating efr32-brd4166a-lock gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4166A"' {out}/efr32-brd4166a-lock # Generating efr32-brd4166a-lock-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4166A" import("//with_pw_rpc.gni")' {out}/efr32-brd4166a-lock-rpc +# Generating efr32-brd4166a-lock-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4166A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4166a-lock-rpc-with-ota-requestor + +# Generating efr32-brd4166a-lock-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4166A" chip_enable_ota_requestor=true' {out}/efr32-brd4166a-lock-with-ota-requestor + # Generating efr32-brd4166a-switch gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4166A"' {out}/efr32-brd4166a-switch +# Generating efr32-brd4166a-switch-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4166A" chip_enable_ota_requestor=true' {out}/efr32-brd4166a-switch-with-ota-requestor + # Generating efr32-brd4166a-unit-test gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4166A"' {out}/efr32-brd4166a-unit-test +# Generating efr32-brd4166a-unit-test-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4166A" chip_enable_ota_requestor=true' {out}/efr32-brd4166a-unit-test-with-ota-requestor + # Generating efr32-brd4166a-window-covering gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4166A"' {out}/efr32-brd4166a-window-covering +# Generating efr32-brd4166a-window-covering-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4166A" chip_enable_ota_requestor=true' {out}/efr32-brd4166a-window-covering-with-ota-requestor + # Generating efr32-brd4170a-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4170A"' {out}/efr32-brd4170a-light # Generating efr32-brd4170a-light-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4170A" import("//with_pw_rpc.gni")' {out}/efr32-brd4170a-light-rpc +# Generating efr32-brd4170a-light-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4170A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4170a-light-rpc-with-ota-requestor + +# Generating efr32-brd4170a-light-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4170A" chip_enable_ota_requestor=true' {out}/efr32-brd4170a-light-with-ota-requestor + # Generating efr32-brd4170a-lock gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4170A"' {out}/efr32-brd4170a-lock # Generating efr32-brd4170a-lock-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4170A" import("//with_pw_rpc.gni")' {out}/efr32-brd4170a-lock-rpc +# Generating efr32-brd4170a-lock-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4170A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4170a-lock-rpc-with-ota-requestor + +# Generating efr32-brd4170a-lock-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4170A" chip_enable_ota_requestor=true' {out}/efr32-brd4170a-lock-with-ota-requestor + # Generating efr32-brd4170a-switch gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4170A"' {out}/efr32-brd4170a-switch +# Generating efr32-brd4170a-switch-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4170A" chip_enable_ota_requestor=true' {out}/efr32-brd4170a-switch-with-ota-requestor + # Generating efr32-brd4170a-unit-test gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4170A"' {out}/efr32-brd4170a-unit-test +# Generating efr32-brd4170a-unit-test-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4170A" chip_enable_ota_requestor=true' {out}/efr32-brd4170a-unit-test-with-ota-requestor + # Generating efr32-brd4170a-window-covering gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4170A"' {out}/efr32-brd4170a-window-covering +# Generating efr32-brd4170a-window-covering-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4170A" chip_enable_ota_requestor=true' {out}/efr32-brd4170a-window-covering-with-ota-requestor + # Generating efr32-brd4186a-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4186A"' {out}/efr32-brd4186a-light # Generating efr32-brd4186a-light-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4186A" import("//with_pw_rpc.gni")' {out}/efr32-brd4186a-light-rpc +# Generating efr32-brd4186a-light-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4186A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4186a-light-rpc-with-ota-requestor + +# Generating efr32-brd4186a-light-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4186A" chip_enable_ota_requestor=true' {out}/efr32-brd4186a-light-with-ota-requestor + # Generating efr32-brd4186a-lock gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4186A"' {out}/efr32-brd4186a-lock # Generating efr32-brd4186a-lock-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4186A" import("//with_pw_rpc.gni")' {out}/efr32-brd4186a-lock-rpc +# Generating efr32-brd4186a-lock-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4186A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4186a-lock-rpc-with-ota-requestor + +# Generating efr32-brd4186a-lock-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4186A" chip_enable_ota_requestor=true' {out}/efr32-brd4186a-lock-with-ota-requestor + # Generating efr32-brd4186a-switch gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4186A"' {out}/efr32-brd4186a-switch +# Generating efr32-brd4186a-switch-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4186A" chip_enable_ota_requestor=true' {out}/efr32-brd4186a-switch-with-ota-requestor + # Generating efr32-brd4186a-unit-test gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4186A"' {out}/efr32-brd4186a-unit-test +# Generating efr32-brd4186a-unit-test-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4186A" chip_enable_ota_requestor=true' {out}/efr32-brd4186a-unit-test-with-ota-requestor + # Generating efr32-brd4186a-window-covering gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4186A"' {out}/efr32-brd4186a-window-covering +# Generating efr32-brd4186a-window-covering-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4186A" chip_enable_ota_requestor=true' {out}/efr32-brd4186a-window-covering-with-ota-requestor + # Generating efr32-brd4187a-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4187A"' {out}/efr32-brd4187a-light # Generating efr32-brd4187a-light-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4187A" import("//with_pw_rpc.gni")' {out}/efr32-brd4187a-light-rpc +# Generating efr32-brd4187a-light-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4187A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4187a-light-rpc-with-ota-requestor + +# Generating efr32-brd4187a-light-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4187A" chip_enable_ota_requestor=true' {out}/efr32-brd4187a-light-with-ota-requestor + # Generating efr32-brd4187a-lock gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4187A"' {out}/efr32-brd4187a-lock # Generating efr32-brd4187a-lock-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4187A" import("//with_pw_rpc.gni")' {out}/efr32-brd4187a-lock-rpc +# Generating efr32-brd4187a-lock-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4187A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4187a-lock-rpc-with-ota-requestor + +# Generating efr32-brd4187a-lock-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4187A" chip_enable_ota_requestor=true' {out}/efr32-brd4187a-lock-with-ota-requestor + # Generating efr32-brd4187a-switch gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4187A"' {out}/efr32-brd4187a-switch +# Generating efr32-brd4187a-switch-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4187A" chip_enable_ota_requestor=true' {out}/efr32-brd4187a-switch-with-ota-requestor + # Generating efr32-brd4187a-unit-test gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4187A"' {out}/efr32-brd4187a-unit-test +# Generating efr32-brd4187a-unit-test-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4187A" chip_enable_ota_requestor=true' {out}/efr32-brd4187a-unit-test-with-ota-requestor + # Generating efr32-brd4187a-window-covering gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4187A"' {out}/efr32-brd4187a-window-covering +# Generating efr32-brd4187a-window-covering-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4187A" chip_enable_ota_requestor=true' {out}/efr32-brd4187a-window-covering-with-ota-requestor + # Generating efr32-brd4304a-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4304A"' {out}/efr32-brd4304a-light # Generating efr32-brd4304a-light-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4304A" import("//with_pw_rpc.gni")' {out}/efr32-brd4304a-light-rpc +# Generating efr32-brd4304a-light-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4304A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4304a-light-rpc-with-ota-requestor + +# Generating efr32-brd4304a-light-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4304A" chip_enable_ota_requestor=true' {out}/efr32-brd4304a-light-with-ota-requestor + # Generating efr32-brd4304a-lock gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4304A"' {out}/efr32-brd4304a-lock # Generating efr32-brd4304a-lock-rpc gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4304A" import("//with_pw_rpc.gni")' {out}/efr32-brd4304a-lock-rpc +# Generating efr32-brd4304a-lock-rpc-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4304A" import("//with_pw_rpc.gni") chip_enable_ota_requestor=true' {out}/efr32-brd4304a-lock-rpc-with-ota-requestor + +# Generating efr32-brd4304a-lock-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4304A" chip_enable_ota_requestor=true' {out}/efr32-brd4304a-lock-with-ota-requestor + # Generating efr32-brd4304a-switch gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4304A"' {out}/efr32-brd4304a-switch +# Generating efr32-brd4304a-switch-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/light-switch-app/efr32 '--args=efr32_board="BRD4304A" chip_enable_ota_requestor=true' {out}/efr32-brd4304a-switch-with-ota-requestor + # Generating efr32-brd4304a-unit-test gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4304A"' {out}/efr32-brd4304a-unit-test +# Generating efr32-brd4304a-unit-test-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4304A" chip_enable_ota_requestor=true' {out}/efr32-brd4304a-unit-test-with-ota-requestor + # Generating efr32-brd4304a-window-covering gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4304A"' {out}/efr32-brd4304a-window-covering +# Generating efr32-brd4304a-window-covering-with-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4304A" chip_enable_ota_requestor=true' {out}/efr32-brd4304a-window-covering-with-ota-requestor + # Generating esp32-c3devkit-all-clusters mkdir -p {out}/esp32-c3devkit-all-clusters @@ -955,168 +1123,336 @@ ninja -C {out}/efr32-brd4161a-light # Building efr32-brd4161a-light-rpc ninja -C {out}/efr32-brd4161a-light-rpc +# Building efr32-brd4161a-light-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4161a-light-rpc-with-ota-requestor + +# Building efr32-brd4161a-light-with-ota-requestor +ninja -C {out}/efr32-brd4161a-light-with-ota-requestor + # Building efr32-brd4161a-lock ninja -C {out}/efr32-brd4161a-lock # Building efr32-brd4161a-lock-rpc ninja -C {out}/efr32-brd4161a-lock-rpc +# Building efr32-brd4161a-lock-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4161a-lock-rpc-with-ota-requestor + +# Building efr32-brd4161a-lock-with-ota-requestor +ninja -C {out}/efr32-brd4161a-lock-with-ota-requestor + # Building efr32-brd4161a-switch ninja -C {out}/efr32-brd4161a-switch +# Building efr32-brd4161a-switch-with-ota-requestor +ninja -C {out}/efr32-brd4161a-switch-with-ota-requestor + # Building efr32-brd4161a-unit-test ninja -C {out}/efr32-brd4161a-unit-test +# Building efr32-brd4161a-unit-test-with-ota-requestor +ninja -C {out}/efr32-brd4161a-unit-test-with-ota-requestor + # Building efr32-brd4161a-window-covering ninja -C {out}/efr32-brd4161a-window-covering +# Building efr32-brd4161a-window-covering-with-ota-requestor +ninja -C {out}/efr32-brd4161a-window-covering-with-ota-requestor + # Building efr32-brd4163a-light ninja -C {out}/efr32-brd4163a-light # Building efr32-brd4163a-light-rpc ninja -C {out}/efr32-brd4163a-light-rpc +# Building efr32-brd4163a-light-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4163a-light-rpc-with-ota-requestor + +# Building efr32-brd4163a-light-with-ota-requestor +ninja -C {out}/efr32-brd4163a-light-with-ota-requestor + # Building efr32-brd4163a-lock ninja -C {out}/efr32-brd4163a-lock # Building efr32-brd4163a-lock-rpc ninja -C {out}/efr32-brd4163a-lock-rpc +# Building efr32-brd4163a-lock-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4163a-lock-rpc-with-ota-requestor + +# Building efr32-brd4163a-lock-with-ota-requestor +ninja -C {out}/efr32-brd4163a-lock-with-ota-requestor + # Building efr32-brd4163a-switch ninja -C {out}/efr32-brd4163a-switch +# Building efr32-brd4163a-switch-with-ota-requestor +ninja -C {out}/efr32-brd4163a-switch-with-ota-requestor + # Building efr32-brd4163a-unit-test ninja -C {out}/efr32-brd4163a-unit-test +# Building efr32-brd4163a-unit-test-with-ota-requestor +ninja -C {out}/efr32-brd4163a-unit-test-with-ota-requestor + # Building efr32-brd4163a-window-covering ninja -C {out}/efr32-brd4163a-window-covering +# Building efr32-brd4163a-window-covering-with-ota-requestor +ninja -C {out}/efr32-brd4163a-window-covering-with-ota-requestor + # Building efr32-brd4164a-light ninja -C {out}/efr32-brd4164a-light # Building efr32-brd4164a-light-rpc ninja -C {out}/efr32-brd4164a-light-rpc +# Building efr32-brd4164a-light-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4164a-light-rpc-with-ota-requestor + +# Building efr32-brd4164a-light-with-ota-requestor +ninja -C {out}/efr32-brd4164a-light-with-ota-requestor + # Building efr32-brd4164a-lock ninja -C {out}/efr32-brd4164a-lock # Building efr32-brd4164a-lock-rpc ninja -C {out}/efr32-brd4164a-lock-rpc +# Building efr32-brd4164a-lock-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4164a-lock-rpc-with-ota-requestor + +# Building efr32-brd4164a-lock-with-ota-requestor +ninja -C {out}/efr32-brd4164a-lock-with-ota-requestor + # Building efr32-brd4164a-switch ninja -C {out}/efr32-brd4164a-switch +# Building efr32-brd4164a-switch-with-ota-requestor +ninja -C {out}/efr32-brd4164a-switch-with-ota-requestor + # Building efr32-brd4164a-unit-test ninja -C {out}/efr32-brd4164a-unit-test +# Building efr32-brd4164a-unit-test-with-ota-requestor +ninja -C {out}/efr32-brd4164a-unit-test-with-ota-requestor + # Building efr32-brd4164a-window-covering ninja -C {out}/efr32-brd4164a-window-covering +# Building efr32-brd4164a-window-covering-with-ota-requestor +ninja -C {out}/efr32-brd4164a-window-covering-with-ota-requestor + # Building efr32-brd4166a-light ninja -C {out}/efr32-brd4166a-light # Building efr32-brd4166a-light-rpc ninja -C {out}/efr32-brd4166a-light-rpc +# Building efr32-brd4166a-light-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4166a-light-rpc-with-ota-requestor + +# Building efr32-brd4166a-light-with-ota-requestor +ninja -C {out}/efr32-brd4166a-light-with-ota-requestor + # Building efr32-brd4166a-lock ninja -C {out}/efr32-brd4166a-lock # Building efr32-brd4166a-lock-rpc ninja -C {out}/efr32-brd4166a-lock-rpc +# Building efr32-brd4166a-lock-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4166a-lock-rpc-with-ota-requestor + +# Building efr32-brd4166a-lock-with-ota-requestor +ninja -C {out}/efr32-brd4166a-lock-with-ota-requestor + # Building efr32-brd4166a-switch ninja -C {out}/efr32-brd4166a-switch +# Building efr32-brd4166a-switch-with-ota-requestor +ninja -C {out}/efr32-brd4166a-switch-with-ota-requestor + # Building efr32-brd4166a-unit-test ninja -C {out}/efr32-brd4166a-unit-test +# Building efr32-brd4166a-unit-test-with-ota-requestor +ninja -C {out}/efr32-brd4166a-unit-test-with-ota-requestor + # Building efr32-brd4166a-window-covering ninja -C {out}/efr32-brd4166a-window-covering +# Building efr32-brd4166a-window-covering-with-ota-requestor +ninja -C {out}/efr32-brd4166a-window-covering-with-ota-requestor + # Building efr32-brd4170a-light ninja -C {out}/efr32-brd4170a-light # Building efr32-brd4170a-light-rpc ninja -C {out}/efr32-brd4170a-light-rpc +# Building efr32-brd4170a-light-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4170a-light-rpc-with-ota-requestor + +# Building efr32-brd4170a-light-with-ota-requestor +ninja -C {out}/efr32-brd4170a-light-with-ota-requestor + # Building efr32-brd4170a-lock ninja -C {out}/efr32-brd4170a-lock # Building efr32-brd4170a-lock-rpc ninja -C {out}/efr32-brd4170a-lock-rpc +# Building efr32-brd4170a-lock-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4170a-lock-rpc-with-ota-requestor + +# Building efr32-brd4170a-lock-with-ota-requestor +ninja -C {out}/efr32-brd4170a-lock-with-ota-requestor + # Building efr32-brd4170a-switch ninja -C {out}/efr32-brd4170a-switch +# Building efr32-brd4170a-switch-with-ota-requestor +ninja -C {out}/efr32-brd4170a-switch-with-ota-requestor + # Building efr32-brd4170a-unit-test ninja -C {out}/efr32-brd4170a-unit-test +# Building efr32-brd4170a-unit-test-with-ota-requestor +ninja -C {out}/efr32-brd4170a-unit-test-with-ota-requestor + # Building efr32-brd4170a-window-covering ninja -C {out}/efr32-brd4170a-window-covering +# Building efr32-brd4170a-window-covering-with-ota-requestor +ninja -C {out}/efr32-brd4170a-window-covering-with-ota-requestor + # Building efr32-brd4186a-light ninja -C {out}/efr32-brd4186a-light # Building efr32-brd4186a-light-rpc ninja -C {out}/efr32-brd4186a-light-rpc +# Building efr32-brd4186a-light-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4186a-light-rpc-with-ota-requestor + +# Building efr32-brd4186a-light-with-ota-requestor +ninja -C {out}/efr32-brd4186a-light-with-ota-requestor + # Building efr32-brd4186a-lock ninja -C {out}/efr32-brd4186a-lock # Building efr32-brd4186a-lock-rpc ninja -C {out}/efr32-brd4186a-lock-rpc +# Building efr32-brd4186a-lock-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4186a-lock-rpc-with-ota-requestor + +# Building efr32-brd4186a-lock-with-ota-requestor +ninja -C {out}/efr32-brd4186a-lock-with-ota-requestor + # Building efr32-brd4186a-switch ninja -C {out}/efr32-brd4186a-switch +# Building efr32-brd4186a-switch-with-ota-requestor +ninja -C {out}/efr32-brd4186a-switch-with-ota-requestor + # Building efr32-brd4186a-unit-test ninja -C {out}/efr32-brd4186a-unit-test +# Building efr32-brd4186a-unit-test-with-ota-requestor +ninja -C {out}/efr32-brd4186a-unit-test-with-ota-requestor + # Building efr32-brd4186a-window-covering ninja -C {out}/efr32-brd4186a-window-covering +# Building efr32-brd4186a-window-covering-with-ota-requestor +ninja -C {out}/efr32-brd4186a-window-covering-with-ota-requestor + # Building efr32-brd4187a-light ninja -C {out}/efr32-brd4187a-light # Building efr32-brd4187a-light-rpc ninja -C {out}/efr32-brd4187a-light-rpc +# Building efr32-brd4187a-light-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4187a-light-rpc-with-ota-requestor + +# Building efr32-brd4187a-light-with-ota-requestor +ninja -C {out}/efr32-brd4187a-light-with-ota-requestor + # Building efr32-brd4187a-lock ninja -C {out}/efr32-brd4187a-lock # Building efr32-brd4187a-lock-rpc ninja -C {out}/efr32-brd4187a-lock-rpc +# Building efr32-brd4187a-lock-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4187a-lock-rpc-with-ota-requestor + +# Building efr32-brd4187a-lock-with-ota-requestor +ninja -C {out}/efr32-brd4187a-lock-with-ota-requestor + # Building efr32-brd4187a-switch ninja -C {out}/efr32-brd4187a-switch +# Building efr32-brd4187a-switch-with-ota-requestor +ninja -C {out}/efr32-brd4187a-switch-with-ota-requestor + # Building efr32-brd4187a-unit-test ninja -C {out}/efr32-brd4187a-unit-test +# Building efr32-brd4187a-unit-test-with-ota-requestor +ninja -C {out}/efr32-brd4187a-unit-test-with-ota-requestor + # Building efr32-brd4187a-window-covering ninja -C {out}/efr32-brd4187a-window-covering +# Building efr32-brd4187a-window-covering-with-ota-requestor +ninja -C {out}/efr32-brd4187a-window-covering-with-ota-requestor + # Building efr32-brd4304a-light ninja -C {out}/efr32-brd4304a-light # Building efr32-brd4304a-light-rpc ninja -C {out}/efr32-brd4304a-light-rpc +# Building efr32-brd4304a-light-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4304a-light-rpc-with-ota-requestor + +# Building efr32-brd4304a-light-with-ota-requestor +ninja -C {out}/efr32-brd4304a-light-with-ota-requestor + # Building efr32-brd4304a-lock ninja -C {out}/efr32-brd4304a-lock # Building efr32-brd4304a-lock-rpc ninja -C {out}/efr32-brd4304a-lock-rpc +# Building efr32-brd4304a-lock-rpc-with-ota-requestor +ninja -C {out}/efr32-brd4304a-lock-rpc-with-ota-requestor + +# Building efr32-brd4304a-lock-with-ota-requestor +ninja -C {out}/efr32-brd4304a-lock-with-ota-requestor + # Building efr32-brd4304a-switch ninja -C {out}/efr32-brd4304a-switch +# Building efr32-brd4304a-switch-with-ota-requestor +ninja -C {out}/efr32-brd4304a-switch-with-ota-requestor + # Building efr32-brd4304a-unit-test ninja -C {out}/efr32-brd4304a-unit-test +# Building efr32-brd4304a-unit-test-with-ota-requestor +ninja -C {out}/efr32-brd4304a-unit-test-with-ota-requestor + # Building efr32-brd4304a-window-covering ninja -C {out}/efr32-brd4304a-window-covering +# Building efr32-brd4304a-window-covering-with-ota-requestor +ninja -C {out}/efr32-brd4304a-window-covering-with-ota-requestor + rm -f examples/all-clusters-app/esp32/sdkconfig # Building esp32-c3devkit-all-clusters diff --git a/scripts/build/testdata/build_linux_on_x64.txt b/scripts/build/testdata/build_linux_on_x64.txt index 62a44b15655273..44f1f6addfd6ea 100644 --- a/scripts/build/testdata/build_linux_on_x64.txt +++ b/scripts/build/testdata/build_linux_on_x64.txt @@ -41,6 +41,26 @@ bash -c ' PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/minimal-mdns '"'"'--args=chip_inet_config_enable_ipv4=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-minmdns-ipv6only' +# Generating linux-arm64-ota-provider +bash -c ' +PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \ + gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-provider-app/linux '"'"'--args=chip_config_network_layer_ble=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-ota-provider' + +# Generating linux-arm64-ota-provider-ipv6only +bash -c ' +PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \ + gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-provider-app/linux '"'"'--args=chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-ota-provider-ipv6only' + +# Generating linux-arm64-ota-requestor +bash -c ' +PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \ + gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-requestor-app/linux '"'"'--args=chip_config_network_layer_ble=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-ota-requestor' + +# Generating linux-arm64-ota-requestor-ipv6only +bash -c ' +PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \ + gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-requestor-app/linux '"'"'--args=chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-ota-requestor-ipv6only' + # Generating linux-arm64-shell bash -c ' PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \ @@ -94,6 +114,18 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa # Generating linux-x64-minmdns-ipv6only gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/minimal-mdns --args=chip_inet_config_enable_ipv4=false {out}/linux-x64-minmdns-ipv6only +# Generating linux-x64-ota-provider +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-provider-app/linux --args=chip_config_network_layer_ble=false {out}/linux-x64-ota-provider + +# Generating linux-x64-ota-provider-ipv6only +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-provider-app/linux '--args=chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=false' {out}/linux-x64-ota-provider-ipv6only + +# Generating linux-x64-ota-requestor +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-requestor-app/linux --args=chip_config_network_layer_ble=false {out}/linux-x64-ota-requestor + +# Generating linux-x64-ota-requestor-ipv6only +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-requestor-app/linux '--args=chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=false' {out}/linux-x64-ota-requestor-ipv6only + # Generating linux-x64-rpc-console gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/common/pigweed/rpc_console {out}/linux-x64-rpc-console @@ -142,6 +174,18 @@ ninja -C {out}/linux-arm64-minmdns # Building linux-arm64-minmdns-ipv6only ninja -C {out}/linux-arm64-minmdns-ipv6only +# Building linux-arm64-ota-provider +ninja -C {out}/linux-arm64-ota-provider + +# Building linux-arm64-ota-provider-ipv6only +ninja -C {out}/linux-arm64-ota-provider-ipv6only + +# Building linux-arm64-ota-requestor +ninja -C {out}/linux-arm64-ota-requestor + +# Building linux-arm64-ota-requestor-ipv6only +ninja -C {out}/linux-arm64-ota-requestor-ipv6only + # Building linux-arm64-shell ninja -C {out}/linux-arm64-shell @@ -187,6 +231,18 @@ ninja -C {out}/linux-x64-minmdns # Building linux-x64-minmdns-ipv6only ninja -C {out}/linux-x64-minmdns-ipv6only +# Building linux-x64-ota-provider +ninja -C {out}/linux-x64-ota-provider + +# Building linux-x64-ota-provider-ipv6only +ninja -C {out}/linux-x64-ota-provider-ipv6only + +# Building linux-x64-ota-requestor +ninja -C {out}/linux-x64-ota-requestor + +# Building linux-x64-ota-requestor-ipv6only +ninja -C {out}/linux-x64-ota-requestor-ipv6only + # Building linux-x64-rpc-console ninja -C {out}/linux-x64-rpc-console diff --git a/scripts/build_python.sh b/scripts/build_python.sh index 7949f04644ca6f..c4504f1433907c 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -42,6 +42,7 @@ declare chip_detail_logging=false declare enable_pybindings=false declare chip_mdns declare case_retry_delta +declare install_wheel=no help() { @@ -58,6 +59,10 @@ Input Options: -t --time_between_case_retries MRPActiveRetryInterval Specify MRPActiveRetryInterval value Default is 300 ms + -i, --install_wheel no|build-env|separate Where to install the Python wheel + no: Do not install + build-env: install to virtual env for build matter + separate: install to another virtual env (out/python_env) " } @@ -85,6 +90,10 @@ while (($#)); do chip_case_retry_delta=$2 shift ;; + --install_wheel | -i) + install_wheel=$2 + shift + ;; -*) help echo "Unknown Option \"$1\"" @@ -114,24 +123,34 @@ else ninja -C "$OUTPUT_ROOT" python fi -# Create a virtual environment that has access to the built python tools -virtualenv --clear "$ENVIRONMENT_ROOT" - -# Activate the new environment to register the python WHL - if [ "$enable_pybindings" == true ]; then WHEEL=$(ls "$OUTPUT_ROOT"/pybindings/pycontroller/pychip-*.whl | head -n 1) else WHEEL=$(ls "$OUTPUT_ROOT"/controller/python/chip-*.whl | head -n 1) fi -source "$ENVIRONMENT_ROOT"/bin/activate -"$ENVIRONMENT_ROOT"/bin/python -m pip install --upgrade pip -"$ENVIRONMENT_ROOT"/bin/pip install --upgrade --force-reinstall --no-cache-dir "$WHEEL" - -echo "" -echo_green "Compilation completed and WHL package installed in: " -echo_blue " $ENVIRONMENT_ROOT" -echo "" -echo_green "To use please run:" -echo_bold_white " source $ENVIRONMENT_ROOT/bin/activate" +if [ "$install_wheel" = "no" ]; then + exit 0 +elif [ "$install_wheel" = "separate" ]; then + # Create a virtual environment that has access to the built python tools + virtualenv --clear "$ENVIRONMENT_ROOT" + + source "$ENVIRONMENT_ROOT"/bin/activate + "$ENVIRONMENT_ROOT"/bin/python -m pip install --upgrade pip + "$ENVIRONMENT_ROOT"/bin/pip install --upgrade --force-reinstall --no-cache-dir "$WHEEL" + + echo "" + echo_green "Compilation completed and WHL package installed in: " + echo_blue " $ENVIRONMENT_ROOT" + echo "" + echo_green "To use please run:" + echo_bold_white " source $ENVIRONMENT_ROOT/bin/activate" +elif [ "$install_wheel" = "build-env" ]; then + pip install --force-reinstall "$WHEEL" + + echo "" + echo_green "Compilation completed and WHL package installed in virtualenv for building sdk" + echo "" + echo_green "To use please run:" + echo_bold_white " source $CHIP_ROOT/scripts/activate.sh" +fi diff --git a/scripts/environment.json b/scripts/environment.json index 4662e6dc6c1df8..afe568101b78d3 100644 --- a/scripts/environment.json +++ b/scripts/environment.json @@ -8,5 +8,6 @@ "gn_root": ".", "gn_targets": [":python_packages.install"] }, - "required_submodules": ["third_party/pigweed/repo"] + "required_submodules": ["third_party/pigweed/repo"], + "gni_file": "build_overrides/pigweed_environment.gni" } diff --git a/scripts/environment_no_cipd.json b/scripts/environment_no_cipd.json index 054886430e9787..3efe20c8ff6fdc 100644 --- a/scripts/environment_no_cipd.json +++ b/scripts/environment_no_cipd.json @@ -2,5 +2,6 @@ "virtualenv": { "gn_root": ".", "gn_targets": [":python_packages.install"] - } + }, + "gni_file": "build_overrides/pigweed_environment.gni" } diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index 200176a22e4501..22913392fc8972 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -61,6 +61,10 @@ if [ "$#" == "0" ]; then Location for an alternate or modified efr32 SDK enable_heap_monitoring Monitor & log memory usage at runtime. (Default false) + enable_openthread_cli + Enables openthread cli without matter shell. (Default true) + show_qr_code + Enables QR code on LCD for devices with an LCD setupDiscriminator Discriminatoor value used for BLE connexion. (Default 3840) setupPinCode @@ -78,7 +82,8 @@ if [ "$#" == "0" ]; then Periodic query timeout variable for OTA in seconds Presets --sed - enable sleepy end device and set thread mtd + enable sleepy end device, set thread mtd + For minimum consumption, disable openthread cli and qr code --wifi build wifi example variant for given exansion board " diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index 63f1cdcc1af61f..0642c7a4513424 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -39,13 +39,12 @@ def __init__(self, runner, command): def start(self, discriminator): if not self.process: - self.process = None - process, outpipe, errpipe = self.__startServer( + # Make sure to assign self.process before we do any operations that + # might fail, so attempts to kill us on failure actually work. + self.process, self.outpipe, errpipe = self.__startServer( self.runner, self.command, discriminator) - self.waitForAnyAdvertisement(process, outpipe) - self.__updateSetUpCode(outpipe) - self.process = process - self.outpipe = outpipe + self.waitForAnyAdvertisement() + self.__updateSetUpCode() with self.cv_stopped: self.stopped = False self.cv_stopped.notify() @@ -78,8 +77,8 @@ def factoryReset(self): return True - def waitForAnyAdvertisement(self, process, outpipe): - self.__waitFor("mDNS service published:", process, outpipe) + def waitForAnyAdvertisement(self): + self.__waitFor("mDNS service published:", self.process, self.outpipe) def waitForCommissionableAdvertisement(self): self.__waitFor("mDNS service published: _matterc._udp", @@ -135,8 +134,8 @@ def __waitFor(self, waitForString, server_process, outpipe): logging.debug('Success waiting for: %s' % waitForString) - def __updateSetUpCode(self, outpipe): - qrLine = outpipe.FindLastMatchingLine('.*SetupQRCode: *\\[(.*)]') + def __updateSetUpCode(self): + qrLine = self.outpipe.FindLastMatchingLine('.*SetupQRCode: *\\[(.*)]') if not qrLine: raise Exception("Unable to find QR code") self.setupCode = qrLine.group(1) @@ -232,11 +231,13 @@ def Run(self, runner, apps_register, paths: ApplicationPaths): os.unlink(f) app = App(runner, app_cmd) + # Add the App to the register immediately, so if it fails during + # start() we will be able to clean things up properly. + apps_register.add("default", app) # Remove server application storage (factory reset), # so it will be commissionable again. app.factoryReset() app.start(str(randrange(1, 4096))) - apps_register.add("default", app) runner.RunSubprocess( tool_cmd + ['pairing', 'qrcode', TEST_NODE_ID, app.setupCode], diff --git a/scripts/tests/cirque_tests.sh b/scripts/tests/cirque_tests.sh index 943bf158578269..b26db8d4465849 100755 --- a/scripts/tests/cirque_tests.sh +++ b/scripts/tests/cirque_tests.sh @@ -40,6 +40,7 @@ CIRQUE_TESTS=( "MobileDeviceTest" "CommissioningTest" "InteractionModelTest" + "SplitCommissioningTest" ) BOLD_GREEN_TEXT="\033[1;32m" diff --git a/scripts/tests/ota_test.sh b/scripts/tests/ota_test.sh index 2838c106b7e11b..eecded2912c86a 100755 --- a/scripts/tests/ota_test.sh +++ b/scripts/tests/ota_test.sh @@ -65,10 +65,16 @@ timeout 30 grep -q "OTA image downloaded to" <(tail -n0 -f /tmp/ota/requestor-lo echo "Exiting, logs are in tmp/ota/" -killall -e "$OTA_PROVIDER_APP" "$OTA_REQUESTOR_APP" - if cmp "$OTA_DOWNLOAD_PATH" "$FIRMWARE_BIN"; then - echo Test passed && exit 0 + TEST_RESULT="Test passed" + RETURN_VALUE=0 else - echo Test failed && exit 1 + TEST_RESULT="Test failed" + RETURN_VALUE=1 fi + +killall -e "$OTA_PROVIDER_APP" "$OTA_REQUESTOR_APP" +rm -f "$FIRMWARE_OTA" "$FIRMWARE_BIN" "$OTA_DOWNLOAD_PATH" + +echo "$TEST_RESULT" +exit "$RETURN_VALUE" diff --git a/scripts/tests/run_python_test.py b/scripts/tests/run_python_test.py new file mode 100755 index 00000000000000..229e26594a4694 --- /dev/null +++ b/scripts/tests/run_python_test.py @@ -0,0 +1,157 @@ +#!/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 pty +import subprocess +import click +import os +import pathlib +import typing +import queue +import threading +import sys +import time +import datetime +import shlex +import logging + +DEFAULT_CHIP_ROOT = os.path.abspath( + os.path.join(os.path.dirname(__file__), '..', '..')) + + +def FindBinaryPath(name: str): + for path in pathlib.Path(DEFAULT_CHIP_ROOT).rglob(name): + if not path.is_file(): + continue + if path.name != name: + continue + return str(path) + + return None + + +def EnqueueLogOutput(fp, tag, q): + for line in iter(fp.readline, b''): + timestamp = time.time() + if len(line) > len('[1646290606.901990]') and line[0:1] == b'[': + try: + timestamp = float(line[1:18].decode()) + line = line[19:] + except Exception as ex: + pass + q.put((tag, line, datetime.datetime.fromtimestamp( + timestamp).isoformat(sep=" "))) + fp.close() + + +def RedirectQueueThread(fp, tag, queue) -> threading.Thread: + log_queue_thread = threading.Thread(target=EnqueueLogOutput, args=( + fp, tag, queue)) + log_queue_thread.start() + return log_queue_thread + + +def DumpLogOutput(q: queue.Queue): + # TODO: Due to the nature of os pipes, the order of the timestamp is not guaranteed, need to figure out a better output format. + while True: + line = q.get_nowait() + sys.stdout.buffer.write( + (f"[{line[2]}]").encode() + line[0] + line[1]) + sys.stdout.flush() + + +def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: str, process: subprocess.Popen, queue: queue.Queue): + thread_list.append(RedirectQueueThread(process.stdout, + (f"[{tag}][\33[33mSTDOUT\33[0m]").encode(), queue)) + thread_list.append(RedirectQueueThread(process.stderr, + (f"[{tag}][\33[31mSTDERR\33[0m]").encode(), queue)) + + +@click.command() +@click.option("--app", type=str, default=None, help='Local application to use, omit to use external apps, use a path for a specific binary or use a filename to search under the current matter checkout.') +@click.option("--factoryreset", is_flag=True, help='Remove app config and repl configs (/tmp/chip* and /tmp/repl*) before running the tests.') +@click.option("--app-params", type=str, default='', help='The extra parameters passed to the device.') +@click.option("--script", type=click.Path(exists=True), default=FindBinaryPath("mobile-device-test.py"), help='Test script to use.') +@click.argument("script-args", nargs=-1, type=str) +def main(app: str, factoryreset: bool, app_params: str, script: str, script_args: typing.List[str]): + if factoryreset: + retcode = subprocess.call("rm -rf /tmp/chip* /tmp/repl*", shell=True) + if retcode != 0: + raise Exception("Failed to remove /tmp/chip* for factory reset.") + + log_queue = queue.Queue() + log_cooking_threads = [] + + app_process = None + if app: + if not os.path.exists(app): + app = FindBinaryPath(app) + if app is None: + raise FileNotFoundError(f"{app} not found") + app_args = [app] + shlex.split(app_params) + logging.info(f"Execute: {app_args}") + app_process = subprocess.Popen( + app_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) + DumpProgramOutputToQueue( + log_cooking_threads, "\33[34mAPP \33[0m", app_process, log_queue) + + script_command = ["/usr/bin/env", "python3", script, + '--log-format', '%(message)s'] + [v for v in script_args] + logging.info(f"Execute: {script_command}") + test_script_process = subprocess.Popen( + script_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + DumpProgramOutputToQueue(log_cooking_threads, "\33[32mTEST\33[0m", + test_script_process, log_queue) + + test_script_exit_code = test_script_process.poll() + while test_script_exit_code is None: + try: + DumpLogOutput(log_queue) + except queue.Empty: + pass + test_script_exit_code = test_script_process.poll() + + test_app_exit_code = 0 + if app_process: + app_process.send_signal(2) + + test_app_exit_code = app_process.poll() + while test_app_exit_code is None: + try: + DumpLogOutput(log_queue) + except queue.Empty: + pass + test_app_exit_code = app_process.poll() + + # There are some logs not cooked, so we wait until we have processed all logs. + # This procedure should be very fast since the related processes are finished. + for thread in log_cooking_threads: + thread.join() + + try: + DumpLogOutput(log_queue) + except queue.Empty: + pass + + if test_script_exit_code != 0: + sys.exit(test_script_exit_code) + else: + # We expect both app and test script should exit with 0 + sys.exit(test_app_exit_code) + + +if __name__ == '__main__': + main() diff --git a/src/access/examples/ExampleAccessControlDelegate.cpp b/src/access/examples/ExampleAccessControlDelegate.cpp index 95c659a493c155..f6b219b66a93e7 100644 --- a/src/access/examples/ExampleAccessControlDelegate.cpp +++ b/src/access/examples/ExampleAccessControlDelegate.cpp @@ -129,7 +129,7 @@ class SubjectStorage } public: - CHIP_ERROR Serialize(chip::TLV::TLVWriter & writer) { return writer.Put(chip::TLV::AnonymousTag(), mNode); } + CHIP_ERROR Serialize(chip::TLV::TLVWriter & writer) const { return writer.Put(chip::TLV::AnonymousTag(), mNode); } CHIP_ERROR Deserialize(chip::TLV::TLVReader & reader) { @@ -193,7 +193,7 @@ class TargetStorage } public: - CHIP_ERROR Serialize(chip::TLV::TLVWriter & writer) + CHIP_ERROR Serialize(chip::TLV::TLVWriter & writer) const { ReturnErrorOnFailure(writer.Put(chip::TLV::AnonymousTag(), mCluster)); return writer.Put(chip::TLV::AnonymousTag(), mDeviceType); @@ -870,7 +870,7 @@ class EntryDelegate : public Entry::Delegate { return CHIP_NO_ERROR; } - else if (auto * storage = EntryStorage::Find(nullptr)) + if (auto * storage = EntryStorage::Find(nullptr)) { *storage = *mStorage; mStorage = storage; diff --git a/src/app/AttributeCache.h b/src/app/AttributeCache.h index 00f5105bdcb748..f9143d5e2ab504 100644 --- a/src/app/AttributeCache.h +++ b/src/app/AttributeCache.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/app/AttributePathExpandIterator.cpp b/src/app/AttributePathExpandIterator.cpp index 0d893c5886a98a..235d45185a2dee 100644 --- a/src/app/AttributePathExpandIterator.cpp +++ b/src/app/AttributePathExpandIterator.cpp @@ -205,7 +205,7 @@ bool AttributePathExpandIterator::Next() // Return true will skip the increment of mClusterIndex, mEndpointIndex and mpClusterInfo. return true; } - else if (mGlobalAttributeIndex < mGlobalAttributeEndIndex) + if (mGlobalAttributeIndex < mGlobalAttributeEndIndex) { // Return a path pointing to the next global attribute. mOutputPath.mAttributeId = GlobalAttributesNotInMetadata[mGlobalAttributeIndex]; diff --git a/src/app/CASEClientPool.h b/src/app/CASEClientPool.h index 99bc913793e738..f44d487771c8fc 100644 --- a/src/app/CASEClientPool.h +++ b/src/app/CASEClientPool.h @@ -36,7 +36,7 @@ template class CASEClientPool : public CASEClientPoolDelegate { public: - ~CASEClientPool() { mClientPool.ReleaseAll(); } + ~CASEClientPool() override { mClientPool.ReleaseAll(); } CASEClient * Allocate(CASEClientInitParams params) override { return mClientPool.CreateObject(params); } diff --git a/src/app/CASESessionManager.cpp b/src/app/CASESessionManager.cpp index 58ec144a8f3fa6..92c67a6b8f6f49 100644 --- a/src/app/CASESessionManager.cpp +++ b/src/app/CASESessionManager.cpp @@ -38,9 +38,15 @@ CHIP_ERROR CASESessionManager::FindOrEstablishSession(PeerId peerId, Callback::C false; #endif + ChipLogDetail(CASESessionManager, + "FindOrEstablishSession: PeerId = " ChipLogFormatX64 ":" ChipLogFormatX64 ", NodeIdWasResolved = %d", + ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId()), nodeIDWasResolved); + OperationalDeviceProxy * session = FindExistingSession(peerId); if (session == nullptr) { + ChipLogDetail(CASESessionManager, "FindOrEstablishSession: No existing session found"); + // TODO - Implement LRU to evict least recently used session to handle mActiveSessions pool exhaustion if (nodeIDWasResolved) { @@ -109,17 +115,17 @@ CHIP_ERROR CASESessionManager::GetPeerAddress(PeerId peerId, Transport::PeerAddr return CHIP_NO_ERROR; } -OperationalDeviceProxy * CASESessionManager::FindSession(const SessionHandle & session) +OperationalDeviceProxy * CASESessionManager::FindSession(const SessionHandle & session) const { return mConfig.devicePool->FindDevice(session); } -OperationalDeviceProxy * CASESessionManager::FindExistingSession(PeerId peerId) +OperationalDeviceProxy * CASESessionManager::FindExistingSession(PeerId peerId) const { return mConfig.devicePool->FindDevice(peerId); } -void CASESessionManager::ReleaseSession(OperationalDeviceProxy * session) +void CASESessionManager::ReleaseSession(OperationalDeviceProxy * session) const { if (session != nullptr) { diff --git a/src/app/CASESessionManager.h b/src/app/CASESessionManager.h index 2f698c3f4e58ce..4f7c118c92a92f 100644 --- a/src/app/CASESessionManager.h +++ b/src/app/CASESessionManager.h @@ -61,10 +61,10 @@ class CASESessionManager mConfig = params; } - virtual ~CASESessionManager() { mDNSResolver.Shutdown(); } + virtual ~CASESessionManager() {} CHIP_ERROR Init(chip::System::Layer * systemLayer); - void Shutdown() { mDNSResolver.Shutdown(); } + void Shutdown() {} /** * Find an existing session for the given node ID, or trigger a new session request. @@ -75,7 +75,7 @@ class CASESessionManager CHIP_ERROR FindOrEstablishSession(PeerId peerId, Callback::Callback * onConnection, Callback::Callback * onFailure); - OperationalDeviceProxy * FindExistingSession(PeerId peerId); + OperationalDeviceProxy * FindExistingSession(PeerId peerId) const; void ReleaseSession(PeerId peerId); @@ -94,11 +94,10 @@ class CASESessionManager CHIP_ERROR GetPeerAddress(PeerId peerId, Transport::PeerAddress & addr); private: - OperationalDeviceProxy * FindSession(const SessionHandle & session); - void ReleaseSession(OperationalDeviceProxy * device); + OperationalDeviceProxy * FindSession(const SessionHandle & session) const; + void ReleaseSession(OperationalDeviceProxy * device) const; CASESessionManagerConfig mConfig; - Dnssd::ResolverProxy mDNSResolver; }; } // namespace chip diff --git a/src/app/ChunkedWriteCallback.cpp b/src/app/ChunkedWriteCallback.cpp index af5215627b0b26..ffef2641ed1653 100644 --- a/src/app/ChunkedWriteCallback.cpp +++ b/src/app/ChunkedWriteCallback.cpp @@ -38,11 +38,9 @@ void ChunkedWriteCallback::OnResponse(const WriteClient * apWriteClient, const C } return; } - else - { - // This is a response to another attribute write. Report the final result of last attribute write. - callback->OnResponse(apWriteClient, mLastAttributePath.Value(), mAttributeStatus); - } + + // This is a response to another attribute write. Report the final result of last attribute write. + callback->OnResponse(apWriteClient, mLastAttributePath.Value(), mAttributeStatus); } // This is the first report for a new attribute. We assume it will never be a list item operation. diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 56f60e1fbd9d1e..ebbb4dd4607f99 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -125,6 +126,15 @@ CHIP_ERROR CommandHandler::ProcessInvokeRequest(System::PacketBufferHandle && pa } invokeRequests.GetReader(&invokeRequestsReader); + + { + // We don't support handling multiple commands but the protocol is ready to support it in the future, reject all of them and + // IM Engine will send a status response. + size_t commandCount = 0; + TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */); + VerifyOrReturnError(commandCount == 1, CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + } + while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) { VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG); @@ -546,10 +556,8 @@ TLV::TLVWriter * CommandHandler::GetCommandDataIBTLVWriter() { return nullptr; } - else - { - return mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand().GetWriter(); - } + + return mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand().GetWriter(); } FabricIndex CommandHandler::GetAccessingFabricIndex() const diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index 05b183d59211e1..24c97e3eb8b69c 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -372,10 +372,8 @@ TLV::TLVWriter * CommandSender::GetCommandDataIBTLVWriter() { return nullptr; } - else - { - return mInvokeRequestBuilder.GetInvokeRequests().GetCommandData().GetWriter(); - } + + return mInvokeRequestBuilder.GetInvokeRequests().GetCommandData().GetWriter(); } CHIP_ERROR CommandSender::HandleTimedStatus(const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload) diff --git a/src/app/CommandSender.h b/src/app/CommandSender.h index 53edd9f3294ba0..1e9985eaf8338a 100644 --- a/src/app/CommandSender.h +++ b/src/app/CommandSender.h @@ -59,7 +59,7 @@ class CommandSender final : public Messaging::ExchangeDelegate * * See Abort() for details on when that might occur. */ - virtual ~CommandSender() { Abort(); } + ~CommandSender() override { Abort(); } /** * Gets the inner exchange context object, without ownership. diff --git a/src/app/DataVersionFilter.h b/src/app/DataVersionFilter.h index ba93de61689693..1a6608e04a47eb 100644 --- a/src/app/DataVersionFilter.h +++ b/src/app/DataVersionFilter.h @@ -32,7 +32,7 @@ struct DataVersionFilter DataVersionFilter() {} - bool IsValidDataVersionFilter() + bool IsValidDataVersionFilter() const { return (mEndpointId != kInvalidEndpointId) && (mClusterId != kInvalidClusterId) && (mDataVersion.HasValue()); } diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index a48d790f01d631..88d4b7be7808f6 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -399,7 +399,7 @@ CHIP_ERROR EventManagement::CopyAndAdjustDeltaTime(const TLVReader & aReader, si // Does not go on the wire. return CHIP_NO_ERROR; } - else if ((aReader.GetTag() == TLV::ContextTag(to_underlying(EventDataIB::Tag::kSystemTimestamp))) && !(ctx->mpContext->mFirst)) + if ((aReader.GetTag() == TLV::ContextTag(to_underlying(EventDataIB::Tag::kSystemTimestamp))) && !(ctx->mpContext->mFirst)) { return ctx->mpWriter->Put(TLV::ContextTag(to_underlying(EventDataIB::Tag::kDeltaSystemTimestamp)), ctx->mpContext->mCurrentTime.mValue - ctx->mpContext->mPreviousTime.mValue); @@ -501,12 +501,10 @@ CHIP_ERROR EventManagement::LogEventPrivate(EventLoggingDelegate * apDelegate, c { break; } - else - { - buffer = buffer->GetNextCircularEventBuffer(); - assert(buffer != nullptr); - // code guarantees that every PriorityLevel has a buffer destination. - } + + buffer = buffer->GetNextCircularEventBuffer(); + assert(buffer != nullptr); + // code guarantees that every PriorityLevel has a buffer destination. } mBytesWritten += writer.GetLengthWritten(); @@ -872,7 +870,7 @@ CHIP_ERROR EventManagement::EvictEvent(CHIPCircularTLVBuffer & apBuffer, void * return CHIP_END_OF_TLV; } -void EventManagement::SetScheduledEventInfo(EventNumber & aEventNumber, uint32_t & aInitialWrittenEventBytes) +void EventManagement::SetScheduledEventInfo(EventNumber & aEventNumber, uint32_t & aInitialWrittenEventBytes) const { #if !CHIP_SYSTEM_CONFIG_NO_LOCKING ScopedLock lock(sInstance); diff --git a/src/app/EventManagement.h b/src/app/EventManagement.h index 07b900ca0f375c..9d6802105cc237 100644 --- a/src/app/EventManagement.h +++ b/src/app/EventManagement.h @@ -98,9 +98,9 @@ class CircularEventBuffer : public TLV::CHIPCircularTLVBuffer CircularEventBuffer * GetNextCircularEventBuffer() { return mpNext; } void SetRequiredSpaceforEvicted(size_t aRequiredSpace) { mRequiredSpaceForEvicted = aRequiredSpace; } - size_t GetRequiredSpaceforEvicted() { return mRequiredSpaceForEvicted; } + size_t GetRequiredSpaceforEvicted() const { return mRequiredSpaceForEvicted; } - virtual ~CircularEventBuffer() = default; + ~CircularEventBuffer() override = default; private: CircularEventBuffer * mpPrev = nullptr; ///< A pointer CircularEventBuffer storing events less important events @@ -349,7 +349,7 @@ class EventManagement * * @return EventNumber most recently vended event Number for that event priority */ - EventNumber GetLastEventNumber() { return mLastEventNumber; } + EventNumber GetLastEventNumber() const { return mLastEventNumber; } /** * @brief @@ -360,7 +360,7 @@ class EventManagement /** * Logger would save last logged event number and initial written event bytes number into schedule event number array */ - void SetScheduledEventInfo(EventNumber & aEventNumber, uint32_t & aInitialWrittenEventBytes); + void SetScheduledEventInfo(EventNumber & aEventNumber, uint32_t & aInitialWrittenEventBytes) const; private: /** diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index f89ada218da0ec..572e9cbb35e833 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -129,7 +129,7 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman /** * The Magic number of this InteractionModelEngine, the magic number is set during Init() */ - uint32_t GetMagicNumber() { return mMagic; } + uint32_t GetMagicNumber() const { return mMagic; } reporting::Engine & GetReportingEngine() { return mReportingEngine; } diff --git a/src/app/MessageDef/Builder.cpp b/src/app/MessageDef/Builder.cpp index e93582412f1922..ef804028566406 100644 --- a/src/app/MessageDef/Builder.cpp +++ b/src/app/MessageDef/Builder.cpp @@ -32,7 +32,7 @@ using namespace chip::TLV; namespace chip { namespace app { -Builder::Builder() : mError(CHIP_ERROR_INCORRECT_STATE), mpWriter(NULL), mOuterContainerType(chip::TLV::kTLVType_NotSpecified) {} +Builder::Builder() : mError(CHIP_ERROR_INCORRECT_STATE), mpWriter(nullptr), mOuterContainerType(chip::TLV::kTLVType_NotSpecified) {} void Builder::Init(chip::TLV::TLVWriter * const apWriter, chip::TLV::TLVType aOuterContainerType) { diff --git a/src/app/OperationalDeviceProxy.cpp b/src/app/OperationalDeviceProxy.cpp index 2ecd1287def89f..4aad213124c966 100644 --- a/src/app/OperationalDeviceProxy.cpp +++ b/src/app/OperationalDeviceProxy.cpp @@ -40,9 +40,23 @@ #include using namespace chip::Callback; +using chip::AddressResolve::NodeLookupRequest; +using chip::AddressResolve::Resolver; +using chip::AddressResolve::ResolveResult; namespace chip { +void OperationalDeviceProxy::MoveToState(State aTargetState) +{ + if (mState != aTargetState) + { + ChipLogDetail(Controller, "OperationalDeviceProxy[" ChipLogFormatX64 ":" ChipLogFormatX64 "]: State change %d --> %d", + ChipLogValueX64(mPeerId.GetCompressedFabricId()), ChipLogValueX64(mPeerId.GetNodeId()), to_underlying(mState), + to_underlying(aTargetState)); + mState = aTargetState; + } +} + CHIP_ERROR OperationalDeviceProxy::Connect(Callback::Callback * onConnection, Callback::Callback * onFailure) { @@ -115,8 +129,8 @@ CHIP_ERROR OperationalDeviceProxy::UpdateDeviceData(const Transport::PeerAddress if (mState == State::NeedsAddress) { - mState = State::Initialized; - err = EstablishConnection(); + MoveToState(State::Initialized); + err = EstablishConnection(); if (err != CHIP_NO_ERROR) { OnSessionEstablishmentError(err); @@ -160,7 +174,7 @@ CHIP_ERROR OperationalDeviceProxy::EstablishConnection() mCASEClient->EstablishSession(mPeerId, mDeviceAddress, mMRPConfig, HandleCASEConnected, HandleCASEConnectionFailure, this); ReturnErrorOnFailure(err); - mState = State::Connecting; + MoveToState(State::Connecting); return CHIP_NO_ERROR; } @@ -219,7 +233,7 @@ void OperationalDeviceProxy::HandleCASEConnectionFailure(void * context, CASECli ChipLogError(Controller, "HandleCASEConnectionFailure was called while the device was not initialized")); VerifyOrReturn(client == device->mCASEClient, ChipLogError(Controller, "HandleCASEConnectionFailure for unknown CASEClient")); - device->mState = State::Initialized; + device->MoveToState(State::Initialized); device->CloseCASESession(); device->DequeueConnectionSuccessCallbacks(/* executeCallback */ false); @@ -244,7 +258,7 @@ void OperationalDeviceProxy::HandleCASEConnected(void * context, CASEClient * cl } else { - device->mState = State::SecureConnected; + device->MoveToState(State::SecureConnected); device->CloseCASESession(); device->DequeueConnectionFailureCallbacks(CHIP_NO_ERROR, /* executeCallback */ false); @@ -261,7 +275,7 @@ CHIP_ERROR OperationalDeviceProxy::Disconnect() { mInitParams.sessionManager->ExpirePairing(mSecureSession.Get()); } - mState = State::Initialized; + MoveToState(State::Initialized); if (mCASEClient) { mInitParams.clientPool->Release(mCASEClient); @@ -273,7 +287,7 @@ CHIP_ERROR OperationalDeviceProxy::Disconnect() void OperationalDeviceProxy::SetConnectedSession(const SessionHandle & handle) { mSecureSession.Grab(handle); - mState = State::SecureConnected; + MoveToState(State::SecureConnected); } void OperationalDeviceProxy::Clear() @@ -284,7 +298,7 @@ void OperationalDeviceProxy::Clear() mCASEClient = nullptr; } - mState = State::Uninitialized; + MoveToState(State::Uninitialized); mInitParams = DeviceProxyInitParams(); } @@ -299,7 +313,7 @@ void OperationalDeviceProxy::CloseCASESession() void OperationalDeviceProxy::OnSessionReleased() { - mState = State::Initialized; + MoveToState(State::Initialized); } CHIP_ERROR OperationalDeviceProxy::ShutdownSubscriptions() @@ -309,6 +323,19 @@ CHIP_ERROR OperationalDeviceProxy::ShutdownSubscriptions() OperationalDeviceProxy::~OperationalDeviceProxy() { + if (mAddressLookupHandle.IsActive()) + { + ChipLogProgress(Discovery, "Cancelling incomplete address resolution as device is being deleted."); + + // Skip cancel callback since the destructor is being called, so we assume that this object is + // obviously not used anymore + CHIP_ERROR err = Resolver::Instance().CancelLookup(mAddressLookupHandle, Resolver::FailureCallback::Skip); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Discovery, "Lookup cancel failed: %" CHIP_ERROR_FORMAT, err.Format()); + } + } + if (mCASEClient) { // Make sure we don't leak it. @@ -318,18 +345,18 @@ OperationalDeviceProxy::~OperationalDeviceProxy() CHIP_ERROR OperationalDeviceProxy::LookupPeerAddress() { - if (mAddressLookupHandle.IsInList()) + if (mAddressLookupHandle.IsActive()) { ChipLogProgress(Discovery, "Operational node lookup already in progress. Will NOT start a new one."); return CHIP_NO_ERROR; } - AddressResolve::NodeLookupRequest request(mPeerId); + NodeLookupRequest request(mPeerId); - return AddressResolve::Resolver::Instance().LookupNode(request, mAddressLookupHandle); + return Resolver::Instance().LookupNode(request, mAddressLookupHandle); } -void OperationalDeviceProxy::OnNodeAddressResolved(const PeerId & peerId, const AddressResolve::ResolveResult & result) +void OperationalDeviceProxy::OnNodeAddressResolved(const PeerId & peerId, const ResolveResult & result) { UpdateDeviceData(result.address, result.mrpConfig); } diff --git a/src/app/OperationalDeviceProxy.h b/src/app/OperationalDeviceProxy.h index 3083fc68408f9f..74806c4a57a4cc 100644 --- a/src/app/OperationalDeviceProxy.h +++ b/src/app/OperationalDeviceProxy.h @@ -88,7 +88,7 @@ class DLL_EXPORT OperationalDeviceProxy : public DeviceProxy, public AddressResolve::NodeListener { public: - virtual ~OperationalDeviceProxy(); + ~OperationalDeviceProxy() override; OperationalDeviceProxy(DeviceProxyInitParams & params, PeerId peerId) : mSecureSession(*this) { VerifyOrReturn(params.Validate() == CHIP_NO_ERROR); @@ -246,6 +246,8 @@ class DLL_EXPORT OperationalDeviceProxy : public DeviceProxy, Transport::PeerAddress mDeviceAddress = Transport::PeerAddress::UDP(Inet::IPAddress::Any); + void MoveToState(State aTargetState); + State mState = State::Uninitialized; SessionHolderWithDelegate mSecureSession; diff --git a/src/app/OperationalDeviceProxyPool.h b/src/app/OperationalDeviceProxyPool.h index cb93c29aebd40d..194c325bf426a4 100644 --- a/src/app/OperationalDeviceProxyPool.h +++ b/src/app/OperationalDeviceProxyPool.h @@ -48,7 +48,7 @@ template class OperationalDeviceProxyPool : public OperationalDeviceProxyPoolDelegate { public: - ~OperationalDeviceProxyPool() { mDevicePool.ReleaseAll(); } + ~OperationalDeviceProxyPool() override { mDevicePool.ReleaseAll(); } OperationalDeviceProxy * Allocate(DeviceProxyInitParams & params, PeerId peerId) override { diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 0595d9bb1e1674..4966a71c93d131 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -904,12 +904,11 @@ bool ReadClient::ResubscribeIfNeeded() ChipLogProgress(DataManagement, "Fail to resubscribe with error %" CHIP_ERROR_FORMAT, err.Format()); return false; } - else - { - ChipLogProgress(DataManagement, - "Will try to Resubscribe to %02x:" ChipLogFormatX64 " at retry index %" PRIu32 " after %" PRIu32 "ms", - mFabricIndex, ChipLogValueX64(mPeerNodeId), mNumRetries, intervalMsec); - } + + ChipLogProgress(DataManagement, + "Will try to Resubscribe to %02x:" ChipLogFormatX64 " at retry index %" PRIu32 " after %" PRIu32 "ms", + mFabricIndex, ChipLogValueX64(mPeerNodeId), mNumRetries, intervalMsec); + return true; } diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index c8f30f359c5350..942d52cb3bd70a 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -202,7 +202,7 @@ class ReadClient : public Messaging::ExchangeDelegate * * OnDone() will not be called. */ - virtual ~ReadClient(); + ~ReadClient() override; /* * This forcibly closes the exchange context if a valid one is pointed to. Such a situation does diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 952d360046c11d..0ef94fd1f80706 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -273,7 +273,7 @@ CHIP_ERROR ReadHandler::OnMessageReceived(Messaging::ExchangeContext * apExchang return err; } -bool ReadHandler::IsFromSubscriber(Messaging::ExchangeContext & apExchangeContext) +bool ReadHandler::IsFromSubscriber(Messaging::ExchangeContext & apExchangeContext) const { return (IsType(InteractionType::Subscribe) && GetInitiatorNodeId() == apExchangeContext.GetSessionHandle()->AsSecureSession()->GetPeerNodeId() && diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index 9b7d84fb965e27..f2c4bfc390ecb4 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -98,7 +98,7 @@ class ReadHandler : public Messaging::ExchangeDelegate * * See Abort() for details on when that might occur. */ - ~ReadHandler(); + ~ReadHandler() override; /** * Process a read/subscribe request. Parts of the processing may end up being asynchronous, but the ReadHandler @@ -126,7 +126,7 @@ class ReadHandler : public Messaging::ExchangeDelegate /** * Returns whether this ReadHandler represents a subscription that was created by the other side of the provided exchange. */ - bool IsFromSubscriber(Messaging::ExchangeContext & apExchangeContext); + bool IsFromSubscriber(Messaging::ExchangeContext & apExchangeContext) const; bool IsReportable() const { return mState == HandlerState::GeneratingReports && !mHoldReport && (mDirty || !mHoldSync); } bool IsGeneratingReports() const { return mState == HandlerState::GeneratingReports; } @@ -145,12 +145,12 @@ class ReadHandler : public Messaging::ExchangeDelegate bool CheckEventClean(EventManagement & aEventManager); bool IsType(InteractionType type) const { return (mInteractionType == type); } - bool IsChunkedReport() { return mIsChunkedReport; } - bool IsPriming() { return mIsPrimingReports; } + bool IsChunkedReport() const { return mIsChunkedReport; } + bool IsPriming() const { return mIsPrimingReports; } bool IsActiveSubscription() const { return mActiveSubscription; } bool IsFabricFiltered() const { return mIsFabricFiltered; } CHIP_ERROR OnSubscribeRequest(Messaging::ExchangeContext * apExchangeContext, System::PacketBufferHandle && aPayload); - void GetSubscriptionId(uint64_t & aSubscriptionId) { aSubscriptionId = mSubscriptionId; } + void GetSubscriptionId(uint64_t & aSubscriptionId) const { aSubscriptionId = mSubscriptionId; } AttributePathExpandIterator * GetAttributePathExpandIterator() { return &mAttributePathExpandIterator; } void SetDirty() { @@ -161,7 +161,7 @@ class ReadHandler : public Messaging::ExchangeDelegate mAttributeEncoderState = AttributeValueEncoder::AttributeEncodeState(); } void ClearDirty() { mDirty = false; } - bool IsDirty() { return mDirty; } + bool IsDirty() const { return mDirty; } NodeId GetInitiatorNodeId() const { return mInitiatorNodeId; } FabricIndex GetAccessingFabricIndex() const { return mSubjectDescriptor.fabricIndex; } @@ -175,7 +175,7 @@ class ReadHandler : public Messaging::ExchangeDelegate const AttributeValueEncoder::AttributeEncodeState & GetAttributeEncodeState() const { return mAttributeEncoderState; } void SetAttributeEncodeState(const AttributeValueEncoder::AttributeEncodeState & aState) { mAttributeEncoderState = aState; } - uint32_t GetLastWrittenEventsBytes() { return mLastWrittenEventsBytes; } + uint32_t GetLastWrittenEventsBytes() const { return mLastWrittenEventsBytes; } CHIP_ERROR SendStatusReport(Protocols::InteractionModel::Status aStatus); private: diff --git a/src/app/TimedHandler.h b/src/app/TimedHandler.h index da0f06bd0a0eac..47faa9d5940946 100644 --- a/src/app/TimedHandler.h +++ b/src/app/TimedHandler.h @@ -51,7 +51,7 @@ class TimedHandler : public Messaging::ExchangeDelegate { public: TimedHandler() {} - virtual ~TimedHandler() {} + ~TimedHandler() override {} // ExchangeDelegate implementation. CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * aExchangeContext, const PayloadHeader & aPayloadHeader, diff --git a/src/app/WriteClient.cpp b/src/app/WriteClient.cpp index 2a162a5291b079..e8f3490b896142 100644 --- a/src/app/WriteClient.cpp +++ b/src/app/WriteClient.cpp @@ -322,10 +322,8 @@ CHIP_ERROR WriteClient::PutPreencodedAttribute(const ConcreteDataAttributePath & } return err; } - else // We are writing a non-list attribute, or we are writing a single element of a list. - { - return PutSinglePreencodedAttributeWritePayload(attributePath, data); - } + // We are writing a non-list attribute, or we are writing a single element of a list. + return PutSinglePreencodedAttributeWritePayload(attributePath, data); } const char * WriteClient::GetStateStr() const diff --git a/src/app/WriteClient.h b/src/app/WriteClient.h index 92b6e98d7f9793..0fd3e8466e1590 100644 --- a/src/app/WriteClient.h +++ b/src/app/WriteClient.h @@ -196,10 +196,8 @@ class WriteClient : public Messaging::ExchangeDelegate attributePath.mClusterId, attributePath.mAttributeId, aDataVersion), value); } - else - { - return EncodeAttribute(attributePath, value.Value()); - } + + return EncodeAttribute(attributePath, value.Value()); } /** @@ -234,7 +232,7 @@ class WriteClient : public Messaging::ExchangeDelegate * * See Abort() for details on when that might occur. */ - virtual ~WriteClient() { Abort(); } + ~WriteClient() override { Abort(); } private: friend class TestWriteInteraction; diff --git a/src/app/WriteHandler.h b/src/app/WriteHandler.h index b38108baf64c78..6b820282cecf79 100644 --- a/src/app/WriteHandler.h +++ b/src/app/WriteHandler.h @@ -76,7 +76,7 @@ class WriteHandler : public Messaging::ExchangeDelegate bool IsFree() const { return mState == State::Uninitialized; } - virtual ~WriteHandler() = default; + ~WriteHandler() override = default; CHIP_ERROR ProcessAttributeDataIBs(TLV::TLVReader & aAttributeDataIBsReader); CHIP_ERROR ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttributeDataIBsReader); diff --git a/src/app/app-platform/ContentAppPlatform.cpp b/src/app/app-platform/ContentAppPlatform.cpp index 588932dc3c83b4..c726167efd30cf 100644 --- a/src/app/app-platform/ContentAppPlatform.cpp +++ b/src/app/app-platform/ContentAppPlatform.cpp @@ -452,11 +452,11 @@ CHIP_ERROR ContentAppPlatform::ManageClientAccess(OperationalDeviceProxy * targe } bindings.push_back(Binding::Structs::TargetStruct::Type{ - .fabricIndex = kUndefinedFabricIndex, .node = MakeOptional(localNodeId), .group = NullOptional, .endpoint = MakeOptional(kLocalVideoPlayerEndpointId), .cluster = MakeOptional(kNoClusterIdSpecified), + .fabricIndex = kUndefinedFabricIndex, }); } @@ -467,11 +467,11 @@ CHIP_ERROR ContentAppPlatform::ManageClientAccess(OperationalDeviceProxy * targe ReturnErrorOnFailure(entry.AddTarget(nullptr, target)); bindings.push_back(Binding::Structs::TargetStruct::Type{ - .fabricIndex = kUndefinedFabricIndex, .node = MakeOptional(localNodeId), .group = NullOptional, .endpoint = MakeOptional(kLocalSpeakerEndpointId), .cluster = MakeOptional(kNoClusterIdSpecified), + .fabricIndex = kUndefinedFabricIndex, }); } @@ -495,11 +495,11 @@ CHIP_ERROR ContentAppPlatform::ManageClientAccess(OperationalDeviceProxy * targe ReturnErrorOnFailure(entry.AddTarget(nullptr, target)); bindings.push_back(Binding::Structs::TargetStruct::Type{ - .fabricIndex = kUndefinedFabricIndex, .node = MakeOptional(localNodeId), .group = NullOptional, .endpoint = MakeOptional(app->GetEndpointId()), .cluster = MakeOptional(kNoClusterIdSpecified), + .fabricIndex = kUndefinedFabricIndex, }); } } diff --git a/src/app/clusters/access-control-server/access-control-server.cpp b/src/app/clusters/access-control-server/access-control-server.cpp index e97f93f5234ffc..19b17d4406093f 100644 --- a/src/app/clusters/access-control-server/access-control-server.cpp +++ b/src/app/clusters/access-control-server/access-control-server.cpp @@ -429,8 +429,8 @@ CHIP_ERROR LogEntryChangedEvent(const AccessControl::Entry & entry, const Access adminPasscodeID.SetNonNull(PAKEKeyIdFromNodeId(subjectDescriptor.subject)); } - AccessControlCluster::Events::AccessControlEntryChanged::Type event{ subjectDescriptor.fabricIndex, adminNodeID, - adminPasscodeID, changeType, latestValue }; + AccessControlCluster::Events::AccessControlEntryChanged::Type event{ adminNodeID, adminPasscodeID, changeType, latestValue, + subjectDescriptor.fabricIndex }; err = LogEvent(event, 0, eventNumber); if (CHIP_NO_ERROR != err) diff --git a/src/app/clusters/bindings/bindings.cpp b/src/app/clusters/bindings/bindings.cpp index e54e2e68759982..d13c1621416716 100644 --- a/src/app/clusters/bindings/bindings.cpp +++ b/src/app/clusters/bindings/bindings.cpp @@ -25,11 +25,9 @@ #include #include #include -#include +#include #include -#include #include - using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; @@ -86,7 +84,7 @@ CHIP_ERROR CheckValidBindingList(const DecodableBindingListType & bindingList, F return CHIP_NO_ERROR; } -void AddBindingEntry(const TargetStructType & entry, EndpointId localEndpoint) +void CreateBindingEntry(const TargetStructType & entry, EndpointId localEndpoint) { EmberBindingTableEntry bindingEntry; @@ -98,18 +96,9 @@ void AddBindingEntry(const TargetStructType & entry, EndpointId localEndpoint) { bindingEntry = EmberBindingTableEntry::ForNode(entry.fabricIndex, entry.node.Value(), localEndpoint, entry.endpoint.Value(), entry.cluster); - CHIP_ERROR err = BindingManager::GetInstance().UnicastBindingCreated(entry.fabricIndex, entry.node.Value()); - if (err != CHIP_NO_ERROR) - { - // Unicast connection failure can happen if peer is offline. We'll retry connection on-demand. - ChipLogProgress( - Zcl, "Binding: Failed to create session for unicast binding to device " ChipLogFormatX64 ": %" CHIP_ERROR_FORMAT, - ChipLogValueX64(entry.node.Value()), err.Format()); - } } - BindingTable::GetInstance().Add(bindingEntry); - BindingManager::GetInstance().NotifyBindingAdded(bindingEntry); + AddBindingEntry(bindingEntry); } CHIP_ERROR BindingTableAccess::Read(const ConcreteReadAttributePath & path, AttributeValueEncoder & encoder) @@ -132,22 +121,22 @@ CHIP_ERROR BindingTableAccess::ReadBindingTable(EndpointId endpoint, AttributeVa if (entry.local == endpoint && entry.type == EMBER_UNICAST_BINDING) { Binding::Structs::TargetStruct::Type value = { - .fabricIndex = entry.fabricIndex, .node = MakeOptional(entry.nodeId), .group = NullOptional, .endpoint = MakeOptional(entry.remote), .cluster = entry.clusterId, + .fabricIndex = entry.fabricIndex, }; ReturnErrorOnFailure(subEncoder.Encode(value)); } else if (entry.local == endpoint && entry.type == EMBER_MULTICAST_BINDING) { Binding::Structs::TargetStruct::Type value = { - .fabricIndex = entry.fabricIndex, .node = NullOptional, .group = MakeOptional(entry.groupId), .endpoint = NullOptional, .cluster = entry.clusterId, + .fabricIndex = entry.fabricIndex, }; ReturnErrorOnFailure(subEncoder.Encode(value)); } @@ -200,7 +189,7 @@ CHIP_ERROR BindingTableAccess::WriteBindingTable(const ConcreteDataAttributePath auto iter = newBindingList.begin(); while (iter.Next()) { - AddBindingEntry(iter.GetValue(), path.mEndpointId); + CreateBindingEntry(iter.GetValue(), path.mEndpointId); } return CHIP_NO_ERROR; } @@ -212,7 +201,7 @@ CHIP_ERROR BindingTableAccess::WriteBindingTable(const ConcreteDataAttributePath { return CHIP_IM_GLOBAL_STATUS(ConstraintError); } - AddBindingEntry(target, path.mEndpointId); + CreateBindingEntry(target, path.mEndpointId); return CHIP_NO_ERROR; } return CHIP_IM_GLOBAL_STATUS(UnsupportedWrite); @@ -223,3 +212,21 @@ void MatterBindingPluginServerInitCallback() { registerAttributeAccessOverride(&gAttrAccess); } + +void AddBindingEntry(const EmberBindingTableEntry & entry) +{ + if (entry.type == EMBER_UNICAST_BINDING) + { + CHIP_ERROR err = BindingManager::GetInstance().UnicastBindingCreated(entry.fabricIndex, entry.nodeId); + if (err != CHIP_NO_ERROR) + { + // Unicast connection failure can happen if peer is offline. We'll retry connection on-demand. + ChipLogProgress( + Zcl, "Binding: Failed to create session for unicast binding to device " ChipLogFormatX64 ": %" CHIP_ERROR_FORMAT, + ChipLogValueX64(entry.nodeId), err.Format()); + } + } + + BindingTable::GetInstance().Add(entry); + BindingManager::GetInstance().NotifyBindingAdded(entry); +} diff --git a/src/app/clusters/bindings/bindings.h b/src/app/clusters/bindings/bindings.h new file mode 100644 index 00000000000000..3d6d773cdbcd8c --- /dev/null +++ b/src/app/clusters/bindings/bindings.h @@ -0,0 +1,31 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include + +/** + * @brief appends a binding to the list of bindings + * This function is to be used when a device wants to add a binding to its own table + * If entry is a unicast binding, BindingManager will be notified and will establish a case session with the peer device + * Entry will be added to the binding table and persisted into storage + * BindingManager will be notified and the binding added callback will be called if it has been set + * + * @param entry binding to add + */ +void AddBindingEntry(const EmberBindingTableEntry & entry); diff --git a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp index 6001f601142487..c46cfdd603fe21 100644 --- a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp +++ b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp @@ -32,6 +32,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -131,6 +132,7 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * const app::ConcreteCommandPath & commandPath, const Commands::ArmFailSafe::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("ArmFailSafe", "GeneralCommissioning"); FailSafeContext & failSafeContext = DeviceLayer::DeviceControlServer::DeviceControlSvr().GetFailSafeContext(); Commands::ArmFailSafeResponse::Type response; @@ -162,6 +164,7 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback( app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::CommissioningComplete::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("CommissioningComplete", "GeneralCommissioning"); DeviceControlServer * server = &DeviceLayer::DeviceControlServer::DeviceControlSvr(); /* @@ -184,6 +187,7 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH const app::ConcreteCommandPath & commandPath, const Commands::SetRegulatoryConfig::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("SetRegulatoryConfig", "GeneralCommissioning"); DeviceControlServer * server = &DeviceLayer::DeviceControlServer::DeviceControlSvr(); CheckSuccess(server->SetRegulatoryConfig(to_underlying(commandData.location), commandData.countryCode, commandData.breadcrumb), diff --git a/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp b/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp index ddc6891a526e9e..35bb53403295ef 100644 --- a/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp +++ b/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp @@ -166,9 +166,11 @@ class GroupKeyManagementAttributeAccess : public AttributeAccessInterface GroupDataProvider::GroupKey mapping; while (iter->Next(mapping)) { - GroupKeyManagement::Structs::GroupKeyMapStruct::Type key = { .fabricIndex = fabric_index, - .groupId = mapping.group_id, - .groupKeySetID = mapping.keyset_id }; + GroupKeyManagement::Structs::GroupKeyMapStruct::Type key = { + .groupId = mapping.group_id, + .groupKeySetID = mapping.keyset_id, + .fabricIndex = fabric_index, + }; encoder.Encode(key); } iter->Release(); diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index e1ee0ac79775cc..fb3ff2b8a63246 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -27,6 +27,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -86,7 +87,7 @@ CHIP_ERROR Instance::Init() VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); ReturnErrorOnFailure( DeviceLayer::PlatformMgrImpl().AddEventHandler(_OnCommissioningComplete, reinterpret_cast(this))); - ReturnErrorOnFailure(mpBaseDriver->Init()); + ReturnErrorOnFailure(mpBaseDriver->Init(this)); mLastNetworkingStatusValue.SetNull(); mLastConnectErrorValue.SetNull(); mLastNetworkIDLen = 0; @@ -239,9 +240,37 @@ CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeVal } } -void Instance::HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetworks::DecodableType & req) +void Instance::OnNetworkingStatusChange(DeviceLayer::NetworkCommissioning::Status aCommissioningError, + Optional aNetworkId, Optional aConnectStatus) { + if (aNetworkId.HasValue() && aNetworkId.Value().size() > kMaxNetworkIDLen) + { + ChipLogError(DeviceLayer, "Invalid network id received when calling OnNetworkingStatusChange"); + return; + } + mLastNetworkingStatusValue.SetNonNull(ToClusterObjectEnum(aCommissioningError)); + if (aNetworkId.HasValue()) + { + memcpy(mLastNetworkID, aNetworkId.Value().data(), aNetworkId.Value().size()); + mLastNetworkIDLen = static_cast(aNetworkId.Value().size()); + } + else + { + mLastNetworkIDLen = 0; + } + if (aConnectStatus.HasValue()) + { + mLastConnectErrorValue.SetNonNull(aConnectStatus.Value()); + } + else + { + mLastConnectErrorValue.SetNull(); + } +} +void Instance::HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetworks::DecodableType & req) +{ + MATTER_TRACE_EVENT_SCOPE("HandleScanNetwork", "NetworkCommissioning"); if (mFeatureFlags.Has(NetworkCommissioningFeature::kWiFiNetworkInterface)) { mAsyncCommandHandle = CommandHandler::Handle(&ctx.mCommandHandler); @@ -260,6 +289,7 @@ void Instance::HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetw void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req) { + MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning"); Commands::NetworkConfigResponse::Type response; response.networkingStatus = ToClusterObjectEnum(mpDriver.Get()->AddOrUpdateNetwork(req.ssid, req.credentials)); ctx.mCommandHandler.AddResponseData(ctx.mRequestPath, response); @@ -267,6 +297,7 @@ void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req) { + MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning"); Commands::NetworkConfigResponse::Type response; response.networkingStatus = ToClusterObjectEnum(mpDriver.Get()->AddOrUpdateNetwork(req.operationalDataset)); ctx.mCommandHandler.AddResponseData(ctx.mRequestPath, response); @@ -274,6 +305,7 @@ void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Comman void Instance::HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveNetwork::DecodableType & req) { + MATTER_TRACE_EVENT_SCOPE("HandleRemoveNetwork", "NetworkCommissioning"); Commands::NetworkConfigResponse::Type response; response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->RemoveNetwork(req.networkID)); ctx.mCommandHandler.AddResponseData(ctx.mRequestPath, response); @@ -281,6 +313,7 @@ void Instance::HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveN void Instance::HandleConnectNetwork(HandlerContext & ctx, const Commands::ConnectNetwork::DecodableType & req) { + MATTER_TRACE_EVENT_SCOPE("HandleConnectNetwork", "NetworkCommissioning"); if (req.networkID.size() > DeviceLayer::NetworkCommissioning::kMaxNetworkIDLen) { ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::InvalidValue); @@ -296,6 +329,7 @@ void Instance::HandleConnectNetwork(HandlerContext & ctx, const Commands::Connec void Instance::HandleReorderNetwork(HandlerContext & ctx, const Commands::ReorderNetwork::DecodableType & req) { + MATTER_TRACE_EVENT_SCOPE("HandleReorderNetwork", "NetworkCommissioning"); Commands::NetworkConfigResponse::Type response; response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->ReorderNetwork(req.networkID, req.networkIndex)); ctx.mCommandHandler.AddResponseData(ctx.mRequestPath, response); @@ -321,7 +355,15 @@ void Instance::OnResult(Status commissioningError, CharSpan errorText, int32_t i mLastNetworkIDLen = mConnectingNetworkIDLen; memcpy(mLastNetworkID, mConnectingNetworkID, mLastNetworkIDLen); mLastNetworkingStatusValue.SetNonNull(ToClusterObjectEnum(commissioningError)); - mLastConnectErrorValue.SetNonNull(interfaceStatus); + + if (commissioningError == Status::kSuccess) + { + mLastConnectErrorValue.SetNull(); + } + else + { + mLastConnectErrorValue.SetNonNull(interfaceStatus); + } if (commissioningError == Status::kSuccess) { diff --git a/src/app/clusters/network-commissioning/network-commissioning.h b/src/app/clusters/network-commissioning/network-commissioning.h index 40dfab985a7ec2..7678765460e972 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.h +++ b/src/app/clusters/network-commissioning/network-commissioning.h @@ -36,6 +36,7 @@ namespace NetworkCommissioning { // TODO: Use macro to disable some wifi or thread class Instance : public CommandHandlerInterface, public AttributeAccessInterface, + public DeviceLayer::NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback, public DeviceLayer::NetworkCommissioning::Internal::WirelessDriver::ConnectCallback, public DeviceLayer::NetworkCommissioning::WiFiDriver::ScanCallback, public DeviceLayer::NetworkCommissioning::ThreadDriver::ScanCallback @@ -54,6 +55,10 @@ class Instance : public CommandHandlerInterface, CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; + // BaseDriver::NetworkStatusChangeCallback + void OnNetworkingStatusChange(DeviceLayer::NetworkCommissioning::Status aCommissioningError, Optional aNetworkId, + Optional aConnectStatus) override; + // WirelessDriver::ConnectCallback void OnResult(DeviceLayer::NetworkCommissioning::Status commissioningError, CharSpan errorText, int32_t interfaceStatus) override; @@ -84,8 +89,9 @@ class Instance : public CommandHandlerInterface, // Last* attributes // Setting these values don't have to care about parallel requests, since we will reject other requests when there is another // request ongoing. + // These values can be updated via OnNetworkingStatusChange callback, ScanCallback::OnFinished and ConnectCallback::OnResult. DataModel::Nullable mLastNetworkingStatusValue; - DataModel::Nullable mLastConnectErrorValue; + Attributes::LastConnectErrorValue::TypeInfo::Type mLastConnectErrorValue; uint8_t mConnectingNetworkID[DeviceLayer::NetworkCommissioning::kMaxNetworkIDLen]; uint8_t mConnectingNetworkIDLen = 0; uint8_t mLastNetworkID[DeviceLayer::NetworkCommissioning::kMaxNetworkIDLen]; diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 9ef192c645c184..e83c150a632196 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -49,6 +49,7 @@ #include #include #include +#include using namespace chip; using namespace ::chip::DeviceLayer; @@ -262,6 +263,57 @@ FabricInfo * RetrieveCurrentFabric(CommandHandler * aCommandHandler) return Server::GetInstance().GetFabricTable().FindFabricWithIndex(index); } +void FailSafeCleanup(const chip::DeviceLayer::ChipDeviceEvent * event) +{ + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Call to FailSafeCleanup"); + + FabricIndex fabricIndex = event->CommissioningComplete.PeerFabricIndex; + + // If an AddNOC or UpdateNOC command has been successfully invoked, terminate all CASE sessions associated with the Fabric + // whose Fabric Index is recorded in the Fail-Safe context (see ArmFailSafe Command) by clearing any associated Secure + // Session Context at the Server. + if (event->CommissioningComplete.AddNocCommandHasBeenInvoked || event->CommissioningComplete.UpdateNocCommandHasBeenInvoked) + { + CASESessionManager * caseSessionManager = Server::GetInstance().GetCASESessionManager(); + if (caseSessionManager) + { + FabricInfo * fabricInfo = Server::GetInstance().GetFabricTable().FindFabricWithIndex(fabricIndex); + VerifyOrReturn(fabricInfo != nullptr); + + caseSessionManager->ReleaseSessionsForFabric(fabricInfo->GetCompressedId()); + } + + Server::GetInstance().GetSecureSessionManager().ExpireAllPairingsForFabric(fabricIndex); + } + + // If an AddNOC command had been successfully invoked, achieve the equivalent effect of invoking the RemoveFabric command + // against the Fabric Index stored in the Fail-Safe Context for the Fabric Index that was the subject of the AddNOC + // command. + if (event->CommissioningComplete.AddNocCommandHasBeenInvoked) + { + Server::GetInstance().GetFabricTable().Delete(fabricIndex); + } + + // If an UpdateNOC command had been successfully invoked, revert the state of operational key pair, NOC and ICAC for that + // Fabric to the state prior to the Fail-Safe timer being armed, for the Fabric Index that was the subject of the UpdateNOC + // command. + if (event->CommissioningComplete.UpdateNocCommandHasBeenInvoked) + { + // TODO: Revert the state of operational key pair, NOC and ICAC + } +} + +void OnPlatformEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg) +{ + if (event->Type == DeviceLayer::DeviceEventType::kCommissioningComplete) + { + if (event->CommissioningComplete.Status != CHIP_NO_ERROR) + { + FailSafeCleanup(event); + } + } +} + } // anonymous namespace // As per specifications section 11.22.5.1. Constant RESP_MAX @@ -340,6 +392,8 @@ void MatterOperationalCredentialsPluginServerInitCallback(void) registerAttributeAccessOverride(&gAttrAccess); Server::GetInstance().GetFabricTable().AddFabricDelegate(&gFabricDelegate); + + DeviceLayer::PlatformMgrImpl().AddEventHandler(OnPlatformEventHandler); } namespace { @@ -368,6 +422,7 @@ bool emberAfOperationalCredentialsClusterRemoveFabricCallback(app::CommandHandle const app::ConcreteCommandPath & commandPath, const Commands::RemoveFabric::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("RemoveFabric", "OperationalCredentials"); auto & fabricBeingRemoved = commandData.fabricIndex; emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: RemoveFabric"); // TODO: Generate emberAfFabricClusterPrintln @@ -425,6 +480,7 @@ bool emberAfOperationalCredentialsClusterUpdateFabricLabelCallback(app::CommandH const app::ConcreteCommandPath & commandPath, const Commands::UpdateFabricLabel::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("UpdateFabricLabel", "OperationalCredentials"); auto & Label = commandData.label; auto ourFabricIndex = commandObj->GetAccessingFabricIndex(); @@ -521,6 +577,7 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co const app::ConcreteCommandPath & commandPath, const Commands::AddNOC::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("AddNOC", "OperationalCredentials"); auto & NOCValue = commandData.NOCValue; auto & ICACValue = commandData.ICACValue; auto & adminVendorId = commandData.adminVendorId; @@ -595,7 +652,7 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co // The Fabric Index associated with the armed fail-safe context SHALL be updated to match the Fabric // Index just allocated. - failSafeContext.SetNocCommandInvoked(fabricIndex); + failSafeContext.SetAddNocCommandInvoked(fabricIndex); exit: @@ -618,6 +675,7 @@ bool emberAfOperationalCredentialsClusterUpdateNOCCallback(app::CommandHandler * const app::ConcreteCommandPath & commandPath, const Commands::UpdateNOC::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("UpdateNOC", "OperationalCredentials"); auto & NOCValue = commandData.NOCValue; auto & ICACValue = commandData.ICACValue; @@ -661,7 +719,7 @@ bool emberAfOperationalCredentialsClusterUpdateNOCCallback(app::CommandHandler * // The Fabric Index associated with the armed fail-safe context SHALL be updated to match the Fabric // Index associated with the UpdateNOC command being invoked. - failSafeContext.SetNocCommandInvoked(fabricIndex); + failSafeContext.SetUpdateNocCommandInvoked(fabricIndex); exit: @@ -683,6 +741,7 @@ bool emberAfOperationalCredentialsClusterCertificateChainRequestCallback( app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::CertificateChainRequest::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("CertificateChainRequest", "OperationalCredentials"); auto & certificateType = commandData.certificateType; CHIP_ERROR err = CHIP_NO_ERROR; @@ -730,6 +789,7 @@ bool emberAfOperationalCredentialsClusterAttestationRequestCallback(app::Command const app::ConcreteCommandPath & commandPath, const Commands::AttestationRequest::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("AttestationRequest", "OperationalCredentials"); auto & attestationNonce = commandData.attestationNonce; CHIP_ERROR err = CHIP_NO_ERROR; @@ -790,6 +850,7 @@ bool emberAfOperationalCredentialsClusterCSRRequestCallback(app::CommandHandler const app::ConcreteCommandPath & commandPath, const Commands::CSRRequest::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("CSRRequest", "OperationalCredentials"); emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: commissioner has requested a CSR"); CHIP_ERROR err = CHIP_NO_ERROR; @@ -879,6 +940,7 @@ bool emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback( app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::AddTrustedRootCertificate::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("AddTrustedRootCertificate", "OperationalCredentials"); auto & RootCertificate = commandData.rootCertificate; EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; @@ -917,6 +979,7 @@ bool emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback( app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::RemoveTrustedRootCertificate::DecodableType & commandData) { + MATTER_TRACE_EVENT_SCOPE("RemoveTrustedRootCertificate", "OperationalCredentials"); // TODO: Implement the logic for RemoveTrustedRootCertificate EmberAfStatus status = EMBER_ZCL_STATUS_FAILURE; emberAfSendImmediateDefaultResponse(status); diff --git a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp index f278dfb1ab40e2..7f0cda72eeaa3f 100644 --- a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp +++ b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp @@ -23,11 +23,14 @@ // // This particular implementation of the OTARequestorDriver makes the following choices: // - Only a single timer can be active at any given moment -// - The default provider timer is running if and only if there is no update in progress (the OTARequestor +// - The periodic query timer is running if and only if there is no update in progress (the OTARequestor // UpdateState is kIdle) // - AnnounceOTAProviders command is ignored if an update is in progress // - The provider location passed in AnnounceOTAProviders is used in a single query (possibly retried) and then discarded // - Explicitly triggering a query through TriggerImmediateQuery() cancels any in-progress update +// - A QueryImage call results in the driver iterating through the list of default OTA providers, from beginning to the end, until a +// provider successfully transfers the OTA image. If a provider is busy, it will be retried a set number of times before moving +// to the next available one. If all else fails, the periodic query timer is kicked off again. #include #include @@ -55,8 +58,9 @@ GenericOTARequestorDriver * ToDriver(void * context) void GenericOTARequestorDriver::Init(OTARequestorInterface * requestor, OTAImageProcessorInterface * processor) { - mRequestor = requestor; - mImageProcessor = processor; + mRequestor = requestor; + mImageProcessor = processor; + mProviderRetryCount = 0; if (mImageProcessor->IsFirstImageRun()) { @@ -117,7 +121,7 @@ void GenericOTARequestorDriver::HandleIdleState(IdleStateReason reason) break; case IdleStateReason::kInvalidSession: // An invalid session is detected which may be temporary so try to query the same provider again - DeviceLayer::SystemLayer().ScheduleLambda([this] { mRequestor->TriggerImmediateQueryInternal(); }); + SendQueryImage(); break; } } @@ -146,14 +150,21 @@ void GenericOTARequestorDriver::UpdateNotFound(UpdateNotFoundReason reason, Syst break; case UpdateNotFoundReason::kBusy: willTryAnotherQuery = true; - break; + if (mProviderRetryCount <= kMaxBusyProviderRetryCount) + { + break; + } + ChipLogProgress(SoftwareUpdate, "Max Busy Provider retries reached. Attempting to get next Provider."); + __attribute__((fallthrough)); // fallthrough case UpdateNotFoundReason::kNotAvailable: { // IMPLEMENTATION CHOICE: // This implementation schedules a query only if a different provider is available - Optional lastUsedProvider; - mRequestor->GetProviderLocation(lastUsedProvider); - if ((GetNextProviderLocation(providerLocation) != true) || - (lastUsedProvider.HasValue() && ProviderLocationsEqual(providerLocation, lastUsedProvider.Value()))) + // Note that the "listExhausted" being set to TRUE, implies that the entire list of + // defaultOTAProviders has been traversed. On bootup, the last provider is reset + // which ensures that every QueryImage call will ensure that the list is traversed from + // start to end, until an OTA is successfully completed. + bool listExhausted = false; + if ((GetNextProviderLocation(providerLocation, listExhausted) != true) || (listExhausted == true)) { willTryAnotherQuery = false; } @@ -164,9 +175,6 @@ void GenericOTARequestorDriver::UpdateNotFound(UpdateNotFoundReason reason, Syst } break; } - default: - willTryAnotherQuery = false; - break; } if (delay < kDefaultDelayedActionTime) @@ -182,6 +190,7 @@ void GenericOTARequestorDriver::UpdateNotFound(UpdateNotFoundReason reason, Syst else { ChipLogProgress(SoftwareUpdate, "UpdateNotFound, not scheduling further retries"); + StartDefaultProviderTimer(); } } @@ -295,7 +304,22 @@ void GenericOTARequestorDriver::ProcessAnnounceOTAProviders( void GenericOTARequestorDriver::SendQueryImage() { - + Optional lastUsedProvider; + mRequestor->GetProviderLocation(lastUsedProvider); + if (!lastUsedProvider.HasValue()) + { + ProviderLocationType providerLocation; + bool listExhausted = false; + if (GetNextProviderLocation(providerLocation, listExhausted) == true) + { + mRequestor->SetCurrentProviderLocation(providerLocation); + } + else + { + ChipLogProgress(SoftwareUpdate, "No provider available"); + return; + } + } // IMPLEMENTATION CHOICE // In this implementation explicitly triggering a query cancels any in-progress update. UpdateCancelled(); @@ -304,6 +328,8 @@ void GenericOTARequestorDriver::SendQueryImage() // TriggerImmediateQueryInternal() will cause the state to change from kIdle StopDefaultProviderTimer(); + mProviderRetryCount++; + DeviceLayer::SystemLayer().ScheduleLambda([this] { mRequestor->TriggerImmediateQueryInternal(); }); } @@ -313,7 +339,8 @@ void GenericOTARequestorDriver::DefaultProviderTimerHandler(System::Layer * syst // Determine which provider to query next ProviderLocationType providerLocation; - if (GetNextProviderLocation(providerLocation) != true) + bool listExhausted = false; + if (GetNextProviderLocation(providerLocation, listExhausted) != true) { StartDefaultProviderTimer(); return; @@ -328,7 +355,6 @@ void GenericOTARequestorDriver::StartDefaultProviderTimer() { ChipLogProgress(SoftwareUpdate, "Starting the Default Provider timer, timeout: %u seconds", (unsigned int) mPeriodicQueryTimeInterval); - ScheduleDelayedAction( System::Clock::Seconds32(mPeriodicQueryTimeInterval), [](System::Layer *, void * context) { @@ -352,10 +378,12 @@ void GenericOTARequestorDriver::StopDefaultProviderTimer() * circular list and return the next value (based on the last used provider). If the list of DefaultOtaProviders is empty, FALSE is * returned. */ -bool GenericOTARequestorDriver::GetNextProviderLocation(ProviderLocationType & providerLocation) +bool GenericOTARequestorDriver::GetNextProviderLocation(ProviderLocationType & providerLocation, bool & listExhausted) { Optional lastUsedProvider; mRequestor->GetProviderLocation(lastUsedProvider); + mProviderRetryCount = 0; // Reset provider retry count + listExhausted = false; // Iterate through the default providers list and find the last used provider. If found, return the provider after it auto iterator = mRequestor->GetDefaultOTAProviderListIterator(); @@ -376,6 +404,7 @@ bool GenericOTARequestorDriver::GetNextProviderLocation(ProviderLocationType & p if (iterator.Next()) { providerLocation = iterator.GetValue(); + listExhausted = true; return true; } else diff --git a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.h b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.h index 5fe392fd4e6516..5b2e51762ea0c3 100644 --- a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.h +++ b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.h @@ -68,7 +68,7 @@ class GenericOTARequestorDriver : public OTARequestorDriver void ProcessAnnounceOTAProviders(const ProviderLocationType & providerLocation, app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason announcementReason) override; void SendQueryImage() override; - bool GetNextProviderLocation(ProviderLocationType & providerLocation) override; + bool GetNextProviderLocation(ProviderLocationType & providerLocation, bool & listExhausted) override; protected: void StartDefaultProviderTimer(); @@ -82,6 +82,9 @@ class GenericOTARequestorDriver : public OTARequestorDriver OTAImageProcessorInterface * mImageProcessor = nullptr; uint32_t mOtaStartDelaySec = 0; uint32_t mPeriodicQueryTimeInterval = (24 * 60 * 60); // Timeout for querying providers on the default OTA provider list + // Maximum number of times to retry a BUSY OTA provider before moving to the next available one + static constexpr uint8_t kMaxBusyProviderRetryCount = 3; + uint8_t mProviderRetryCount; // Track retry count for the current provider }; } // namespace DeviceLayer diff --git a/src/app/clusters/ota-requestor/OTARequestor.cpp b/src/app/clusters/ota-requestor/OTARequestor.cpp index 29b8efc03a3234..059c590f035fbd 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.cpp +++ b/src/app/clusters/ota-requestor/OTARequestor.cpp @@ -475,7 +475,8 @@ void OTARequestor::TriggerImmediateQueryInternal() OTARequestorInterface::OTATriggerResult OTARequestor::TriggerImmediateQuery() { ProviderLocationType providerLocation; - if (mOtaRequestorDriver->GetNextProviderLocation(providerLocation) != true) + bool listExhausted = false; + if (mOtaRequestorDriver->GetNextProviderLocation(providerLocation, listExhausted) != true) { ChipLogError(SoftwareUpdate, "No OTA Providers available"); return kNoProviderKnown; @@ -787,6 +788,8 @@ CHIP_ERROR OTARequestor::SendNotifyUpdateAppliedRequest(OperationalDeviceProxy & Controller::OtaSoftwareUpdateProviderCluster cluster; cluster.Associate(&deviceProxy, mProviderLocation.Value().endpoint); + mProviderLocation.ClearValue(); // Clearing the last used provider location to start afresh on reboot + return cluster.InvokeCommand(args, this, OnNotifyUpdateAppliedResponse, OnNotifyUpdateAppliedFailure); } diff --git a/src/app/clusters/ota-requestor/OTARequestor.h b/src/app/clusters/ota-requestor/OTARequestor.h index 47ca0fe7c4bd9e..7ac6d08a0bae8b 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.h +++ b/src/app/clusters/ota-requestor/OTARequestor.h @@ -130,7 +130,6 @@ class OTARequestor : public OTARequestorInterface, public BDXDownloader::StateDe mUpdateToken = updateToken; } - // Schedule the initializations that needs to be performed in the CHIP context DeviceLayer::PlatformMgr().ScheduleWork(InitState, reinterpret_cast(this)); @@ -333,7 +332,10 @@ class OTARequestor : public OTARequestorInterface, public BDXDownloader::StateDe OTAUpdateStateEnum mCurrentUpdateState = OTAUpdateStateEnum::kUnknown; Server * mServer = nullptr; ProviderLocationList mDefaultOtaProviderList; - Optional mProviderLocation; // Provider location used for the current/last update in progress + // Provider location used for the current/last update in progress. Note that on reboot, this value will be read from the + // persistent storage (if available), used for sending the NotifyApplied message, and then cleared. This will ensure determinism + // in the OTARequestorDriver on reboot. + Optional mProviderLocation; }; } // namespace chip diff --git a/src/app/clusters/ota-requestor/OTARequestorDriver.h b/src/app/clusters/ota-requestor/OTARequestorDriver.h index 40c8af5a37d399..fe2e52fabb3788 100644 --- a/src/app/clusters/ota-requestor/OTARequestorDriver.h +++ b/src/app/clusters/ota-requestor/OTARequestorDriver.h @@ -128,7 +128,9 @@ class OTARequestorDriver // Driver picks the OTA Provider that should be used for the next query and update. The Provider is picked according to // the driver's internal logic such as, for example, traversing the default providers list. // Returns true if there is a Provider available for the next query, returns false otherwise. - virtual bool GetNextProviderLocation(ProviderLocationType & providerLocation) = 0; + // [in] listExhausted - set to TRUE if the list of providers has been traversed until the end and has looped + // back to the beginning. + virtual bool GetNextProviderLocation(ProviderLocationType & providerLocation, bool & listExhausted) = 0; }; } // namespace chip diff --git a/src/app/data-model/DecodableList.h b/src/app/data-model/DecodableList.h index a620f0ad36d7b9..d06332ab84f8a5 100644 --- a/src/app/data-model/DecodableList.h +++ b/src/app/data-model/DecodableList.h @@ -134,10 +134,8 @@ class DecodableList { return CHIP_NO_ERROR; } - else - { - return mStatus; - } + + return mStatus; } private: @@ -194,10 +192,8 @@ class DecodableList *size = 0; return CHIP_NO_ERROR; } - else - { - return mReader.CountRemainingInContainer(size); - } + + return mReader.CountRemainingInContainer(size); } CHIP_ERROR Decode(TLV::TLVReader & reader) diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index 1e4f7eb9942404..557f6f185ae5d7 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -763,10 +763,9 @@ CHIP_ERROR Engine::ScheduleEventDelivery(ConcreteEventPath & aPath, uint32_t aBy ChipLogDetail(DataManagement, "urgent event schedule run"); return ScheduleRun(); } - else - { - return ScheduleBufferPressureEventDelivery(aBytesWritten); - } + + return ScheduleBufferPressureEventDelivery(aBytesWritten); + return CHIP_NO_ERROR; } diff --git a/src/app/reporting/Engine.h b/src/app/reporting/Engine.h index c29f100d0e5ac2..3ed8512dad8b47 100644 --- a/src/app/reporting/Engine.h +++ b/src/app/reporting/Engine.h @@ -118,7 +118,7 @@ class Engine } } - uint32_t GetNumReportsInFlight() { return mNumReportsInFlight; } + uint32_t GetNumReportsInFlight() const { return mNumReportsInFlight; } void ScheduleUrgentEventDeliverySync(); diff --git a/src/app/server/Dnssd.cpp b/src/app/server/Dnssd.cpp index f6df0e0fe444af..f2804f0908d637 100644 --- a/src/app/server/Dnssd.cpp +++ b/src/app/server/Dnssd.cpp @@ -321,6 +321,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi advertiseParameters.SetMac(mac); uint16_t value; + uint32_t val32; if (DeviceLayer::ConfigurationMgr().GetVendorId(value) != CHIP_NO_ERROR) { ChipLogProgress(Discovery, "Vendor ID not known"); @@ -356,9 +357,9 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi .SetLongDiscriminator(discriminator); if (DeviceLayer::ConfigurationMgr().IsCommissionableDeviceTypeEnabled() && - DeviceLayer::ConfigurationMgr().GetDeviceTypeId(value) == CHIP_NO_ERROR) + DeviceLayer::ConfigurationMgr().GetDeviceTypeId(val32) == CHIP_NO_ERROR) { - advertiseParameters.SetDeviceType(chip::Optional::Value(value)); + advertiseParameters.SetDeviceType(chip::Optional::Value(val32)); } char deviceName[chip::Dnssd::kKeyDeviceNameMaxLength + 1]; diff --git a/src/app/server/Dnssd.h b/src/app/server/Dnssd.h index c396fa5964b72d..efc7b86ea5ce08 100644 --- a/src/app/server/Dnssd.h +++ b/src/app/server/Dnssd.h @@ -45,13 +45,13 @@ class DLL_EXPORT DnssdServer void SetSecuredPort(uint16_t port) { mSecuredPort = port; } /// Gets the secure Matter port - uint16_t GetSecuredPort() { return mSecuredPort; } + uint16_t GetSecuredPort() const { return mSecuredPort; } /// Sets the unsecure Matter port void SetUnsecuredPort(uint16_t port) { mUnsecuredPort = port; } /// Gets the unsecure Matter port - uint16_t GetUnsecuredPort() { return mUnsecuredPort; } + uint16_t GetUnsecuredPort() const { return mUnsecuredPort; } /// Sets the interface id used for advertising void SetInterfaceId(Inet::InterfaceId interfaceId) { mInterfaceId = interfaceId; } @@ -63,7 +63,7 @@ class DLL_EXPORT DnssdServer void SetDiscoveryTimeoutSecs(int16_t secs) { mDiscoveryTimeoutSecs = secs; } /// Gets the factory-new state commissionable node discovery timeout - int16_t GetDiscoveryTimeoutSecs() { return mDiscoveryTimeoutSecs; } + int16_t GetDiscoveryTimeoutSecs() const { return mDiscoveryTimeoutSecs; } // // Override the referenced fabric table from the default that is present diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 229b4786c648a0..949affe999294d 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -197,6 +197,8 @@ CHIP_ERROR Server::Init(AppDelegate * delegate, uint16_t secureServicePort, uint err = chip::app::InteractionModelEngine::GetInstance()->Init(&mExchangeMgr); SuccessOrExit(err); + chip::Dnssd::Resolver::Instance().Init(DeviceLayer::UDPEndPointManager()); + #if CHIP_CONFIG_ENABLE_SERVER_IM_EVENT // Initialize event logging subsystem { diff --git a/src/app/server/Server.h b/src/app/server/Server.h index e108629c87f694..0b717ce7cca056 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -122,11 +122,9 @@ class Server { return CHIP_ERROR_INVALID_ARGUMENT; } - else - { - // When size is zero, let's give a non-nullptr to the KVS backend - buffer = &emptyPlaceholder; - } + + // When size is zero, let's give a non-nullptr to the KVS backend + buffer = &emptyPlaceholder; } size_t bytesRead = 0; diff --git a/src/app/tests/TestAttributeValueEncoder.cpp b/src/app/tests/TestAttributeValueEncoder.cpp index 4363582c29cb2a..e063e0e888ac0e 100644 --- a/src/app/tests/TestAttributeValueEncoder.cpp +++ b/src/app/tests/TestAttributeValueEncoder.cpp @@ -294,8 +294,8 @@ void TestEncodeFabricScoped(nlTestSuite * aSuite, void * aContext) 0x34, 0x05, // Tag (05) Null 0x18, // End of container (attribute path) 0x35, 0x02, // Tag 02 (attribute data) - 0x24, 0x00, 0x01, // Tag 0, UINT8 Value 1 (fabric index) 0x30, 0x01, 0x00, // Tag 1, OCTET_STRING length 0 (data) + 0x24, 0xFE, 0x01, // Tag 0xFE, UINT8 Value 1 (fabric index) 0x18, 0x18, 0x18, diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index df42d3fdb8c70d..5aeb21815c51b8 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -182,6 +182,7 @@ class TestCommandInteraction static void TestCommandHandlerWithSendEmptyResponse(nlTestSuite * apSuite, void * apContext); static void TestCommandHandlerWithProcessReceivedMsg(nlTestSuite * apSuite, void * apContext); static void TestCommandHandlerWithProcessReceivedEmptyDataMsg(nlTestSuite * apSuite, void * apContext); + static void TestCommandHandlerRejectMultipleCommands(nlTestSuite * apSuite, void * apContext); static void TestCommandSenderCommandSuccessResponseFlow(nlTestSuite * apSuite, void * apContext); static void TestCommandSenderCommandAsyncSuccessResponseFlow(nlTestSuite * apSuite, void * apContext); @@ -754,6 +755,63 @@ void TestCommandInteraction::TestCommandSenderAbruptDestruction(nlTestSuite * ap NL_TEST_ASSERT(apSuite, GetNumActiveHandlerObjects() == 0); } +void TestCommandInteraction::TestCommandHandlerRejectMultipleCommands(nlTestSuite * apSuite, void * apContext) +{ + TestContext & ctx = *static_cast(apContext); + CHIP_ERROR err = CHIP_NO_ERROR; + + isCommandDispatched = false; + mockCommandSenderDelegate.ResetCounter(); + app::CommandSender commandSender(&mockCommandSenderDelegate, &ctx.GetExchangeManager()); + + { + // Command ID is not important here, since the command handler should reject the commands without handling it. + auto commandPathParams = MakeTestCommandPath(kTestCommandIdCommandSpecificResponse); + + commandSender.AllocateBuffer(); + + // CommandSender does not support sending multiple commands with public API, so we craft a message manaully. + for (int i = 0; i < 2; i++) + { + InvokeRequests::Builder & invokeRequests = commandSender.mInvokeRequestBuilder.GetInvokeRequests(); + CommandDataIB::Builder & invokeRequest = invokeRequests.CreateCommandData(); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == invokeRequests.GetError()); + CommandPathIB::Builder & path = invokeRequest.CreatePath(); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == invokeRequest.GetError()); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == path.Encode(commandPathParams)); + NL_TEST_ASSERT(apSuite, + CHIP_NO_ERROR == + invokeRequest.GetWriter()->StartContainer(TLV::ContextTag(to_underlying(CommandDataIB::Tag::kData)), + TLV::kTLVType_Structure, + commandSender.mDataElementContainerType)); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == invokeRequest.GetWriter()->PutBoolean(chip::TLV::ContextTag(1), true)); + NL_TEST_ASSERT(apSuite, + CHIP_NO_ERROR == invokeRequest.GetWriter()->EndContainer(commandSender.mDataElementContainerType)); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == invokeRequest.EndOfCommandDataIB().GetError()); + } + + NL_TEST_ASSERT(apSuite, + CHIP_NO_ERROR == commandSender.mInvokeRequestBuilder.GetInvokeRequests().EndOfInvokeRequests().GetError()); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == commandSender.mInvokeRequestBuilder.EndOfInvokeRequestMessage().GetError()); + + commandSender.MoveToState(app::CommandSender::State::AddedCommand); + } + + err = commandSender.SendCommandRequest(ctx.GetSessionBobToAlice()); + + NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + + ctx.DrainAndServiceIO(); + + NL_TEST_ASSERT(apSuite, + mockCommandSenderDelegate.onResponseCalledTimes == 0 && mockCommandSenderDelegate.onFinalCalledTimes == 1 && + mockCommandSenderDelegate.onErrorCalledTimes == 1); + NL_TEST_ASSERT(apSuite, !chip::isCommandDispatched); + + NL_TEST_ASSERT(apSuite, GetNumActiveHandlerObjects() == 0); + NL_TEST_ASSERT(apSuite, ctx.GetExchangeManager().GetNumActiveExchanges() == 0); +} + } // namespace app } // namespace chip @@ -772,6 +830,7 @@ const nlTest sTests[] = NL_TEST_DEF("TestCommandHandlerWithProcessReceivedMsg", chip::app::TestCommandInteraction::TestCommandHandlerWithProcessReceivedMsg), NL_TEST_DEF("TestCommandHandlerWithProcessReceivedNotExistCommand", chip::app::TestCommandInteraction::TestCommandHandlerWithProcessReceivedNotExistCommand), NL_TEST_DEF("TestCommandHandlerWithProcessReceivedEmptyDataMsg", chip::app::TestCommandInteraction::TestCommandHandlerWithProcessReceivedEmptyDataMsg), + NL_TEST_DEF("TestCommandHandlerRejectMultipleCommands", chip::app::TestCommandInteraction::TestCommandHandlerRejectMultipleCommands), NL_TEST_DEF("TestCommandSenderCommandSuccessResponseFlow", chip::app::TestCommandInteraction::TestCommandSenderCommandSuccessResponseFlow), NL_TEST_DEF("TestCommandSenderCommandAsyncSuccessResponseFlow", chip::app::TestCommandInteraction::TestCommandSenderCommandAsyncSuccessResponseFlow), diff --git a/src/app/tests/TestWriteInteraction.cpp b/src/app/tests/TestWriteInteraction.cpp index 9c5827575f829e..4e9c5eac95f81b 100644 --- a/src/app/tests/TestWriteInteraction.cpp +++ b/src/app/tests/TestWriteInteraction.cpp @@ -479,10 +479,13 @@ int Test_Setup(void * inContext) VerifyOrReturnError(TestContext::InitializeAsync(inContext) == SUCCESS, FAILURE); - constexpr chip::FabricIndex kFabricIndex1 = 1; - static const uint8_t kCompressedFabricId[] = { 0x29, 0x06, 0xC9, 0x08, 0xD1, 0x15, 0xD3, 0x62 }; + TestContext & ctx = *static_cast(inContext); VerifyOrReturnError(CHIP_NO_ERROR == chip::GroupTesting::InitProvider(), FAILURE); - VerifyOrReturnError(CHIP_NO_ERROR == chip::GroupTesting::InitData(kFabricIndex1, chip::ByteSpan(kCompressedFabricId)), FAILURE); + + uint8_t buf[sizeof(chip::CompressedFabricId)]; + chip::MutableByteSpan span(buf); + VerifyOrReturnError(CHIP_NO_ERROR == ctx.GetBobFabric()->GetCompressedId(span), FAILURE); + VerifyOrReturnError(CHIP_NO_ERROR == chip::GroupTesting::InitData(ctx.GetBobFabricIndex(), span), FAILURE); return SUCCESS; } diff --git a/src/app/tests/suites/TestLogCommands.yaml b/src/app/tests/suites/TestLogCommands.yaml index fc9a1ebf37c1a0..8d9a1b61f5239a 100644 --- a/src/app/tests/suites/TestLogCommands.yaml +++ b/src/app/tests/suites/TestLogCommands.yaml @@ -36,6 +36,28 @@ tests: - name: "message" value: "This is a simple message" + - label: "Do a simple user prompt message. Expect 'y' to pass." + cluster: "LogCommands" + command: "UserPrompt" + disabled: true + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Do a simple user prompt message. Use enter to coninue." + cluster: "LogCommands" + command: "UserPrompt" + disabled: true + arguments: + values: + - name: "message" + value: "Please enter enter to continue" + - name: "expectedValue" + value: "" + - label: "Do a simple user prompt message" cluster: "LogCommands" command: "UserPrompt" diff --git a/src/app/tests/suites/commands/commissioner/CommissionerCommands.h b/src/app/tests/suites/commands/commissioner/CommissionerCommands.h index 90e9d021672870..bd622c9a10ba31 100644 --- a/src/app/tests/suites/commands/commissioner/CommissionerCommands.h +++ b/src/app/tests/suites/commands/commissioner/CommissionerCommands.h @@ -25,7 +25,7 @@ class CommissionerCommands : public chip::Controller::DevicePairingDelegate { public: CommissionerCommands(){}; - virtual ~CommissionerCommands(){}; + ~CommissionerCommands() override{}; virtual CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) = 0; virtual chip::Controller::DeviceCommissioner & GetCurrentCommissioner() = 0; diff --git a/src/app/tests/suites/commands/discovery/DiscoveryCommands.h b/src/app/tests/suites/commands/discovery/DiscoveryCommands.h index 729136e2093bff..b0123e5476e04b 100644 --- a/src/app/tests/suites/commands/discovery/DiscoveryCommands.h +++ b/src/app/tests/suites/commands/discovery/DiscoveryCommands.h @@ -47,7 +47,7 @@ class DiscoveryCommands : public chip::Dnssd::CommissioningResolveDelegate, publ { public: DiscoveryCommands(){}; - virtual ~DiscoveryCommands(){}; + ~DiscoveryCommands() override{}; virtual CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) = 0; diff --git a/src/app/tests/suites/commands/log/LogCommands.cpp b/src/app/tests/suites/commands/log/LogCommands.cpp index 1aa8ef3b0de5b2..b19bf857bc9d5e 100644 --- a/src/app/tests/suites/commands/log/LogCommands.cpp +++ b/src/app/tests/suites/commands/log/LogCommands.cpp @@ -17,6 +17,7 @@ */ #include "LogCommands.h" +#include CHIP_ERROR LogCommands::Log(const char * message) { @@ -24,8 +25,20 @@ CHIP_ERROR LogCommands::Log(const char * message) return ContinueOnChipMainThread(CHIP_NO_ERROR); } -CHIP_ERROR LogCommands::UserPrompt(const char * message) +CHIP_ERROR LogCommands::UserPrompt(const char * message, const char * expectedValue) { + CHIP_ERROR err = CHIP_NO_ERROR; + std::string line; ChipLogDetail(chipTool, "USER_PROMPT: %s", message); - return ContinueOnChipMainThread(CHIP_NO_ERROR); + if (expectedValue == nullptr) + { + return ContinueOnChipMainThread(err); + } + + std::getline(std::cin, line); + if (line != expectedValue) + { + err = CHIP_ERROR_INVALID_ARGUMENT; + } + return ContinueOnChipMainThread(err); } diff --git a/src/app/tests/suites/commands/log/LogCommands.h b/src/app/tests/suites/commands/log/LogCommands.h index 3e6159921525f3..7eed6a09b3dbd5 100644 --- a/src/app/tests/suites/commands/log/LogCommands.h +++ b/src/app/tests/suites/commands/log/LogCommands.h @@ -29,5 +29,5 @@ class LogCommands virtual CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) = 0; CHIP_ERROR Log(const char * message); - CHIP_ERROR UserPrompt(const char * message); + CHIP_ERROR UserPrompt(const char * message, const char * expectedValue = nullptr); }; diff --git a/src/app/tests/suites/pics/PICSBooleanExpressionParser.cpp b/src/app/tests/suites/pics/PICSBooleanExpressionParser.cpp index 7de152f876313d..c8df5aff939f46 100644 --- a/src/app/tests/suites/pics/PICSBooleanExpressionParser.cpp +++ b/src/app/tests/suites/pics/PICSBooleanExpressionParser.cpp @@ -115,17 +115,15 @@ bool PICSBooleanExpressionParser::EvaluateExpression(std::vector & bool rightExpr = EvaluateExpression(tokens, PICS, index); return leftExpr && rightExpr; } - else if (token == "||") + if (token == "||") { index++; bool rightExpr = EvaluateExpression(tokens, PICS, index); return leftExpr || rightExpr; } - else - { - ChipLogError(chipTool, "Unknown token: '%s'", token.c_str()); - chipDie(); - } + + ChipLogError(chipTool, "Unknown token: '%s'", token.c_str()); + chipDie(); } bool PICSBooleanExpressionParser::EvaluateSubExpression(std::vector & tokens, std::map & PICS, @@ -145,23 +143,21 @@ bool PICSBooleanExpressionParser::EvaluateSubExpression(std::vector index++; return expr; } - else if (token == "!") + if (token == "!") { index++; bool expr = EvaluateSubExpression(tokens, PICS, index); return !expr; } - else - { - index++; - if (PICS.find(token) == PICS.end()) - { - // By default, let's consider that if a PICS item is not defined, it is |false|. - // It allows to create a file that only contains enabled features. - return false; - } + index++; - return PICS[token]; + if (PICS.find(token) == PICS.end()) + { + // By default, let's consider that if a PICS item is not defined, it is |false|. + // It allows to create a file that only contains enabled features. + return false; } + + return PICS[token]; } diff --git a/src/app/util/af-event.cpp b/src/app/util/af-event.cpp index 59b69ed18bacee..9cc2b8495a71d4 100644 --- a/src/app/util/af-event.cpp +++ b/src/app/util/af-event.cpp @@ -84,7 +84,7 @@ const char * emAfEventStrings[] = { EMBER_AF_GENERATED_EVENT_STRINGS #endif - NULL, + nullptr, }; EmberEventData emAfEvents[] = { @@ -93,7 +93,7 @@ EmberEventData emAfEvents[] = { EMBER_AF_GENERATED_EVENTS #endif - { NULL, NULL } + { nullptr, nullptr } }; void EventControlHandler(chip::System::Layer * systemLayer, void * appState) @@ -103,7 +103,7 @@ void EventControlHandler(chip::System::Layer * systemLayer, void * appState) { control->status = EMBER_EVENT_INACTIVE; - if (control->callback != NULL) + if (control->callback != nullptr) { (control->callback)(control->endpoint); return; @@ -146,7 +146,7 @@ static EmberAfEventContext * findEventContext(EndpointId endpoint, ClusterId clu } } #endif // EMBER_AF_GENERATED_EVENT_CONTEXT - return NULL; + return nullptr; } EmberStatus emberEventControlSetDelayMS(EmberEventControl * control, uint32_t delayMs) @@ -195,10 +195,8 @@ EmberStatus emberAfEventControlSetDelayQS(EmberEventControl * control, uint32_t { return emberEventControlSetDelayMS(control, delayQs << 8); } - else - { - return EMBER_BAD_ARGUMENT; - } + + return EMBER_BAD_ARGUMENT; } EmberStatus emberAfEventControlSetDelayMinutes(EmberEventControl * control, uint16_t delayM) @@ -207,10 +205,8 @@ EmberStatus emberAfEventControlSetDelayMinutes(EmberEventControl * control, uint { return emberEventControlSetDelayMS(control, static_cast(delayM) << 16); } - else - { - return EMBER_BAD_ARGUMENT; - } + + return EMBER_BAD_ARGUMENT; } EmberStatus emberAfScheduleTickExtended(EndpointId endpoint, ClusterId clusterId, bool isClient, uint32_t delayMs, @@ -222,7 +218,7 @@ EmberStatus emberAfScheduleTickExtended(EndpointId endpoint, ClusterId clusterId // simulation. EMBER_TEST_ASSERT(emberAfEndpointIsEnabled(endpoint)); - if (context != NULL && emberAfEndpointIsEnabled(endpoint) && + if (context != nullptr && emberAfEndpointIsEnabled(endpoint) && (emberEventControlSetDelayMS(context->eventControl, delayMs) == EMBER_SUCCESS)) { context->pollControl = pollControl; @@ -265,7 +261,7 @@ EmberStatus emberAfScheduleServerTick(EndpointId endpoint, ClusterId clusterId, EmberStatus emberAfDeactivateClusterTick(EndpointId endpoint, ClusterId clusterId, bool isClient) { EmberAfEventContext * context = findEventContext(endpoint, clusterId, isClient); - if (context != NULL) + if (context != nullptr) { emberEventControlSetInactive(context->eventControl); return EMBER_SUCCESS; diff --git a/src/app/util/attribute-size-util.cpp b/src/app/util/attribute-size-util.cpp index c5b7f467598b11..a318befcdc1500 100644 --- a/src/app/util/attribute-size-util.cpp +++ b/src/app/util/attribute-size-util.cpp @@ -75,7 +75,7 @@ uint16_t emberAfAttributeValueSize(ClusterId clusterId, AttributeId attrId, Embe uint16_t dataSize = 0; if (emberAfIsThisDataTypeAStringType(dataType)) { - if (buffer != 0) + if (buffer != nullptr) { if (emberAfIsStringAttributeType(dataType)) { diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index bd439ad25823f3..748ac1c84cddf3 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -316,10 +316,10 @@ void emberAfClusterDefaultResponseCallback(EndpointId endpoint, ClusterId cluste uint8_t clientServerMask) { const EmberAfCluster * cluster = emberAfFindCluster(endpoint, clusterId, clientServerMask); - if (cluster != NULL) + if (cluster != nullptr) { EmberAfGenericClusterFunction f = emberAfFindClusterFunction(cluster, CLUSTER_MASK_DEFAULT_RESPONSE_FUNCTION); - if (f != NULL) + if (f != nullptr) { ((EmberAfDefaultResponseFunction) f)(endpoint, commandId, status); } @@ -330,16 +330,16 @@ void emberAfClusterDefaultResponseCallback(EndpointId endpoint, ClusterId cluste void emberAfClusterMessageSentCallback(const MessageSendDestination & destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status) { - if (apsFrame != NULL && message != NULL && msgLen != 0) + if (apsFrame != nullptr && message != nullptr && msgLen != 0) { const EmberAfCluster * cluster = emberAfFindCluster( apsFrame->sourceEndpoint, apsFrame->clusterId, (((message[0] & ZCL_FRAME_CONTROL_DIRECTION_MASK) == ZCL_FRAME_CONTROL_SERVER_TO_CLIENT) ? CLUSTER_MASK_SERVER : CLUSTER_MASK_CLIENT)); - if (cluster != NULL) + if (cluster != nullptr) { EmberAfGenericClusterFunction f = emberAfFindClusterFunction(cluster, CLUSTER_MASK_MESSAGE_SENT_FUNCTION); - if (f != NULL) + if (f != nullptr) { ((EmberAfMessageSentFunction) f)(destination, apsFrame, msgLen, message, status); } @@ -351,10 +351,10 @@ void emberAfClusterMessageSentCallback(const MessageSendDestination & destinatio void emAfClusterAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, uint8_t clientServerMask) { const EmberAfCluster * cluster = emberAfFindCluster(attributePath.mEndpointId, attributePath.mClusterId, clientServerMask); - if (cluster != NULL) + if (cluster != nullptr) { EmberAfGenericClusterFunction f = emberAfFindClusterFunction(cluster, CLUSTER_MASK_ATTRIBUTE_CHANGED_FUNCTION); - if (f != NULL) + if (f != nullptr) { ((EmberAfClusterAttributeChangedCallback) f)(attributePath); } @@ -366,23 +366,21 @@ EmberAfStatus emAfClusterPreAttributeChangedCallback(const app::ConcreteAttribut EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) { const EmberAfCluster * cluster = emberAfFindCluster(attributePath.mEndpointId, attributePath.mClusterId, clientServerMask); - if (cluster == NULL) + if (cluster == nullptr) { return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; } - else + + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + // Casting and calling a function pointer on the same line results in ignoring the return + // of the call on gcc-arm-none-eabi-9-2019-q4-major + EmberAfClusterPreAttributeChangedCallback f = (EmberAfClusterPreAttributeChangedCallback)( + emberAfFindClusterFunction(cluster, CLUSTER_MASK_PRE_ATTRIBUTE_CHANGED_FUNCTION)); + if (f != nullptr) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - // Casting and calling a function pointer on the same line results in ignoring the return - // of the call on gcc-arm-none-eabi-9-2019-q4-major - EmberAfClusterPreAttributeChangedCallback f = (EmberAfClusterPreAttributeChangedCallback)( - emberAfFindClusterFunction(cluster, CLUSTER_MASK_PRE_ATTRIBUTE_CHANGED_FUNCTION)); - if (f != NULL) - { - status = f(attributePath, attributeType, size, value); - } - return status; + status = f(attributePath, attributeType, size, value); } + return status; } static void initializeEndpoint(EmberAfDefinedEndpoint * definedEndpoint) @@ -395,7 +393,7 @@ static void initializeEndpoint(EmberAfDefinedEndpoint * definedEndpoint) EmberAfGenericClusterFunction f; emberAfClusterInitCallback(definedEndpoint->endpoint, cluster->clusterId); f = emberAfFindClusterFunction(cluster, CLUSTER_MASK_INIT_FUNCTION); - if (f != NULL) + if (f != nullptr) { ((EmberAfInitFunction) f)(definedEndpoint->endpoint); } @@ -419,16 +417,16 @@ void emAfCallInits(void) const EmberAfAttributeMetadata * emberAfLocateAttributeMetadata(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask) { - const EmberAfAttributeMetadata * metadata = NULL; + const EmberAfAttributeMetadata * metadata = nullptr; EmberAfAttributeSearchRecord record; record.endpoint = endpoint; record.clusterId = clusterId; record.clusterMask = mask; record.attributeId = attributeId; emAfReadOrWriteAttribute(&record, &metadata, - NULL, // buffer - 0, // buffer size - false); // write? + nullptr, // buffer + 0, // buffer size + false); // write? return metadata; } @@ -493,7 +491,7 @@ static EmberAfStatus typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, u { return EMBER_ZCL_STATUS_INSUFFICIENT_SPACE; } - if (src == NULL) + if (src == nullptr) { memset(dest, 0, am->size); } @@ -579,7 +577,7 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord, if (emAfMatchAttribute(cluster, am, attRecord)) { // Got the attribute // If passed metadata location is not null, populate - if (metadata != NULL) + if (metadata != nullptr) { *metadata = am; } @@ -601,7 +599,7 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord, } else { - if (buffer == NULL) + if (buffer == nullptr) { return EMBER_ZCL_STATUS_SUCCESS; } @@ -623,17 +621,15 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord, : emberAfExternalAttributeReadCallback(attRecord->endpoint, attRecord->clusterId, am, buffer, emberAfAttributeSize(am))); } + + // Internal storage is only supported for fixed endpoints + if (!isDynamicEndpoint) + { + return typeSensitiveMemCopy(attRecord->clusterId, dst, src, am, write, readLength); + } else { - // Internal storage is only supported for fixed endpoints - if (!isDynamicEndpoint) - { - return typeSensitiveMemCopy(attRecord->clusterId, dst, src, am, write, readLength); - } - else - { - return EMBER_ZCL_STATUS_FAILURE; - } + return EMBER_ZCL_STATUS_FAILURE; } } } @@ -702,7 +698,7 @@ const EmberAfCluster * emberAfFindClusterInType(const EmberAfEndpointType * endp } } - return NULL; + return nullptr; } uint8_t emberAfClusterIndex(EndpointId endpoint, ClusterId clusterId, EmberAfClusterMask mask) @@ -715,7 +711,7 @@ uint8_t emberAfClusterIndex(EndpointId endpoint, ClusterId clusterId, EmberAfClu { const EmberAfEndpointType * endpointType = emAfEndpoints[ep].endpointType; uint8_t index = 0xFF; - if (emberAfFindClusterInType(endpointType, clusterId, mask, &index) != NULL) + if (emberAfFindClusterInType(endpointType, clusterId, mask, &index) != nullptr) { return index; } @@ -728,19 +724,19 @@ uint8_t emberAfClusterIndex(EndpointId endpoint, ClusterId clusterId, EmberAfClu // cluster on it. bool emberAfContainsCluster(EndpointId endpoint, ClusterId clusterId) { - return (emberAfFindCluster(endpoint, clusterId, 0) != NULL); + return (emberAfFindCluster(endpoint, clusterId, 0) != nullptr); } // Returns whether the given endpoint has the server of the given cluster on it. bool emberAfContainsServer(EndpointId endpoint, ClusterId clusterId) { - return (emberAfFindCluster(endpoint, clusterId, CLUSTER_MASK_SERVER) != NULL); + return (emberAfFindCluster(endpoint, clusterId, CLUSTER_MASK_SERVER) != nullptr); } // Returns whether the given endpoint has the client of the given cluster on it. bool emberAfContainsClient(EndpointId endpoint, ClusterId clusterId) { - return (emberAfFindCluster(endpoint, clusterId, CLUSTER_MASK_CLIENT) != NULL); + return (emberAfFindCluster(endpoint, clusterId, CLUSTER_MASK_CLIENT) != nullptr); } // This will find the first server that has the clusterId given from the index of endpoint. @@ -750,10 +746,8 @@ bool emberAfContainsServerFromIndex(uint16_t index, ClusterId clusterId) { return false; } - else - { - return emberAfFindClusterInType(emAfEndpoints[index].endpointType, clusterId, CLUSTER_MASK_SERVER); - } + + return emberAfFindClusterInType(emAfEndpoints[index].endpointType, clusterId, CLUSTER_MASK_SERVER); } namespace chip { @@ -795,12 +789,10 @@ const EmberAfCluster * emberAfFindCluster(EndpointId endpoint, ClusterId cluster uint16_t ep = emberAfIndexFromEndpoint(endpoint); if (ep == 0xFFFF) { - return NULL; - } - else - { - return emberAfFindClusterInType(emAfEndpoints[ep].endpointType, clusterId, mask); + return nullptr; } + + return emberAfFindClusterInType(emAfEndpoints[ep].endpointType, clusterId, mask); } // Returns cluster within the endpoint; Does not ignore disabled endpoints @@ -812,7 +804,7 @@ const EmberAfCluster * emberAfFindClusterIncludingDisabledEndpoints(EndpointId e { return emberAfFindClusterInType(emAfEndpoints[ep].endpointType, clusterId, mask); } - return NULL; + return nullptr; } // Server wrapper for findClusterEndpointIndex @@ -832,7 +824,7 @@ static uint16_t findClusterEndpointIndex(EndpointId endpoint, ClusterId clusterI { uint16_t i, epi = 0; - if (emberAfFindCluster(endpoint, clusterId, mask) == NULL) + if (emberAfFindCluster(endpoint, clusterId, mask) == nullptr) { return 0xFFFF; } @@ -844,7 +836,7 @@ static uint16_t findClusterEndpointIndex(EndpointId endpoint, ClusterId clusterI break; } epi = static_cast( - epi + ((emberAfFindClusterIncludingDisabledEndpoints(emAfEndpoints[i].endpoint, clusterId, mask) != NULL) ? 1 : 0)); + epi + ((emberAfFindClusterIncludingDisabledEndpoints(emAfEndpoints[i].endpoint, clusterId, mask) != nullptr) ? 1 : 0)); } return epi; @@ -1010,7 +1002,7 @@ uint8_t emberAfClusterCount(EndpointId endpoint, bool server) uint8_t emberAfClusterCountByIndex(uint16_t endpointIndex, bool server) { const EmberAfDefinedEndpoint * de = &(emAfEndpoints[endpointIndex]); - if (de->endpointType == NULL) + if (de->endpointType == nullptr) { return 0; } @@ -1062,13 +1054,13 @@ const EmberAfCluster * emberAfGetClusterByIndex(EndpointId endpoint, uint8_t clu if (endpointIndex == 0xFFFF) { - return NULL; + return nullptr; } definedEndpoint = &(emAfEndpoints[endpointIndex]); if (clusterIndex >= definedEndpoint->endpointType->clusterCount) { - return NULL; + return nullptr; } return &(definedEndpoint->endpointType->cluster[clusterIndex]); } @@ -1094,7 +1086,7 @@ const EmberAfCluster * emberAfGetNthCluster(EndpointId endpoint, uint8_t n, bool if (index == 0xFFFF) { - return NULL; + return nullptr; } de = &(emAfEndpoints[index]); @@ -1111,7 +1103,7 @@ const EmberAfCluster * emberAfGetNthCluster(EndpointId endpoint, uint8_t n, bool c++; } } - return NULL; + return nullptr; } // Returns the cluster id of Nth server or client cluster, @@ -1141,7 +1133,7 @@ uint8_t emberAfGetClustersFromEndpoint(EndpointId endpoint, ClusterId * clusterL for (i = 0; i < clusterCount; i++) { cluster = emberAfGetNthCluster(endpoint, i, server); - clusterList[i] = (cluster == NULL ? 0xFFFF : cluster->clusterId); + clusterList[i] = (cluster == nullptr ? 0xFFFF : cluster->clusterId); } return clusterCount; } @@ -1275,7 +1267,7 @@ void emAfLoadAttributeDefaults(EndpointId endpoint, bool ignoreStorage, Optional } emAfReadOrWriteAttribute(&record, - NULL, // metadata - unused + nullptr, // metadata - unused ptr, 0, // buffer size - unused true); // write? @@ -1349,7 +1341,7 @@ EmberAfGenericClusterFunction emberAfFindClusterFunction(const EmberAfCluster * if ((cluster->mask & functionMask) == 0) { - return NULL; + return nullptr; } while (mask < functionMask) diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index 617e02b8fbb2e4..13e2efc42bfe83 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -127,13 +127,13 @@ EmberAfStatus emberAfReadAttribute(EndpointId endpoint, ClusterId cluster, Attri EmberAfStatus emberAfReadServerAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr, uint16_t readLength) { - return emAfReadAttribute(endpoint, cluster, attributeID, CLUSTER_MASK_SERVER, dataPtr, readLength, NULL); + return emAfReadAttribute(endpoint, cluster, attributeID, CLUSTER_MASK_SERVER, dataPtr, readLength, nullptr); } EmberAfStatus emberAfReadClientAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr, uint16_t readLength) { - return emAfReadAttribute(endpoint, cluster, attributeID, CLUSTER_MASK_CLIENT, dataPtr, readLength, NULL); + return emAfReadAttribute(endpoint, cluster, attributeID, CLUSTER_MASK_CLIENT, dataPtr, readLength, nullptr); } static void emberAfAttributeDecodeAndPrintCluster(ClusterId cluster) @@ -185,7 +185,7 @@ void emberAfPrintAttributeTable(void) emberAfAttributesFlush(); status = emAfReadAttribute(ep->endpoint, cluster->clusterId, metaData->attributeId, (emberAfAttributeIsClient(metaData) ? CLUSTER_MASK_CLIENT : CLUSTER_MASK_SERVER), data, - ATTRIBUTE_LARGEST, NULL); + ATTRIBUTE_LARGEST, nullptr); if (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) { emberAfAttributesPrintln("Unsupported"); @@ -299,19 +299,19 @@ static bool IsNullValue(const uint8_t * data, uint16_t dataLen, bool isAttribute EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t mask, uint8_t * data, EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType, bool justTest) { - const EmberAfAttributeMetadata * metadata = NULL; + const EmberAfAttributeMetadata * metadata = nullptr; EmberAfAttributeSearchRecord record; record.endpoint = endpoint; record.clusterId = cluster; record.clusterMask = mask; record.attributeId = attributeID; emAfReadOrWriteAttribute(&record, &metadata, - NULL, // buffer - 0, // buffer size - false); // write? + nullptr, // buffer + 0, // buffer size + false); // write? // if we dont support that attribute - if (metadata == NULL) + if (metadata == nullptr) { emberAfAttributesPrintln("%pep %x clus " ChipLogFormatMEI " attr " ChipLogFormatMEI " not supported", "WRITE ERR: ", endpoint, ChipLogValueMEI(cluster), ChipLogValueMEI(attributeID)); @@ -402,7 +402,7 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu // write the attribute status = emAfReadOrWriteAttribute(&record, - NULL, // metadata + nullptr, // metadata data, 0, // buffer size - unused true); // write? @@ -444,7 +444,7 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu EmberAfStatus emAfReadAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t mask, uint8_t * dataPtr, uint16_t readLength, EmberAfAttributeType * dataType) { - const EmberAfAttributeMetadata * metadata = NULL; + const EmberAfAttributeMetadata * metadata = nullptr; EmberAfAttributeSearchRecord record; EmberAfStatus status; record.endpoint = endpoint; @@ -457,7 +457,7 @@ EmberAfStatus emAfReadAttribute(EndpointId endpoint, ClusterId cluster, Attribut if (status == EMBER_ZCL_STATUS_SUCCESS) { // It worked! If the user asked for the type, set it before returning. - if (dataType != NULL) + if (dataType != nullptr) { (*dataType) = metadata->attributeType; } diff --git a/src/app/util/binding-table.cpp b/src/app/util/binding-table.cpp index ea15e94e68b497..d92df75454461a 100644 --- a/src/app/util/binding-table.cpp +++ b/src/app/util/binding-table.cpp @@ -64,23 +64,21 @@ CHIP_ERROR BindingTable::Add(const EmberBindingTableEntry & entry) mBindingTable[newIndex].type = EMBER_UNUSED_BINDING; return error; } + + if (mTail == kNextNullIndex) + { + mTail = newIndex; + mHead = newIndex; + } else { - if (mTail == kNextNullIndex) - { - mTail = newIndex; - mHead = newIndex; - } - else - { - mNextIndex[mTail] = newIndex; - mNextIndex[newIndex] = kNextNullIndex; - mTail = newIndex; - } - - mSize++; - return CHIP_NO_ERROR; + mNextIndex[mTail] = newIndex; + mNextIndex[newIndex] = kNextNullIndex; + mTail = newIndex; } + + mSize++; + return CHIP_NO_ERROR; } const EmberBindingTableEntry & BindingTable::GetAt(uint8_t index) diff --git a/src/app/util/binding-table.h b/src/app/util/binding-table.h index 1ae270fd109035..792a796b737356 100644 --- a/src/app/util/binding-table.h +++ b/src/app/util/binding-table.h @@ -50,11 +50,11 @@ class BindingTable Iterator operator++(); - bool operator==(const Iterator & rhs) { return mIndex == rhs.mIndex; } + bool operator==(const Iterator & rhs) const { return mIndex == rhs.mIndex; } - bool operator!=(const Iterator & rhs) { return mIndex != rhs.mIndex; } + bool operator!=(const Iterator & rhs) const { return mIndex != rhs.mIndex; } - uint8_t GetIndex() { return mIndex; } + uint8_t GetIndex() const { return mIndex; } private: BindingTable * mTable; @@ -71,7 +71,7 @@ class BindingTable // Returns the number of active entries in the binding table. // *NOTE* The function does not return the capacity of the binding table. - uint8_t Size() { return mSize; } + uint8_t Size() const { return mSize; } Iterator begin(); diff --git a/src/app/util/client-api.cpp b/src/app/util/client-api.cpp index cb2d25038a3e8d..79f1c7243b694e 100644 --- a/src/app/util/client-api.cpp +++ b/src/app/util/client-api.cpp @@ -45,14 +45,14 @@ using namespace chip; -uint8_t * emAfZclBuffer = NULL; +uint8_t * emAfZclBuffer = nullptr; uint16_t emAfZclBufferLen = 0; // Pointer to where this API should put the length -uint16_t * emAfResponseLengthPtr = NULL; +uint16_t * emAfResponseLengthPtr = nullptr; // Pointer to where the API should put the cluster ID -EmberApsFrame * emAfCommandApsFrame = NULL; +EmberApsFrame * emAfCommandApsFrame = nullptr; ///////////////// @@ -101,7 +101,7 @@ static uint16_t vFillBuffer(uint8_t * buffer, uint16_t bufferLen, uint8_t frameC char cmd; value = 0; valueLen = 0; - data = 0; + data = nullptr; cmd = format[i]; if (cmd <= 's') { @@ -231,7 +231,7 @@ static uint16_t vFillBuffer(uint8_t * buffer, uint16_t bufferLen, uint8_t frameC // explicit check. if (dataLen != 0) { - if (data == NULL) + if (data == nullptr) { emberAfDebugPrintln("ERR: Missing data for %d bytes for format '%c'", dataLen, cmd); return 0; diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index 1627d80c0a94fa..f9a5090fd52548 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -482,10 +482,8 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b { return CHIP_NO_ERROR; } - else - { - return SendFailureStatus(aPath, aAttributeReports, Protocols::InteractionModel::Status::UnsupportedAccess, nullptr); - } + + return SendFailureStatus(aPath, aAttributeReports, Protocols::InteractionModel::Status::UnsupportedAccess, nullptr); } } @@ -969,10 +967,8 @@ bool IsClusterDataVersionEqual(const ConcreteClusterPath & aConcreteClusterPath, aConcreteClusterPath.mEndpointId, ChipLogValueMEI(aConcreteClusterPath.mClusterId)); return false; } - else - { - return (*(version)) == aRequiredVersion; - } + + return (*(version)) == aRequiredVersion; } } // namespace app diff --git a/src/app/util/message.cpp b/src/app/util/message.cpp index cd59151cecbf5d..97d744ff389296 100644 --- a/src/app/util/message.cpp +++ b/src/app/util/message.cpp @@ -73,7 +73,7 @@ void emberAfClearResponseData(void) emberAfResponseType = ZCL_UTIL_RESP_NORMAL; // To prevent accidentally sending to someone else, // set the destination to ourselves. - emberAfResponseDestination = 0 /* emberAfGetNodeId() */; + emberAfResponseDestination = nullptr /* emberAfGetNodeId() */; memset(appResponseData, 0, EMBER_AF_RESPONSE_BUFFER_LEN); appResponseLength = 0; memset(&emberAfResponseApsFrame, 0, sizeof(EmberApsFrame)); @@ -90,7 +90,7 @@ uint8_t * emberAfPutInt8uInResp(uint8_t value) return &appResponseData[appResponseLength - 1]; } - return NULL; + return nullptr; } uint16_t * emberAfPutInt16uInResp(uint16_t value) @@ -102,10 +102,8 @@ uint16_t * emberAfPutInt16uInResp(uint16_t value) { return (uint16_t *) low; } - else - { - return NULL; - } + + return nullptr; } uint32_t * emberAfPutInt32uInResp(uint32_t value) @@ -119,10 +117,8 @@ uint32_t * emberAfPutInt32uInResp(uint32_t value) { return (uint32_t *) a; } - else - { - return NULL; - } + + return nullptr; } uint32_t * emberAfPutInt24uInResp(uint32_t value) @@ -135,10 +131,8 @@ uint32_t * emberAfPutInt24uInResp(uint32_t value) { return (uint32_t *) a; } - else - { - return NULL; - } + + return nullptr; } uint8_t * emberAfPutBlockInResp(const uint8_t * data, uint16_t length) @@ -149,10 +143,8 @@ uint8_t * emberAfPutBlockInResp(const uint8_t * data, uint16_t length) appResponseLength = static_cast(appResponseLength + length); return &appResponseData[appResponseLength - length]; } - else - { - return NULL; - } + + return nullptr; } uint8_t * emberAfPutStringInResp(const uint8_t * buffer) @@ -172,10 +164,8 @@ uint8_t * emberAfPutDateInResp(EmberAfDate * value) { return a; } - else - { - return NULL; - } + + return nullptr; } void emberAfPutInt16sInResp(int16_t value) diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index d0bfa582928ccb..279495dd8ef4e0 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -74,8 +74,8 @@ uint32_t afNumPktsSent; #endif const EmberAfClusterName zclClusterNames[] = { - CLUSTER_IDS_TO_NAMES // defined in print-cluster.h - { ZCL_NULL_CLUSTER_ID, EMBER_AF_NULL_MANUFACTURER_CODE, NULL }, // terminator + CLUSTER_IDS_TO_NAMES // defined in print-cluster.h + { ZCL_NULL_CLUSTER_ID, EMBER_AF_NULL_MANUFACTURER_CODE, nullptr }, // terminator }; // A pointer to the current command being processed @@ -312,14 +312,12 @@ void emberAfDecodeAndPrintCluster(ClusterId cluster) // for references to the standard library. uint16_t emberAfGetMfgCodeFromCurrentCommand(void) { - if (emberAfCurrentCommand() != NULL) + if (emberAfCurrentCommand() != nullptr) { return emberAfCurrentCommand()->mfgCode; } - else - { - return EMBER_AF_NULL_MANUFACTURER_CODE; - } + + return EMBER_AF_NULL_MANUFACTURER_CODE; } uint8_t emberAfNextSequence(void) @@ -361,11 +359,11 @@ EmberAfRetryOverride emberAfGetRetryOverride(void) void emAfApplyRetryOverride(EmberApsOption * options) { - if (options == NULL) + if (options == nullptr) { return; } - else if (emberAfApsRetryOverride == EMBER_AF_RETRY_OVERRIDE_SET) + if (emberAfApsRetryOverride == EMBER_AF_RETRY_OVERRIDE_SET) { *options |= EMBER_APS_OPTION_RETRY; } @@ -395,11 +393,11 @@ EmberAfDisableDefaultResponse emberAfGetDisableDefaultResponse(void) void emAfApplyDisableDefaultResponse(uint8_t * frame_control) { - if (frame_control == NULL) + if (frame_control == nullptr) { return; } - else if (emAfDisableDefaultResponse == EMBER_AF_DISABLE_DEFAULT_RESPONSE_ONE_SHOT) + if (emAfDisableDefaultResponse == EMBER_AF_DISABLE_DEFAULT_RESPONSE_ONE_SHOT) { emAfDisableDefaultResponse = emAfSavedDisableDefaultResponseVale; *frame_control |= ZCL_DISABLE_DEFAULT_RESPONSE_MASK; @@ -459,7 +457,7 @@ void emberAfCopyInt32u(uint8_t * data, uint16_t index, uint32_t x) void emberAfCopyString(uint8_t * dest, const uint8_t * src, size_t size) { - if (src == NULL) + if (src == nullptr) { dest[0] = 0; // Zero out the length of string } @@ -482,7 +480,7 @@ void emberAfCopyString(uint8_t * dest, const uint8_t * src, size_t size) void emberAfCopyLongString(uint8_t * dest, const uint8_t * src, size_t size) { - if (src == NULL) + if (src == nullptr) { dest[0] = dest[1] = 0; // Zero out the length of string } @@ -527,7 +525,7 @@ int8_t emberAfCompareValues(const uint8_t * val1, const uint8_t * val2, uint16_t for (i = 0; i < len; i++) { - j = (val1 == NULL ? 0 : (EM_BIG_ENDIAN ? val1[i] : val1[(len - 1) - i])); + j = (val1 == nullptr ? 0 : (EM_BIG_ENDIAN ? val1[i] : val1[(len - 1) - i])); accum1 |= j << (8 * (len - 1 - i)); k = (EM_BIG_ENDIAN ? val2[i] : val2[(len - 1) - i]); @@ -551,7 +549,7 @@ int8_t emberAfCompareValues(const uint8_t * val1, const uint8_t * val2, uint16_t { return 1; } - else if (accum1 < accum2) + if (accum1 < accum2) { return -1; } @@ -569,14 +567,14 @@ int8_t emberAfCompareValues(const uint8_t * val1, const uint8_t * val2, uint16_t { // regular unsigned number comparison for (i = 0; i < len; i++) { - j = (val1 == NULL ? 0 : (EM_BIG_ENDIAN ? val1[i] : val1[(len - 1) - i])); + j = (val1 == nullptr ? 0 : (EM_BIG_ENDIAN ? val1[i] : val1[(len - 1) - i])); k = (EM_BIG_ENDIAN ? val2[i] : val2[(len - 1) - i]); if (j > k) { return 1; } - else if (k > j) + if (k > j) { return -1; } @@ -640,7 +638,7 @@ uint8_t emberAfAppendCharacters(uint8_t * zclString, uint8_t zclStringMaxLen, co uint8_t curLen; uint8_t charsToWrite; - if ((zclString == NULL) || (zclStringMaxLen == 0) || (appendingChars == NULL) || (appendingCharsLen == 0)) + if ((zclString == nullptr) || (zclStringMaxLen == 0) || (appendingChars == nullptr) || (appendingCharsLen == 0)) { return 0; } diff --git a/src/app/zap-templates/common/ClusterTestGeneration.js b/src/app/zap-templates/common/ClusterTestGeneration.js index 09f39444c969db..f7c2c9bd5dbbf2 100644 --- a/src/app/zap-templates/common/ClusterTestGeneration.js +++ b/src/app/zap-templates/common/ClusterTestGeneration.js @@ -734,12 +734,9 @@ function octetStringEscapedForCLiteral(value) // Escape control characters, things outside the ASCII range, and single // quotes (because that's our string terminator). return value.replace(/\p{Control}|\P{ASCII}|"/gu, ch => { - let code = ch.charCodeAt(0); - code = code.toString(16); - if (code.length == 1) { - code = "0" + code; - } - return "\\x" + code; + var code = ch.charCodeAt(0).toString(8) + return "\\" + + "0".repeat(3 - code.length) + code; }); } diff --git a/src/app/zap-templates/common/simulated-clusters/clusters/LogCommands.js b/src/app/zap-templates/common/simulated-clusters/clusters/LogCommands.js index aba2675c345582..107a2548fbec3f 100644 --- a/src/app/zap-templates/common/simulated-clusters/clusters/LogCommands.js +++ b/src/app/zap-templates/common/simulated-clusters/clusters/LogCommands.js @@ -32,7 +32,7 @@ const Log = { const UserPrompt = { name : 'UserPrompt', - arguments : [ { type : 'CHAR_STRING', name : 'message' } ], + arguments : [ { type : 'CHAR_STRING', name : 'message' }, { type : 'CHAR_STRING', name : 'expectedValue', isOptional : true } ], response : { arguments : [] } }; diff --git a/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml index 5630d4efeffbcb..8132833cfe25c8 100644 --- a/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml @@ -49,17 +49,17 @@ limitations under the License. - + - + @@ -88,19 +88,19 @@ limitations under the License. The cluster SHALL send AccessControlEntryChanged events whenever its ACL attribute data is changed by an Administrator. - + The cluster SHALL send AccessControlExtensionChanged events whenever its extension attribute data is changed by an Administrator. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/binding-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/binding-cluster.xml index ede4f797947dec..f7cecaf94bf083 100644 --- a/src/app/zap-templates/zcl/data-model/chip/binding-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/binding-cluster.xml @@ -19,11 +19,11 @@ limitations under the License. - - - - - + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml index 0af50b69c7be7f..bd05cae4f1e937 100644 --- a/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml @@ -109,7 +109,7 @@ limitations under the License. MinRFIDCodeLength - CredentialRulesSupport + CredentialRulesSupport EnableLogging @@ -141,8 +141,8 @@ limitations under the License. - SupportedOperatingModes - DefaultConfigurationRegister + SupportedOperatingModes + DefaultConfigurationRegister EnableLocalProgramming @@ -163,7 +163,7 @@ limitations under the License. - + LocalProgrammingFeatures @@ -199,49 +199,49 @@ limitations under the License. - + AlarmMask - + KeypadOperationEventMask - + RemoteOperationEventMask - + ManualOperationEventMask - + RFIDOperationEventMask - + KeypadProgrammingEventMask - + RemoteProgrammingEventMask - + RFIDProgrammingEventMask @@ -663,6 +663,13 @@ limitations under the License. + + + + + + + @@ -882,7 +889,7 @@ limitations under the License. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml index 41c338211a42d5..8299bb12894564 100644 --- a/src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml @@ -19,17 +19,17 @@ limitations under the License. - + - + diff --git a/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml index df8b57f1d53c03..b61590f299b1d9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml @@ -19,12 +19,12 @@ limitations under the License. - - - - - - + + + + + + @@ -43,9 +43,9 @@ limitations under the License. - - - + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml index c14f1cb877411a..b5649c56da6d2a 100644 --- a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml @@ -24,14 +24,14 @@ limitations under the License. - - - - - - - - + + + + + + + + @@ -577,7 +577,7 @@ limitations under the License. Example test event - + diff --git a/src/ble/BLEEndPoint.cpp b/src/ble/BLEEndPoint.cpp index 337e72e70151f2..cfbc86d491464b 100644 --- a/src/ble/BLEEndPoint.cpp +++ b/src/ble/BLEEndPoint.cpp @@ -586,8 +586,15 @@ CHIP_ERROR BLEEndPoint::Init(BleLayer * bleLayer, BLE_CONNECTION_OBJECT connObj, return CHIP_NO_ERROR; } +void BLEEndPoint::AddRef() +{ + VerifyOrDie(mRefCount < UINT32_MAX); + mRefCount++; +} + void BLEEndPoint::Release() { + VerifyOrDie(mRefCount > 0u); // Decrement the ref count. When it reaches zero, NULL out the pointer to the chip::System::Layer // object. This effectively declared the object free and ready for re-allocation. mRefCount--; diff --git a/src/ble/BLEEndPoint.h b/src/ble/BLEEndPoint.h index feee860ecbd7a3..7a50256ca064a4 100644 --- a/src/ble/BLEEndPoint.h +++ b/src/ble/BLEEndPoint.h @@ -114,7 +114,7 @@ class DLL_EXPORT BLEEndPoint uint32_t mRefCount; - void AddRef() { mRefCount++; } + void AddRef(); void Release(); // Private data members: diff --git a/src/ble/BleConfig.h b/src/ble/BleConfig.h index 70340bfff0cfe5..1c514dc21b5807 100644 --- a/src/ble/BleConfig.h +++ b/src/ble/BleConfig.h @@ -122,7 +122,7 @@ * */ #ifndef BLE_CONNECTION_UNINITIALIZED -#define BLE_CONNECTION_UNINITIALIZED NULL +#define BLE_CONNECTION_UNINITIALIZED nullptr #endif // BLE_CONNECTION_UNINITIALIZED /** diff --git a/src/ble/BleLayer.cpp b/src/ble/BleLayer.cpp index 50cf13ebe3e242..d634e1940e806e 100644 --- a/src/ble/BleLayer.cpp +++ b/src/ble/BleLayer.cpp @@ -94,7 +94,7 @@ class BleEndPointPool return nullptr; } - BLEEndPoint * Find(BLE_CONNECTION_OBJECT c) + BLEEndPoint * Find(BLE_CONNECTION_OBJECT c) const { if (c == BLE_CONNECTION_UNINITIALIZED) { diff --git a/src/ble/BtpEngine.h b/src/ble/BtpEngine.h index 1c3bed32206df9..d861c3df5e4c0c 100644 --- a/src/ble/BtpEngine.h +++ b/src/ble/BtpEngine.h @@ -108,14 +108,14 @@ class BtpEngine inline void SetTxFragmentSize(uint16_t size) { mTxFragmentSize = size; } inline void SetRxFragmentSize(uint16_t size) { mRxFragmentSize = size; } - uint16_t GetRxFragmentSize() { return mRxFragmentSize; } - uint16_t GetTxFragmentSize() { return mTxFragmentSize; } + uint16_t GetRxFragmentSize() const { return mRxFragmentSize; } + uint16_t GetTxFragmentSize() const { return mTxFragmentSize; } SequenceNumber_t GetAndIncrementNextTxSeqNum(); SequenceNumber_t GetAndRecordRxAckSeqNum(); - inline SequenceNumber_t GetLastReceivedSequenceNumber() { return mRxNewestUnackedSeqNum; } - inline SequenceNumber_t GetNewestUnackedSentSequenceNumber() { return mTxNewestUnackedSeqNum; } + inline SequenceNumber_t GetLastReceivedSequenceNumber() const { return mRxNewestUnackedSeqNum; } + inline SequenceNumber_t GetNewestUnackedSentSequenceNumber() const { return mTxNewestUnackedSeqNum; } inline bool ExpectingAck() const { return mExpectingAck; } diff --git a/src/controller/AbstractDnssdDiscoveryController.h b/src/controller/AbstractDnssdDiscoveryController.h index 66eab16ff7139d..3372aab1f67bf8 100644 --- a/src/controller/AbstractDnssdDiscoveryController.h +++ b/src/controller/AbstractDnssdDiscoveryController.h @@ -40,7 +40,7 @@ class DLL_EXPORT AbstractDnssdDiscoveryController : public Dnssd::CommissioningR { public: AbstractDnssdDiscoveryController() {} - virtual ~AbstractDnssdDiscoveryController() {} + ~AbstractDnssdDiscoveryController() override {} void OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & nodeData) override; diff --git a/src/controller/AutoCommissioner.cpp b/src/controller/AutoCommissioner.cpp index 56fd26caf7ac10..763d92939a8ad8 100644 --- a/src/controller/AutoCommissioner.cpp +++ b/src/controller/AutoCommissioner.cpp @@ -102,6 +102,14 @@ CHIP_ERROR AutoCommissioner::SetCommissioningParameters(const CommissioningParam } CommissioningStage AutoCommissioner::GetNextCommissioningStage(CommissioningStage currentStage, CHIP_ERROR & lastErr) +{ + auto nextStage = GetNextCommissioningStageInternal(currentStage, lastErr); + ChipLogProgress(Controller, "Going from commissioning step '%s' with lastErr = '%s' --> '%s'", StageToString(currentStage), + lastErr.AsString(), StageToString(nextStage)); + return nextStage; +} + +CommissioningStage AutoCommissioner::GetNextCommissioningStageInternal(CommissioningStage currentStage, CHIP_ERROR & lastErr) { if (lastErr != CHIP_NO_ERROR) { @@ -142,8 +150,8 @@ CommissioningStage AutoCommissioner::GetNextCommissioningStage(CommissioningStag { return CommissioningStage::kWiFiNetworkSetup; } - else if (mParams.GetThreadOperationalDataset().HasValue() && - mDeviceCommissioningInfo.network.thread.endpoint != kInvalidEndpointId) + if (mParams.GetThreadOperationalDataset().HasValue() && + mDeviceCommissioningInfo.network.thread.endpoint != kInvalidEndpointId) { return CommissioningStage::kThreadNetworkSetup; } @@ -201,9 +209,6 @@ CommissioningStage AutoCommissioner::GetNextCommissioningStage(CommissioningStag case CommissioningStage::kSendComplete: return CommissioningStage::kCleanup; - // Currently unimplemented. - case CommissioningStage::kConfigACL: - return CommissioningStage::kError; // Neither of these have a next stage so return kError; case CommissioningStage::kCleanup: case CommissioningStage::kError: @@ -212,7 +217,7 @@ CommissioningStage AutoCommissioner::GetNextCommissioningStage(CommissioningStag return CommissioningStage::kError; } -EndpointId AutoCommissioner::GetEndpoint(const CommissioningStage & stage) +EndpointId AutoCommissioner::GetEndpoint(const CommissioningStage & stage) const { switch (stage) { @@ -252,7 +257,7 @@ CHIP_ERROR AutoCommissioner::StartCommissioning(DeviceCommissioner * commissione return CHIP_NO_ERROR; } -Optional AutoCommissioner::GetCommandTimeout(CommissioningStage stage) +Optional AutoCommissioner::GetCommandTimeout(CommissioningStage stage) const { // Per spec, all commands that are sent with the arm failsafe held need at least a 30s timeout. // Network clusters can indicate the time required to connect, so if we are connecting, use that time as long as it is > 30s. @@ -323,6 +328,9 @@ CHIP_ERROR AutoCommissioner::CommissioningStepFinished(CHIP_ERROR err, Commissio } else { + ChipLogProgress(Controller, "Finished commissioning step '%s' with error '%s'", StageToString(report.stageCompleted), + err.AsString()); + switch (report.stageCompleted) { case CommissioningStage::kReadCommissioningInfo: diff --git a/src/controller/AutoCommissioner.h b/src/controller/AutoCommissioner.h index 15a765fa17adf6..82dd12fd4cbcc6 100644 --- a/src/controller/AutoCommissioner.h +++ b/src/controller/AutoCommissioner.h @@ -29,16 +29,17 @@ class AutoCommissioner : public CommissioningDelegate { public: AutoCommissioner(); - virtual ~AutoCommissioner(); + ~AutoCommissioner() override; CHIP_ERROR SetCommissioningParameters(const CommissioningParameters & params) override; void SetOperationalCredentialsDelegate(OperationalCredentialsDelegate * operationalCredentialsDelegate) override; - virtual CHIP_ERROR StartCommissioning(DeviceCommissioner * commissioner, CommissioneeDeviceProxy * proxy) override; + CHIP_ERROR StartCommissioning(DeviceCommissioner * commissioner, CommissioneeDeviceProxy * proxy) override; - virtual CHIP_ERROR CommissioningStepFinished(CHIP_ERROR err, CommissioningDelegate::CommissioningReport report) override; + CHIP_ERROR CommissioningStepFinished(CHIP_ERROR err, CommissioningDelegate::CommissioningReport report) override; private: CommissioningStage GetNextCommissioningStage(CommissioningStage currentStage, CHIP_ERROR & lastErr); + CommissioningStage GetNextCommissioningStageInternal(CommissioningStage currentStage, CHIP_ERROR & lastErr); void ReleaseDAC(); void ReleasePAI(); @@ -49,8 +50,8 @@ class AutoCommissioner : public CommissioningDelegate ByteSpan GetPAI() const { return ByteSpan(mPAI, mPAILen); } CHIP_ERROR NOCChainGenerated(ByteSpan noc, ByteSpan icac, ByteSpan rcac, AesCcm128KeySpan ipk, NodeId adminSubject); - Optional GetCommandTimeout(CommissioningStage stage); - EndpointId GetEndpoint(const CommissioningStage & stage); + Optional GetCommandTimeout(CommissioningStage stage) const; + EndpointId GetEndpoint(const CommissioningStage & stage) const; DeviceCommissioner * mCommissioner = nullptr; CommissioneeDeviceProxy * mCommissioneeDeviceProxy = nullptr; diff --git a/src/controller/BUILD.gn b/src/controller/BUILD.gn index ece90d3921420d..013f2101c457e1 100644 --- a/src/controller/BUILD.gn +++ b/src/controller/BUILD.gn @@ -46,6 +46,7 @@ static_library("controller") { "CommissioneeDeviceProxy.h", "CommissionerDiscoveryController.cpp", "CommissionerDiscoveryController.h", + "CommissioningDelegate.cpp", "DeviceDiscoveryDelegate.h", "EmptyDataModelHandler.cpp", "ExampleOperationalCredentialsIssuer.cpp", @@ -67,6 +68,7 @@ static_library("controller") { "${chip_root}/src/platform", "${chip_root}/src/protocols", "${chip_root}/src/setup_payload", + "${chip_root}/src/trace", "${chip_root}/src/transport", ] diff --git a/src/controller/CHIPCluster.h b/src/controller/CHIPCluster.h index 42706a1f9576e1..5dbbb8aaa91204 100644 --- a/src/controller/CHIPCluster.h +++ b/src/controller/CHIPCluster.h @@ -150,12 +150,10 @@ class DLL_EXPORT ClusterBase requestData, onSuccessCb, onFailureCb, aTimedWriteTimeoutMs, onDoneCb, aDataVersion); } - else - { - return chip::Controller::WriteAttribute(mDevice->GetSecureSession().Value(), mEndpoint, clusterId, - attributeId, requestData, onSuccessCb, onFailureCb, - aTimedWriteTimeoutMs, onDoneCb, aDataVersion); - } + + return chip::Controller::WriteAttribute(mDevice->GetSecureSession().Value(), mEndpoint, clusterId, attributeId, + requestData, onSuccessCb, onFailureCb, aTimedWriteTimeoutMs, onDoneCb, + aDataVersion); } template diff --git a/src/controller/CHIPCommissionableNodeController.cpp b/src/controller/CHIPCommissionableNodeController.cpp index 6081cf92d0f500..59b8ecc559fa03 100644 --- a/src/controller/CHIPCommissionableNodeController.cpp +++ b/src/controller/CHIPCommissionableNodeController.cpp @@ -40,13 +40,11 @@ CHIP_ERROR CommissionableNodeController::DiscoverCommissioners(Dnssd::DiscoveryF mDNSResolver.SetCommissioningDelegate(this); return mDNSResolver.FindCommissioners(discoveryFilter); } - else - { + #if CONFIG_DEVICE_LAYER - ReturnErrorOnFailure(mResolver->Init(DeviceLayer::UDPEndPointManager())); + ReturnErrorOnFailure(mResolver->Init(DeviceLayer::UDPEndPointManager())); #endif - return mResolver->FindCommissioners(discoveryFilter); - } + return mResolver->FindCommissioners(discoveryFilter); } const Dnssd::DiscoveredNodeData * CommissionableNodeController::GetDiscoveredCommissioner(int idx) diff --git a/src/controller/CHIPCommissionableNodeController.h b/src/controller/CHIPCommissionableNodeController.h index cc381fccb0b583..53b77776d72abf 100644 --- a/src/controller/CHIPCommissionableNodeController.h +++ b/src/controller/CHIPCommissionableNodeController.h @@ -37,7 +37,7 @@ class DLL_EXPORT CommissionableNodeController : public AbstractDnssdDiscoveryCon { public: CommissionableNodeController(chip::Dnssd::Resolver * resolver = nullptr) : mResolver(resolver) {} - virtual ~CommissionableNodeController() {} + ~CommissionableNodeController() override {} CHIP_ERROR DiscoverCommissioners(Dnssd::DiscoveryFilter discoveryFilter = Dnssd::DiscoveryFilter()); diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 7a26eada2a22ba..01e327144b086c 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -73,6 +73,7 @@ #include #include #include +#include #if CONFIG_NETWORK_LAYER_BLE #include @@ -148,28 +149,6 @@ CHIP_ERROR DeviceController::Init(ControllerInitParams params) } } - DeviceProxyInitParams deviceInitParams = { - .sessionManager = params.systemState->SessionMgr(), - .exchangeMgr = params.systemState->ExchangeMgr(), - .idAllocator = &mIDAllocator, - .fabricTable = params.systemState->Fabrics(), - .clientPool = &mCASEClientPool, - .mrpLocalConfig = Optional::Value(GetLocalMRPConfig()), - }; - - CASESessionManagerConfig sessionManagerConfig = { - .sessionInitParams = deviceInitParams, -#if CHIP_CONFIG_MDNS_CACHE_SIZE > 0 - .dnsCache = &mDNSCache, -#endif - .devicePool = &mDevicePool, - }; - - mCASESessionManager = chip::Platform::New(sessionManagerConfig); - VerifyOrReturnError(mCASESessionManager != nullptr, CHIP_ERROR_NO_MEMORY); - - ReturnErrorOnFailure(mCASESessionManager->Init(params.systemState->SystemLayer())); - mSystemState = params.systemState->Retain(); mState = State::Initialized; return CHIP_NO_ERROR; @@ -243,11 +222,9 @@ CHIP_ERROR DeviceController::Shutdown() if (mFabricInfo != nullptr) { - // Shut down any ongoing CASE session activity we have. Note that we - // own the mCASESessionManager, so shutting down everything on it is - // fine. If we ever end up sharing the CASE session manager with other - // DeviceController instances we may need to be more targeted here. - mCASESessionManager->ReleaseAllSessions(); + // Shut down any ongoing CASE session activity we have. We're going to + // assume that all sessions for our fabric belong to us here. + mSystemState->CASESessionMgr()->ReleaseSessionsForFabric(GetCompressedFabricId()); // TODO: The CASE session manager does not shut down existing CASE // sessions. It just shuts down any ongoing CASE session establishment @@ -268,9 +245,6 @@ CHIP_ERROR DeviceController::Shutdown() mDNSResolver.Shutdown(); mDeviceDiscoveryDelegate = nullptr; - chip::Platform::Delete(mCASESessionManager); - mCASESessionManager = nullptr; - return CHIP_NO_ERROR; } @@ -288,14 +262,14 @@ void DeviceController::ReleaseOperationalDevice(NodeId remoteDeviceId) { VerifyOrReturn(mState == State::Initialized && mFabricInfo != nullptr, ChipLogError(Controller, "ReleaseOperationalDevice was called in incorrect state")); - mCASESessionManager->ReleaseSession(mFabricInfo->GetPeerIdForNode(remoteDeviceId)); + mSystemState->CASESessionMgr()->ReleaseSession(mFabricInfo->GetPeerIdForNode(remoteDeviceId)); } CHIP_ERROR DeviceController::DisconnectDevice(NodeId nodeId) { ChipLogProgress(Controller, "Force close session for node 0x%" PRIx64, nodeId); - OperationalDeviceProxy * proxy = mCASESessionManager->FindExistingSession(mFabricInfo->GetPeerIdForNode(nodeId)); + OperationalDeviceProxy * proxy = mSystemState->CASESessionMgr()->FindExistingSession(mFabricInfo->GetPeerIdForNode(nodeId)); if (proxy == nullptr) { ChipLogProgress(Controller, "Attempted to close a session that does not exist."); @@ -419,7 +393,7 @@ CHIP_ERROR DeviceController::GetPeerAddressAndPort(PeerId peerId, Inet::IPAddres { VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); Transport::PeerAddress peerAddr; - ReturnErrorOnFailure(mCASESessionManager->GetPeerAddress(peerId, peerAddr)); + ReturnErrorOnFailure(mSystemState->CASESessionMgr()->GetPeerAddress(peerId, peerAddr)); addr = peerAddr.GetIPAddress(); port = peerAddr.GetPort(); return CHIP_NO_ERROR; @@ -446,7 +420,7 @@ void DeviceController::OnVIDReadResponse(void * context, VendorId value) controller->mSetupPayload.vendorID = value; OperationalDeviceProxy * device = - controller->mCASESessionManager->FindExistingSession(controller->GetPeerIdWithCommissioningWindowOpen()); + controller->mSystemState->CASESessionMgr()->FindExistingSession(controller->GetPeerIdWithCommissioningWindowOpen()); if (device == nullptr) { ChipLogError(Controller, "Could not find device for opening commissioning window"); @@ -534,7 +508,8 @@ CHIP_ERROR DeviceController::OpenCommissioningWindowWithCallback(NodeId deviceId if (callback != nullptr && mCommissioningWindowOption != CommissioningWindowOption::kOriginalSetupCode && readVIDPIDAttributes) { - OperationalDeviceProxy * device = mCASESessionManager->FindExistingSession(GetPeerIdWithCommissioningWindowOpen()); + OperationalDeviceProxy * device = + mSystemState->CASESessionMgr()->FindExistingSession(GetPeerIdWithCommissioningWindowOpen()); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); constexpr EndpointId kBasicClusterEndpoint = 0; @@ -552,7 +527,7 @@ CHIP_ERROR DeviceController::OpenCommissioningWindowInternal() ChipLogProgress(Controller, "OpenCommissioningWindow for device ID %" PRIu64, mDeviceWithCommissioningWindowOpen); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - OperationalDeviceProxy * device = mCASESessionManager->FindExistingSession(GetPeerIdWithCommissioningWindowOpen()); + OperationalDeviceProxy * device = mSystemState->CASESessionMgr()->FindExistingSession(GetPeerIdWithCommissioningWindowOpen()); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); constexpr EndpointId kAdministratorCommissioningClusterEndpoint = 0; @@ -619,7 +594,7 @@ ControllerDeviceInitParams DeviceController::GetControllerDeviceInitParams() .exchangeMgr = mSystemState->ExchangeMgr(), .udpEndPointManager = mSystemState->UDPEndPointManager(), .storageDelegate = mStorageDelegate, - .idAllocator = &mIDAllocator, + .idAllocator = mSystemState->SessionIDAlloc(), .fabricsTable = mSystemState->Fabrics(), }; } @@ -629,9 +604,10 @@ DeviceCommissioner::DeviceCommissioner() : mDeviceAttestationInformationVerificationCallback(OnDeviceAttestationInformationVerification, this), mDeviceNOCChainCallback(OnDeviceNOCChainGeneration, this), mSetUpCodePairer(this) { - mPairingDelegate = nullptr; - mPairedDevicesUpdated = false; - mDeviceBeingCommissioned = nullptr; + mPairingDelegate = nullptr; + mPairedDevicesUpdated = false; + mDeviceBeingCommissioned = nullptr; + mDeviceInPASEEstablishment = nullptr; } CHIP_ERROR DeviceCommissioner::Init(CommissionerInitParams params) @@ -682,12 +658,13 @@ CHIP_ERROR DeviceCommissioner::Shutdown() ChipLogDetail(Controller, "Shutting down the commissioner"); // Check to see if pairing in progress before shutting down - CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; + CommissioneeDeviceProxy * device = mDeviceInPASEEstablishment; if (device != nullptr && device->IsSessionSetupInProgress()) { ChipLogDetail(Controller, "Setup in progress, stopping setup before shutting down"); OnSessionEstablishmentError(CHIP_ERROR_CONNECTION_ABORTED); } + // TODO: If we have a commissioning step in progress, is there a way to cancel that callback? mSystemState->SessionMgr()->UnregisterRecoveryDelegate(*this); @@ -714,6 +691,7 @@ CHIP_ERROR DeviceCommissioner::Shutdown() CommissioneeDeviceProxy * DeviceCommissioner::FindCommissioneeDevice(const SessionHandle & session) { + MATTER_TRACE_EVENT_SCOPE("FindCommissioneeDevice", "DeviceCommissioner"); CommissioneeDeviceProxy * foundDevice = nullptr; mCommissioneeDevicePool.ForEachActiveObject([&](auto * deviceProxy) { if (deviceProxy->MatchesSession(session)) @@ -729,6 +707,7 @@ CommissioneeDeviceProxy * DeviceCommissioner::FindCommissioneeDevice(const Sessi CommissioneeDeviceProxy * DeviceCommissioner::FindCommissioneeDevice(NodeId id) { + MATTER_TRACE_EVENT_SCOPE("FindCommissioneeDevice", "DeviceCommissioner"); CommissioneeDeviceProxy * foundDevice = nullptr; mCommissioneeDevicePool.ForEachActiveObject([&](auto * deviceProxy) { if (deviceProxy->GetDeviceId() == id) @@ -745,6 +724,11 @@ CommissioneeDeviceProxy * DeviceCommissioner::FindCommissioneeDevice(NodeId id) void DeviceCommissioner::ReleaseCommissioneeDevice(CommissioneeDeviceProxy * device) { mCommissioneeDevicePool.ReleaseObject(device); + // Make sure that there will be no dangling pointer + if (mDeviceInPASEEstablishment == device) + { + mDeviceInPASEEstablishment = nullptr; + } } CHIP_ERROR DeviceCommissioner::GetDeviceBeingCommissioned(NodeId deviceId, CommissioneeDeviceProxy ** out_device) @@ -761,17 +745,20 @@ CHIP_ERROR DeviceCommissioner::GetDeviceBeingCommissioned(NodeId deviceId, Commi CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, const char * setUpCode, const CommissioningParameters & params) { + MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner"); ReturnErrorOnFailure(mAutoCommissioner.SetCommissioningParameters(params)); return mSetUpCodePairer.PairDevice(remoteDeviceId, setUpCode, SetupCodePairerBehaviour::kCommission); } CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, const char * setUpCode) { + MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner"); return mSetUpCodePairer.PairDevice(remoteDeviceId, setUpCode, SetupCodePairerBehaviour::kCommission); } CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParameters & params) { + MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner"); ReturnErrorOnFailure(EstablishPASEConnection(remoteDeviceId, params)); return Commission(remoteDeviceId); } @@ -779,17 +766,20 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParameters & rendezvousParams, CommissioningParameters & commissioningParams) { + MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner"); ReturnErrorOnFailure(EstablishPASEConnection(remoteDeviceId, rendezvousParams)); return Commission(remoteDeviceId, commissioningParams); } CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, const char * setUpCode) { + MATTER_TRACE_EVENT_SCOPE("EstablishPASEConnection", "DeviceCommissioner"); return mSetUpCodePairer.PairDevice(remoteDeviceId, setUpCode, SetupCodePairerBehaviour::kPaseOnly); } CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, RendezvousParameters & params) { + MATTER_TRACE_EVENT_SCOPE("EstablishPASEConnection", "DeviceCommissioner"); CHIP_ERROR err = CHIP_NO_ERROR; CommissioneeDeviceProxy * device = nullptr; Transport::PeerAddress peerAddress = Transport::PeerAddress::UDP(Inet::IPAddress::Any); @@ -800,8 +790,9 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re uint16_t keyID = 0; VerifyOrExit(mState == State::Initialized, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mDeviceBeingCommissioned == nullptr, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(mDeviceInPASEEstablishment == nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // This will initialize the commissionee device pool if it has not already been initialized. err = InitializePairedDeviceList(); SuccessOrExit(err); @@ -830,7 +821,7 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re device = mCommissioneeDevicePool.CreateObject(); VerifyOrExit(device != nullptr, err = CHIP_ERROR_NO_MEMORY); - mDeviceBeingCommissioned = device; + mDeviceInPASEEstablishment = device; { FabricIndex fabricIndex = mFabricInfo != nullptr ? mFabricInfo->GetFabricIndex() : kUndefinedFabricIndex; @@ -862,7 +853,7 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re session = mSystemState->SessionMgr()->CreateUnauthenticatedSession(params.GetPeerAddress(), device->GetMRPConfig()); VerifyOrExit(session.HasValue(), err = CHIP_ERROR_NO_MEMORY); - err = mIDAllocator.Allocate(keyID); + err = mSystemState->SessionIDAlloc()->Allocate(keyID); SuccessOrExit(err); // TODO - Remove use of SetActive/IsActive from CommissioneeDeviceProxy @@ -887,7 +878,6 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re if (device != nullptr) { ReleaseCommissioneeDevice(device); - mDeviceBeingCommissioned = nullptr; } } @@ -902,15 +892,19 @@ CHIP_ERROR DeviceCommissioner::Commission(NodeId remoteDeviceId, CommissioningPa CHIP_ERROR DeviceCommissioner::Commission(NodeId remoteDeviceId) { - // TODO(cecille): Can we get rid of mDeviceBeingCommissioned and use the remote id instead? Would require storing the - // commissioning stage in the device. - CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; - if (device == nullptr || device->GetDeviceId() != remoteDeviceId || - (!device->IsSecureConnected() && !device->IsSessionSetupInProgress())) + MATTER_TRACE_EVENT_SCOPE("Commission", "DeviceCommissioner"); + CommissioneeDeviceProxy * device = FindCommissioneeDevice(remoteDeviceId); + if (device == nullptr || (!device->IsSecureConnected() && !device->IsSessionSetupInProgress())) { ChipLogError(Controller, "Invalid device for commissioning " ChipLogFormatX64, ChipLogValueX64(remoteDeviceId)); return CHIP_ERROR_INCORRECT_STATE; } + if (!device->IsSecureConnected() && device != mDeviceInPASEEstablishment) + { + // We should not end up in this state because we won't attempt to establish more than one connection at a time. + ChipLogError(Controller, "Device is not connected and not being paired " ChipLogFormatX64, ChipLogValueX64(remoteDeviceId)); + return CHIP_ERROR_INCORRECT_STATE; + } if (mCommissioningStage != CommissioningStage::kSecurePairing) { @@ -966,18 +960,17 @@ CHIP_ERROR DeviceCommissioner::UnpairDevice(NodeId remoteDeviceId) void DeviceCommissioner::RendezvousCleanup(CHIP_ERROR status) { - if (mDeviceBeingCommissioned != nullptr) + if (mDeviceInPASEEstablishment != nullptr) { // Release the commissionee device. For BLE, this is stored, // for IP commissioning, we have taken a reference to the // operational node to send the completion command. - ReleaseCommissioneeDevice(mDeviceBeingCommissioned); - mDeviceBeingCommissioned = nullptr; - } + ReleaseCommissioneeDevice(mDeviceInPASEEstablishment); - if (mPairingDelegate != nullptr) - { - mPairingDelegate->OnPairingComplete(status); + if (mPairingDelegate != nullptr) + { + mPairingDelegate->OnPairingComplete(status); + } } } @@ -997,14 +990,19 @@ void DeviceCommissioner::OnSessionEstablishmentError(CHIP_ERROR err) void DeviceCommissioner::OnSessionEstablished() { // PASE session established. - VerifyOrReturn(mDeviceBeingCommissioned != nullptr, OnSessionEstablishmentError(CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR)); + CommissioneeDeviceProxy * device = mDeviceInPASEEstablishment; + + // We are in the callback for this pairing. Reset so we can pair another device. + mDeviceInPASEEstablishment = nullptr; - PASESession * pairing = &mDeviceBeingCommissioned->GetPairing(); + VerifyOrReturn(device != nullptr, OnSessionEstablishmentError(CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR)); + + PASESession * pairing = &device->GetPairing(); // TODO: the session should know which peer we are trying to connect to when started - pairing->SetPeerNodeId(mDeviceBeingCommissioned->GetDeviceId()); + pairing->SetPeerNodeId(device->GetDeviceId()); - CHIP_ERROR err = mDeviceBeingCommissioned->SetConnected(); + CHIP_ERROR err = device->SetConnected(); if (err != CHIP_NO_ERROR) { ChipLogError(Controller, "Failed in setting up secure channel: err %s", ErrorStr(err)); @@ -1014,12 +1012,10 @@ void DeviceCommissioner::OnSessionEstablished() ChipLogDetail(Controller, "Remote device completed SPAKE2+ handshake"); - // TODO: Add code to receive CSR from the device, and process the signing request - // For IP rendezvous, this is sent as part of the state machine. if (mRunCommissioningAfterConnection) { mRunCommissioningAfterConnection = false; - mDefaultCommissioner->StartCommissioning(this, mDeviceBeingCommissioned); + mDefaultCommissioner->StartCommissioning(this, device); } else { @@ -1031,6 +1027,7 @@ void DeviceCommissioner::OnSessionEstablished() CHIP_ERROR DeviceCommissioner::SendCertificateChainRequestCommand(DeviceProxy * device, Credentials::CertificateType certificateType) { + MATTER_TRACE_EVENT_SCOPE("SendCertificateChainRequestCommand", "DeviceCommissioner"); ChipLogDetail(Controller, "Sending Certificate Chain request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1044,6 +1041,7 @@ CHIP_ERROR DeviceCommissioner::SendCertificateChainRequestCommand(DeviceProxy * void DeviceCommissioner::OnCertificateChainFailureResponse(void * context, CHIP_ERROR error) { + MATTER_TRACE_EVENT_SCOPE("OnCertificateChainFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the Certificate Chain request Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = reinterpret_cast(context); commissioner->CommissioningStageComplete(error); @@ -1052,6 +1050,7 @@ void DeviceCommissioner::OnCertificateChainFailureResponse(void * context, CHIP_ void DeviceCommissioner::OnCertificateChainResponse( void * context, const chip::app::Clusters::OperationalCredentials::Commands::CertificateChainResponse::DecodableType & response) { + MATTER_TRACE_EVENT_SCOPE("OnCertificateChainResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Received certificate chain from the device"); DeviceCommissioner * commissioner = reinterpret_cast(context); @@ -1063,6 +1062,7 @@ void DeviceCommissioner::OnCertificateChainResponse( CHIP_ERROR DeviceCommissioner::SendAttestationRequestCommand(DeviceProxy * device, const ByteSpan & attestationNonce) { + MATTER_TRACE_EVENT_SCOPE("SendAttestationRequestCommand", "DeviceCommissioner"); ChipLogDetail(Controller, "Sending Attestation request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1077,6 +1077,7 @@ CHIP_ERROR DeviceCommissioner::SendAttestationRequestCommand(DeviceProxy * devic void DeviceCommissioner::OnAttestationFailureResponse(void * context, CHIP_ERROR error) { + MATTER_TRACE_EVENT_SCOPE("OnAttestationFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the Attestation Information Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = reinterpret_cast(context); commissioner->CommissioningStageComplete(error); @@ -1085,6 +1086,7 @@ void DeviceCommissioner::OnAttestationFailureResponse(void * context, CHIP_ERROR void DeviceCommissioner::OnAttestationResponse(void * context, const OperationalCredentials::Commands::AttestationResponse::DecodableType & data) { + MATTER_TRACE_EVENT_SCOPE("OnAttestationResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Received Attestation Information from the device"); DeviceCommissioner * commissioner = reinterpret_cast(context); @@ -1095,6 +1097,7 @@ void DeviceCommissioner::OnAttestationResponse(void * context, void DeviceCommissioner::OnDeviceAttestationInformationVerification(void * context, AttestationVerificationResult result) { + MATTER_TRACE_EVENT_SCOPE("OnDeviceAttestationInformationVerification", "DeviceCommissioner"); DeviceCommissioner * commissioner = reinterpret_cast(context); if (result != AttestationVerificationResult::kSuccess) @@ -1109,17 +1112,15 @@ void DeviceCommissioner::OnDeviceAttestationInformationVerification(void * conte commissioner->CommissioningStageComplete(CHIP_ERROR_NOT_IMPLEMENTED, report); return; } - else - { - ChipLogError(Controller, - "Failed in verifying 'Attestation Information' command received from the device: err %hu. Look at " - "AttestationVerificationResult enum to understand the errors", - static_cast(result)); - // Go look at AttestationVerificationResult enum in src/credentials/attestation_verifier/DeviceAttestationVerifier.h to - // understand the errors. - commissioner->CommissioningStageComplete(CHIP_ERROR_INTERNAL, report); - return; - } + + ChipLogError(Controller, + "Failed in verifying 'Attestation Information' command received from the device: err %hu. Look at " + "AttestationVerificationResult enum to understand the errors", + static_cast(result)); + // Go look at AttestationVerificationResult enum in src/credentials/attestation_verifier/DeviceAttestationVerifier.h to + // understand the errors. + commissioner->CommissioningStageComplete(CHIP_ERROR_INTERNAL, report); + return; } ChipLogProgress(Controller, "Successfully validated 'Attestation Information' command received from the device."); @@ -1128,6 +1129,7 @@ void DeviceCommissioner::OnDeviceAttestationInformationVerification(void * conte CHIP_ERROR DeviceCommissioner::ValidateAttestationInfo(const Credentials::DeviceAttestationVerifier::AttestationInfo & info) { + MATTER_TRACE_EVENT_SCOPE("ValidateAttestationInfo", "DeviceCommissioner"); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); DeviceAttestationVerifier * dac_verifier = GetDeviceAttestationVerifier(); @@ -1141,6 +1143,7 @@ CHIP_ERROR DeviceCommissioner::ValidateAttestationInfo(const Credentials::Device CHIP_ERROR DeviceCommissioner::SendOperationalCertificateSigningRequestCommand(DeviceProxy * device, const ByteSpan & csrNonce) { + MATTER_TRACE_EVENT_SCOPE("SendOperationalCertificateSigningRequestCommand", "DeviceCommissioner"); ChipLogDetail(Controller, "Sending CSR request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1155,6 +1158,7 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificateSigningRequestCommand(D void DeviceCommissioner::OnCSRFailureResponse(void * context, CHIP_ERROR error) { + MATTER_TRACE_EVENT_SCOPE("OnCSRFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the CSR request Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = static_cast(context); commissioner->CommissioningStageComplete(error); @@ -1163,6 +1167,7 @@ void DeviceCommissioner::OnCSRFailureResponse(void * context, CHIP_ERROR error) void DeviceCommissioner::OnOperationalCertificateSigningRequest( void * context, const OperationalCredentials::Commands::CSRResponse::DecodableType & data) { + MATTER_TRACE_EVENT_SCOPE("OnOperationalCertificateSigningRequest", "DeviceCommissioner"); ChipLogProgress(Controller, "Received certificate signing request from the device"); DeviceCommissioner * commissioner = static_cast(context); @@ -1175,6 +1180,7 @@ void DeviceCommissioner::OnDeviceNOCChainGeneration(void * context, CHIP_ERROR s const ByteSpan & rcac, Optional ipk, Optional adminSubject) { + MATTER_TRACE_EVENT_SCOPE("OnDeviceNOCChainGeneration", "DeviceCommissioner"); DeviceCommissioner * commissioner = static_cast(context); // TODO(#13825): If not passed by the signer, the commissioner should @@ -1202,6 +1208,7 @@ void DeviceCommissioner::OnDeviceNOCChainGeneration(void * context, CHIP_ERROR s CHIP_ERROR DeviceCommissioner::ProcessCSR(DeviceProxy * proxy, const ByteSpan & NOCSRElements, const ByteSpan & AttestationSignature, ByteSpan dac, ByteSpan csrNonce) { + MATTER_TRACE_EVENT_SCOPE("ProcessOpCSR", "DeviceCommissioner"); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); ChipLogProgress(Controller, "Getting certificate chain for the device from the issuer"); @@ -1234,6 +1241,7 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(DeviceProxy * device, const ByteSpan & icaCertBuf, const AesCcm128KeySpan ipk, const NodeId adminSubject) { + MATTER_TRACE_EVENT_SCOPE("SendOperationalCertificate", "DeviceCommissioner"); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); OperationalCredentials::Commands::AddNOC::Type request; @@ -1243,8 +1251,8 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(DeviceProxy * device, request.caseAdminNode = adminSubject; request.adminVendorId = mVendorId; - ReturnErrorOnFailure(SendCommand(mDeviceBeingCommissioned, request, - OnOperationalCertificateAddResponse, OnAddNOCFailureResponse)); + ReturnErrorOnFailure( + SendCommand(device, request, OnOperationalCertificateAddResponse, OnAddNOCFailureResponse)); ChipLogProgress(Controller, "Sent operational certificate to the device"); @@ -1281,6 +1289,7 @@ CHIP_ERROR DeviceCommissioner::ConvertFromOperationalCertStatus(OperationalCrede void DeviceCommissioner::OnAddNOCFailureResponse(void * context, CHIP_ERROR error) { + MATTER_TRACE_EVENT_SCOPE("OnAddNOCFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the operational certificate Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = static_cast(context); commissioner->CommissioningStageComplete(error); @@ -1289,11 +1298,11 @@ void DeviceCommissioner::OnAddNOCFailureResponse(void * context, CHIP_ERROR erro void DeviceCommissioner::OnOperationalCertificateAddResponse( void * context, const OperationalCredentials::Commands::NOCResponse::DecodableType & data) { + MATTER_TRACE_EVENT_SCOPE("OnOperationalCertificateAddResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device returned status %d on receiving the NOC", to_underlying(data.statusCode)); DeviceCommissioner * commissioner = static_cast(context); - CHIP_ERROR err = CHIP_NO_ERROR; - CommissioneeDeviceProxy * device = nullptr; + CHIP_ERROR err = CHIP_NO_ERROR; VerifyOrExit(commissioner->mState == State::Initialized, err = CHIP_ERROR_INCORRECT_STATE); @@ -1302,9 +1311,7 @@ void DeviceCommissioner::OnOperationalCertificateAddResponse( err = ConvertFromOperationalCertStatus(data.statusCode); SuccessOrExit(err); - device = commissioner->mDeviceBeingCommissioned; - - err = commissioner->OnOperationalCredentialsProvisioningCompletion(device); + err = commissioner->OnOperationalCredentialsProvisioningCompletion(commissioner->mDeviceBeingCommissioned); exit: if (err != CHIP_NO_ERROR) @@ -1316,6 +1323,7 @@ void DeviceCommissioner::OnOperationalCertificateAddResponse( CHIP_ERROR DeviceCommissioner::SendTrustedRootCertificate(DeviceProxy * device, const ByteSpan & rcac) { + MATTER_TRACE_EVENT_SCOPE("SendTrustedRootCertificate", "DeviceCommissioner"); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); ChipLogProgress(Controller, "Sending root certificate to the device"); @@ -1332,6 +1340,7 @@ CHIP_ERROR DeviceCommissioner::SendTrustedRootCertificate(DeviceProxy * device, void DeviceCommissioner::OnRootCertSuccessResponse(void * context, const chip::app::DataModel::NullObjectType &) { + MATTER_TRACE_EVENT_SCOPE("OnRootCertSuccessResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device confirmed that it has received the root certificate"); DeviceCommissioner * commissioner = static_cast(context); commissioner->CommissioningStageComplete(CHIP_NO_ERROR); @@ -1339,13 +1348,15 @@ void DeviceCommissioner::OnRootCertSuccessResponse(void * context, const chip::a void DeviceCommissioner::OnRootCertFailureResponse(void * context, CHIP_ERROR error) { + MATTER_TRACE_EVENT_SCOPE("OnRootCertFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the root certificate Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = static_cast(context); commissioner->CommissioningStageComplete(error); } -CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(CommissioneeDeviceProxy * device) +CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(DeviceProxy * device) { + MATTER_TRACE_EVENT_SCOPE("OnOperationalCredentialsProvisioningCompletion", "DeviceCommissioner"); ChipLogProgress(Controller, "Operational credentials provisioned on device %p", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1386,11 +1397,12 @@ CHIP_ERROR DeviceCommissioner::CloseBleConnection() void DeviceCommissioner::OnSessionEstablishmentTimeout() { + // This is called from the session establishment timer. Please see + // https://github.com/project-chip/connectedhomeip/issues/14650 VerifyOrReturn(mState == State::Initialized); VerifyOrReturn(mDeviceBeingCommissioned != nullptr); - CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; - StopPairing(device->GetDeviceId()); + StopPairing(mDeviceBeingCommissioned->GetDeviceId()); if (mPairingDelegate != nullptr) { @@ -1456,6 +1468,11 @@ void OnBasicFailure(void * context, CHIP_ERROR error) void DeviceCommissioner::CommissioningStageComplete(CHIP_ERROR err, CommissioningDelegate::CommissioningReport report) { + // Once this stage is complete, reset mDeviceBeingCommissioned - this will be reset when the delegate calls the next step. + MATTER_TRACE_EVENT_SCOPE("CommissioningStageComplete", "DeviceCommissioner"); + NodeId nodeId = mDeviceBeingCommissioned->GetDeviceId(); + mDeviceBeingCommissioned = nullptr; + if (mCommissioningDelegate == nullptr) { return; @@ -1466,9 +1483,9 @@ void DeviceCommissioner::CommissioningStageComplete(CHIP_ERROR err, Commissionin { // Commissioning delegate will only return error if it failed to perform the appropriate commissioning step. // In this case, we should call back the commissioning complete and call session error - if (mPairingDelegate != nullptr) + if (mPairingDelegate != nullptr && mDeviceBeingCommissioned != nullptr) { - mPairingDelegate->OnCommissioningComplete(mDeviceBeingCommissioned->GetDeviceId(), status); + mPairingDelegate->OnCommissioningComplete(nodeId, status); } } } @@ -1482,26 +1499,25 @@ void DeviceCommissioner::OnDeviceConnectedFn(void * context, OperationalDevicePr if (commissioner->mCommissioningStage == CommissioningStage::kFindOperational) { if (commissioner->mDeviceBeingCommissioned != nullptr && - commissioner->mDeviceBeingCommissioned->GetDeviceId() == device->GetDeviceId()) + commissioner->mDeviceBeingCommissioned->GetDeviceId() == device->GetDeviceId() && + commissioner->mCommissioningDelegate != nullptr) { - // Let's release the device that's being paired, if pairing was successful, - // and the device is available on the operational network. - commissioner->ReleaseCommissioneeDevice(commissioner->mDeviceBeingCommissioned); - commissioner->mDeviceBeingCommissioned = nullptr; - if (commissioner->mCommissioningDelegate != nullptr) - { - CommissioningDelegate::CommissioningReport report; - report.Set(OperationalNodeFoundData(device)); - commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report); - } + CommissioningDelegate::CommissioningReport report; + report.Set(OperationalNodeFoundData(device)); + commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report); } } - else + else if (commissioner->mPairingDelegate != nullptr) { - VerifyOrReturn(commissioner->mPairingDelegate != nullptr, - ChipLogProgress(Controller, "Device connected callback with null pairing delegate. Ignoring")); commissioner->mPairingDelegate->OnPairingComplete(CHIP_NO_ERROR); } + + // Release any CommissioneeDeviceProxies we have here as we now have an OperationalDeviceProxy. + CommissioneeDeviceProxy * commissionee = commissioner->FindCommissioneeDevice(device->GetDeviceId()); + if (commissionee != nullptr) + { + commissioner->ReleaseCommissioneeDevice(commissionee); + } } void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error) @@ -1521,8 +1537,14 @@ void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, PeerId peer ChipLogError(Controller, "Device connection failed without a valid error code. Making one up."); error = CHIP_ERROR_INTERNAL; } + // TODO: Determine if we really want the PASE session removed here. See #16089. + CommissioneeDeviceProxy * commissionee = commissioner->FindCommissioneeDevice(peerId.GetNodeId()); + if (commissionee != nullptr) + { + commissioner->ReleaseCommissioneeDevice(commissionee); + } - commissioner->mCASESessionManager->ReleaseSession(peerId); + commissioner->mSystemState->CASESessionMgr()->ReleaseSession(peerId); if (commissioner->mCommissioningStage == CommissioningStage::kFindOperational && commissioner->mCommissioningDelegate != nullptr) { @@ -1532,20 +1554,6 @@ void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, PeerId peer { commissioner->mPairingDelegate->OnPairingComplete(error); } - - if (commissioner->mDeviceBeingCommissioned != nullptr && commissioner->mDeviceBeingCommissioned->GetPeerId() == peerId) - { - // This prevents a leak when commissioning fails in the middle. - // Can use one of the following to simulate a failure: - // - comment out SendSigma2 on the device side (chip-tool will timeout in 1m or so) - // - set kMinLookupTimeMsDefault (and max) in AddressResolve.h - // to a very low value to quickly fail (e.g. 10 ms and 11ms), not enough time for the device - // to actually become operational. Chiptool should fail fast after PASE - // - // Run the above cases under valgrind/asan to validate no additional leaks. - commissioner->ReleaseCommissioneeDevice(commissioner->mDeviceBeingCommissioned); - commissioner->mDeviceBeingCommissioned = nullptr; - } } void DeviceCommissioner::SetupCluster(ClusterBase & base, DeviceProxy * proxy, EndpointId endpoint, @@ -1754,10 +1762,14 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio CommissioningDelegate * delegate, EndpointId endpoint, Optional timeout) { + ChipLogProgress(Controller, "Performing next commissioning step '%s' with completion status = '%s'", StageToString(step), + params.GetCompletionStatus().AsString()); + // For now, we ignore errors coming in from the device since not all commissioning clusters are implemented on the device // side. - mCommissioningStage = step; - mCommissioningDelegate = delegate; + mCommissioningStage = step; + mCommissioningDelegate = delegate; + mDeviceBeingCommissioned = proxy; // TODO: Extend timeouts to the DAC and Opcert requests. // TODO(cecille): We probably want something better than this for breadcrumbs. @@ -1840,8 +1852,8 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio // Value is only switchable on the devices with indoor/outdoor capability if (capability == app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoorOutdoor) { - // If the device supports indoor and outdoor configs, use the setting from the commissioner, otherwise fall back to the - // current device setting then to outdoor (most restrictive) + // If the device supports indoor and outdoor configs, use the setting from the commissioner, otherwise fall back to + // the current device setting then to outdoor (most restrictive) if (params.GetDeviceRegulatoryLocation().HasValue()) { regulatoryLocation = params.GetDeviceRegulatoryLocation().Value(); @@ -1998,13 +2010,9 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio CommissioningStageComplete(CHIP_ERROR_INVALID_ARGUMENT); return; } - ChipLogProgress(Controller, "Sending operational certificate chain to the device"); SendOperationalCertificate(proxy, params.GetNoc().Value(), params.GetIcac().Value(), params.GetIpk().Value(), params.GetAdminSubject().Value()); break; - case CommissioningStage::kConfigACL: - // TODO: Implement - break; case CommissioningStage::kWiFiNetworkSetup: { if (!params.GetWiFiCredentials().HasValue()) { @@ -2013,7 +2021,6 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio return; } - ChipLogProgress(Controller, "Adding wifi network"); NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Type request; request.ssid = params.GetWiFiCredentials().Value().ssid; request.credentials = params.GetWiFiCredentials().Value().credentials; @@ -2028,7 +2035,6 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio CommissioningStageComplete(CHIP_ERROR_INVALID_ARGUMENT); return; } - ChipLogProgress(Controller, "Adding thread network"); NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Type request; request.operationalDataset = params.GetThreadOperationalDataset().Value(); request.breadcrumb = breadcrumb; @@ -2042,7 +2048,6 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio CommissioningStageComplete(CHIP_ERROR_INVALID_ARGUMENT); return; } - ChipLogProgress(Controller, "Enabling wifi network"); NetworkCommissioning::Commands::ConnectNetwork::Type request; request.networkID = params.GetWiFiCredentials().Value().ssid; request.breadcrumb = breadcrumb; @@ -2060,7 +2065,6 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio CommissioningStageComplete(CHIP_ERROR_INVALID_ARGUMENT); return; } - ChipLogProgress(Controller, "Enabling thread network"); NetworkCommissioning::Commands::ConnectNetwork::Type request; request.networkID = extendedPanId; request.breadcrumb = breadcrumb; @@ -2078,14 +2082,12 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio } break; case CommissioningStage::kSendComplete: { - ChipLogProgress(Controller, "Calling commissioning complete"); GeneralCommissioning::Commands::CommissioningComplete::Type request; SendCommand(proxy, request, OnCommissioningCompleteResponse, OnBasicFailure, endpoint, timeout); } break; case CommissioningStage::kCleanup: - ChipLogProgress(Controller, "Rendezvous cleanup"); if (mPairingDelegate != nullptr) { mPairingDelegate->OnCommissioningComplete(proxy->GetDeviceId(), params.GetCompletionStatus()); @@ -2113,13 +2115,13 @@ CHIP_ERROR DeviceController::UpdateDevice(NodeId deviceId) OperationalDeviceProxy * DeviceController::GetDeviceSession(const PeerId & peerId) { - return mCASESessionManager->FindExistingSession(peerId); + return mSystemState->CASESessionMgr()->FindExistingSession(peerId); } OperationalDeviceProxy * DeviceCommissioner::GetDeviceSession(const PeerId & peerId) { - CHIP_ERROR err = - mCASESessionManager->FindOrEstablishSession(peerId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); + CHIP_ERROR err = mSystemState->CASESessionMgr()->FindOrEstablishSession(peerId, &mOnDeviceConnectedCallback, + &mOnDeviceConnectionFailureCallback); if (err != CHIP_NO_ERROR) { diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index ef7160d6c7a859..0634c33ef8b47f 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -71,8 +71,6 @@ #include #endif #include -#include -#include namespace chip { @@ -174,7 +172,7 @@ class DLL_EXPORT DeviceController : public SessionRecoveryDelegate, public Abstr { public: DeviceController(); - virtual ~DeviceController() {} + ~DeviceController() override {} enum class CommissioningWindowOption : uint8_t { @@ -213,7 +211,8 @@ class DLL_EXPORT DeviceController : public SessionRecoveryDelegate, public Abstr chip::Callback::Callback * onFailure) { VerifyOrReturnError(mState == State::Initialized && mFabricInfo != nullptr, CHIP_ERROR_INCORRECT_STATE); - return mCASESessionManager->FindOrEstablishSession(mFabricInfo->GetPeerIdForNode(deviceId), onConnection, onFailure); + return mSystemState->CASESessionMgr()->FindOrEstablishSession(mFabricInfo->GetPeerIdForNode(deviceId), onConnection, + onFailure); } /** @@ -352,14 +351,6 @@ class DLL_EXPORT DeviceController : public SessionRecoveryDelegate, public Abstr State mState; - CASESessionManager * mCASESessionManager = nullptr; - -#if CHIP_CONFIG_MDNS_CACHE_SIZE > 0 - Dnssd::DnssdCache mDNSCache; -#endif - CASEClientPool mCASEClientPool; - OperationalDeviceProxyPool mDevicePool; - SerializableU64Set mPairedDevices; bool mPairedDevicesInitialized; @@ -379,8 +370,6 @@ class DLL_EXPORT DeviceController : public SessionRecoveryDelegate, public Abstr OperationalCredentialsDelegate * mOperationalCredentialsDelegate; - SessionIDAllocator mIDAllocator; - uint16_t mVendorId; /// Fetches the session to use for the current device. Allows overriding @@ -438,7 +427,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, { public: DeviceCommissioner(); - ~DeviceCommissioner() {} + ~DeviceCommissioner() override {} #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY // make this commissioner discoverable /** @@ -698,7 +687,8 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, private: DevicePairingDelegate * mPairingDelegate; - CommissioneeDeviceProxy * mDeviceBeingCommissioned = nullptr; + DeviceProxy * mDeviceBeingCommissioned = nullptr; + CommissioneeDeviceProxy * mDeviceInPASEEstablishment = nullptr; /* This field is true when device pairing information changes, e.g. a new device is paired, or the pairing for a device is removed. The DeviceCommissioner uses this to decide when to @@ -751,7 +741,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, the operational credential provisioning process. The function does not hold a reference to the device object. */ - CHIP_ERROR OnOperationalCredentialsProvisioningCompletion(CommissioneeDeviceProxy * device); + CHIP_ERROR OnOperationalCredentialsProvisioningCompletion(DeviceProxy * device); /* Callback when the previously sent CSR request results in failure */ static void OnCSRFailureResponse(void * context, CHIP_ERROR error); diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp index 4fc754997f3ee4..213ffddafb46e7 100644 --- a/src/controller/CHIPDeviceControllerFactory.cpp +++ b/src/controller/CHIPDeviceControllerFactory.cpp @@ -24,8 +24,10 @@ #include +#include #include #include +#include #if CONFIG_DEVICE_LAYER #include @@ -201,6 +203,31 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params) chip::app::DnssdServer::Instance().StartServer(); } + stateParams.sessionIDAllocator = Platform::New(); + stateParams.operationalDevicePool = Platform::New(); + stateParams.caseClientPool = Platform::New(); + + DeviceProxyInitParams deviceInitParams = { + .sessionManager = stateParams.sessionMgr, + .exchangeMgr = stateParams.exchangeMgr, + .idAllocator = stateParams.sessionIDAllocator, + .fabricTable = stateParams.fabricTable, + .clientPool = stateParams.caseClientPool, + .mrpLocalConfig = Optional::Value(GetLocalMRPConfig()), + }; + + CASESessionManagerConfig sessionManagerConfig = { + .sessionInitParams = deviceInitParams, +#if CHIP_CONFIG_MDNS_CACHE_SIZE > 0 + .dnsCache = NoSuchThingWeWouldNeedToAddIt, +#endif + .devicePool = stateParams.operationalDevicePool, + }; + + // TODO: Need to be able to create a CASESessionManagerConfig here! + stateParams.caseSessionManager = Platform::New(sessionManagerConfig); + ReturnErrorOnFailure(stateParams.caseSessionManager->Init(stateParams.systemLayer)); + // store the system state mSystemState = chip::Platform::New(stateParams); ChipLogDetail(Controller, "System State Initialized..."); @@ -287,6 +314,33 @@ CHIP_ERROR DeviceControllerSystemState::Shutdown() mCASEServer = nullptr; } + if (mCASESessionManager != nullptr) + { + mCASESessionManager->Shutdown(); + Platform::Delete(mCASESessionManager); + mCASESessionManager = nullptr; + } + + // mSessionIDAllocator, mCASEClientPool, and mDevicePool must be deallocated + // after mCASESessionManager, which uses them. + if (mSessionIDAllocator != nullptr) + { + Platform::Delete(mSessionIDAllocator); + mSessionIDAllocator = nullptr; + } + + if (mOperationalDevicePool != nullptr) + { + Platform::Delete(mOperationalDevicePool); + mOperationalDevicePool = nullptr; + } + + if (mCASEClientPool != nullptr) + { + Platform::Delete(mCASEClientPool); + mCASEClientPool = nullptr; + } + Dnssd::Resolver::Instance().Shutdown(); // Shut down the interaction model @@ -324,7 +378,11 @@ CHIP_ERROR DeviceControllerSystemState::Shutdown() } mSystemLayer = nullptr; + mTCPEndPointManager = nullptr; mUDPEndPointManager = nullptr; +#if CONFIG_NETWORK_LAYER_BLE + mBleLayer = nullptr; +#endif // CONFIG_NETWORK_LAYER_BLE if (mMessageCounterManager != nullptr) { diff --git a/src/controller/CHIPDeviceControllerSystemState.h b/src/controller/CHIPDeviceControllerSystemState.h index ebb0c87be3ef8a..869d77c1ca68a1 100644 --- a/src/controller/CHIPDeviceControllerSystemState.h +++ b/src/controller/CHIPDeviceControllerSystemState.h @@ -29,9 +29,13 @@ #pragma once +#include +#include #include +#include #include #include +#include #include #include @@ -63,18 +67,29 @@ namespace Controller { struct DeviceControllerSystemStateParams { + using OperationalDevicePool = OperationalDeviceProxyPool; + using CASEClientPool = chip::CASEClientPool; + + // Params that can outlive the DeviceControllerSystemState System::Layer * systemLayer = nullptr; Inet::EndPointManager * tcpEndPointManager = nullptr; Inet::EndPointManager * udpEndPointManager = nullptr; #if CONFIG_NETWORK_LAYER_BLE Ble::BleLayer * bleLayer = nullptr; #endif + + // Params that will be deallocated via Platform::Delete in + // DeviceControllerSystemState::Shutdown. DeviceTransportMgr * transportMgr = nullptr; SessionManager * sessionMgr = nullptr; Messaging::ExchangeManager * exchangeMgr = nullptr; secure_channel::MessageCounterManager * messageCounterManager = nullptr; FabricTable * fabricTable = nullptr; CASEServer * caseServer = nullptr; + CASESessionManager * caseSessionManager = nullptr; + SessionIDAllocator * sessionIDAllocator = nullptr; + OperationalDevicePool * operationalDevicePool = nullptr; + CASEClientPool * caseClientPool = nullptr; }; // A representation of the internal state maintained by the DeviceControllerFactory @@ -82,13 +97,18 @@ struct DeviceControllerSystemStateParams // Expects that the creator of this object is the last one to release it. class DeviceControllerSystemState { + using OperationalDevicePool = DeviceControllerSystemStateParams::OperationalDevicePool; + using CASEClientPool = DeviceControllerSystemStateParams::CASEClientPool; + public: ~DeviceControllerSystemState(){}; DeviceControllerSystemState(DeviceControllerSystemStateParams params) : mSystemLayer(params.systemLayer), mTCPEndPointManager(params.tcpEndPointManager), mUDPEndPointManager(params.udpEndPointManager), mTransportMgr(params.transportMgr), mSessionMgr(params.sessionMgr), mExchangeMgr(params.exchangeMgr), mMessageCounterManager(params.messageCounterManager), mFabrics(params.fabricTable), - mCASEServer(params.caseServer) + mCASEServer(params.caseServer), mCASESessionManager(params.caseSessionManager), + mSessionIDAllocator(params.sessionIDAllocator), mOperationalDevicePool(params.operationalDevicePool), + mCASEClientPool(params.caseClientPool) { #if CONFIG_NETWORK_LAYER_BLE mBleLayer = params.bleLayer; @@ -120,7 +140,8 @@ class DeviceControllerSystemState bool IsInitialized() { return mSystemLayer != nullptr && mUDPEndPointManager != nullptr && mTransportMgr != nullptr && mSessionMgr != nullptr && - mExchangeMgr != nullptr && mMessageCounterManager != nullptr && mFabrics != nullptr; + mExchangeMgr != nullptr && mMessageCounterManager != nullptr && mFabrics != nullptr && mCASESessionManager != nullptr && + mSessionIDAllocator != nullptr && mOperationalDevicePool != nullptr && mCASEClientPool != nullptr; }; System::Layer * SystemLayer() { return mSystemLayer; }; @@ -134,6 +155,8 @@ class DeviceControllerSystemState #if CONFIG_NETWORK_LAYER_BLE Ble::BleLayer * BleLayer() { return mBleLayer; }; #endif + CASESessionManager * CASESessionMgr() const { return mCASESessionManager; } + SessionIDAllocator * SessionIDAlloc() const { return mSessionIDAllocator; } private: DeviceControllerSystemState(){}; @@ -150,6 +173,10 @@ class DeviceControllerSystemState secure_channel::MessageCounterManager * mMessageCounterManager = nullptr; FabricTable * mFabrics = nullptr; CASEServer * mCASEServer = nullptr; + CASESessionManager * mCASESessionManager = nullptr; + SessionIDAllocator * mSessionIDAllocator = nullptr; + OperationalDevicePool * mOperationalDevicePool = nullptr; + CASEClientPool * mCASEClientPool = nullptr; std::atomic mRefCount{ 1 }; diff --git a/src/controller/CommissioneeDeviceProxy.h b/src/controller/CommissioneeDeviceProxy.h index a40a38eff91733..6d053ffec9b9d2 100644 --- a/src/controller/CommissioneeDeviceProxy.h +++ b/src/controller/CommissioneeDeviceProxy.h @@ -79,7 +79,7 @@ struct ControllerDeviceInitParams class CommissioneeDeviceProxy : public DeviceProxy, public SessionReleaseDelegate { public: - ~CommissioneeDeviceProxy(); + ~CommissioneeDeviceProxy() override; CommissioneeDeviceProxy() : mSecureSession(*this) {} CommissioneeDeviceProxy(const CommissioneeDeviceProxy &) = delete; diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h index aff599dd663034..143c16465b1638 100644 --- a/src/controller/CommissionerDiscoveryController.h +++ b/src/controller/CommissionerDiscoveryController.h @@ -183,7 +183,7 @@ class CommissionerDiscoveryController : public chip::Protocols::UserDirectedComm * * This code will call the registered UserPrompter's PromptForCommissionOKPermission */ - void OnUserDirectedCommissioningRequest(UDCClientState state); + void OnUserDirectedCommissioningRequest(UDCClientState state) override; /** * This method should be called after the user has given consent for commissioning of the client diff --git a/src/controller/CommissioningDelegate.cpp b/src/controller/CommissioningDelegate.cpp new file mode 100644 index 00000000000000..9038af9402679f --- /dev/null +++ b/src/controller/CommissioningDelegate.cpp @@ -0,0 +1,111 @@ +/* + * + * 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. + */ + +#include + +namespace chip { +namespace Controller { + +const char * StageToString(CommissioningStage stage) +{ + switch (stage) + { + case kError: + return "Error"; + break; + + case kSecurePairing: + return "SecurePairing"; + break; + + case kArmFailsafe: + return "ArmFailSafe"; + break; + + case kConfigRegulatory: + return "ConfigRegulatory"; + break; + + case kSendPAICertificateRequest: + return "SendPAICertificateRequest"; + break; + + case kSendDACCertificateRequest: + return "SendDACCertificateRequest"; + break; + + case kSendAttestationRequest: + return "SendAttestationRequest"; + break; + + case kAttestationVerification: + return "AttestationVerification"; + break; + + case kSendOpCertSigningRequest: + return "SendOpCertSigningRequest"; + break; + + case kGenerateNOCChain: + return "GenerateNOCChain"; + break; + + case kSendTrustedRootCert: + return "SendTrustedRootCert"; + break; + + case kSendNOC: + return "SendNOC"; + break; + + case kWiFiNetworkSetup: + return "WiFiNetworkSetup"; + break; + + case kThreadNetworkSetup: + return "ThreadNetworkSetup"; + break; + + case kWiFiNetworkEnable: + return "WiFiNetworkEnable"; + break; + + case kThreadNetworkEnable: + return "ThreadNetworkEnable"; + break; + + case kFindOperational: + return "FindOperational"; + break; + + case kSendComplete: + return "SendComplete"; + break; + + case kCleanup: + return "Cleanup"; + break; + + default: + return "???"; + break; + } +} + +} // namespace Controller +} // namespace chip diff --git a/src/controller/CommissioningDelegate.h b/src/controller/CommissioningDelegate.h index b75168a9d47e3e..fd92c67095e054 100644 --- a/src/controller/CommissioningDelegate.h +++ b/src/controller/CommissioningDelegate.h @@ -33,9 +33,6 @@ enum CommissioningStage : uint8_t kSecurePairing, kReadCommissioningInfo, kArmFailsafe, - // kConfigTime, // NOT YET IMPLEMENTED - // kConfigTimeZone, // NOT YET IMPLEMENTED - // kConfigDST, // NOT YET IMPLEMENTED kConfigRegulatory, kSendPAICertificateRequest, kSendDACCertificateRequest, @@ -52,9 +49,10 @@ enum CommissioningStage : uint8_t kFindOperational, kSendComplete, kCleanup, - kConfigACL, }; +const char * StageToString(CommissioningStage stage); + struct WiFiCredentials { ByteSpan ssid; @@ -77,38 +75,130 @@ class CommissioningParameters static constexpr size_t kMaxSsidLen = 32; static constexpr size_t kMaxCredentialsLen = 64; + // Value to use when setting the commissioning failsafe timer on the node being commissioned. + // If the failsafe timer value is passed in as part of the commissioning parameters, that value will be used. If not supplied, + // the AutoCommissioner will set this to the recommended value read from the node. If that is not set, it will fall back to the + // default kDefaultFailsafeTimeout. + // This value should be set before running PerformCommissioningStep for the kArmFailsafe step. const Optional GetFailsafeTimerSeconds() const { return mFailsafeTimerSeconds; } + + // The location (indoor/outdoor) of the node being commissioned. + // The node regulartory location (indoor/outdoor) should be set by the commissioner explicitly as it may be different than the + // location of the commissioner. This location will be set on the node if the node supports configurable regulatory location + // (from GetLocationCapability - see below). If the regulatory location is not supplied, this will fall back to the location in + // GetDefaultRegulatoryLocation and then to Outdoor (most restrictive). + // This value should be set before calling PerformCommissioningStep for the kConfigRegulatory step. const Optional GetDeviceRegulatoryLocation() const { return mDeviceRegulatoryLocation; } + + // Nonce sent to the node to use during the CSR request. + // When using the AutoCommissioner, this value will be ignored in favour of the value supplied by the + // OperationalCredentialsDelegate ObtainCsrNonce function. If the credential delegate is not supplied, the value supplied here + // will be used. If neither is supplied random value will be used as a fallback. + // This value must be set before calling PerformCommissioningStep for the kSendOpCertSigningRequest step. const Optional GetCSRNonce() const { return mCSRNonce; } + + // Nonce value sent to the node to use during the attestation request. + // When using the AutoCommissioner, this value will fall back to random if not supplied. + // If a non-random value is to be used, the value must be set before calling PerformCommissioningStep for the + // kSendAttestationRequest step. const Optional GetAttestationNonce() const { return mAttestationNonce; } + + // WiFi SSID and credentials to use when adding/updating and enabling WiFi on the node. + // This value must be set before calling PerformCommissioningStep for the kWiFiNetworkSetup or kWiFiNetworkEnable steps. const Optional GetWiFiCredentials() const { return mWiFiCreds; } + + // Thread operational dataset to use when adding/updating and enabling the thread network on the node. + // This value must be set before calling PerformCommissioningStep for the kThreadNetworkSetup or kThreadNetworkEnable steps. const Optional GetThreadOperationalDataset() const { return mThreadOperationalDataset; } + + // The NOCSR parameters (elements and signature) returned from the node. In the AutoCommissioner, this is set using the data + // returned from the kSendOpCertSigningRequest stage. + // This value must be set before calling PerformCommissioningStep for the kGenerateNOCChain step. const Optional GetNOCChainGenerationParameters() const { return mNOCChainGenerationParameters; } + + // The root certificate for the operational certificate chain. In the auto commissioner, this is set by by the kGenerateNOCChain + // stage through the OperationalCredentialsDelegate. + // This value must be set before calling PerformCommissioningStep for the kSendTrustedRootCert step. const Optional GetRootCert() const { return mRootCert; } + + // The node operational certificate for the node being commissioned. In the AutoCommissioner, this is set by by the + // kGenerateNOCChain stage through the OperationalCredentialsDelegate. + // This value must be set before calling PerformCommissioningStep for the kSendNOC step. + // This value must also be set before calling PerformCommissioningStep for the kSendTrustedRootCert step, as it is used to set + // the node id in the DeviceProxy. const Optional GetNoc() const { return mNoc; } + + // The intermediate certificate for the node being commissioned. In the AutoCommissioner, this is set by by the + // kGenerateNOCChain stage through the OperationalCredentialsDelegate. + // This value should be set before calling PerformCommissioningStep for the kSendNOC step. const Optional GetIcac() const { return mIcac; } + + // Epoch key for the identity protection key for the node being commissioned. In the AutoCommissioner, this is set by by the + // kGenerateNOCChain stage through the OperationalCredentialsDelegate. + // This value must be set before calling PerformCommissioningStep for the kSendNOC step. const Optional GetIpk() const { return mIpk.HasValue() ? Optional(mIpk.Value().Span()) : Optional(); } + + // Admin subject id used for the case access control entry created if the AddNOC command succeeds. In the AutoCommissioner, this + // is set by by the kGenerateNOCChain stage through the OperationalCredentialsDelegate. + // This must be set before calling PerformCommissioningStep for the kSendNOC step. const Optional GetAdminSubject() const { return mAdminSubject; } + + // Attestation elements from the node. These are obtained from node in response to the AttestationRequest command. In the + // AutoCommissioner, this is automatically set from the report from the kSendAttestationRequest stage. + // This must be set before calling PerformCommissioningStep for the kAttestationVerification step. const Optional GetAttestationElements() const { return mAttestationElements; } + + // Attestation signature from the node. This is obtained from node in response to the AttestationRequest command. In the + // AutoCommissioner, this is automatically set from the report from the kSendAttestationRequest stage. + // This must be set before calling PerformCommissioningStep for the kAttestationVerification step. const Optional GetAttestationSignature() const { return mAttestationSignature; } + + // Product attestation intermediate certificate from the node. This is obtained from the node in response to the + // CertificateChainRequest command for the PAI. In the AutoCommissioner, this is automatically set from the report from the + // kSendPAICertificateRequest stage. + // This must be set before calling PerformCommissioningStep for the kAttestationVerificationstep. const Optional GetPAI() const { return mPAI; } + + // Device attestation certificate from the node. This is obtained from the node in response to the CertificateChainRequest + // command for the DAC. In the AutoCommissioner, this is automatically set from the report from the kSendDACCertificateRequest + // stage. + // This must be set before calling PerformCommissioningStep for the kAttestationVerification step. const Optional GetDAC() const { return mDAC; } + + // Node vendor ID from the basic information cluster. In the AutoCommissioner, this is automatically set from report from the + // kReadCommissioningInfo stage. + // This must be set before calling PerformCommissioningStep for the kAttestationVerification step. const Optional GetRemoteVendorId() const { return mRemoteVendorId; } + + // Node product ID from the basic information cluster. In the AutoCommissioner, this is automatically set from report from the + // kReadCommissioningInfo stage. + // This must be set before calling PerformCommissioningStep for the kAttestationVerification step. const Optional GetRemoteProductId() const { return mRemoteProductId; } + + // Default regulatory location set by the node, as read from the GeneralCommissioning cluster. In the AutoCommissioner, this is + // automatically set from report from the kReadCommissioningInfo stage. + // This should be set before calling PerformCommissioningStep for the kConfigRegulatory step. const Optional GetDefaultRegulatoryLocation() const { return mDefaultRegulatoryLocation; } + + // Location capabilities of the node, as read from the GeneralCommissioning cluster. In the AutoCommissioner, this is + // automatically set from report from the kReadCommissioningInfo stage. + // This should be set before calling PerformCommissioningStep for the kConfigRegulatory step. const Optional GetLocationCapability() const { return mLocationCapability; } + + // Status to send when calling CommissioningComplete on the PairingDelegate during the kCleanup step. The AutoCommissioner uses + // this to pass through any error messages received during commissioning. CHIP_ERROR GetCompletionStatus() { return completionStatus; } CommissioningParameters & SetFailsafeTimerSeconds(uint16_t seconds) @@ -229,8 +319,8 @@ class CommissioningParameters // Items that can be set by the commissioner Optional mFailsafeTimerSeconds; Optional mDeviceRegulatoryLocation; - Optional mCSRNonce; ///< CSR Nonce passed by the commissioner - Optional mAttestationNonce; ///< Attestation Nonce passed by the commissioner + Optional mCSRNonce; + Optional mAttestationNonce; Optional mWiFiCreds; Optional mThreadOperationalDataset; Optional mNOCChainGenerationParameters; @@ -335,6 +425,26 @@ class CommissioningDelegate { public: virtual ~CommissioningDelegate(){}; + /* CommissioningReport is returned after each commissioning step is completed. The reports for each step are: + * kReadCommissioningInfo - ReadCommissioningInfo + * kArmFailsafe: none + * kConfigRegulatory: none + * kSendPAICertificateRequest: RequestedCertificate + * kSendDACCertificateRequest: RequestedCertificate + * kSendAttestationRequest: AttestationResponse + * kAttestationVerification: AdditionalErrorInfo if there is an error + * kSendOpCertSigningRequest: CSRResponse + * kGenerateNOCChain: NocChain + * kSendTrustedRootCert: None + * kSendNOC: none + * kWiFiNetworkSetup: none + * kThreadNetworkSetup: none + * kWiFiNetworkEnable: none + * kThreadNetworkEnable: none + * kFindOperational: OperationalNodeFoundData + * kSendComplete: none + * kCleanup: none + */ struct CommissioningReport : Variant { diff --git a/src/controller/ExampleOperationalCredentialsIssuer.h b/src/controller/ExampleOperationalCredentialsIssuer.h index 98a04ae6defe61..96023a4945dc5a 100644 --- a/src/controller/ExampleOperationalCredentialsIssuer.h +++ b/src/controller/ExampleOperationalCredentialsIssuer.h @@ -52,7 +52,7 @@ class DLL_EXPORT ExampleOperationalCredentialsIssuer : public OperationalCredent // It is recommended that this index track the fabric index within which this issuer is operating. // ExampleOperationalCredentialsIssuer(uint32_t index = 0) { mIndex = index; } - virtual ~ExampleOperationalCredentialsIssuer() {} + ~ExampleOperationalCredentialsIssuer() override {} CHIP_ERROR GenerateNOCChain(const ByteSpan & csrElements, const ByteSpan & attestationSignature, const ByteSpan & DAC, const ByteSpan & PAI, const ByteSpan & PAA, diff --git a/src/controller/SetUpCodePairer.cpp b/src/controller/SetUpCodePairer.cpp index 0cde726a50de15..cda0978655f74c 100644 --- a/src/controller/SetUpCodePairer.cpp +++ b/src/controller/SetUpCodePairer.cpp @@ -167,7 +167,7 @@ void SetUpCodePairer::OnDiscoveredDeviceOverBleError(void * appState, CHIP_ERROR } #endif // CONFIG_NETWORK_LAYER_BLE -bool SetUpCodePairer::NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & nodeData) +bool SetUpCodePairer::NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & nodeData) const { if (nodeData.commissioningMode == 0) { diff --git a/src/controller/SetUpCodePairer.h b/src/controller/SetUpCodePairer.h index 51c3bbf46ca453..19b57999f0eeae 100644 --- a/src/controller/SetUpCodePairer.h +++ b/src/controller/SetUpCodePairer.h @@ -85,7 +85,7 @@ class DLL_EXPORT SetUpCodePairer static void OnDiscoveredDeviceOverBleError(void * appState, CHIP_ERROR err); #endif // CONFIG_NETWORK_LAYER_BLE - bool NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & nodeData); + bool NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & nodeData) const; Dnssd::DiscoveryFilter currentFilter; DeviceCommissioner * mCommissioner = nullptr; diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 0ba1b9da8ad16f..67cde8b0bc354b 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -28,11 +28,11 @@ client cluster AccessControl = 31 { } struct AccessControlEntry { - fabric_idx fabricIndex = 0; Privilege privilege = 1; AuthMode authMode = 2; nullable INT64U subjects[] = 3; nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; } struct Target { @@ -42,24 +42,24 @@ client cluster AccessControl = 31 { } struct ExtensionEntry { - fabric_idx fabricIndex = 0; OCTET_STRING<254> data = 1; + fabric_idx fabricIndex = 254; } info event AccessControlEntryChanged = 0 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable AccessControlEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } info event AccessControlExtensionChanged = 1 { - fabric_idx adminFabricIndex = 0; nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; nullable ExtensionEntry latestValue = 4; + fabric_idx adminFabricIndex = 254; } attribute AccessControlEntry acl[] = 0; @@ -320,11 +320,11 @@ client cluster BinaryInputBasic = 15 { client cluster Binding = 30 { struct TargetStruct { - FABRIC_IDX fabricIndex = 0; optional NODE_ID node = 1; optional GROUP_ID group = 2; optional ENDPOINT_NO endpoint = 3; optional CLUSTER_ID cluster = 4; + FABRIC_IDX fabricIndex = 254; } attribute TargetStruct binding[] = 0; @@ -1249,6 +1249,12 @@ client cluster DoorLock = 257 { kForcedDoorOpenUnderDoorLockedCondition = 0x40; } + bitmap DlCredentialRuleMask : BITMAP8 { + kSingle = 0x1; + kDual = 0x2; + kTri = 0x4; + } + bitmap DlCredentialRulesSupport : BITMAP8 { kSingle = 0x1; kDual = 0x2; @@ -1440,7 +1446,7 @@ client cluster DoorLock = 257 { attribute int32u autoRelockTime = 35; attribute int8u soundVolume = 36; attribute DlOperatingMode operatingMode = 37; - readonly attribute bitmap16 supportedOperatingModes = 38; + readonly attribute DlSupportedOperatingModes supportedOperatingModes = 38; attribute boolean enableOneTouchLocking = 41; attribute boolean enablePrivacyModeButton = 43; attribute int8u wrongCodeEntryLimit = 48; @@ -1836,16 +1842,16 @@ client cluster GroupKeyManagement = 63 { } struct GroupKeyMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; INT16U groupKeySetID = 2; + fabric_idx fabricIndex = 254; } struct GroupInfoMapStruct { - fabric_idx fabricIndex = 0; group_id groupId = 1; endpoint_no endpoints[] = 2; optional CHAR_STRING<16> groupName = 3; + fabric_idx fabricIndex = 254; } struct GroupKeySetStruct { @@ -2734,18 +2740,18 @@ client cluster OperationalCredentials = 62 { } struct NOCStruct { - fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; nullable OCTET_STRING icac = 2; + fabric_idx fabricIndex = 254; } struct FabricDescriptor { - fabric_idx fabricIndex = 0; OCTET_STRING<65> rootPublicKey = 1; INT16U vendorId = 2; FABRIC_ID fabricId = 3; NODE_ID nodeId = 4; CHAR_STRING<32> label = 5; + fabric_idx fabricIndex = 254; } readonly attribute NOCStruct NOCs[] = 0; @@ -3344,7 +3350,6 @@ client cluster TestCluster = 1295 { } struct TestFabricScoped { - fabric_idx fabricIndex = 0; INT8U fabricSensitiveInt8u = 1; optional INT8U optionalFabricSensitiveInt8u = 2; nullable INT8U nullableFabricSensitiveInt8u = 3; @@ -3352,6 +3357,7 @@ client cluster TestCluster = 1295 { CHAR_STRING fabricSensitiveCharString = 5; SimpleStruct fabricSensitiveStruct = 6; INT8U fabricSensitiveInt8uList[] = 7; + fabric_idx fabricIndex = 254; } struct NestedStructList { @@ -3380,7 +3386,7 @@ client cluster TestCluster = 1295 { } info event TestFabricScopedEvent = 2 { - fabric_idx arg1 = 1; + fabric_idx arg1 = 254; } attribute boolean boolean = 0; diff --git a/src/controller/java/AndroidCallbacks.cpp b/src/controller/java/AndroidCallbacks.cpp index 6dc10ee617df69..499411fdcd18a5 100644 --- a/src/controller/java/AndroidCallbacks.cpp +++ b/src/controller/java/AndroidCallbacks.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -214,8 +215,10 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat TLV::TLVReader readerForJavaObject; TLV::TLVReader readerForJavaTLV; + TLV::TLVReader readerForJson; readerForJavaObject.Init(*apData); readerForJavaTLV.Init(*apData); + readerForJson.Init(*apData); jobject value = DecodeAttributeValue(aPath, readerForJavaObject, &err); // If we don't know this attribute, just skip it. @@ -238,14 +241,20 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat size = writer.GetLengthWritten(); chip::ByteArray jniByteArray(env, reinterpret_cast(buffer.get()), size); + // Convert TLV to JSON + Json::Value json; + err = TlvToJson(readerForJson, json); + UtfString jsonString(env, JsonToString(json).c_str()); + // Create AttributeState object jclass attributeStateCls; err = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/model/AttributeState", attributeStateCls); VerifyOrReturn(attributeStateCls != nullptr, ChipLogError(Controller, "Could not find AttributeState class")); chip::JniClass attributeStateJniCls(attributeStateCls); - jmethodID attributeStateCtor = env->GetMethodID(attributeStateCls, "", "(Ljava/lang/Object;[B)V"); + jmethodID attributeStateCtor = env->GetMethodID(attributeStateCls, "", "(Ljava/lang/Object;[BLjava/lang/String;)V"); VerifyOrReturn(attributeStateCtor != nullptr, ChipLogError(Controller, "Could not find AttributeState constructor")); - jobject attributeStateObj = env->NewObject(attributeStateCls, attributeStateCtor, value, jniByteArray.jniValue()); + jobject attributeStateObj = + env->NewObject(attributeStateCls, attributeStateCtor, value, jniByteArray.jniValue(), jsonString.jniValue()); VerifyOrReturn(attributeStateObj != nullptr, ChipLogError(Controller, "Could not create AttributeState object")); // Add AttributeState to NodeState diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 88240abbf00291..1357c0f6dc1f69 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -49,6 +49,7 @@ shared_library("jni") { "${chip_root}/src/credentials:default_attestation_verifier", "${chip_root}/src/inet", "${chip_root}/src/lib", + "${chip_root}/src/lib/support/jsontlv", "${chip_root}/src/platform", "${chip_root}/src/platform/android", ] diff --git a/src/controller/java/src/chip/devicecontroller/model/AttributeState.java b/src/controller/java/src/chip/devicecontroller/model/AttributeState.java index 2920d321f38334..db7eefc21b878d 100644 --- a/src/controller/java/src/chip/devicecontroller/model/AttributeState.java +++ b/src/controller/java/src/chip/devicecontroller/model/AttributeState.java @@ -17,14 +17,26 @@ */ package chip.devicecontroller.model; -/** Represents the reported value of an attribute in object form AND TLV. */ +import android.util.Log; +import org.json.JSONException; +import org.json.JSONObject; + +/** Represents the reported value of an attribute in object form, TLV and JSON. */ public final class AttributeState { + private static final String TAG = "AttributeState"; + private Object valueObject; private byte[] tlv; + private JSONObject json; - public AttributeState(Object valueObject, byte[] tlv) { + public AttributeState(Object valueObject, byte[] tlv, String jsonString) { this.valueObject = valueObject; this.tlv = tlv; + try { + this.json = new JSONObject(jsonString); + } catch (JSONException ex) { + Log.e(TAG, "Error parsing JSON string", ex); + } } public Object getValue() { @@ -37,4 +49,8 @@ public Object getValue() { public byte[] getTlv() { return tlv; } + + public JSONObject getJson() { + return json; + } } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 0f1188b2e1d185..753dd452d55c20 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -57,12 +57,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_privilege; std::string newElement_0_privilegeClassName = "java/lang/Integer"; std::string newElement_0_privilegeCtorSignature = "(I)V"; @@ -171,6 +165,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR chip::JniReferences::GetInstance().AddToList(newElement_0_targets, newElement_NaN); } } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass accessControlEntryStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -182,7 +182,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } jmethodID accessControlEntryStructCtor = env->GetMethodID( accessControlEntryStructClass, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/util/ArrayList;)V"); + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/util/ArrayList;Ljava/lang/Integer;)V"); if (accessControlEntryStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterAccessControlEntry constructor"); @@ -190,8 +190,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } newElement_0 = - env->NewObject(accessControlEntryStructClass, accessControlEntryStructCtor, newElement_0_fabricIndex, - newElement_0_privilege, newElement_0_authMode, newElement_0_subjects, newElement_0_targets); + env->NewObject(accessControlEntryStructClass, accessControlEntryStructCtor, newElement_0_privilege, + newElement_0_authMode, newElement_0_subjects, newElement_0_targets, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; @@ -212,17 +212,17 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; + jobject newElement_0_data; + jbyteArray newElement_0_dataByteArray = env->NewByteArray(static_cast(entry_0.data.size())); + env->SetByteArrayRegion(newElement_0_dataByteArray, 0, static_cast(entry_0.data.size()), + reinterpret_cast(entry_0.data.data())); + newElement_0_data = newElement_0_dataByteArray; jobject newElement_0_fabricIndex; std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; std::string newElement_0_fabricIndexCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), newElement_0_fabricIndexCtorSignature.c_str(), entry_0.fabricIndex, newElement_0_fabricIndex); - jobject newElement_0_data; - jbyteArray newElement_0_dataByteArray = env->NewByteArray(static_cast(entry_0.data.size())); - env->SetByteArrayRegion(newElement_0_dataByteArray, 0, static_cast(entry_0.data.size()), - reinterpret_cast(entry_0.data.data())); - newElement_0_data = newElement_0_dataByteArray; jclass extensionEntryStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -233,15 +233,15 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jmethodID extensionEntryStructCtor = - env->GetMethodID(extensionEntryStructClass, "", "(Ljava/lang/Integer;[B)V"); + env->GetMethodID(extensionEntryStructClass, "", "([BLjava/lang/Integer;)V"); if (extensionEntryStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterExtensionEntry constructor"); return nullptr; } - newElement_0 = env->NewObject(extensionEntryStructClass, extensionEntryStructCtor, newElement_0_fabricIndex, - newElement_0_data); + newElement_0 = env->NewObject(extensionEntryStructClass, extensionEntryStructCtor, newElement_0_data, + newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; @@ -1853,12 +1853,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_node; if (!entry_0.node.HasValue()) { @@ -1921,6 +1915,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_0_clusterInsideOptional); chip::JniReferences::GetInstance().CreateOptional(newElement_0_clusterInsideOptional, newElement_0_cluster); } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass targetStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -1932,15 +1932,16 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } jmethodID targetStructStructCtor = env->GetMethodID( targetStructStructClass, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/lang/Integer;)V"); if (targetStructStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$BindingClusterTargetStruct constructor"); return nullptr; } - newElement_0 = env->NewObject(targetStructStructClass, targetStructStructCtor, newElement_0_fabricIndex, - newElement_0_node, newElement_0_group, newElement_0_endpoint, newElement_0_cluster); + newElement_0 = + env->NewObject(targetStructStructClass, targetStructStructCtor, newElement_0_node, newElement_0_group, + newElement_0_endpoint, newElement_0_cluster, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; @@ -4631,7 +4632,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - cppValue, value); + cppValue.Raw(), value); return value; } case Attributes::EnableOneTouchLocking::Id: { @@ -6311,12 +6312,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_groupId; std::string newElement_0_groupIdClassName = "java/lang/Integer"; std::string newElement_0_groupIdCtorSignature = "(I)V"; @@ -6329,6 +6324,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_groupKeySetIDClassName.c_str(), newElement_0_groupKeySetIDCtorSignature.c_str(), entry_0.groupKeySetID, newElement_0_groupKeySetID); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass groupKeyMapStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -6347,8 +6348,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } - newElement_0 = env->NewObject(groupKeyMapStructStructClass, groupKeyMapStructStructCtor, newElement_0_fabricIndex, - newElement_0_groupId, newElement_0_groupKeySetID); + newElement_0 = env->NewObject(groupKeyMapStructStructClass, groupKeyMapStructStructCtor, newElement_0_groupId, + newElement_0_groupKeySetID, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; @@ -6369,12 +6370,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_groupId; std::string newElement_0_groupIdClassName = "java/lang/Integer"; std::string newElement_0_groupIdCtorSignature = "(I)V"; @@ -6407,6 +6402,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR env->NewStringUTF(std::string(entry_0.groupName.Value().data(), entry_0.groupName.Value().size()).c_str()); chip::JniReferences::GetInstance().CreateOptional(newElement_0_groupNameInsideOptional, newElement_0_groupName); } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass groupInfoMapStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -6419,15 +6420,15 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } jmethodID groupInfoMapStructStructCtor = env->GetMethodID(groupInfoMapStructStructClass, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/util/Optional;)V"); + "(Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/util/Optional;Ljava/lang/Integer;)V"); if (groupInfoMapStructStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$GroupKeyManagementClusterGroupInfoMapStruct constructor"); return nullptr; } - newElement_0 = env->NewObject(groupInfoMapStructStructClass, groupInfoMapStructStructCtor, newElement_0_fabricIndex, - newElement_0_groupId, newElement_0_endpoints, newElement_0_groupName); + newElement_0 = env->NewObject(groupInfoMapStructStructClass, groupInfoMapStructStructCtor, newElement_0_groupId, + newElement_0_endpoints, newElement_0_groupName, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; @@ -9243,12 +9244,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_noc; jbyteArray newElement_0_nocByteArray = env->NewByteArray(static_cast(entry_0.noc.size())); env->SetByteArrayRegion(newElement_0_nocByteArray, 0, static_cast(entry_0.noc.size()), @@ -9266,6 +9261,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR reinterpret_cast(entry_0.icac.Value().data())); newElement_0_icac = newElement_0_icacByteArray; } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass NOCStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -9275,15 +9276,15 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR ChipLogError(Zcl, "Could not find class ChipStructs$OperationalCredentialsClusterNOCStruct"); return nullptr; } - jmethodID NOCStructStructCtor = env->GetMethodID(NOCStructStructClass, "", "(Ljava/lang/Integer;[B[B)V"); + jmethodID NOCStructStructCtor = env->GetMethodID(NOCStructStructClass, "", "([B[BLjava/lang/Integer;)V"); if (NOCStructStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$OperationalCredentialsClusterNOCStruct constructor"); return nullptr; } - newElement_0 = env->NewObject(NOCStructStructClass, NOCStructStructCtor, newElement_0_fabricIndex, newElement_0_noc, - newElement_0_icac); + newElement_0 = env->NewObject(NOCStructStructClass, NOCStructStructCtor, newElement_0_noc, newElement_0_icac, + newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; @@ -9304,12 +9305,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_rootPublicKey; jbyteArray newElement_0_rootPublicKeyByteArray = env->NewByteArray(static_cast(entry_0.rootPublicKey.size())); @@ -9336,6 +9331,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR entry_0.nodeId, newElement_0_nodeId); jobject newElement_0_label; newElement_0_label = env->NewStringUTF(std::string(entry_0.label.data(), entry_0.label.size()).c_str()); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass fabricDescriptorStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -9348,16 +9349,16 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } jmethodID fabricDescriptorStructCtor = env->GetMethodID( fabricDescriptorStructClass, "", - "(Ljava/lang/Integer;[BLjava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;)V"); + "([BLjava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/Integer;)V"); if (fabricDescriptorStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$OperationalCredentialsClusterFabricDescriptor constructor"); return nullptr; } - newElement_0 = env->NewObject(fabricDescriptorStructClass, fabricDescriptorStructCtor, newElement_0_fabricIndex, - newElement_0_rootPublicKey, newElement_0_vendorId, newElement_0_fabricId, - newElement_0_nodeId, newElement_0_label); + newElement_0 = env->NewObject(fabricDescriptorStructClass, fabricDescriptorStructCtor, newElement_0_rootPublicKey, + newElement_0_vendorId, newElement_0_fabricId, newElement_0_nodeId, newElement_0_label, + newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; @@ -12755,12 +12756,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_fabricSensitiveInt8u; std::string newElement_0_fabricSensitiveInt8uClassName = "java/lang/Integer"; std::string newElement_0_fabricSensitiveInt8uCtorSignature = "(I)V"; @@ -12919,6 +12914,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_NaNClassName.c_str(), newElement_NaNCtorSignature.c_str(), entry_NaN, newElement_NaN); chip::JniReferences::GetInstance().AddToList(newElement_0_fabricSensitiveInt8uList, newElement_NaN); } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass testFabricScopedStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -12930,20 +12931,19 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } jmethodID testFabricScopedStructCtor = env->GetMethodID( testFabricScopedStructClass, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Optional;Ljava/lang/Integer;Ljava/util/Optional;Ljava/lang/" - "String;Lchip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;Ljava/util/ArrayList;)V"); + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/lang/Integer;Ljava/util/Optional;Ljava/lang/String;Lchip/" + "devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;Ljava/util/ArrayList;Ljava/lang/Integer;)V"); if (testFabricScopedStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$TestClusterClusterTestFabricScoped constructor"); return nullptr; } - newElement_0 = - env->NewObject(testFabricScopedStructClass, testFabricScopedStructCtor, newElement_0_fabricIndex, - newElement_0_fabricSensitiveInt8u, newElement_0_optionalFabricSensitiveInt8u, - newElement_0_nullableFabricSensitiveInt8u, newElement_0_nullableOptionalFabricSensitiveInt8u, - newElement_0_fabricSensitiveCharString, newElement_0_fabricSensitiveStruct, - newElement_0_fabricSensitiveInt8uList); + newElement_0 = env->NewObject( + testFabricScopedStructClass, testFabricScopedStructCtor, newElement_0_fabricSensitiveInt8u, + newElement_0_optionalFabricSensitiveInt8u, newElement_0_nullableFabricSensitiveInt8u, + newElement_0_nullableOptionalFabricSensitiveInt8u, newElement_0_fabricSensitiveCharString, + newElement_0_fabricSensitiveStruct, newElement_0_fabricSensitiveInt8uList, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index 122e4bfb436a54..ec99d550be3f33 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -67,12 +67,6 @@ JNI_METHOD(void, AccessControlCluster, writeAclAttribute) { jobject element_0; chip::JniReferences::GetInstance().GetListItem(value, i_0, element_0); - jobject element_0_fabricIndexItem_1; - chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", - element_0_fabricIndexItem_1); - listHolder_0->mList[i_0].fabricIndex = - static_castmList[i_0].fabricIndex)>>( - chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); jobject element_0_privilegeItem_1; chip::JniReferences::GetInstance().GetObjectField(element_0, "privilege", "Ljava/lang/Integer;", element_0_privilegeItem_1); @@ -192,6 +186,12 @@ JNI_METHOD(void, AccessControlCluster, writeAclAttribute) } } } + jobject element_0_fabricIndexItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", + element_0_fabricIndexItem_1); + listHolder_0->mList[i_0].fabricIndex = + static_castmList[i_0].fabricIndex)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); } cppValue = ListType_0(listHolder_0->mList, valueSize); } @@ -264,17 +264,17 @@ JNI_METHOD(void, AccessControlCluster, writeExtensionAttribute) { jobject element_0; chip::JniReferences::GetInstance().GetListItem(value, i_0, element_0); + jobject element_0_dataItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "data", "[B", element_0_dataItem_1); + cleanupByteArrays.push_back( + chip::Platform::MakeUnique(env, static_cast(element_0_dataItem_1))); + listHolder_0->mList[i_0].data = cleanupByteArrays.back()->byteSpan(); jobject element_0_fabricIndexItem_1; chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", element_0_fabricIndexItem_1); listHolder_0->mList[i_0].fabricIndex = static_castmList[i_0].fabricIndex)>>( chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); - jobject element_0_dataItem_1; - chip::JniReferences::GetInstance().GetObjectField(element_0, "data", "[B", element_0_dataItem_1); - cleanupByteArrays.push_back( - chip::Platform::MakeUnique(env, static_cast(element_0_dataItem_1))); - listHolder_0->mList[i_0].data = cleanupByteArrays.back()->byteSpan(); } cppValue = ListType_0(listHolder_0->mList, valueSize); } @@ -607,12 +607,6 @@ JNI_METHOD(void, BindingCluster, writeBindingAttribute) { jobject element_0; chip::JniReferences::GetInstance().GetListItem(value, i_0, element_0); - jobject element_0_fabricIndexItem_1; - chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", - element_0_fabricIndexItem_1); - listHolder_0->mList[i_0].fabricIndex = - static_castmList[i_0].fabricIndex)>>( - chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); jobject element_0_nodeItem_1; chip::JniReferences::GetInstance().GetObjectField(element_0, "node", "Ljava/util/Optional;", element_0_nodeItem_1); if (element_0_nodeItem_1 != nullptr) @@ -668,6 +662,12 @@ JNI_METHOD(void, BindingCluster, writeBindingAttribute) chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_2)); } } + jobject element_0_fabricIndexItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", + element_0_fabricIndexItem_1); + listHolder_0->mList[i_0].fabricIndex = + static_castmList[i_0].fabricIndex)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); } cppValue = ListType_0(listHolder_0->mList, valueSize); } @@ -2037,12 +2037,6 @@ JNI_METHOD(void, GroupKeyManagementCluster, writeGroupKeyMapAttribute) { jobject element_0; chip::JniReferences::GetInstance().GetListItem(value, i_0, element_0); - jobject element_0_fabricIndexItem_1; - chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", - element_0_fabricIndexItem_1); - listHolder_0->mList[i_0].fabricIndex = - static_castmList[i_0].fabricIndex)>>( - chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); jobject element_0_groupIdItem_1; chip::JniReferences::GetInstance().GetObjectField(element_0, "groupId", "Ljava/lang/Integer;", element_0_groupIdItem_1); @@ -2054,6 +2048,12 @@ JNI_METHOD(void, GroupKeyManagementCluster, writeGroupKeyMapAttribute) listHolder_0->mList[i_0].groupKeySetID = static_castmList[i_0].groupKeySetID)>>( chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_groupKeySetIDItem_1)); + jobject element_0_fabricIndexItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", + element_0_fabricIndexItem_1); + listHolder_0->mList[i_0].fabricIndex = + static_castmList[i_0].fabricIndex)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); } cppValue = ListType_0(listHolder_0->mList, valueSize); } @@ -5934,12 +5934,6 @@ JNI_METHOD(void, TestClusterCluster, writeListFabricScopedAttribute) { jobject element_0; chip::JniReferences::GetInstance().GetListItem(value, i_0, element_0); - jobject element_0_fabricIndexItem_1; - chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", - element_0_fabricIndexItem_1); - listHolder_0->mList[i_0].fabricIndex = - static_castmList[i_0].fabricIndex)>>( - chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); jobject element_0_fabricSensitiveInt8uItem_1; chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricSensitiveInt8u", "Ljava/lang/Integer;", element_0_fabricSensitiveInt8uItem_1); @@ -6086,6 +6080,12 @@ JNI_METHOD(void, TestClusterCluster, writeListFabricScopedAttribute) listHolder_0->mList[i_0].fabricSensitiveInt8uList = ListType_2(); } } + jobject element_0_fabricIndexItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", + element_0_fabricIndexItem_1); + listHolder_0->mList[i_0].fabricIndex = + static_castmList[i_0].fabricIndex)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); } cppValue = ListType_0(listHolder_0->mList, valueSize); } diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 97656a3dd69e48..b0179879605a71 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -732,12 +732,6 @@ void CHIPAccessControlAclAttributeCallback::CallbackFn( { auto & entry_0 = iter_arrayListObj_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_privilege; std::string newElement_0_privilegeClassName = "java/lang/Integer"; std::string newElement_0_privilegeCtorSignature = "(I)V"; @@ -846,6 +840,12 @@ void CHIPAccessControlAclAttributeCallback::CallbackFn( chip::JniReferences::GetInstance().AddToList(newElement_0_targets, newElement_NaN); } } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass accessControlEntryStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -857,15 +857,15 @@ void CHIPAccessControlAclAttributeCallback::CallbackFn( } jmethodID accessControlEntryStructCtor = env->GetMethodID( accessControlEntryStructClass, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/util/ArrayList;)V"); + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/util/ArrayList;Ljava/lang/Integer;)V"); if (accessControlEntryStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterAccessControlEntry constructor"); return; } - newElement_0 = env->NewObject(accessControlEntryStructClass, accessControlEntryStructCtor, newElement_0_fabricIndex, - newElement_0_privilege, newElement_0_authMode, newElement_0_subjects, newElement_0_targets); + newElement_0 = env->NewObject(accessControlEntryStructClass, accessControlEntryStructCtor, newElement_0_privilege, + newElement_0_authMode, newElement_0_subjects, newElement_0_targets, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); } @@ -932,17 +932,17 @@ void CHIPAccessControlExtensionAttributeCallback::CallbackFn( { auto & entry_0 = iter_arrayListObj_0.GetValue(); jobject newElement_0; + jobject newElement_0_data; + jbyteArray newElement_0_dataByteArray = env->NewByteArray(static_cast(entry_0.data.size())); + env->SetByteArrayRegion(newElement_0_dataByteArray, 0, static_cast(entry_0.data.size()), + reinterpret_cast(entry_0.data.data())); + newElement_0_data = newElement_0_dataByteArray; jobject newElement_0_fabricIndex; std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; std::string newElement_0_fabricIndexCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), newElement_0_fabricIndexCtorSignature.c_str(), entry_0.fabricIndex, newElement_0_fabricIndex); - jobject newElement_0_data; - jbyteArray newElement_0_dataByteArray = env->NewByteArray(static_cast(entry_0.data.size())); - env->SetByteArrayRegion(newElement_0_dataByteArray, 0, static_cast(entry_0.data.size()), - reinterpret_cast(entry_0.data.data())); - newElement_0_data = newElement_0_dataByteArray; jclass extensionEntryStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -952,7 +952,7 @@ void CHIPAccessControlExtensionAttributeCallback::CallbackFn( ChipLogError(Zcl, "Could not find class ChipStructs$AccessControlClusterExtensionEntry"); return; } - jmethodID extensionEntryStructCtor = env->GetMethodID(extensionEntryStructClass, "", "(Ljava/lang/Integer;[B)V"); + jmethodID extensionEntryStructCtor = env->GetMethodID(extensionEntryStructClass, "", "([BLjava/lang/Integer;)V"); if (extensionEntryStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterExtensionEntry constructor"); @@ -960,7 +960,7 @@ void CHIPAccessControlExtensionAttributeCallback::CallbackFn( } newElement_0 = - env->NewObject(extensionEntryStructClass, extensionEntryStructCtor, newElement_0_fabricIndex, newElement_0_data); + env->NewObject(extensionEntryStructClass, extensionEntryStructCtor, newElement_0_data, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); } @@ -3302,12 +3302,6 @@ void CHIPBindingBindingAttributeCallback::CallbackFn( { auto & entry_0 = iter_arrayListObj_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_node; if (!entry_0.node.HasValue()) { @@ -3368,6 +3362,12 @@ void CHIPBindingBindingAttributeCallback::CallbackFn( entry_0.cluster.Value(), newElement_0_clusterInsideOptional); chip::JniReferences::GetInstance().CreateOptional(newElement_0_clusterInsideOptional, newElement_0_cluster); } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass targetStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$BindingClusterTargetStruct", @@ -3379,15 +3379,15 @@ void CHIPBindingBindingAttributeCallback::CallbackFn( } jmethodID targetStructStructCtor = env->GetMethodID( targetStructStructClass, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/lang/Integer;)V"); if (targetStructStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$BindingClusterTargetStruct constructor"); return; } - newElement_0 = env->NewObject(targetStructStructClass, targetStructStructCtor, newElement_0_fabricIndex, newElement_0_node, - newElement_0_group, newElement_0_endpoint, newElement_0_cluster); + newElement_0 = env->NewObject(targetStructStructClass, targetStructStructCtor, newElement_0_node, newElement_0_group, + newElement_0_endpoint, newElement_0_cluster, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); } @@ -8880,12 +8880,6 @@ void CHIPGroupKeyManagementGroupKeyMapAttributeCallback::CallbackFn( { auto & entry_0 = iter_arrayListObj_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_groupId; std::string newElement_0_groupIdClassName = "java/lang/Integer"; std::string newElement_0_groupIdCtorSignature = "(I)V"; @@ -8898,6 +8892,12 @@ void CHIPGroupKeyManagementGroupKeyMapAttributeCallback::CallbackFn( chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_groupKeySetIDClassName.c_str(), newElement_0_groupKeySetIDCtorSignature.c_str(), entry_0.groupKeySetID, newElement_0_groupKeySetID); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass groupKeyMapStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -8915,8 +8915,8 @@ void CHIPGroupKeyManagementGroupKeyMapAttributeCallback::CallbackFn( return; } - newElement_0 = env->NewObject(groupKeyMapStructStructClass, groupKeyMapStructStructCtor, newElement_0_fabricIndex, - newElement_0_groupId, newElement_0_groupKeySetID); + newElement_0 = env->NewObject(groupKeyMapStructStructClass, groupKeyMapStructStructCtor, newElement_0_groupId, + newElement_0_groupKeySetID, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); } @@ -8986,12 +8986,6 @@ void CHIPGroupKeyManagementGroupTableAttributeCallback::CallbackFn( { auto & entry_0 = iter_arrayListObj_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_groupId; std::string newElement_0_groupIdClassName = "java/lang/Integer"; std::string newElement_0_groupIdCtorSignature = "(I)V"; @@ -9024,6 +9018,12 @@ void CHIPGroupKeyManagementGroupTableAttributeCallback::CallbackFn( env->NewStringUTF(std::string(entry_0.groupName.Value().data(), entry_0.groupName.Value().size()).c_str()); chip::JniReferences::GetInstance().CreateOptional(newElement_0_groupNameInsideOptional, newElement_0_groupName); } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass groupInfoMapStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -9035,15 +9035,15 @@ void CHIPGroupKeyManagementGroupTableAttributeCallback::CallbackFn( } jmethodID groupInfoMapStructStructCtor = env->GetMethodID(groupInfoMapStructStructClass, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/util/Optional;)V"); + "(Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/util/Optional;Ljava/lang/Integer;)V"); if (groupInfoMapStructStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$GroupKeyManagementClusterGroupInfoMapStruct constructor"); return; } - newElement_0 = env->NewObject(groupInfoMapStructStructClass, groupInfoMapStructStructCtor, newElement_0_fabricIndex, - newElement_0_groupId, newElement_0_endpoints, newElement_0_groupName); + newElement_0 = env->NewObject(groupInfoMapStructStructClass, groupInfoMapStructStructCtor, newElement_0_groupId, + newElement_0_endpoints, newElement_0_groupName, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); } @@ -13908,12 +13908,6 @@ void CHIPOperationalCredentialsNOCsAttributeCallback::CallbackFn( { auto & entry_0 = iter_arrayListObj_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_noc; jbyteArray newElement_0_nocByteArray = env->NewByteArray(static_cast(entry_0.noc.size())); env->SetByteArrayRegion(newElement_0_nocByteArray, 0, static_cast(entry_0.noc.size()), @@ -13931,6 +13925,12 @@ void CHIPOperationalCredentialsNOCsAttributeCallback::CallbackFn( reinterpret_cast(entry_0.icac.Value().data())); newElement_0_icac = newElement_0_icacByteArray; } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass NOCStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -13940,15 +13940,15 @@ void CHIPOperationalCredentialsNOCsAttributeCallback::CallbackFn( ChipLogError(Zcl, "Could not find class ChipStructs$OperationalCredentialsClusterNOCStruct"); return; } - jmethodID NOCStructStructCtor = env->GetMethodID(NOCStructStructClass, "", "(Ljava/lang/Integer;[B[B)V"); + jmethodID NOCStructStructCtor = env->GetMethodID(NOCStructStructClass, "", "([B[BLjava/lang/Integer;)V"); if (NOCStructStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$OperationalCredentialsClusterNOCStruct constructor"); return; } - newElement_0 = env->NewObject(NOCStructStructClass, NOCStructStructCtor, newElement_0_fabricIndex, newElement_0_noc, - newElement_0_icac); + newElement_0 = env->NewObject(NOCStructStructClass, NOCStructStructCtor, newElement_0_noc, newElement_0_icac, + newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); } @@ -14018,12 +14018,6 @@ void CHIPOperationalCredentialsFabricsAttributeCallback::CallbackFn( { auto & entry_0 = iter_arrayListObj_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_rootPublicKey; jbyteArray newElement_0_rootPublicKeyByteArray = env->NewByteArray(static_cast(entry_0.rootPublicKey.size())); env->SetByteArrayRegion(newElement_0_rootPublicKeyByteArray, 0, static_cast(entry_0.rootPublicKey.size()), @@ -14048,6 +14042,12 @@ void CHIPOperationalCredentialsFabricsAttributeCallback::CallbackFn( newElement_0_nodeIdClassName.c_str(), newElement_0_nodeIdCtorSignature.c_str(), entry_0.nodeId, newElement_0_nodeId); jobject newElement_0_label; newElement_0_label = env->NewStringUTF(std::string(entry_0.label.data(), entry_0.label.size()).c_str()); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass fabricDescriptorStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -14059,16 +14059,16 @@ void CHIPOperationalCredentialsFabricsAttributeCallback::CallbackFn( } jmethodID fabricDescriptorStructCtor = env->GetMethodID(fabricDescriptorStructClass, "", - "(Ljava/lang/Integer;[BLjava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;)V"); + "([BLjava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/Integer;)V"); if (fabricDescriptorStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$OperationalCredentialsClusterFabricDescriptor constructor"); return; } - newElement_0 = env->NewObject(fabricDescriptorStructClass, fabricDescriptorStructCtor, newElement_0_fabricIndex, - newElement_0_rootPublicKey, newElement_0_vendorId, newElement_0_fabricId, newElement_0_nodeId, - newElement_0_label); + newElement_0 = env->NewObject(fabricDescriptorStructClass, fabricDescriptorStructCtor, newElement_0_rootPublicKey, + newElement_0_vendorId, newElement_0_fabricId, newElement_0_nodeId, newElement_0_label, + newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); } @@ -18128,12 +18128,6 @@ void CHIPTestClusterListFabricScopedAttributeCallback::CallbackFn( { auto & entry_0 = iter_arrayListObj_0.GetValue(); jobject newElement_0; - jobject newElement_0_fabricIndex; - std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; - std::string newElement_0_fabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), - newElement_0_fabricIndexCtorSignature.c_str(), - entry_0.fabricIndex, newElement_0_fabricIndex); jobject newElement_0_fabricSensitiveInt8u; std::string newElement_0_fabricSensitiveInt8uClassName = "java/lang/Integer"; std::string newElement_0_fabricSensitiveInt8uCtorSignature = "(I)V"; @@ -18283,6 +18277,12 @@ void CHIPTestClusterListFabricScopedAttributeCallback::CallbackFn( newElement_NaNClassName.c_str(), newElement_NaNCtorSignature.c_str(), entry_NaN, newElement_NaN); chip::JniReferences::GetInstance().AddToList(newElement_0_fabricSensitiveInt8uList, newElement_NaN); } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); jclass testFabricScopedStructClass; err = chip::JniReferences::GetInstance().GetClassRef( @@ -18294,19 +18294,19 @@ void CHIPTestClusterListFabricScopedAttributeCallback::CallbackFn( } jmethodID testFabricScopedStructCtor = env->GetMethodID( testFabricScopedStructClass, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Optional;Ljava/lang/Integer;Ljava/util/Optional;Ljava/lang/" - "String;Lchip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;Ljava/util/ArrayList;)V"); + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/lang/Integer;Ljava/util/Optional;Ljava/lang/String;Lchip/" + "devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;Ljava/util/ArrayList;Ljava/lang/Integer;)V"); if (testFabricScopedStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$TestClusterClusterTestFabricScoped constructor"); return; } - newElement_0 = env->NewObject(testFabricScopedStructClass, testFabricScopedStructCtor, newElement_0_fabricIndex, - newElement_0_fabricSensitiveInt8u, newElement_0_optionalFabricSensitiveInt8u, - newElement_0_nullableFabricSensitiveInt8u, newElement_0_nullableOptionalFabricSensitiveInt8u, - newElement_0_fabricSensitiveCharString, newElement_0_fabricSensitiveStruct, - newElement_0_fabricSensitiveInt8uList); + newElement_0 = + env->NewObject(testFabricScopedStructClass, testFabricScopedStructCtor, newElement_0_fabricSensitiveInt8u, + newElement_0_optionalFabricSensitiveInt8u, newElement_0_nullableFabricSensitiveInt8u, + newElement_0_nullableOptionalFabricSensitiveInt8u, newElement_0_fabricSensitiveCharString, + newElement_0_fabricSensitiveStruct, newElement_0_fabricSensitiveInt8uList, newElement_0_fabricIndex); chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java index 259e808736ee83..67be474ef5dc1d 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java @@ -55,32 +55,29 @@ public String toString() { } public static class AccessControlClusterAccessControlEntry { - public Integer fabricIndex; public Integer privilege; public Integer authMode; public @Nullable ArrayList subjects; public @Nullable ArrayList targets; + public Integer fabricIndex; public AccessControlClusterAccessControlEntry( - Integer fabricIndex, Integer privilege, Integer authMode, @Nullable ArrayList subjects, - @Nullable ArrayList targets) { - this.fabricIndex = fabricIndex; + @Nullable ArrayList targets, + Integer fabricIndex) { this.privilege = privilege; this.authMode = authMode; this.subjects = subjects; this.targets = targets; + this.fabricIndex = fabricIndex; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("AccessControlClusterAccessControlEntry {\n"); - output.append("\tfabricIndex: "); - output.append(fabricIndex); - output.append("\n"); output.append("\tprivilege: "); output.append(privilege); output.append("\n"); @@ -93,30 +90,33 @@ public String toString() { output.append("\ttargets: "); output.append(targets); output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); output.append("}\n"); return output.toString(); } } public static class AccessControlClusterExtensionEntry { - public Integer fabricIndex; public byte[] data; + public Integer fabricIndex; - public AccessControlClusterExtensionEntry(Integer fabricIndex, byte[] data) { - this.fabricIndex = fabricIndex; + public AccessControlClusterExtensionEntry(byte[] data, Integer fabricIndex) { this.data = data; + this.fabricIndex = fabricIndex; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("AccessControlClusterExtensionEntry {\n"); - output.append("\tfabricIndex: "); - output.append(fabricIndex); - output.append("\n"); output.append("\tdata: "); output.append(Arrays.toString(data)); output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -226,32 +226,29 @@ public String toString() { } public static class BindingClusterTargetStruct { - public Integer fabricIndex; public Optional node; public Optional group; public Optional endpoint; public Optional cluster; + public Integer fabricIndex; public BindingClusterTargetStruct( - Integer fabricIndex, Optional node, Optional group, Optional endpoint, - Optional cluster) { - this.fabricIndex = fabricIndex; + Optional cluster, + Integer fabricIndex) { this.node = node; this.group = group; this.endpoint = endpoint; this.cluster = cluster; + this.fabricIndex = fabricIndex; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("BindingClusterTargetStruct {\n"); - output.append("\tfabricIndex: "); - output.append(fabricIndex); - output.append("\n"); output.append("\tnode: "); output.append(node); output.append("\n"); @@ -264,6 +261,9 @@ public String toString() { output.append("\tcluster: "); output.append(cluster); output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -777,29 +777,26 @@ public String toString() { } public static class GroupKeyManagementClusterGroupInfoMapStruct { - public Integer fabricIndex; public Integer groupId; public ArrayList endpoints; public Optional groupName; + public Integer fabricIndex; public GroupKeyManagementClusterGroupInfoMapStruct( - Integer fabricIndex, Integer groupId, ArrayList endpoints, - Optional groupName) { - this.fabricIndex = fabricIndex; + Optional groupName, + Integer fabricIndex) { this.groupId = groupId; this.endpoints = endpoints; this.groupName = groupName; + this.fabricIndex = fabricIndex; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("GroupKeyManagementClusterGroupInfoMapStruct {\n"); - output.append("\tfabricIndex: "); - output.append(fabricIndex); - output.append("\n"); output.append("\tgroupId: "); output.append(groupId); output.append("\n"); @@ -809,36 +806,39 @@ public String toString() { output.append("\tgroupName: "); output.append(groupName); output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); output.append("}\n"); return output.toString(); } } public static class GroupKeyManagementClusterGroupKeyMapStruct { - public Integer fabricIndex; public Integer groupId; public Integer groupKeySetID; + public Integer fabricIndex; public GroupKeyManagementClusterGroupKeyMapStruct( - Integer fabricIndex, Integer groupId, Integer groupKeySetID) { - this.fabricIndex = fabricIndex; + Integer groupId, Integer groupKeySetID, Integer fabricIndex) { this.groupId = groupId; this.groupKeySetID = groupKeySetID; + this.fabricIndex = fabricIndex; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("GroupKeyManagementClusterGroupKeyMapStruct {\n"); - output.append("\tfabricIndex: "); - output.append(fabricIndex); - output.append("\n"); output.append("\tgroupId: "); output.append(groupId); output.append("\n"); output.append("\tgroupKeySetID: "); output.append(groupKeySetID); output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -1185,35 +1185,32 @@ public String toString() { } public static class OperationalCredentialsClusterFabricDescriptor { - public Integer fabricIndex; public byte[] rootPublicKey; public Integer vendorId; public Long fabricId; public Long nodeId; public String label; + public Integer fabricIndex; public OperationalCredentialsClusterFabricDescriptor( - Integer fabricIndex, byte[] rootPublicKey, Integer vendorId, Long fabricId, Long nodeId, - String label) { - this.fabricIndex = fabricIndex; + String label, + Integer fabricIndex) { this.rootPublicKey = rootPublicKey; this.vendorId = vendorId; this.fabricId = fabricId; this.nodeId = nodeId; this.label = label; + this.fabricIndex = fabricIndex; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("OperationalCredentialsClusterFabricDescriptor {\n"); - output.append("\tfabricIndex: "); - output.append(fabricIndex); - output.append("\n"); output.append("\trootPublicKey: "); output.append(Arrays.toString(rootPublicKey)); output.append("\n"); @@ -1229,36 +1226,39 @@ public String toString() { output.append("\tlabel: "); output.append(label); output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); output.append("}\n"); return output.toString(); } } public static class OperationalCredentialsClusterNOCStruct { - public Integer fabricIndex; public byte[] noc; public @Nullable byte[] icac; + public Integer fabricIndex; public OperationalCredentialsClusterNOCStruct( - Integer fabricIndex, byte[] noc, @Nullable byte[] icac) { - this.fabricIndex = fabricIndex; + byte[] noc, @Nullable byte[] icac, Integer fabricIndex) { this.noc = noc; this.icac = icac; + this.fabricIndex = fabricIndex; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("OperationalCredentialsClusterNOCStruct {\n"); - output.append("\tfabricIndex: "); - output.append(fabricIndex); - output.append("\n"); output.append("\tnoc: "); output.append(Arrays.toString(noc)); output.append("\n"); output.append("\ticac: "); output.append(Arrays.toString(icac)); output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -1518,7 +1518,6 @@ public String toString() { } public static class TestClusterClusterTestFabricScoped { - public Integer fabricIndex; public Integer fabricSensitiveInt8u; public Optional optionalFabricSensitiveInt8u; public @Nullable Integer nullableFabricSensitiveInt8u; @@ -1526,17 +1525,17 @@ public static class TestClusterClusterTestFabricScoped { public String fabricSensitiveCharString; public ChipStructs.TestClusterClusterSimpleStruct fabricSensitiveStruct; public ArrayList fabricSensitiveInt8uList; + public Integer fabricIndex; public TestClusterClusterTestFabricScoped( - Integer fabricIndex, Integer fabricSensitiveInt8u, Optional optionalFabricSensitiveInt8u, @Nullable Integer nullableFabricSensitiveInt8u, @Nullable Optional nullableOptionalFabricSensitiveInt8u, String fabricSensitiveCharString, ChipStructs.TestClusterClusterSimpleStruct fabricSensitiveStruct, - ArrayList fabricSensitiveInt8uList) { - this.fabricIndex = fabricIndex; + ArrayList fabricSensitiveInt8uList, + Integer fabricIndex) { this.fabricSensitiveInt8u = fabricSensitiveInt8u; this.optionalFabricSensitiveInt8u = optionalFabricSensitiveInt8u; this.nullableFabricSensitiveInt8u = nullableFabricSensitiveInt8u; @@ -1544,15 +1543,13 @@ public TestClusterClusterTestFabricScoped( this.fabricSensitiveCharString = fabricSensitiveCharString; this.fabricSensitiveStruct = fabricSensitiveStruct; this.fabricSensitiveInt8uList = fabricSensitiveInt8uList; + this.fabricIndex = fabricIndex; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("TestClusterClusterTestFabricScoped {\n"); - output.append("\tfabricIndex: "); - output.append(fabricIndex); - output.append("\n"); output.append("\tfabricSensitiveInt8u: "); output.append(fabricSensitiveInt8u); output.append("\n"); @@ -1574,6 +1571,9 @@ public String toString() { output.append("\tfabricSensitiveInt8uList: "); output.append(fabricSensitiveInt8uList); output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); output.append("}\n"); return output.toString(); } diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 02dd28c50b5a41..ec53d017787927 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -248,6 +248,7 @@ def EstablishPASESessionIP(self, ipaddr, setupPinCode, nodeid): def Commission(self, nodeid): self.CheckIsActive() + self._ChipStack.commissioningCompleteEvent.clear() self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_Commission( diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 81ef8395dc9063..9acdf507cc1d20 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -5565,18 +5565,18 @@ class TargetStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="node", Tag=1, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="group", Tag=2, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="endpoint", Tag=3, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="cluster", Tag=4, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), ]) - fabricIndex: 'uint' = 0 node: 'typing.Optional[uint]' = None group: 'typing.Optional[uint]' = None endpoint: 'typing.Optional[uint]' = None cluster: 'typing.Optional[uint]' = None + fabricIndex: 'uint' = 0 @@ -5746,18 +5746,18 @@ class AccessControlEntry(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="privilege", Tag=1, Type=AccessControl.Enums.Privilege), ClusterObjectFieldDescriptor(Label="authMode", Tag=2, Type=AccessControl.Enums.AuthMode), ClusterObjectFieldDescriptor(Label="subjects", Tag=3, Type=typing.Union[Nullable, typing.List[uint]]), ClusterObjectFieldDescriptor(Label="targets", Tag=4, Type=typing.Union[Nullable, typing.List[AccessControl.Structs.Target]]), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), ]) - fabricIndex: 'uint' = 0 privilege: 'AccessControl.Enums.Privilege' = 0 authMode: 'AccessControl.Enums.AuthMode' = 0 subjects: 'typing.Union[Nullable, typing.List[uint]]' = NullValue targets: 'typing.Union[Nullable, typing.List[AccessControl.Structs.Target]]' = NullValue + fabricIndex: 'uint' = 0 @dataclass class ExtensionEntry(ClusterObject): @@ -5765,12 +5765,12 @@ class ExtensionEntry(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="data", Tag=1, Type=bytes), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), ]) - fabricIndex: 'uint' = 0 data: 'bytes' = b"" + fabricIndex: 'uint' = 0 @@ -5904,18 +5904,18 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="adminFabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="adminNodeID", Tag=1, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="adminPasscodeID", Tag=2, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="changeType", Tag=3, Type=AccessControl.Enums.ChangeTypeEnum), ClusterObjectFieldDescriptor(Label="latestValue", Tag=4, Type=typing.Union[Nullable, AccessControl.Structs.AccessControlEntry]), + ClusterObjectFieldDescriptor(Label="adminFabricIndex", Tag=254, Type=uint), ]) - adminFabricIndex: 'uint' = 0 adminNodeID: 'typing.Union[Nullable, uint]' = NullValue adminPasscodeID: 'typing.Union[Nullable, uint]' = NullValue changeType: 'AccessControl.Enums.ChangeTypeEnum' = 0 latestValue: 'typing.Union[Nullable, AccessControl.Structs.AccessControlEntry]' = NullValue + adminFabricIndex: 'uint' = 0 @dataclass class AccessControlExtensionChanged(ClusterEvent): @@ -5931,18 +5931,18 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="adminFabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="adminNodeID", Tag=1, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="adminPasscodeID", Tag=2, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="changeType", Tag=3, Type=AccessControl.Enums.ChangeTypeEnum), ClusterObjectFieldDescriptor(Label="latestValue", Tag=4, Type=typing.Union[Nullable, AccessControl.Structs.ExtensionEntry]), + ClusterObjectFieldDescriptor(Label="adminFabricIndex", Tag=254, Type=uint), ]) - adminFabricIndex: 'uint' = 0 adminNodeID: 'typing.Union[Nullable, uint]' = NullValue adminPasscodeID: 'typing.Union[Nullable, uint]' = NullValue changeType: 'AccessControl.Enums.ChangeTypeEnum' = 0 latestValue: 'typing.Union[Nullable, AccessControl.Structs.ExtensionEntry]' = NullValue + adminFabricIndex: 'uint' = 0 @dataclass @@ -14087,20 +14087,20 @@ class FabricDescriptor(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="rootPublicKey", Tag=1, Type=bytes), ClusterObjectFieldDescriptor(Label="vendorId", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="fabricId", Tag=3, Type=uint), ClusterObjectFieldDescriptor(Label="nodeId", Tag=4, Type=uint), ClusterObjectFieldDescriptor(Label="label", Tag=5, Type=str), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), ]) - fabricIndex: 'uint' = 0 rootPublicKey: 'bytes' = b"" vendorId: 'uint' = 0 fabricId: 'uint' = 0 nodeId: 'uint' = 0 label: 'str' = "" + fabricIndex: 'uint' = 0 @dataclass class NOCStruct(ClusterObject): @@ -14108,14 +14108,14 @@ class NOCStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="noc", Tag=1, Type=bytes), ClusterObjectFieldDescriptor(Label="icac", Tag=2, Type=typing.Union[Nullable, bytes]), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), ]) - fabricIndex: 'uint' = 0 noc: 'bytes' = b"" icac: 'typing.Union[Nullable, bytes]' = NullValue + fabricIndex: 'uint' = 0 @@ -14555,16 +14555,16 @@ class GroupInfoMapStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="groupId", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="endpoints", Tag=2, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="groupName", Tag=3, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), ]) - fabricIndex: 'uint' = 0 groupId: 'uint' = 0 endpoints: 'typing.List[uint]' = field(default_factory=lambda: []) groupName: 'typing.Optional[str]' = None + fabricIndex: 'uint' = 0 @dataclass class GroupKeyMapStruct(ClusterObject): @@ -14572,14 +14572,14 @@ class GroupKeyMapStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="groupId", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="groupKeySetID", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), ]) - fabricIndex: 'uint' = 0 groupId: 'uint' = 0 groupKeySetID: 'uint' = 0 + fabricIndex: 'uint' = 0 @dataclass class GroupKeySetStruct(ClusterObject): @@ -34244,7 +34244,6 @@ class TestFabricScoped(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="fabricSensitiveInt8u", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="optionalFabricSensitiveInt8u", Tag=2, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="nullableFabricSensitiveInt8u", Tag=3, Type=typing.Union[Nullable, uint]), @@ -34252,9 +34251,9 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="fabricSensitiveCharString", Tag=5, Type=str), ClusterObjectFieldDescriptor(Label="fabricSensitiveStruct", Tag=6, Type=TestCluster.Structs.SimpleStruct), ClusterObjectFieldDescriptor(Label="fabricSensitiveInt8uList", Tag=7, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), ]) - fabricIndex: 'uint' = 0 fabricSensitiveInt8u: 'uint' = 0 optionalFabricSensitiveInt8u: 'typing.Optional[uint]' = None nullableFabricSensitiveInt8u: 'typing.Union[Nullable, uint]' = NullValue @@ -34262,6 +34261,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: fabricSensitiveCharString: 'str' = "" fabricSensitiveStruct: 'TestCluster.Structs.SimpleStruct' = field(default_factory=lambda: TestCluster.Structs.SimpleStruct()) fabricSensitiveInt8uList: 'typing.List[uint]' = field(default_factory=lambda: []) + fabricIndex: 'uint' = 0 @dataclass class NullablesAndOptionalsStruct(ClusterObject): @@ -36404,7 +36404,7 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="arg1", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="arg1", Tag=254, Type=uint), ]) arg1: 'uint' = 0 diff --git a/src/controller/python/chip/tlv/__init__.py b/src/controller/python/chip/tlv/__init__.py index 962d208872e7a1..20f2bfebd2f2dd 100644 --- a/src/controller/python/chip/tlv/__init__.py +++ b/src/controller/python/chip/tlv/__init__.py @@ -29,7 +29,8 @@ from __future__ import print_function import struct -from collections import Mapping, Sequence, OrderedDict +from collections import OrderedDict +from collections.abc import Mapping, Sequence from enum import Enum TLV_TYPE_SIGNED_INTEGER = 0x00 diff --git a/src/controller/python/test/test_scripts/base.py b/src/controller/python/test/test_scripts/base.py index 4094b2e65c13f9..c06431411da516 100644 --- a/src/controller/python/test/test_scripts/base.py +++ b/src/controller/python/test/test_scripts/base.py @@ -15,8 +15,10 @@ # limitations under the License. # +import asyncio from dataclasses import dataclass from inspect import Attribute +import inspect from typing import Any import typing from chip import ChipDeviceCtrl @@ -55,6 +57,67 @@ def FailIfNot(cond, message): TestFail(message) +_configurable_tests = set() +_configurable_test_sets = set() +_enabled_tests = [] +_disabled_tests = [] + + +def SetTestSet(enabled_tests, disabled_tests): + global _enabled_tests, _disabled_tests + _enabled_tests = enabled_tests[:] + _disabled_tests = disabled_tests[:] + + +def TestIsEnabled(test_name: str): + enabled_len = -1 + disabled_len = -1 + if 'all' in _enabled_tests: + enabled_len = 0 + if 'all' in _disabled_tests: + disabled_len = 0 + + for test_item in _enabled_tests: + if test_name.startswith(test_item) and (len(test_item) > enabled_len): + enabled_len = len(test_item) + + for test_item in _disabled_tests: + if test_name.startswith(test_item) and (len(test_item) > disabled_len): + disabled_len = len(test_item) + + return enabled_len > disabled_len + + +def test_set(cls): + _configurable_test_sets.add(cls.__qualname__) + return cls + + +def test_case(func): + test_name = func.__qualname__ + _configurable_tests.add(test_name) + + def CheckEnableBeforeRun(*args, **kwargs): + if TestIsEnabled(test_name=test_name): + return func(*args, **kwargs) + elif inspect.iscoroutinefunction(func): + # noop, so users can use await as usual + return asyncio.sleep(0) + return CheckEnableBeforeRun + + +def configurable_tests(): + res = [v for v in _configurable_test_sets] + res.sort() + return res + + +def configurable_test_cases(): + res = [v for v in _configurable_tests] + res.sort() + return res + + class TestTimeout(threading.Thread): def __init__(self, timeout: int): threading.Thread.__init__(self) @@ -136,6 +199,39 @@ def TestDiscovery(self, discriminator: int): self.logger.info(f"Found device at {res}") return res + def TestPaseOnly(self, ip: str, setuppin: int, nodeid: int): + self.logger.info( + "Attempting to establish PASE session with device id: {} addr: {}".format(str(nodeid), ip)) + if self.devCtrl.EstablishPASESessionIP( + ip.encode("utf-8"), setuppin, nodeid) is not None: + self.logger.info( + "Failed to establish PASE session with device id: {} addr: {}".format(str(nodeid), ip)) + return False + self.logger.info( + "Successfully established PASE session with device id: {} addr: {}".format(str(nodeid), ip)) + return True + + def TestCommissionOnly(self, nodeid: int): + self.logger.info( + "Commissioning device with id {}".format(nodeid)) + if not self.devCtrl.Commission(nodeid): + self.logger.info( + "Failed to commission device with id {}".format(str(nodeid))) + return False + self.logger.info( + "Successfully commissioned device with id {}".format(str(nodeid))) + return True + + def TestKeyExchangeBLE(self, discriminator: int, setuppin: int, nodeid: int): + self.logger.info( + "Conducting key exchange with device {}".format(discriminator)) + if not self.devCtrl.ConnectBLE(discriminator, setuppin, nodeid): + self.logger.info( + "Failed to finish key exchange with device {}".format(discriminator)) + return False + self.logger.info("Device finished key exchange.") + return True + def TestKeyExchange(self, ip: str, setuppin: int, nodeid: int): self.logger.info("Conducting key exchange with device {}".format(ip)) if not self.devCtrl.CommissionIP(ip.encode("utf-8"), setuppin, nodeid): diff --git a/src/controller/python/test/test_scripts/cluster_objects.py b/src/controller/python/test/test_scripts/cluster_objects.py index bc2b9f2dde6c0b..2586c1865a6f5f 100644 --- a/src/controller/python/test/test_scripts/cluster_objects.py +++ b/src/controller/python/test/test_scripts/cluster_objects.py @@ -15,7 +15,7 @@ # limitations under the License. # - +import pprint import chip.clusters as Clusters import chip.exceptions import logging @@ -24,6 +24,8 @@ import asyncio import time +import base + logger = logging.getLogger('PythonMatterControllerTEST') logger.setLevel(logging.INFO) @@ -44,19 +46,18 @@ def _IgnoreAttributeDecodeFailure(path): def VerifyDecodeSuccess(values): - print(f"{values}") + pprint.pprint(values) for endpoint in values: for cluster in values[endpoint]: for attribute in values[endpoint][cluster]: v = values[endpoint][cluster][attribute] - print(f"EP{endpoint}/{cluster}/{attribute} = {v}") if (isinstance(v, ValueDecodeFailure)): if _IgnoreAttributeDecodeFailure((endpoint, cluster, attribute)): print( - f"Ignoring attribute decode failure for path {endpoint}/{cluster}/{attribute}") + f"Ignoring attribute decode failure for path {endpoint}/{attribute}") else: raise AssertionError( - f"Cannot decode value for path {endpoint}/{cluster}/{attribute}, got error: '{str(v.Reason)}', raw TLV data: '{v.TLVValue}'") + f"Cannot decode value for path {endpoint}/{attribute}, got error: '{str(v.Reason)}', raw TLV data: '{v.TLVValue}'") for endpoint in values: for cluster in values[endpoint]: @@ -71,8 +72,10 @@ def _AssumeEventsDecodeSuccess(values): print(f"Dump the events: {values} ") +@base.test_set class ClusterObjectTests: @classmethod + @base.test_case def TestAPI(cls): if Clusters.OnOff.id != 6: raise ValueError() @@ -86,7 +89,8 @@ def TestAPI(cls): raise ValueError() @classmethod - async def RoundTripTest(cls, devCtrl): + @base.test_case + async def TestCommandRoundTrip(cls, devCtrl): req = Clusters.OnOff.Commands.On() res = await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=LIGHTING_ENDPOINT_ID, payload=req) if res is not None: @@ -95,7 +99,8 @@ async def RoundTripTest(cls, devCtrl): raise ValueError() @classmethod - async def RoundTripTestWithBadEndpoint(cls, devCtrl): + @base.test_case + async def TestCommandRoundTripWithBadEndpoint(cls, devCtrl): req = Clusters.OnOff.Commands.On() try: await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=233, payload=req) @@ -105,7 +110,8 @@ async def RoundTripTestWithBadEndpoint(cls, devCtrl): return @classmethod - async def SendCommandWithResponse(cls, devCtrl): + @base.test_case + async def TestCommandWithResponse(cls, devCtrl): req = Clusters.TestCluster.Commands.TestAddArguments(arg1=2, arg2=3) res = await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=LIGHTING_ENDPOINT_ID, payload=req) if not isinstance(res, Clusters.TestCluster.Commands.TestAddArgumentsResponse): @@ -116,7 +122,8 @@ async def SendCommandWithResponse(cls, devCtrl): raise ValueError() @classmethod - async def SendWriteRequest(cls, devCtrl): + @base.test_case + async def TestWriteRequest(cls, devCtrl): logger.info("1: Trivial writes (multiple attributes)") res = await devCtrl.WriteAttribute(nodeid=NODE_ID, attributes=[ @@ -154,6 +161,7 @@ async def SendWriteRequest(cls, devCtrl): raise AssertionError("Write returned unexpected result.") @classmethod + @base.test_case async def TestSubscribeAttribute(cls, devCtrl): logger.info("Test Subscription") sub = await devCtrl.ReadAttribute(nodeid=NODE_ID, attributes=[(1, Clusters.OnOff.Attributes.OnOff)], reportInterval=(3, 10)) @@ -179,6 +187,7 @@ def subUpdate(path: TypedAttributePath, transaction: SubscriptionTransaction): sub.Shutdown() @classmethod + @base.test_case async def TestReadAttributeRequests(cls, devCtrl): ''' Tests out various permutations of endpoint, cluster and attribute ID (with wildcards) to validate @@ -284,6 +293,7 @@ async def TriggerAndWaitForEvents(cls, devCtrl, req): raise AssertionError("Got no events back") @classmethod + @base.test_case async def TestReadEventRequests(cls, devCtrl, expectEventsNum): logger.info("1: Reading Ex Cx Ex") req = [ @@ -323,6 +333,7 @@ async def TestReadEventRequests(cls, devCtrl, expectEventsNum): # TODO: Add more wildcard test for IM events. @classmethod + @base.test_case async def TestTimedRequest(cls, devCtrl): logger.info("1: Send Timed Command Request") req = Clusters.TestCluster.Commands.TimedInvokeRequest() @@ -336,49 +347,53 @@ async def TestTimedRequest(cls, devCtrl): ], timedRequestTimeoutMs=1000) - logger.info("3: Send Timed Command Request -- Timeout") + logger.info( + "3: Sending TestCluster-TimedInvokeRequest without timedRequestTimeoutMs should be rejected") try: req = Clusters.TestCluster.Commands.TimedInvokeRequest() - # 10ms is a pretty short timeout, RTT is 400ms in simulated network on CI, so this test should fail. - await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=req, timedRequestTimeoutMs=10) - raise AssertionError("Timeout expected!") - except chip.exceptions.ChipStackException: + await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=req) + raise AssertionError("The command invoke should be rejected.") + except ValueError: pass - logger.info("4: Send Timed Write Request -- Timeout") + logger.info( + "4: Writing TestCluster-TimedWriteBoolean without timedRequestTimeoutMs should be rejected") try: await devCtrl.WriteAttribute(nodeid=NODE_ID, attributes=[ (1, Clusters.TestCluster.Attributes.TimedWriteBoolean( True)), - ], - timedRequestTimeoutMs=10) - raise AssertionError("Timeout expected!") - except chip.exceptions.ChipStackException: + ]) + raise AssertionError("The write request should be rejected.") + except ValueError: pass - logger.info( - "5: Sending TestCluster-TimedInvokeRequest without timedRequestTimeoutMs should be rejected") + @classmethod + @base.test_case + async def TestTimedRequestTimeout(cls, devCtrl): + logger.info("1: Send Timed Command Request -- Timeout") try: req = Clusters.TestCluster.Commands.TimedInvokeRequest() - await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=req) - raise AssertionError("The command invoke should be rejected.") - except ValueError: + # 10ms is a pretty short timeout, RTT is 400ms in simulated network on CI, so this test should fail. + await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=req, timedRequestTimeoutMs=1) + raise AssertionError("Timeout expected!") + except chip.exceptions.ChipStackException: pass - logger.info( - "6: Writing TestCluster-TimedWriteBoolean without timedRequestTimeoutMs should be rejected") + logger.info("2: Send Timed Write Request -- Timeout") try: await devCtrl.WriteAttribute(nodeid=NODE_ID, attributes=[ (1, Clusters.TestCluster.Attributes.TimedWriteBoolean( True)), - ]) - raise AssertionError("The write request should be rejected.") - except ValueError: + ], + timedRequestTimeoutMs=1) + raise AssertionError("Timeout expected!") + except chip.exceptions.ChipStackException: pass @classmethod + @base.test_case async def TestReadWriteAttributeRequestsWithVersion(cls, devCtrl): logger.info("TestReadWriteAttributeRequestsWithVersion") req = [ @@ -457,16 +472,17 @@ async def TestReadWriteAttributeRequestsWithVersion(cls, devCtrl): async def RunTest(cls, devCtrl): try: cls.TestAPI() - await cls.RoundTripTest(devCtrl) - await cls.RoundTripTestWithBadEndpoint(devCtrl) - await cls.SendCommandWithResponse(devCtrl) + await cls.TestCommandRoundTrip(devCtrl) + await cls.TestCommandRoundTripWithBadEndpoint(devCtrl) + await cls.TestCommandWithResponse(devCtrl) await cls.TestReadEventRequests(devCtrl, 1) await cls.TestReadWriteAttributeRequestsWithVersion(devCtrl) await cls.TestReadAttributeRequests(devCtrl) await cls.TestSubscribeAttribute(devCtrl) # Note: Write will change some attribute values, always put it after read tests - await cls.SendWriteRequest(devCtrl) + await cls.TestWriteRequest(devCtrl) await cls.TestTimedRequest(devCtrl) + await cls.TestTimedRequestTimeout(devCtrl) except Exception as ex: logger.error( f"Unexpected error occurred when running tests: {ex}") diff --git a/src/controller/python/test/test_scripts/mobile-device-test.py b/src/controller/python/test/test_scripts/mobile-device-test.py index fdaaeca8b3caed..4c8a137dc7afe0 100755 --- a/src/controller/python/test/test_scripts/mobile-device-test.py +++ b/src/controller/python/test/test_scripts/mobile-device-test.py @@ -18,10 +18,15 @@ # # Commissioning test. +from logging import disable import os import sys -from optparse import OptionParser -from base import TestFail, TestTimeout, BaseTestHelper, FailIfNot, logger +import click +import coloredlogs +import chip.logging +import logging +from base import TestFail, TestTimeout, BaseTestHelper, FailIfNot, logger, TestIsEnabled, SetTestSet +import base from cluster_objects import NODE_ID, ClusterObjectTests from network_commissioning import NetworkCommissioningTests import asyncio @@ -40,53 +45,35 @@ # Network id, for the thread network, current a const value, will be changed to XPANID of the thread network. TEST_THREAD_NETWORK_ID = "fedcba9876543210" TEST_DISCRIMINATOR = 3840 +TEST_SETUPPIN = 20202021 ENDPOINT_ID = 0 LIGHTING_ENDPOINT_ID = 1 GROUP_ID = 0 +TEST_CONTROLLER_NODE_ID = 112233 +TEST_DEVICE_NODE_ID = 1 -def main(): - optParser = OptionParser() - optParser.add_option( - "-t", - "--timeout", - action="store", - dest="testTimeout", - default=75, - type='int', - help="The program will return with timeout after specified seconds.", - metavar="", - ) - optParser.add_option( - "-a", - "--address", - action="store", - dest="deviceAddress", - default='', - type='str', - help="Address of the device", - metavar="", - ) - - (options, remainingArgs) = optParser.parse_args(sys.argv[1:]) - - timeoutTicker = TestTimeout(options.testTimeout) - timeoutTicker.start() +ALL_TESTS = ['network_commissioning', 'datamodel'] - test = BaseTestHelper(nodeid=112233) +def ethernet_commissioning(test: BaseTestHelper, discriminator: int, setup_pin: int, address_override: str, device_nodeid: int): logger.info("Testing discovery") - FailIfNot(test.TestDiscovery(discriminator=TEST_DISCRIMINATOR), - "Failed to discover any devices.") + address = test.TestDiscovery(discriminator=discriminator) + FailIfNot(address, "Failed to discover any devices.") # FailIfNot(test.SetNetworkCommissioningParameters(dataset=TEST_THREAD_NETWORK_DATASET_TLV), # "Failed to finish network commissioning") + if address_override: + address = address_override + else: + address = address.decode("utf-8") + logger.info("Testing key exchange") - FailIfNot(test.TestKeyExchange(ip=options.deviceAddress, - setuppin=20202021, - nodeid=1), + FailIfNot(test.TestKeyExchange(ip=address, + setuppin=setup_pin, + nodeid=device_nodeid), "Failed to finish key exchange") # @@ -95,38 +82,34 @@ def main(): # # Issue: #15688 # - # asyncio.run(test.TestMultiFabric(ip=options.deviceAddress, + # asyncio.run(test.TestMultiFabric(ip=address.decode("utf-8"), # setuppin=20202021, # nodeid=1)) # - # logger.info("Testing writing/reading fabric sensitive data") - # asyncio.run(test.TestFabricSensitive(nodeid=1)) + # The server will crash if we are aborting / closing it too fast. + # Issue: #15987 + # logger.info("Testing closing sessions") + # FailIfNot(test.TestCloseSession(nodeid=device_nodeid), + # "Failed to close sessions") - logger.info("Testing closing sessions") - FailIfNot(test.TestCloseSession(nodeid=1), "Failed to close sessions") - logger.info("Testing resolve") - FailIfNot(test.TestResolve(nodeid=1), - "Failed to resolve nodeid") - - # Still test network commissioning - logger.info("Testing network commissioning") - FailIfNot(asyncio.run(NetworkCommissioningTests(devCtrl=test.devCtrl, nodeid=1).run()), - "Failed to finish network commissioning") +@base.test_case +def TestDatamodel(test: BaseTestHelper, device_nodeid: int): + logger.info("Testing datamodel functions") logger.info("Testing on off cluster") - FailIfNot(test.TestOnOffCluster(nodeid=1, + FailIfNot(test.TestOnOffCluster(nodeid=device_nodeid, endpoint=LIGHTING_ENDPOINT_ID, group=GROUP_ID), "Failed to test on off cluster") logger.info("Testing level control cluster") - FailIfNot(test.TestLevelControlCluster(nodeid=1, + FailIfNot(test.TestLevelControlCluster(nodeid=device_nodeid, endpoint=LIGHTING_ENDPOINT_ID, group=GROUP_ID), "Failed to test level control cluster") logger.info("Testing sending commands to non exist endpoint") - FailIfNot(not test.TestOnOffCluster(nodeid=1, + FailIfNot(not test.TestOnOffCluster(nodeid=device_nodeid, endpoint=233, group=GROUP_ID), "Failed to test on off cluster on non-exist endpoint") @@ -136,13 +119,13 @@ def main(): "Failed when testing Python Cluster Object APIs") logger.info("Testing attribute reading") - FailIfNot(test.TestReadBasicAttributes(nodeid=1, + FailIfNot(test.TestReadBasicAttributes(nodeid=device_nodeid, endpoint=ENDPOINT_ID, group=GROUP_ID), "Failed to test Read Basic Attributes") logger.info("Testing attribute writing") - FailIfNot(test.TestWriteBasicAttributes(nodeid=1, + FailIfNot(test.TestWriteBasicAttributes(nodeid=device_nodeid, endpoint=ENDPOINT_ID, group=GROUP_ID), "Failed to test Write Basic Attributes") @@ -154,18 +137,46 @@ def main(): "Failed to test Read Basic Attributes") logger.info("Testing subscription") - FailIfNot(test.TestSubscription(nodeid=1, endpoint=LIGHTING_ENDPOINT_ID), + FailIfNot(test.TestSubscription(nodeid=device_nodeid, endpoint=LIGHTING_ENDPOINT_ID), "Failed to subscribe attributes.") logger.info("Testing another subscription that kills previous subscriptions") - FailIfNot(test.TestSubscription(nodeid=1, endpoint=LIGHTING_ENDPOINT_ID), + FailIfNot(test.TestSubscription(nodeid=device_nodeid, endpoint=LIGHTING_ENDPOINT_ID), "Failed to subscribe attributes.") logger.info("Testing on off cluster over resolved connection") - FailIfNot(test.TestOnOffCluster(nodeid=1, + FailIfNot(test.TestOnOffCluster(nodeid=device_nodeid, endpoint=LIGHTING_ENDPOINT_ID, group=GROUP_ID), "Failed to test on off cluster") + # logger.info("Testing writing/reading fabric sensitive data") + # asyncio.run(test.TestFabricSensitive(nodeid=device_nodeid)) + + +def do_tests(controller_nodeid, device_nodeid, address, timeout, discriminator, setup_pin): + timeoutTicker = TestTimeout(timeout) + timeoutTicker.start() + + test = BaseTestHelper(nodeid=controller_nodeid) + + chip.logging.RedirectToPythonLogging() + + ethernet_commissioning(test, discriminator, setup_pin, address, + device_nodeid) + + logger.info("Testing resolve") + FailIfNot(test.TestResolve(nodeid=device_nodeid), + "Failed to resolve nodeid") + + # Still test network commissioning + FailIfNot(asyncio.run(NetworkCommissioningTests(devCtrl=test.devCtrl, nodeid=device_nodeid).run()), + "Failed to finish network commissioning") + + TestDatamodel(test, device_nodeid) + + logger.info("Testing non-controller APIs") + FailIfNot(test.TestNonControllerAPIs(), "Non controller API test failed") + timeoutTicker.stop() logger.info("Test finished") @@ -175,9 +186,45 @@ def main(): os._exit(0) +@click.command() +@click.option("--controller-nodeid", default=TEST_CONTROLLER_NODE_ID, type=int, help="NodeId of the controller.") +@click.option("--device-nodeid", default=TEST_DEVICE_NODE_ID, type=int, help="NodeId of the device.") +@click.option("--address", "-a", default='', type=str, help="Skip commissionee discovery, commission the device with the IP directly.") +@click.option("--timeout", "-t", default=240, type=int, help="The program will return with timeout after specified seconds.") +@click.option("--discriminator", default=TEST_DISCRIMINATOR, type=int, help="Discriminator of the device.") +@click.option("--setup-pin", default=TEST_SETUPPIN, type=int, help="Setup pincode of the device.") +@click.option('--enable-test', default=['all'], type=str, multiple=True, help='The tests to be executed. By default, all tests will be executed, use this option to run a specific set of tests. Use --print-test-list for a list of appliable tests.') +@click.option('--disable-test', default=[], type=str, multiple=True, help='The tests to be excluded from the set of enabled tests. Use --print-test-list for a list of appliable tests.') +@click.option('--log-level', default='WARN', type=click.Choice(['ERROR', 'WARN', 'INFO', 'DEBUG']), help="The log level of the test.") +@click.option('--log-format', default=None, type=str, help="Override logging format") +@click.option('--print-test-list', is_flag=True, help="Print a list of test cases and test sets that can be toggled via --enable-test and --disable-test, then exit") +def run(controller_nodeid, device_nodeid, address, timeout, discriminator, setup_pin, enable_test, disable_test, log_level, log_format, print_test_list): + coloredlogs.install(level=log_level, fmt=log_format, logger=logger) + + if print_test_list: + print("Test sets:") + for name in base.configurable_tests(): + print(f"\t{name}") + print("Test cases:") + for name in base.configurable_test_cases(): + print(f"\t{name}") + return + + logger.info("Test Parameters:") + logger.info(f"\tController NodeId: {controller_nodeid}") + logger.info(f"\tDevice NodeId: {device_nodeid}") + logger.info(f"\tTest Timeout: {timeout}s") + logger.info(f"\tDiscriminator: {discriminator}") + logger.info(f"\tEnabled Tests: {enable_test}") + logger.info(f"\tDisabled Tests: {disable_test}") + SetTestSet(enable_test, disable_test) + do_tests(controller_nodeid, device_nodeid, address, timeout, + discriminator, setup_pin) + + if __name__ == "__main__": try: - main() + run() except Exception as ex: logger.exception(ex) TestFail("Exception occurred when running tests.") diff --git a/src/controller/python/test/test_scripts/network_commissioning.py b/src/controller/python/test/test_scripts/network_commissioning.py index 92bba209fd8770..baf8a6da32a851 100644 --- a/src/controller/python/test/test_scripts/network_commissioning.py +++ b/src/controller/python/test/test_scripts/network_commissioning.py @@ -22,6 +22,8 @@ import chip.interaction_model import asyncio +import base + logger = logging.getLogger('NetworkCommissioning') logger.setLevel(logging.INFO) @@ -48,6 +50,7 @@ THREAD_NETWORK_FEATURE_MAP = 2 +@base.test_set class NetworkCommissioningTests: def __init__(self, devCtrl, nodeid): self._devCtrl = devCtrl @@ -116,13 +119,6 @@ async def test_wifi(self, endpointId): if res.networkingStatus != Clusters.NetworkCommissioning.Enums.NetworkCommissioningStatus.kSuccess: raise AssertionError(f"Unexpected result: {res.networkingStatus}") - # Verify Last* attributes - logger.info(f"Read Last* attributes") - res = await self.readLastNetworkingStateAttributes(endpointId=endpointId) - if (res.lastNetworkID != NullValue) or (res.lastNetworkingStatus == NullValue) or (res.lastConnectErrorValue != NullValue): - raise AssertionError( - f"LastNetworkID and LastConnectErrorValue should be Null and LastNetworkingStatus should not be Null") - # Remove existing network logger.info(f"Check network list") res = await self._devCtrl.ReadAttribute(nodeid=self._nodeid, attributes=[(endpointId, Clusters.NetworkCommissioning.Attributes.Networks)], returnClusterObject=True) @@ -187,9 +183,9 @@ async def test_wifi(self, endpointId): # Verify Last* attributes logger.info(f"Read Last* attributes") res = await self.readLastNetworkingStateAttributes(endpointId=endpointId) - if (res.lastNetworkID == NullValue) or (res.lastNetworkingStatus == NullValue) or (res.lastConnectErrorValue == NullValue): + if (res.lastNetworkID == NullValue) or (res.lastNetworkingStatus == NullValue) or (res.lastConnectErrorValue != NullValue): raise AssertionError( - f"LastNetworkID, LastConnectErrorValue and LastNetworkingStatus should not be Null") + f"LastNetworkID, LastNetworkingStatus should not be Null, LastConnectErrorValue should be Null for a successful network provision.") async def test_thread(self, endpointId): logger.info(f"Get basic information of the endpoint") @@ -221,13 +217,6 @@ async def test_thread(self, endpointId): if res.networkingStatus != Clusters.NetworkCommissioning.Enums.NetworkCommissioningStatus.kSuccess: raise AssertionError(f"Unexpected result: {res.networkingStatus}") - # Verify Last* attributes - logger.info(f"Read Last* attributes") - res = await self.readLastNetworkingStateAttributes(endpointId=endpointId) - if (res.lastNetworkID != NullValue) or (res.lastNetworkingStatus == NullValue) or (res.lastConnectErrorValue != NullValue): - raise AssertionError( - f"LastNetworkID and LastConnectErrorValue should be Null and LastNetworkingStatus should not be Null") - # Remove existing network logger.info(f"Check network list") res = await self._devCtrl.ReadAttribute(nodeid=self._nodeid, attributes=[(endpointId, Clusters.NetworkCommissioning.Attributes.Networks)], returnClusterObject=True) @@ -275,9 +264,9 @@ async def test_thread(self, endpointId): # Verify Last* attributes logger.info(f"Read Last* attributes") res = await self.readLastNetworkingStateAttributes(endpointId=endpointId) - if (res.lastNetworkID == NullValue) or (res.lastNetworkingStatus == NullValue) or (res.lastConnectErrorValue == NullValue): + if (res.lastNetworkID == NullValue) or (res.lastNetworkingStatus == NullValue) or (res.lastConnectErrorValue != NullValue): raise AssertionError( - f"LastNetworkID, LastConnectErrorValue and LastNetworkingStatus should not be Null") + f"LastNetworkID, LastNetworkingStatus should not be Null, LastConnectErrorValue should be Null for a successful network provision.") logger.info(f"Check network list") res = await self._devCtrl.ReadAttribute(nodeid=self._nodeid, attributes=[(endpointId, Clusters.NetworkCommissioning.Attributes.Networks)], returnClusterObject=True) @@ -293,26 +282,34 @@ async def test_thread(self, endpointId): raise AssertionError( f"Unexpected result: network is not marked as connected") + @base.test_case + async def Test(self): + clusters = await self._devCtrl.ReadAttribute(nodeid=self._nodeid, attributes=[(Clusters.Descriptor.Attributes.ServerList)], returnClusterObject=True) + if Clusters.NetworkCommissioning.id not in clusters[0][Clusters.Descriptor].serverList: + logger.info( + f"Network commissioning cluster {endpoint} is not enabled on this device.") + return + endpoints = await self._devCtrl.ReadAttribute(nodeid=self._nodeid, attributes=[(Clusters.NetworkCommissioning.Attributes.FeatureMap)], returnClusterObject=True) + logger.info(endpoints) + for endpoint, obj in endpoints.items(): + clus = obj[Clusters.NetworkCommissioning] + if clus.featureMap == WIFI_NETWORK_FEATURE_MAP: + logger.info( + f"Endpoint {endpoint} is configured as WiFi network, run WiFi commissioning test.") + await self.test_negative(endpoint) + await self.test_wifi(endpoint) + elif clus.featureMap == THREAD_NETWORK_FEATURE_MAP: + logger.info( + f"Endpoint {endpoint} is configured as Thread network, run Thread commissioning test.") + await self.test_negative(endpoint) + await self.test_thread(endpoint) + else: + logger.info( + f"Skip endpoint {endpoint} with featureMap {clus.featureMap}") + async def run(self): try: - endpoints = await self._devCtrl.ReadAttribute(nodeid=self._nodeid, attributes=[(Clusters.NetworkCommissioning.Attributes.FeatureMap)], returnClusterObject=True) - logger.info(endpoints) - for endpoint, obj in endpoints.items(): - clus = obj[Clusters.NetworkCommissioning] - if clus.featureMap == WIFI_NETWORK_FEATURE_MAP: - logger.info( - f"Endpoint {endpoint} is configured as WiFi network, run WiFi commissioning test.") - await self.test_negative(endpoint) - await self.test_wifi(endpoint) - elif clus.featureMap == THREAD_NETWORK_FEATURE_MAP: - logger.info( - f"Endpoint {endpoint} is configured as Thread network, run Thread commissioning test.") - await self.test_negative(endpoint) - await self.test_thread(endpoint) - else: - logger.info( - f"Skip endpoint {endpoint} with featureMap {clus.featureMap}") + await self.Test() + return True except Exception as ex: - logger.exception(ex) return False - return True diff --git a/src/controller/python/test/test_scripts/split_commissioning_test.py b/src/controller/python/test/test_scripts/split_commissioning_test.py new file mode 100755 index 00000000000000..37f4dfd3478899 --- /dev/null +++ b/src/controller/python/test/test_scripts/split_commissioning_test.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python3 + +# +# Copyright (c) 2022 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Commissioning test. +import os +import sys +from optparse import OptionParser +from base import TestFail, TestTimeout, BaseTestHelper, FailIfNot, logger +from cluster_objects import NODE_ID, ClusterObjectTests +from network_commissioning import NetworkCommissioningTests +import asyncio + +# The thread network dataset tlv for testing, splited into T-L-V. + +TEST_THREAD_NETWORK_DATASET_TLV = "0e080000000000010000" + \ + "000300000c" + \ + "35060004001fffe0" + \ + "0208fedcba9876543210" + \ + "0708fd00000000001234" + \ + "0510ffeeddccbbaa99887766554433221100" + \ + "030e54657374696e674e6574776f726b" + \ + "0102d252" + \ + "041081cb3b2efa781cc778397497ff520fa50c0302a0ff" +# Network id, for the thread network, current a const value, will be changed to XPANID of the thread network. +TEST_THREAD_NETWORK_ID = "fedcba9876543210" +TEST_DISCRIMINATOR = 3840 + +ENDPOINT_ID = 0 +LIGHTING_ENDPOINT_ID = 1 +GROUP_ID = 0 + + +def main(): + optParser = OptionParser() + optParser.add_option( + "-t", + "--timeout", + action="store", + dest="testTimeout", + default=75, + type='int', + help="The program will return with timeout after specified seconds.", + metavar="", + ) + optParser.add_option( + "--address1", + action="store", + dest="deviceAddress1", + default='', + type='str', + help="Address of the first device", + ) + optParser.add_option( + "--address2", + action="store", + dest="deviceAddress2", + default='', + type='str', + help="Address of the second device", + ) + + (options, remainingArgs) = optParser.parse_args(sys.argv[1:]) + + timeoutTicker = TestTimeout(options.testTimeout) + timeoutTicker.start() + + test = BaseTestHelper(nodeid=112233, testCommissioner=False) + + FailIfNot(test.SetNetworkCommissioningParameters(dataset=TEST_THREAD_NETWORK_DATASET_TLV), + "Failed to finish network commissioning") + + logger.info("Testing PASE connection to device 1") + FailIfNot(test.TestPaseOnly(ip=options.deviceAddress1, + setuppin=20202021, + nodeid=1), + "Failed to establish PASE connection with device 1") + + logger.info("Testing PASE connection to device 2") + FailIfNot(test.TestPaseOnly(ip=options.deviceAddress2, + setuppin=20202021, + nodeid=2), + "Failed to establish PASE connection with device 2") + + FailIfNot(test.TestCommissionOnly(nodeid=1), + "Failed to commission device 1") + + FailIfNot(test.TestCommissionOnly(nodeid=2), + "Failed to commission device 2") + + logger.info("Testing on off cluster on device 1") + FailIfNot(test.TestOnOffCluster(nodeid=1, + endpoint=LIGHTING_ENDPOINT_ID, + group=GROUP_ID), "Failed to test on off cluster on device 1") + + logger.info("Testing on off cluster on device 2") + FailIfNot(test.TestOnOffCluster(nodeid=2, + endpoint=LIGHTING_ENDPOINT_ID, + group=GROUP_ID), "Failed to test on off cluster on device 2") + + timeoutTicker.stop() + + logger.info("Test finished") + + # TODO: Python device controller cannot be shutdown clean sometimes and will block on AsyncDNSResolverSockets shutdown. + # Call os._exit(0) to force close it. + os._exit(0) + + +if __name__ == "__main__": + try: + main() + except Exception as ex: + logger.exception(ex) + TestFail("Exception occurred when running tests.") diff --git a/src/credentials/CHIPCert.cpp b/src/credentials/CHIPCert.cpp index 130ede10847afb..4b92d0e9e79686 100644 --- a/src/credentials/CHIPCert.cpp +++ b/src/credentials/CHIPCert.cpp @@ -526,10 +526,8 @@ bool ChipRDN::IsEqual(const ChipRDN & other) const { return mChipVal == other.mChipVal; } - else - { - return mString.data_equal(other.mString); - } + + return mString.data_equal(other.mString); } ChipDN::ChipDN() {} diff --git a/src/credentials/DeviceAttestationVendorReserved.h b/src/credentials/DeviceAttestationVendorReserved.h index f016d8799f8cc5..7042b2c946ca3b 100644 --- a/src/credentials/DeviceAttestationVendorReserved.h +++ b/src/credentials/DeviceAttestationVendorReserved.h @@ -72,7 +72,7 @@ class DeviceAttestationVendorReservedDeconstructor return CHIP_NO_ERROR; } - size_t GetNumberOfElements() { return mNumVendorReservedData; } + size_t GetNumberOfElements() const { return mNumVendorReservedData; } /** * @brief Return next VendorReserved element. PrepareToReadVendorReservedElements must be called first. @@ -169,7 +169,7 @@ class DeviceAttestationVendorReservedConstructor return CHIP_NO_ERROR; } - size_t GetNumberOfElements() { return mNumEntriesUsed; } + size_t GetNumberOfElements() const { return mNumEntriesUsed; } private: /* diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index d93df4b9b103ea..2642e82cb2dbda 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -434,7 +434,7 @@ CHIP_ERROR FabricInfo::VerifyCredentials(const ByteSpan & noc, const ByteSpan & } CHIP_ERROR FabricInfo::GenerateDestinationID(const ByteSpan & ipk, const ByteSpan & random, NodeId destNodeId, - MutableByteSpan & destinationId) + MutableByteSpan & destinationId) const { constexpr uint16_t kSigmaParamRandomNumberSize = 32; constexpr size_t kDestinationMessageLen = @@ -809,4 +809,27 @@ CHIP_ERROR formatKey(FabricIndex fabricIndex, MutableCharSpan formattedKey, cons return err; } +CHIP_ERROR FabricInfo::TestOnlyBuildFabric(ByteSpan rootCert, ByteSpan icacCert, ByteSpan nocCert, ByteSpan nodePubKey, + ByteSpan nodePrivateKey) +{ + Reset(); + + ReturnErrorOnFailure(SetRootCert(rootCert)); + ReturnErrorOnFailure(SetICACert(icacCert)); + ReturnErrorOnFailure(SetNOCCert(nocCert)); + + // NOTE: this requres ENABLE_HSM_CASE_OPS_KEY is not defined + P256SerializedKeypair opKeysSerialized; + memcpy(static_cast(opKeysSerialized), nodePubKey.data(), nodePubKey.size()); + memcpy(static_cast(opKeysSerialized) + nodePubKey.size(), nodePrivateKey.data(), nodePrivateKey.size()); + ReturnErrorOnFailure(opKeysSerialized.SetLength(nodePubKey.size() + nodePrivateKey.size())); + + P256Keypair opKey; + ReturnErrorOnFailure(opKey.Deserialize(opKeysSerialized)); + ReturnErrorOnFailure(SetOperationalKeypair(&opKey)); + + // NOTE: mVendorId and mFabricLabel are not initialize, because they are not used in tests. + return CHIP_NO_ERROR; +} + } // namespace chip diff --git a/src/credentials/FabricTable.h b/src/credentials/FabricTable.h index 3939ead901ed56..adcfbd680b05a3 100644 --- a/src/credentials/FabricTable.h +++ b/src/credentials/FabricTable.h @@ -141,7 +141,7 @@ class DLL_EXPORT FabricInfo bool IsInitialized() const { return IsOperationalNodeId(mOperationalId.GetNodeId()); } CHIP_ERROR GenerateDestinationID(const ByteSpan & ipk, const ByteSpan & random, NodeId destNodeId, - MutableByteSpan & destinationId); + MutableByteSpan & destinationId) const; CHIP_ERROR MatchDestinationID(const ByteSpan & destinationId, const ByteSpan & initiatorRandom, const ByteSpan * ipkList, size_t ipkListEntries); @@ -208,6 +208,10 @@ class DLL_EXPORT FabricInfo friend class FabricTable; + // Test-only, build a fabric using given root cert and NOC + CHIP_ERROR TestOnlyBuildFabric(ByteSpan rootCert, ByteSpan icacCert, ByteSpan nocCert, ByteSpan nodePubKey, + ByteSpan nodePrivateKey); + private: static constexpr size_t MetadataTLVMaxSize() { diff --git a/src/credentials/GroupDataProvider.h b/src/credentials/GroupDataProvider.h index d6e25c7e3d0dcd..f5fa345213f1b2 100644 --- a/src/credentials/GroupDataProvider.h +++ b/src/credentials/GroupDataProvider.h @@ -87,7 +87,10 @@ class GroupDataProvider GroupId group_id = kUndefinedGroupId; // Set of group keys that generate operational group keys for use with this group KeysetId keyset_id = 0; - bool operator==(const GroupKey & other) { return this->group_id == other.group_id && this->keyset_id == other.keyset_id; } + bool operator==(const GroupKey & other) const + { + return this->group_id == other.group_id && this->keyset_id == other.keyset_id; + } }; struct GroupEndpoint @@ -99,7 +102,7 @@ class GroupDataProvider // Endpoint on the Node to which messages to this group may be forwarded EndpointId endpoint_id = kInvalidEndpointId; - bool operator==(const GroupEndpoint & other) + bool operator==(const GroupEndpoint & other) const { return this->group_id == other.group_id && this->endpoint_id == other.endpoint_id; } @@ -217,8 +220,8 @@ class GroupDataProvider GroupDataProvider(const GroupDataProvider &) = delete; GroupDataProvider & operator=(const GroupDataProvider &) = delete; - uint16_t GetMaxGroupsPerFabric() { return mMaxGroupsPerFabric; } - uint16_t GetMaxGroupKeysPerFabric() { return mMaxGroupKeysPerFabric; } + uint16_t GetMaxGroupsPerFabric() const { return mMaxGroupsPerFabric; } + uint16_t GetMaxGroupKeysPerFabric() const { return mMaxGroupKeysPerFabric; } /** * Initialize the GroupDataProvider, including possibly any persistent diff --git a/src/credentials/GroupDataProviderImpl.cpp b/src/credentials/GroupDataProviderImpl.cpp index 99d49af2634b19..f9c03fd2e0dc8f 100644 --- a/src/credentials/GroupDataProviderImpl.cpp +++ b/src/credentials/GroupDataProviderImpl.cpp @@ -291,7 +291,7 @@ struct FabricData : public PersistentData } // Remove the fabric from the fabrics' linked list - CHIP_ERROR Unregister(PersistentStorageDelegate * storage) + CHIP_ERROR Unregister(PersistentStorageDelegate * storage) const { FabricList fabric_list; CHIP_ERROR err = fabric_list.Load(storage); @@ -334,7 +334,7 @@ struct FabricData : public PersistentData } // Check the fabric is registered in the fabrics' linked list - CHIP_ERROR Validate(PersistentStorageDelegate * storage) + CHIP_ERROR Validate(PersistentStorageDelegate * storage) const { FabricList fabric_list; ReturnErrorOnFailure(fabric_list.Load(storage)); @@ -929,13 +929,11 @@ CHIP_ERROR GroupDataProviderImpl::SetGroupInfo(chip::FabricIndex fabric_index, c group.SetName(info.name); return group.Save(mStorage); } - else - { - // New group_id - group.group_id = info.group_id; - group.SetName(info.name); - return SetGroupInfoAt(fabric_index, fabric.group_count, group); - } + + // New group_id + group.group_id = info.group_id; + group.SetName(info.name); + return SetGroupInfoAt(fabric_index, fabric.group_count, group); } CHIP_ERROR GroupDataProviderImpl::GetGroupInfo(chip::FabricIndex fabric_index, chip::GroupId group_id, GroupInfo & info) @@ -985,7 +983,7 @@ CHIP_ERROR GroupDataProviderImpl::SetGroupInfoAt(chip::FabricIndex fabric_index, // Update existing entry return group.Save(mStorage); } - else if (index < fabric.group_count) + if (index < fabric.group_count) { // Replace existing entry with a new group GroupData old_group; @@ -1631,16 +1629,14 @@ CHIP_ERROR GroupDataProviderImpl::SetKeySet(chip::FabricIndex fabric_index, cons // Update existing keyset info, keep next return keyset.Save(mStorage); } - else - { - // New keyset, insert first - keyset.next = fabric.first_keyset; - ReturnErrorOnFailure(keyset.Save(mStorage)); - // Update fabric - fabric.keyset_count++; - fabric.first_keyset = in_keyset.keyset_id; - return fabric.Save(mStorage); - } + + // New keyset, insert first + keyset.next = fabric.first_keyset; + ReturnErrorOnFailure(keyset.Save(mStorage)); + // Update fabric + fabric.keyset_count++; + fabric.first_keyset = in_keyset.keyset_id; + return fabric.Save(mStorage); } CHIP_ERROR GroupDataProviderImpl::GetKeySet(chip::FabricIndex fabric_index, uint16_t target_id, KeySet & out_keyset) diff --git a/src/credentials/GroupDataProviderImpl.h b/src/credentials/GroupDataProviderImpl.h index acb89dee4ff0be..e9717149367bdd 100644 --- a/src/credentials/GroupDataProviderImpl.h +++ b/src/credentials/GroupDataProviderImpl.h @@ -32,7 +32,7 @@ class GroupDataProviderImpl : public GroupDataProvider GroupDataProviderImpl(uint16_t maxGroupsPerFabric, uint16_t maxGroupKeysPerFabric) : GroupDataProvider(maxGroupsPerFabric, maxGroupKeysPerFabric) {} - virtual ~GroupDataProviderImpl() {} + ~GroupDataProviderImpl() override {} /** * @brief Set the storage implementation used for non-volatile storage of configuration data. diff --git a/src/crypto/CHIPCryptoPAL.cpp b/src/crypto/CHIPCryptoPAL.cpp index 84f355f6c55af2..738614f52f3d77 100644 --- a/src/crypto/CHIPCryptoPAL.cpp +++ b/src/crypto/CHIPCryptoPAL.cpp @@ -67,11 +67,9 @@ CHIP_ERROR ReadDerLength(Reader & reader, uint8_t & length) // We only support lengths of 0..255 over 2 bytes return CHIP_ERROR_INVALID_ARGUMENT; } - else - { - // Next byte has length 0..255. - return reader.Read8(&length).StatusCode(); - } + + // Next byte has length 0..255. + return reader.Read8(&length).StatusCode(); } /** diff --git a/src/crypto/CHIPCryptoPAL.h b/src/crypto/CHIPCryptoPAL.h index e7d8f8429e4bed..056743b682fdaa 100644 --- a/src/crypto/CHIPCryptoPAL.h +++ b/src/crypto/CHIPCryptoPAL.h @@ -362,7 +362,7 @@ class P256Keypair : public P256KeypairBase { public: P256Keypair() {} - virtual ~P256Keypair(); + ~P256Keypair() override; /** * @brief Initialize the keypair. @@ -552,15 +552,15 @@ CHIP_ERROR ConvertIntegerRawToDerWithoutTag(const ByteSpan & raw_integer, Mutabl * @param aad_length Length of additional authentication data * @param key Encryption key * @param key_length Length of encryption key (in bytes) - * @param iv Initial vector - * @param iv_length Length of initial vector + * @param nonce Encryption nonce + * @param nonce_length Length of encryption nonce * @param ciphertext Buffer to write ciphertext into. Caller must ensure this is large enough to hold the ciphertext * @param tag Buffer to write tag into. Caller must ensure this is large enough to hold the tag * @param tag_length Expected length of tag * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise * */ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, const uint8_t * aad, size_t aad_length, - const uint8_t * key, size_t key_length, const uint8_t * iv, size_t iv_length, uint8_t * ciphertext, + const uint8_t * key, size_t key_length, const uint8_t * nonce, size_t nonce_length, uint8_t * ciphertext, uint8_t * tag, size_t tag_length); /** @@ -579,15 +579,15 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c * @param tag_length Length of tag * @param key Decryption key * @param key_length Length of Decryption key (in bytes) - * @param iv Initial vector - * @param iv_length Length of initial vector + * @param nonce Encryption nonce + * @param nonce_length Length of encryption nonce * @param plaintext Buffer to write plaintext into * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise **/ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_length, const uint8_t * aad, size_t aad_length, - const uint8_t * tag, size_t tag_length, const uint8_t * key, size_t key_length, const uint8_t * iv, - size_t iv_length, uint8_t * plaintext); + const uint8_t * tag, size_t tag_length, const uint8_t * key, size_t key_length, const uint8_t * nonce, + size_t nonce_length, uint8_t * plaintext); /** * @brief Verify the Certificate Signing Request (CSR). If successfully verified, it outputs the public key from the CSR. diff --git a/src/crypto/CHIPCryptoPALOpenSSL.cpp b/src/crypto/CHIPCryptoPALOpenSSL.cpp index b9597a63c6be52..fecd6296b1b4d4 100644 --- a/src/crypto/CHIPCryptoPALOpenSSL.cpp +++ b/src/crypto/CHIPCryptoPALOpenSSL.cpp @@ -125,7 +125,7 @@ static const EVP_MD * _digestForType(DigestType digestType) } CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, const uint8_t * aad, size_t aad_length, - const uint8_t * key, size_t key_length, const uint8_t * iv, size_t iv_length, uint8_t * ciphertext, + const uint8_t * key, size_t key_length, const uint8_t * nonce, size_t nonce_length, uint8_t * ciphertext, uint8_t * tag, size_t tag_length) { EVP_CIPHER_CTX * context = nullptr; @@ -166,9 +166,9 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c VerifyOrExit(ciphertext != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(key != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(_isValidKeyLength(key_length), error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(iv != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(iv_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(CanCastTo(iv_length), error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(nonce != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(nonce_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(CanCastTo(nonce_length), error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(tag != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(_isValidTagLength(tag_length), error = CHIP_ERROR_INVALID_ARGUMENT); @@ -183,16 +183,16 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c result = EVP_EncryptInit_ex(context, type, nullptr, nullptr, nullptr); VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL); - // Pass in IV length. Cast is safe because we checked with CanCastTo. - result = EVP_CIPHER_CTX_ctrl(context, EVP_CTRL_CCM_SET_IVLEN, static_cast(iv_length), nullptr); + // Pass in nonce length. Cast is safe because we checked with CanCastTo. + result = EVP_CIPHER_CTX_ctrl(context, EVP_CTRL_CCM_SET_IVLEN, static_cast(nonce_length), nullptr); VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL); // Pass in tag length. Cast is safe because we checked _isValidTagLength. result = EVP_CIPHER_CTX_ctrl(context, EVP_CTRL_CCM_SET_TAG, static_cast(tag_length), nullptr); VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL); - // Pass in key + iv - result = EVP_EncryptInit_ex(context, nullptr, nullptr, Uint8::to_const_uchar(key), Uint8::to_const_uchar(iv)); + // Pass in key + nonce + result = EVP_EncryptInit_ex(context, nullptr, nullptr, Uint8::to_const_uchar(key), Uint8::to_const_uchar(nonce)); VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL); // Pass in plain text length @@ -237,8 +237,8 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c } CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_length, const uint8_t * aad, size_t aad_length, - const uint8_t * tag, size_t tag_length, const uint8_t * key, size_t key_length, const uint8_t * iv, - size_t iv_length, uint8_t * plaintext) + const uint8_t * tag, size_t tag_length, const uint8_t * key, size_t key_length, const uint8_t * nonce, + size_t nonce_length, uint8_t * plaintext) { EVP_CIPHER_CTX * context = nullptr; CHIP_ERROR error = CHIP_NO_ERROR; @@ -278,8 +278,8 @@ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_length, VerifyOrExit(_isValidTagLength(tag_length), error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(key != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(_isValidKeyLength(key_length), error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(iv != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(iv_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(nonce != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(nonce_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT); // TODO: Remove support for AES-256 since not in 1.0 // Determine crypto type by key length @@ -292,9 +292,9 @@ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_length, result = EVP_DecryptInit_ex(context, type, nullptr, nullptr, nullptr); VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL); - // Pass in IV length - VerifyOrExit(CanCastTo(iv_length), error = CHIP_ERROR_INVALID_ARGUMENT); - result = EVP_CIPHER_CTX_ctrl(context, EVP_CTRL_CCM_SET_IVLEN, static_cast(iv_length), nullptr); + // Pass in nonce length + VerifyOrExit(CanCastTo(nonce_length), error = CHIP_ERROR_INVALID_ARGUMENT); + result = EVP_CIPHER_CTX_ctrl(context, EVP_CTRL_CCM_SET_IVLEN, static_cast(nonce_length), nullptr); VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL); // Pass in expected tag @@ -305,8 +305,8 @@ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_length, const_cast(static_cast(tag))); VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL); - // Pass in key + iv - result = EVP_DecryptInit_ex(context, nullptr, nullptr, Uint8::to_const_uchar(key), Uint8::to_const_uchar(iv)); + // Pass in key + nonce + result = EVP_DecryptInit_ex(context, nullptr, nullptr, Uint8::to_const_uchar(key), Uint8::to_const_uchar(nonce)); VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL); // Pass in cipher text length @@ -1525,9 +1525,9 @@ static void security_free_cert_list(X509_LIST * certs) CHIP_ERROR LoadCertsFromPKCS7(const char * pkcs7, X509DerCertificate * x509list, uint32_t * max_certs) { CHIP_ERROR err = CHIP_NO_ERROR; - X509_LIST * certs = NULL; - BIO * bio_cert = NULL; - PKCS7 * p7 = NULL; + X509_LIST * certs = nullptr; + BIO * bio_cert = nullptr; + PKCS7 * p7 = nullptr; int p7_type = 0; VerifyOrExit(x509list != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); @@ -1535,7 +1535,7 @@ CHIP_ERROR LoadCertsFromPKCS7(const char * pkcs7, X509DerCertificate * x509list, bio_cert = BIO_new_mem_buf(pkcs7, -1); - p7 = PEM_read_bio_PKCS7(bio_cert, NULL, NULL, NULL); + p7 = PEM_read_bio_PKCS7(bio_cert, nullptr, nullptr, nullptr); VerifyOrExit(p7 != nullptr, err = CHIP_ERROR_WRONG_CERT_TYPE); p7_type = OBJ_obj2nid(p7->type); @@ -1548,7 +1548,7 @@ CHIP_ERROR LoadCertsFromPKCS7(const char * pkcs7, X509DerCertificate * x509list, certs = p7->d.signed_and_enveloped->cert; } - VerifyOrExit(certs != NULL, err = CHIP_ERROR_WRONG_CERT_TYPE); + VerifyOrExit(certs != nullptr, err = CHIP_ERROR_WRONG_CERT_TYPE); VerifyOrExit(static_cast(sk_X509_num(certs)) <= *max_certs, err = CHIP_ERROR_WRONG_CERT_TYPE); *max_certs = static_cast(sk_X509_num(certs)); @@ -1579,16 +1579,16 @@ CHIP_ERROR LoadCertsFromPKCS7(const char * pkcs7, X509DerCertificate * x509list, CHIP_ERROR LoadCertFromPKCS7(const char * pkcs7, X509DerCertificate * x509list, uint32_t n_cert) { CHIP_ERROR err = CHIP_NO_ERROR; - X509_LIST * certs = NULL; - BIO * bio_cert = NULL; - PKCS7 * p7 = NULL; + X509_LIST * certs = nullptr; + BIO * bio_cert = nullptr; + PKCS7 * p7 = nullptr; int p7_type = 0; VerifyOrExit(x509list != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); bio_cert = BIO_new_mem_buf(pkcs7, -1); - p7 = PEM_read_bio_PKCS7(bio_cert, NULL, NULL, NULL); + p7 = PEM_read_bio_PKCS7(bio_cert, nullptr, nullptr, nullptr); VerifyOrExit(p7 != nullptr, err = CHIP_ERROR_WRONG_CERT_TYPE); p7_type = OBJ_obj2nid(p7->type); @@ -1601,7 +1601,7 @@ CHIP_ERROR LoadCertFromPKCS7(const char * pkcs7, X509DerCertificate * x509list, certs = p7->d.signed_and_enveloped->cert; } - VerifyOrExit(certs != NULL, err = CHIP_ERROR_WRONG_CERT_TYPE); + VerifyOrExit(certs != nullptr, err = CHIP_ERROR_WRONG_CERT_TYPE); VerifyOrExit(n_cert < static_cast(sk_X509_num(certs)), err = CHIP_ERROR_INVALID_ARGUMENT); certs = X509_chain_up_ref(certs); @@ -1629,16 +1629,16 @@ CHIP_ERROR LoadCertFromPKCS7(const char * pkcs7, X509DerCertificate * x509list, CHIP_ERROR GetNumberOfCertsFromPKCS7(const char * pkcs7, uint32_t * n_certs) { CHIP_ERROR err = CHIP_NO_ERROR; - X509_LIST * certs = NULL; - BIO * bio_cert = NULL; - PKCS7 * p7 = NULL; + X509_LIST * certs = nullptr; + BIO * bio_cert = nullptr; + PKCS7 * p7 = nullptr; int p7_type = 0; VerifyOrExit(n_certs != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); bio_cert = BIO_new_mem_buf(pkcs7, -1); - p7 = PEM_read_bio_PKCS7(bio_cert, NULL, NULL, NULL); + p7 = PEM_read_bio_PKCS7(bio_cert, nullptr, nullptr, nullptr); VerifyOrExit(p7 != nullptr, err = CHIP_ERROR_WRONG_CERT_TYPE); p7_type = OBJ_obj2nid(p7->type); @@ -1651,7 +1651,7 @@ CHIP_ERROR GetNumberOfCertsFromPKCS7(const char * pkcs7, uint32_t * n_certs) certs = p7->d.signed_and_enveloped->cert; } - VerifyOrExit(certs != NULL, err = CHIP_ERROR_WRONG_CERT_TYPE); + VerifyOrExit(certs != nullptr, err = CHIP_ERROR_WRONG_CERT_TYPE); *n_certs = static_cast(sk_X509_num(certs)); @@ -1689,25 +1689,25 @@ CHIP_ERROR ValidateCertificateChain(const uint8_t * rootCertificate, size_t root verifyCtx = X509_STORE_CTX_new(); VerifyOrExit(verifyCtx != nullptr, (result = CertificateChainValidationResult::kNoMemory, err = CHIP_ERROR_NO_MEMORY)); - x509RootCertificate = d2i_X509(NULL, &rootCertificate, static_cast(rootCertificateLen)); + x509RootCertificate = d2i_X509(nullptr, &rootCertificate, static_cast(rootCertificateLen)); VerifyOrExit(x509RootCertificate != nullptr, (result = CertificateChainValidationResult::kRootFormatInvalid, err = CHIP_ERROR_INTERNAL)); status = X509_STORE_add_cert(store, x509RootCertificate); VerifyOrExit(status == 1, (result = CertificateChainValidationResult::kInternalFrameworkError, err = CHIP_ERROR_INTERNAL)); - x509CACertificate = d2i_X509(NULL, &caCertificate, static_cast(caCertificateLen)); + x509CACertificate = d2i_X509(nullptr, &caCertificate, static_cast(caCertificateLen)); VerifyOrExit(x509CACertificate != nullptr, (result = CertificateChainValidationResult::kICAFormatInvalid, err = CHIP_ERROR_INTERNAL)); status = X509_STORE_add_cert(store, x509CACertificate); VerifyOrExit(status == 1, (result = CertificateChainValidationResult::kInternalFrameworkError, err = CHIP_ERROR_INTERNAL)); - x509LeafCertificate = d2i_X509(NULL, &leafCertificate, static_cast(leafCertificateLen)); + x509LeafCertificate = d2i_X509(nullptr, &leafCertificate, static_cast(leafCertificateLen)); VerifyOrExit(x509LeafCertificate != nullptr, (result = CertificateChainValidationResult::kLeafFormatInvalid, err = CHIP_ERROR_INTERNAL)); - status = X509_STORE_CTX_init(verifyCtx, store, x509LeafCertificate, NULL); + status = X509_STORE_CTX_init(verifyCtx, store, x509LeafCertificate, nullptr); VerifyOrExit(status == 1, (result = CertificateChainValidationResult::kInternalFrameworkError, err = CHIP_ERROR_INTERNAL)); status = X509_verify_cert(verifyCtx); @@ -1740,10 +1740,11 @@ CHIP_ERROR IsCertificateValidAtIssuance(const ByteSpan & referenceCertificate, c VerifyOrReturnError(!referenceCertificate.empty() && !toBeEvaluatedCertificate.empty(), CHIP_ERROR_INVALID_ARGUMENT); - x509ReferenceCertificate = d2i_X509(NULL, &pReferenceCertificate, static_cast(referenceCertificate.size())); + x509ReferenceCertificate = d2i_X509(nullptr, &pReferenceCertificate, static_cast(referenceCertificate.size())); VerifyOrExit(x509ReferenceCertificate != nullptr, error = CHIP_ERROR_NO_MEMORY); - x509toBeEvaluatedCertificate = d2i_X509(NULL, &pToBeEvaluatedCertificate, static_cast(toBeEvaluatedCertificate.size())); + x509toBeEvaluatedCertificate = + d2i_X509(nullptr, &pToBeEvaluatedCertificate, static_cast(toBeEvaluatedCertificate.size())); VerifyOrExit(x509toBeEvaluatedCertificate != nullptr, error = CHIP_ERROR_NO_MEMORY); refNotBeforeTime = X509_get_notBefore(x509ReferenceCertificate); @@ -1777,7 +1778,7 @@ CHIP_ERROR IsCertificateValidAtCurrentTime(const ByteSpan & certificate) VerifyOrReturnError(!certificate.empty(), CHIP_ERROR_INVALID_ARGUMENT); - x509Certificate = d2i_X509(NULL, &pCertificate, static_cast(certificate.size())); + x509Certificate = d2i_X509(nullptr, &pCertificate, static_cast(certificate.size())); VerifyOrExit(x509Certificate != nullptr, error = CHIP_ERROR_NO_MEMORY); time = X509_get_notBefore(x509Certificate); @@ -1811,7 +1812,7 @@ CHIP_ERROR ExtractPubkeyFromX509Cert(const ByteSpan & certificate, Crypto::P256P unsigned char ** ppPubkey = &pPubkey; int pkeyLen; - x509certificate = d2i_X509(NULL, ppCertificate, static_cast(certificate.size())); + x509certificate = d2i_X509(nullptr, ppCertificate, static_cast(certificate.size())); VerifyOrExit(x509certificate != nullptr, err = CHIP_ERROR_NO_MEMORY); pkey = X509_get_pubkey(x509certificate); @@ -1819,7 +1820,7 @@ CHIP_ERROR ExtractPubkeyFromX509Cert(const ByteSpan & certificate, Crypto::P256P VerifyOrExit(EVP_PKEY_base_id(pkey) == EVP_PKEY_EC, err = CHIP_ERROR_INTERNAL); VerifyOrExit(EVP_PKEY_bits(pkey) == 256, err = CHIP_ERROR_INTERNAL); - pkeyLen = i2d_PublicKey(pkey, NULL); + pkeyLen = i2d_PublicKey(pkey, nullptr); VerifyOrExit(pkeyLen == static_cast(pubkey.Length()), err = CHIP_ERROR_INTERNAL); VerifyOrExit(i2d_PublicKey(pkey, ppPubkey) == pkeyLen, err = CHIP_ERROR_INTERNAL); @@ -1841,7 +1842,7 @@ CHIP_ERROR ExtractKIDFromX509Cert(bool isSKID, const ByteSpan & certificate, Mut const unsigned char ** ppCertificate = &pCertificate; const ASN1_OCTET_STRING * kidString = nullptr; - x509certificate = d2i_X509(NULL, ppCertificate, static_cast(certificate.size())); + x509certificate = d2i_X509(nullptr, ppCertificate, static_cast(certificate.size())); VerifyOrExit(x509certificate != nullptr, err = CHIP_ERROR_NO_MEMORY); kidString = isSKID ? X509_get0_subject_key_id(x509certificate) : X509_get0_authority_key_id(x509certificate); @@ -1886,7 +1887,7 @@ CHIP_ERROR ExtractDNAttributeFromX509Cert(const char * oidString, const ByteSpan VerifyOrReturnError(oidStringSize == sOidStringSize, CHIP_ERROR_INVALID_ARGUMENT); - x509certificate = d2i_X509(NULL, &pCertificate, static_cast(certificate.size())); + x509certificate = d2i_X509(nullptr, &pCertificate, static_cast(certificate.size())); VerifyOrExit(x509certificate != nullptr, err = CHIP_ERROR_NO_MEMORY); subject = X509_get_subject_name(x509certificate); diff --git a/src/crypto/CHIPCryptoPALmbedTLS.cpp b/src/crypto/CHIPCryptoPALmbedTLS.cpp index f56e7b0fcd21f4..5b1a7709fb590b 100644 --- a/src/crypto/CHIPCryptoPALmbedTLS.cpp +++ b/src/crypto/CHIPCryptoPALmbedTLS.cpp @@ -111,7 +111,7 @@ static bool _isValidKeyLength(size_t length) } CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, const uint8_t * aad, size_t aad_length, - const uint8_t * key, size_t key_length, const uint8_t * iv, size_t iv_length, uint8_t * ciphertext, + const uint8_t * key, size_t key_length, const uint8_t * nonce, size_t nonce_length, uint8_t * ciphertext, uint8_t * tag, size_t tag_length) { CHIP_ERROR error = CHIP_NO_ERROR; @@ -124,8 +124,8 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c VerifyOrExit(ciphertext != nullptr || plaintext_length == 0, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(key != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(_isValidKeyLength(key_length), error = CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE); - VerifyOrExit(iv != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(iv_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(nonce != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(nonce_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(tag != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(_isValidTagLength(tag_length), error = CHIP_ERROR_INVALID_ARGUMENT); if (aad_length > 0) @@ -140,7 +140,7 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); // Encrypt - result = mbedtls_ccm_encrypt_and_tag(&context, plaintext_length, Uint8::to_const_uchar(iv), iv_length, + result = mbedtls_ccm_encrypt_and_tag(&context, plaintext_length, Uint8::to_const_uchar(nonce), nonce_length, Uint8::to_const_uchar(aad), aad_length, Uint8::to_const_uchar(plaintext), Uint8::to_uchar(ciphertext), Uint8::to_uchar(tag), tag_length); _log_mbedTLS_error(result); @@ -152,8 +152,8 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c } CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_len, const uint8_t * aad, size_t aad_len, - const uint8_t * tag, size_t tag_length, const uint8_t * key, size_t key_length, const uint8_t * iv, - size_t iv_length, uint8_t * plaintext) + const uint8_t * tag, size_t tag_length, const uint8_t * key, size_t key_length, const uint8_t * nonce, + size_t nonce_length, uint8_t * plaintext) { CHIP_ERROR error = CHIP_NO_ERROR; int result = 1; @@ -167,8 +167,8 @@ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_len, co VerifyOrExit(_isValidTagLength(tag_length), error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(key != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(_isValidKeyLength(key_length), error = CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE); - VerifyOrExit(iv != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(iv_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(nonce != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(nonce_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT); if (aad_len > 0) { VerifyOrExit(aad != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); @@ -181,9 +181,9 @@ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_len, co VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); // Decrypt - result = mbedtls_ccm_auth_decrypt(&context, ciphertext_len, Uint8::to_const_uchar(iv), iv_length, Uint8::to_const_uchar(aad), - aad_len, Uint8::to_const_uchar(ciphertext), Uint8::to_uchar(plaintext), - Uint8::to_const_uchar(tag), tag_length); + result = mbedtls_ccm_auth_decrypt(&context, ciphertext_len, Uint8::to_const_uchar(nonce), nonce_length, + Uint8::to_const_uchar(aad), aad_len, Uint8::to_const_uchar(ciphertext), + Uint8::to_uchar(plaintext), Uint8::to_const_uchar(tag), tag_length); _log_mbedTLS_error(result); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); diff --git a/src/crypto/tests/AES_CCM_128_test_vectors.h b/src/crypto/tests/AES_CCM_128_test_vectors.h index 757df8b1771094..59f5c574756b2e 100644 --- a/src/crypto/tests/AES_CCM_128_test_vectors.h +++ b/src/crypto/tests/AES_CCM_128_test_vectors.h @@ -33,8 +33,8 @@ struct ccm_128_test_vector size_t aad_len; const uint8_t * key; size_t key_len; - const uint8_t * iv; - size_t iv_len; + const uint8_t * nonce; + size_t nonce_len; const uint8_t * ct; size_t ct_len; const uint8_t * tag; @@ -47,910 +47,910 @@ static const uint8_t chiptest_dac9e1195a0d_pt_1[] = { static const uint8_t chiptest_dac9e1195a0d_aad_2[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_3[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_4[] = { 0x75, 0xc7, 0xc1, 0x23, 0xb3, 0x9b, 0x8a, 0x7e }; +static const uint8_t chiptest_dac9e1195a0d_nonce_4[] = { 0x75, 0xc7, 0xc1, 0x23, 0xb3, 0x9b, 0x8a, 0x7e }; static const uint8_t chiptest_dac9e1195a0d_ct_5[] = { 0x74 }; static const uint8_t chiptest_dac9e1195a0d_tag_6[] = { 0x32, 0xf0, 0xc8, 0xf7, 0xdc, 0x07, 0x7c, 0xb8 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_7 = { .pt = chiptest_dac9e1195a0d_pt_1, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_2, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_3, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_4, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_5, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_6, - .tag_len = 8, - .tcId = 1, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_7 = { .pt = chiptest_dac9e1195a0d_pt_1, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_2, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_3, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_4, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_5, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_6, + .tag_len = 8, + .tcId = 1, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_8[] = { 0xee }; static const uint8_t chiptest_dac9e1195a0d_aad_9[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_10[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_11[] = { 0x75, 0xc7, 0xc1, 0x23, 0xb3, 0x9b, 0x8a, 0x7e }; +static const uint8_t chiptest_dac9e1195a0d_nonce_11[] = { 0x75, 0xc7, 0xc1, 0x23, 0xb3, 0x9b, 0x8a, 0x7e }; static const uint8_t chiptest_dac9e1195a0d_ct_12[] = { 0x74 }; static const uint8_t chiptest_dac9e1195a0d_tag_13[] = { 0xc0, 0x1c, 0x51, 0x81, 0x8d, 0x2a, 0x93, 0x57, 0xb4, 0x69, 0x2b, 0x24 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_14 = { .pt = chiptest_dac9e1195a0d_pt_8, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_9, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_10, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_11, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_12, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_13, - .tag_len = 12, - .tcId = 2, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_14 = { .pt = chiptest_dac9e1195a0d_pt_8, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_9, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_10, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_11, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_12, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_13, + .tag_len = 12, + .tcId = 2, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_15[] = { 0xee }; static const uint8_t chiptest_dac9e1195a0d_aad_16[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_17[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_18[] = { 0x75, 0xc7, 0xc1, 0x23, 0xb3, 0x9b, 0x8a, 0x7e }; +static const uint8_t chiptest_dac9e1195a0d_nonce_18[] = { 0x75, 0xc7, 0xc1, 0x23, 0xb3, 0x9b, 0x8a, 0x7e }; static const uint8_t chiptest_dac9e1195a0d_ct_19[] = { 0x74 }; static const uint8_t chiptest_dac9e1195a0d_tag_20[] = { 0x35, 0x5e, 0x27, 0x43, 0xb6, 0x79, 0x36, 0x94, 0xca, 0x78, 0xd6, 0xd9, 0xc8, 0xdc, 0x14, 0x6c }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_21 = { .pt = chiptest_dac9e1195a0d_pt_15, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_16, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_17, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_18, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_19, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_20, - .tag_len = 16, - .tcId = 3, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_21 = { .pt = chiptest_dac9e1195a0d_pt_15, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_16, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_17, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_18, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_19, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_20, + .tag_len = 16, + .tcId = 3, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_22[] = { 0xcd }; static const uint8_t chiptest_dac9e1195a0d_aad_23[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_24[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_25[] = { 0x56, 0x59, 0x39, 0x7e, 0x06, 0x02, 0x8b, 0x14, 0x9d, 0x0b, 0x2b, 0x2b }; -static const uint8_t chiptest_dac9e1195a0d_ct_26[] = { 0xf5 }; -static const uint8_t chiptest_dac9e1195a0d_tag_27[] = { 0x24, 0x70, 0x9e, 0xaf, 0x87, 0x95, 0x80, 0xe8 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_28 = { .pt = chiptest_dac9e1195a0d_pt_22, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_23, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_24, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_25, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_26, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_27, - .tag_len = 8, - .tcId = 4, - .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_nonce_25[] = { 0x56, 0x59, 0x39, 0x7e, 0x06, 0x02, 0x8b, 0x14, 0x9d, 0x0b, 0x2b, 0x2b }; +static const uint8_t chiptest_dac9e1195a0d_ct_26[] = { 0xf5 }; +static const uint8_t chiptest_dac9e1195a0d_tag_27[] = { 0x24, 0x70, 0x9e, 0xaf, 0x87, 0x95, 0x80, 0xe8 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_28 = { .pt = chiptest_dac9e1195a0d_pt_22, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_23, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_24, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_25, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_26, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_27, + .tag_len = 8, + .tcId = 4, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_29[] = { 0xcd }; static const uint8_t chiptest_dac9e1195a0d_aad_30[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_31[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_32[] = { 0x56, 0x59, 0x39, 0x7e, 0x06, 0x02, 0x8b, 0x14, 0x9d, 0x0b, 0x2b, 0x2b }; -static const uint8_t chiptest_dac9e1195a0d_ct_33[] = { 0xf5 }; -static const uint8_t chiptest_dac9e1195a0d_tag_34[] = { 0x9a, 0x23, 0xec, 0x3e, 0xac, 0xef, 0x72, 0xc2, 0x2c, 0x6a, 0x37, 0x08 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_35 = { .pt = chiptest_dac9e1195a0d_pt_29, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_30, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_31, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_32, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_33, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_34, - .tag_len = 12, - .tcId = 5, - .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_nonce_32[] = { 0x56, 0x59, 0x39, 0x7e, 0x06, 0x02, 0x8b, 0x14, 0x9d, 0x0b, 0x2b, 0x2b }; +static const uint8_t chiptest_dac9e1195a0d_ct_33[] = { 0xf5 }; +static const uint8_t chiptest_dac9e1195a0d_tag_34[] = { 0x9a, 0x23, 0xec, 0x3e, 0xac, 0xef, 0x72, 0xc2, 0x2c, 0x6a, 0x37, 0x08 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_35 = { .pt = chiptest_dac9e1195a0d_pt_29, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_30, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_31, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_32, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_33, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_34, + .tag_len = 12, + .tcId = 5, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_36[] = { 0xcd }; static const uint8_t chiptest_dac9e1195a0d_aad_37[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_38[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_39[] = { 0x56, 0x59, 0x39, 0x7e, 0x06, 0x02, 0x8b, 0x14, 0x9d, 0x0b, 0x2b, 0x2b }; -static const uint8_t chiptest_dac9e1195a0d_ct_40[] = { 0xf5 }; -static const uint8_t chiptest_dac9e1195a0d_tag_41[] = { 0x9f, 0x5c, 0xd7, 0x4a, 0x83, 0x60, 0xc7, 0x76, +static const uint8_t chiptest_dac9e1195a0d_nonce_39[] = { 0x56, 0x59, 0x39, 0x7e, 0x06, 0x02, 0x8b, 0x14, 0x9d, 0x0b, 0x2b, 0x2b }; +static const uint8_t chiptest_dac9e1195a0d_ct_40[] = { 0xf5 }; +static const uint8_t chiptest_dac9e1195a0d_tag_41[] = { 0x9f, 0x5c, 0xd7, 0x4a, 0x83, 0x60, 0xc7, 0x76, 0xe7, 0x16, 0x7d, 0xe2, 0xdb, 0xef, 0xac, 0x98 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_42 = { .pt = chiptest_dac9e1195a0d_pt_36, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_37, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_38, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_39, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_40, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_41, - .tag_len = 16, - .tcId = 6, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_42 = { .pt = chiptest_dac9e1195a0d_pt_36, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_37, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_38, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_39, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_40, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_41, + .tag_len = 16, + .tcId = 6, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_43[] = { 0xf4 }; static const uint8_t chiptest_dac9e1195a0d_aad_44[] = { 0xb3, 0x3f, 0xa8, 0xae, 0x4b, 0xc6, 0xea, 0xe4, 0x5f, 0x28, 0x61, 0x9a, 0xc8, 0xd3, 0xae, 0x79 }; static const uint8_t chiptest_dac9e1195a0d_key_45[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_46[] = { 0x6d, 0x4c, 0x91, 0x17, 0x0d, 0xc6, 0x21, 0x7e }; +static const uint8_t chiptest_dac9e1195a0d_nonce_46[] = { 0x6d, 0x4c, 0x91, 0x17, 0x0d, 0xc6, 0x21, 0x7e }; static const uint8_t chiptest_dac9e1195a0d_ct_47[] = { 0x7f }; static const uint8_t chiptest_dac9e1195a0d_tag_48[] = { 0xc6, 0x3e, 0x43, 0xfc, 0x80, 0x03, 0x60, 0xf5 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_49 = { .pt = chiptest_dac9e1195a0d_pt_43, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_44, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_45, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_46, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_47, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_48, - .tag_len = 8, - .tcId = 7, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_49 = { .pt = chiptest_dac9e1195a0d_pt_43, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_44, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_45, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_46, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_47, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_48, + .tag_len = 8, + .tcId = 7, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_50[] = { 0xf4 }; static const uint8_t chiptest_dac9e1195a0d_aad_51[] = { 0xb3, 0x3f, 0xa8, 0xae, 0x4b, 0xc6, 0xea, 0xe4, 0x5f, 0x28, 0x61, 0x9a, 0xc8, 0xd3, 0xae, 0x79 }; static const uint8_t chiptest_dac9e1195a0d_key_52[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_53[] = { 0x6d, 0x4c, 0x91, 0x17, 0x0d, 0xc6, 0x21, 0x7e }; +static const uint8_t chiptest_dac9e1195a0d_nonce_53[] = { 0x6d, 0x4c, 0x91, 0x17, 0x0d, 0xc6, 0x21, 0x7e }; static const uint8_t chiptest_dac9e1195a0d_ct_54[] = { 0x7f }; static const uint8_t chiptest_dac9e1195a0d_tag_55[] = { 0xcf, 0x3d, 0x2c, 0xe6, 0x3c, 0xf3, 0x38, 0x07, 0x67, 0x36, 0xd1, 0x1c }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_56 = { .pt = chiptest_dac9e1195a0d_pt_50, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_51, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_52, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_53, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_54, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_55, - .tag_len = 12, - .tcId = 8, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_56 = { .pt = chiptest_dac9e1195a0d_pt_50, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_51, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_52, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_53, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_54, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_55, + .tag_len = 12, + .tcId = 8, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_57[] = { 0xf4 }; static const uint8_t chiptest_dac9e1195a0d_aad_58[] = { 0xb3, 0x3f, 0xa8, 0xae, 0x4b, 0xc6, 0xea, 0xe4, 0x5f, 0x28, 0x61, 0x9a, 0xc8, 0xd3, 0xae, 0x79 }; static const uint8_t chiptest_dac9e1195a0d_key_59[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_60[] = { 0x6d, 0x4c, 0x91, 0x17, 0x0d, 0xc6, 0x21, 0x7e }; +static const uint8_t chiptest_dac9e1195a0d_nonce_60[] = { 0x6d, 0x4c, 0x91, 0x17, 0x0d, 0xc6, 0x21, 0x7e }; static const uint8_t chiptest_dac9e1195a0d_ct_61[] = { 0x7f }; static const uint8_t chiptest_dac9e1195a0d_tag_62[] = { 0x08, 0x85, 0x6b, 0x4a, 0x5d, 0x73, 0x56, 0xc4, 0xf0, 0x46, 0x3e, 0xa9, 0x0e, 0x3c, 0x36, 0x77 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_63 = { .pt = chiptest_dac9e1195a0d_pt_57, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_58, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_59, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_60, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_61, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_62, - .tag_len = 16, - .tcId = 9, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_63 = { .pt = chiptest_dac9e1195a0d_pt_57, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_58, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_59, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_60, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_61, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_62, + .tag_len = 16, + .tcId = 9, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_64[] = { 0x38 }; static const uint8_t chiptest_dac9e1195a0d_aad_65[] = { 0xf4, 0xc7, 0xa8, 0x88, 0x22, 0x1e, 0xef, 0xf4, 0xc8, 0x15, 0x51, 0xdc, 0x15, 0xd4, 0x10, 0xfb }; static const uint8_t chiptest_dac9e1195a0d_key_66[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_67[] = { 0x7f, 0xf3, 0x44, 0xc6, 0xb3, 0x64, 0xc4, 0x4e, 0x4f, 0xe0, 0xaa, 0xa7 }; -static const uint8_t chiptest_dac9e1195a0d_ct_68[] = { 0x55 }; -static const uint8_t chiptest_dac9e1195a0d_tag_69[] = { 0x4b, 0xae, 0xdd, 0xe7, 0xe8, 0xc1, 0x48, 0xed }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_70 = { .pt = chiptest_dac9e1195a0d_pt_64, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_65, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_66, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_67, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_68, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_69, - .tag_len = 8, - .tcId = 10, - .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_nonce_67[] = { 0x7f, 0xf3, 0x44, 0xc6, 0xb3, 0x64, 0xc4, 0x4e, 0x4f, 0xe0, 0xaa, 0xa7 }; +static const uint8_t chiptest_dac9e1195a0d_ct_68[] = { 0x55 }; +static const uint8_t chiptest_dac9e1195a0d_tag_69[] = { 0x4b, 0xae, 0xdd, 0xe7, 0xe8, 0xc1, 0x48, 0xed }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_70 = { .pt = chiptest_dac9e1195a0d_pt_64, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_65, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_66, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_67, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_68, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_69, + .tag_len = 8, + .tcId = 10, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_71[] = { 0x38 }; static const uint8_t chiptest_dac9e1195a0d_aad_72[] = { 0xf4, 0xc7, 0xa8, 0x88, 0x22, 0x1e, 0xef, 0xf4, 0xc8, 0x15, 0x51, 0xdc, 0x15, 0xd4, 0x10, 0xfb }; static const uint8_t chiptest_dac9e1195a0d_key_73[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_74[] = { 0x7f, 0xf3, 0x44, 0xc6, 0xb3, 0x64, 0xc4, 0x4e, 0x4f, 0xe0, 0xaa, 0xa7 }; -static const uint8_t chiptest_dac9e1195a0d_ct_75[] = { 0x55 }; -static const uint8_t chiptest_dac9e1195a0d_tag_76[] = { 0xdd, 0x3a, 0x04, 0xbc, 0xe4, 0x50, 0xa7, 0xe9, 0x84, 0x26, 0xd2, 0x5c }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_77 = { .pt = chiptest_dac9e1195a0d_pt_71, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_72, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_73, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_74, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_75, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_76, - .tag_len = 12, - .tcId = 11, - .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_nonce_74[] = { 0x7f, 0xf3, 0x44, 0xc6, 0xb3, 0x64, 0xc4, 0x4e, 0x4f, 0xe0, 0xaa, 0xa7 }; +static const uint8_t chiptest_dac9e1195a0d_ct_75[] = { 0x55 }; +static const uint8_t chiptest_dac9e1195a0d_tag_76[] = { 0xdd, 0x3a, 0x04, 0xbc, 0xe4, 0x50, 0xa7, 0xe9, 0x84, 0x26, 0xd2, 0x5c }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_77 = { .pt = chiptest_dac9e1195a0d_pt_71, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_72, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_73, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_74, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_75, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_76, + .tag_len = 12, + .tcId = 11, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_78[] = { 0x38 }; static const uint8_t chiptest_dac9e1195a0d_aad_79[] = { 0xf4, 0xc7, 0xa8, 0x88, 0x22, 0x1e, 0xef, 0xf4, 0xc8, 0x15, 0x51, 0xdc, 0x15, 0xd4, 0x10, 0xfb }; static const uint8_t chiptest_dac9e1195a0d_key_80[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_81[] = { 0x7f, 0xf3, 0x44, 0xc6, 0xb3, 0x64, 0xc4, 0x4e, 0x4f, 0xe0, 0xaa, 0xa7 }; -static const uint8_t chiptest_dac9e1195a0d_ct_82[] = { 0x55 }; -static const uint8_t chiptest_dac9e1195a0d_tag_83[] = { 0x20, 0xc7, 0xb9, 0x71, 0xfb, 0xf3, 0x6f, 0x9c, +static const uint8_t chiptest_dac9e1195a0d_nonce_81[] = { 0x7f, 0xf3, 0x44, 0xc6, 0xb3, 0x64, 0xc4, 0x4e, 0x4f, 0xe0, 0xaa, 0xa7 }; +static const uint8_t chiptest_dac9e1195a0d_ct_82[] = { 0x55 }; +static const uint8_t chiptest_dac9e1195a0d_tag_83[] = { 0x20, 0xc7, 0xb9, 0x71, 0xfb, 0xf3, 0x6f, 0x9c, 0x44, 0x24, 0x78, 0x12, 0xd3, 0x99, 0xb1, 0x45 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_84 = { .pt = chiptest_dac9e1195a0d_pt_78, - .pt_len = 1, - .aad = chiptest_dac9e1195a0d_aad_79, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_80, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_81, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_82, - .ct_len = 1, - .tag = chiptest_dac9e1195a0d_tag_83, - .tag_len = 16, - .tcId = 12, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_84 = { .pt = chiptest_dac9e1195a0d_pt_78, + .pt_len = 1, + .aad = chiptest_dac9e1195a0d_aad_79, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_80, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_81, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_82, + .ct_len = 1, + .tag = chiptest_dac9e1195a0d_tag_83, + .tag_len = 16, + .tcId = 12, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_85[] = { 0x86, 0x74, 0x64, 0xe5, 0x0b, 0xd4, 0x0d, 0x90, 0xe1, 0x17, 0xa3, 0x2d, 0x4b, 0xd4, 0xe1, 0xe6 }; static const uint8_t chiptest_dac9e1195a0d_aad_86[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_87[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_88[] = { 0xf2, 0xf0, 0x11, 0x4f, 0xe7, 0x9a, 0x24, 0xfb }; +static const uint8_t chiptest_dac9e1195a0d_nonce_88[] = { 0xf2, 0xf0, 0x11, 0x4f, 0xe7, 0x9a, 0x24, 0xfb }; static const uint8_t chiptest_dac9e1195a0d_ct_89[] = { 0x17, 0x8d, 0xfc, 0xe4, 0xe8, 0x7b, 0xeb, 0x87, 0x63, 0xe3, 0xdd, 0xc8, 0x68, 0xfa, 0x73, 0x88 }; static const uint8_t chiptest_dac9e1195a0d_tag_90[] = { 0x7f, 0x10, 0xcf, 0x6c, 0x9b, 0x22, 0xb3, 0x96 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_91 = { .pt = chiptest_dac9e1195a0d_pt_85, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_86, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_87, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_88, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_89, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_90, - .tag_len = 8, - .tcId = 13, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_91 = { .pt = chiptest_dac9e1195a0d_pt_85, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_86, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_87, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_88, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_89, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_90, + .tag_len = 8, + .tcId = 13, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_92[] = { 0x86, 0x74, 0x64, 0xe5, 0x0b, 0xd4, 0x0d, 0x90, 0xe1, 0x17, 0xa3, 0x2d, 0x4b, 0xd4, 0xe1, 0xe6 }; static const uint8_t chiptest_dac9e1195a0d_aad_93[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_94[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_95[] = { 0xf2, 0xf0, 0x11, 0x4f, 0xe7, 0x9a, 0x24, 0xfb }; +static const uint8_t chiptest_dac9e1195a0d_nonce_95[] = { 0xf2, 0xf0, 0x11, 0x4f, 0xe7, 0x9a, 0x24, 0xfb }; static const uint8_t chiptest_dac9e1195a0d_ct_96[] = { 0x17, 0x8d, 0xfc, 0xe4, 0xe8, 0x7b, 0xeb, 0x87, 0x63, 0xe3, 0xdd, 0xc8, 0x68, 0xfa, 0x73, 0x88 }; static const uint8_t chiptest_dac9e1195a0d_tag_97[] = { 0x6f, 0x4c, 0x9a, 0x68, 0x32, 0x37, 0x33, 0x1d, 0x6a, 0x98, 0x74, 0xbc }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_98 = { .pt = chiptest_dac9e1195a0d_pt_92, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_93, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_94, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_95, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_96, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_97, - .tag_len = 12, - .tcId = 14, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_98 = { .pt = chiptest_dac9e1195a0d_pt_92, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_93, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_94, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_95, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_96, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_97, + .tag_len = 12, + .tcId = 14, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_99[] = { 0x86, 0x74, 0x64, 0xe5, 0x0b, 0xd4, 0x0d, 0x90, 0xe1, 0x17, 0xa3, 0x2d, 0x4b, 0xd4, 0xe1, 0xe6 }; static const uint8_t chiptest_dac9e1195a0d_aad_100[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_101[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_102[] = { 0xf2, 0xf0, 0x11, 0x4f, 0xe7, 0x9a, 0x24, 0xfb }; +static const uint8_t chiptest_dac9e1195a0d_nonce_102[] = { 0xf2, 0xf0, 0x11, 0x4f, 0xe7, 0x9a, 0x24, 0xfb }; static const uint8_t chiptest_dac9e1195a0d_ct_103[] = { 0x17, 0x8d, 0xfc, 0xe4, 0xe8, 0x7b, 0xeb, 0x87, 0x63, 0xe3, 0xdd, 0xc8, 0x68, 0xfa, 0x73, 0x88 }; static const uint8_t chiptest_dac9e1195a0d_tag_104[] = { 0x7e, 0x04, 0x2a, 0x69, 0xd0, 0x1b, 0x87, 0x26, 0xac, 0xe1, 0x31, 0xde, 0x34, 0x22, 0xc6, 0xae }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_105 = { .pt = chiptest_dac9e1195a0d_pt_99, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_100, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_101, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_102, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_103, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_104, - .tag_len = 16, - .tcId = 14, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_105 = { .pt = chiptest_dac9e1195a0d_pt_99, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_100, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_101, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_102, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_103, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_104, + .tag_len = 16, + .tcId = 14, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_106[] = { 0xab, 0xf9, 0x8a, 0x73, 0x5c, 0xd5, 0x47, 0x8b, 0x9d, 0x6d, 0x3d, 0xdf, 0x02, 0x56, 0x5a, 0xe0 }; static const uint8_t chiptest_dac9e1195a0d_aad_107[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_108[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_109[] = { 0xc7, 0xcf, 0x09, 0xa8, 0xe2, 0x3b, 0xaa, 0xc1, 0xb6, 0x95, 0xc0, 0x42 }; -static const uint8_t chiptest_dac9e1195a0d_ct_110[] = { 0xf8, 0x86, 0xc0, 0x74, 0xae, 0x03, 0xe9, 0x02, +static const uint8_t chiptest_dac9e1195a0d_nonce_109[] = { 0xc7, 0xcf, 0x09, 0xa8, 0xe2, 0x3b, 0xaa, 0xc1, 0xb6, 0x95, 0xc0, 0x42 }; +static const uint8_t chiptest_dac9e1195a0d_ct_110[] = { 0xf8, 0x86, 0xc0, 0x74, 0xae, 0x03, 0xe9, 0x02, 0xf3, 0x3d, 0x0c, 0x91, 0x9e, 0xd7, 0xb5, 0xee }; -static const uint8_t chiptest_dac9e1195a0d_tag_111[] = { 0x44, 0x45, 0x35, 0xc9, 0x73, 0xc9, 0x2b, 0xbb }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_112 = { .pt = chiptest_dac9e1195a0d_pt_106, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_107, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_108, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_109, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_110, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_111, - .tag_len = 8, - .tcId = 15, - .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_tag_111[] = { 0x44, 0x45, 0x35, 0xc9, 0x73, 0xc9, 0x2b, 0xbb }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_112 = { .pt = chiptest_dac9e1195a0d_pt_106, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_107, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_108, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_109, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_110, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_111, + .tag_len = 8, + .tcId = 15, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_113[] = { 0xab, 0xf9, 0x8a, 0x73, 0x5c, 0xd5, 0x47, 0x8b, 0x9d, 0x6d, 0x3d, 0xdf, 0x02, 0x56, 0x5a, 0xe0 }; static const uint8_t chiptest_dac9e1195a0d_aad_114[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_115[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_116[] = { 0xc7, 0xcf, 0x09, 0xa8, 0xe2, 0x3b, 0xaa, 0xc1, 0xb6, 0x95, 0xc0, 0x42 }; -static const uint8_t chiptest_dac9e1195a0d_ct_117[] = { 0xf8, 0x86, 0xc0, 0x74, 0xae, 0x03, 0xe9, 0x02, +static const uint8_t chiptest_dac9e1195a0d_nonce_116[] = { 0xc7, 0xcf, 0x09, 0xa8, 0xe2, 0x3b, 0xaa, 0xc1, 0xb6, 0x95, 0xc0, 0x42 }; +static const uint8_t chiptest_dac9e1195a0d_ct_117[] = { 0xf8, 0x86, 0xc0, 0x74, 0xae, 0x03, 0xe9, 0x02, 0xf3, 0x3d, 0x0c, 0x91, 0x9e, 0xd7, 0xb5, 0xee }; -static const uint8_t chiptest_dac9e1195a0d_tag_118[] = { 0xc9, 0xa7, 0x79, 0xa1, 0xaa, 0x43, 0x0c, 0x7a, 0x4a, 0x43, 0x2f, 0x49 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_119 = { .pt = chiptest_dac9e1195a0d_pt_113, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_114, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_115, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_116, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_117, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_118, - .tag_len = 12, - .tcId = 16, - .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_tag_118[] = { 0xc9, 0xa7, 0x79, 0xa1, 0xaa, 0x43, 0x0c, 0x7a, 0x4a, 0x43, 0x2f, 0x49 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_119 = { .pt = chiptest_dac9e1195a0d_pt_113, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_114, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_115, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_116, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_117, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_118, + .tag_len = 12, + .tcId = 16, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_120[] = { 0xab, 0xf9, 0x8a, 0x73, 0x5c, 0xd5, 0x47, 0x8b, 0x9d, 0x6d, 0x3d, 0xdf, 0x02, 0x56, 0x5a, 0xe0 }; static const uint8_t chiptest_dac9e1195a0d_aad_121[] = {}; static const uint8_t chiptest_dac9e1195a0d_key_122[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_123[] = { 0xc7, 0xcf, 0x09, 0xa8, 0xe2, 0x3b, 0xaa, 0xc1, 0xb6, 0x95, 0xc0, 0x42 }; -static const uint8_t chiptest_dac9e1195a0d_ct_124[] = { 0xf8, 0x86, 0xc0, 0x74, 0xae, 0x03, 0xe9, 0x02, +static const uint8_t chiptest_dac9e1195a0d_nonce_123[] = { 0xc7, 0xcf, 0x09, 0xa8, 0xe2, 0x3b, 0xaa, 0xc1, 0xb6, 0x95, 0xc0, 0x42 }; +static const uint8_t chiptest_dac9e1195a0d_ct_124[] = { 0xf8, 0x86, 0xc0, 0x74, 0xae, 0x03, 0xe9, 0x02, 0xf3, 0x3d, 0x0c, 0x91, 0x9e, 0xd7, 0xb5, 0xee }; -static const uint8_t chiptest_dac9e1195a0d_tag_125[] = { 0x1f, 0x5d, 0xdb, 0xdd, 0x5b, 0xcf, 0xc5, 0x4f, +static const uint8_t chiptest_dac9e1195a0d_tag_125[] = { 0x1f, 0x5d, 0xdb, 0xdd, 0x5b, 0xcf, 0xc5, 0x4f, 0x0c, 0xbc, 0xf4, 0x7f, 0x46, 0x34, 0x63, 0x67 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_126 = { .pt = chiptest_dac9e1195a0d_pt_120, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_121, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_122, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_123, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_124, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_125, - .tag_len = 16, - .tcId = 17, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_126 = { .pt = chiptest_dac9e1195a0d_pt_120, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_121, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_122, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_123, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_124, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_125, + .tag_len = 16, + .tcId = 17, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_127[] = { 0x0a, 0x61, 0xf2, 0xb4, 0xd6, 0x13, 0x5e, 0x2f, 0x63, 0xd3, 0xae, 0x42, 0xc3, 0x08, 0x08, 0x3e }; static const uint8_t chiptest_dac9e1195a0d_aad_128[] = { 0x2c, 0xa7, 0x1b, 0x23, 0x18, 0xdd, 0x96, 0xb2, 0x43, 0xc8, 0x70, 0xa3, 0xdd, 0xa9, 0xfa, 0x0d }; static const uint8_t chiptest_dac9e1195a0d_key_129[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_130[] = { 0x60, 0x66, 0x73, 0x03, 0x90, 0xc3, 0xae, 0x06 }; +static const uint8_t chiptest_dac9e1195a0d_nonce_130[] = { 0x60, 0x66, 0x73, 0x03, 0x90, 0xc3, 0xae, 0x06 }; static const uint8_t chiptest_dac9e1195a0d_ct_131[] = { 0xc2, 0xaf, 0x35, 0x3b, 0x99, 0x82, 0xc3, 0x9f, 0x6d, 0x91, 0x4a, 0xef, 0x8c, 0xf4, 0x97, 0x19 }; static const uint8_t chiptest_dac9e1195a0d_tag_132[] = { 0xce, 0xb1, 0x1e, 0x3a, 0x99, 0xeb, 0x3b, 0xcd }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_133 = { .pt = chiptest_dac9e1195a0d_pt_127, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_128, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_129, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_130, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_131, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_132, - .tag_len = 8, - .tcId = 18, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_133 = { .pt = chiptest_dac9e1195a0d_pt_127, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_128, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_129, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_130, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_131, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_132, + .tag_len = 8, + .tcId = 18, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_134[] = { 0x0a, 0x61, 0xf2, 0xb4, 0xd6, 0x13, 0x5e, 0x2f, 0x63, 0xd3, 0xae, 0x42, 0xc3, 0x08, 0x08, 0x3e }; static const uint8_t chiptest_dac9e1195a0d_aad_135[] = { 0x2c, 0xa7, 0x1b, 0x23, 0x18, 0xdd, 0x96, 0xb2, 0x43, 0xc8, 0x70, 0xa3, 0xdd, 0xa9, 0xfa, 0x0d }; static const uint8_t chiptest_dac9e1195a0d_key_136[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_137[] = { 0x60, 0x66, 0x73, 0x03, 0x90, 0xc3, 0xae, 0x06 }; +static const uint8_t chiptest_dac9e1195a0d_nonce_137[] = { 0x60, 0x66, 0x73, 0x03, 0x90, 0xc3, 0xae, 0x06 }; static const uint8_t chiptest_dac9e1195a0d_ct_138[] = { 0xc2, 0xaf, 0x35, 0x3b, 0x99, 0x82, 0xc3, 0x9f, 0x6d, 0x91, 0x4a, 0xef, 0x8c, 0xf4, 0x97, 0x19 }; static const uint8_t chiptest_dac9e1195a0d_tag_139[] = { 0x54, 0x26, 0x39, 0x94, 0xd2, 0x41, 0xe4, 0xff, 0x06, 0x0c, 0xcb, 0x0f }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_140 = { .pt = chiptest_dac9e1195a0d_pt_134, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_135, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_136, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_137, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_138, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_139, - .tag_len = 12, - .tcId = 19, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_140 = { .pt = chiptest_dac9e1195a0d_pt_134, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_135, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_136, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_137, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_138, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_139, + .tag_len = 12, + .tcId = 19, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_141[] = { 0x0a, 0x61, 0xf2, 0xb4, 0xd6, 0x13, 0x5e, 0x2f, 0x63, 0xd3, 0xae, 0x42, 0xc3, 0x08, 0x08, 0x3e }; static const uint8_t chiptest_dac9e1195a0d_aad_142[] = { 0x2c, 0xa7, 0x1b, 0x23, 0x18, 0xdd, 0x96, 0xb2, 0x43, 0xc8, 0x70, 0xa3, 0xdd, 0xa9, 0xfa, 0x0d }; static const uint8_t chiptest_dac9e1195a0d_key_143[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_144[] = { 0x60, 0x66, 0x73, 0x03, 0x90, 0xc3, 0xae, 0x06 }; +static const uint8_t chiptest_dac9e1195a0d_nonce_144[] = { 0x60, 0x66, 0x73, 0x03, 0x90, 0xc3, 0xae, 0x06 }; static const uint8_t chiptest_dac9e1195a0d_ct_145[] = { 0xc2, 0xaf, 0x35, 0x3b, 0x99, 0x82, 0xc3, 0x9f, 0x6d, 0x91, 0x4a, 0xef, 0x8c, 0xf4, 0x97, 0x19 }; static const uint8_t chiptest_dac9e1195a0d_tag_146[] = { 0x08, 0x68, 0x46, 0xcc, 0x2f, 0x72, 0xa4, 0x90, 0x23, 0xc3, 0x0f, 0xc6, 0x9a, 0xac, 0x4b, 0x7f }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_147 = { .pt = chiptest_dac9e1195a0d_pt_141, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_142, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_143, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_144, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_145, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_146, - .tag_len = 16, - .tcId = 20, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_147 = { .pt = chiptest_dac9e1195a0d_pt_141, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_142, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_143, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_144, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_145, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_146, + .tag_len = 16, + .tcId = 20, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_148[] = { 0x33, 0x23, 0x11, 0xb6, 0xae, 0xb2, 0x15, 0x2e, 0xb8, 0x44, 0x59, 0x4f, 0x41, 0xf8, 0xec, 0x69 }; static const uint8_t chiptest_dac9e1195a0d_aad_149[] = { 0xa4, 0x08, 0xf7, 0x5d, 0xdc, 0x1a, 0x13, 0x31, 0x3d, 0xfb, 0x35, 0x5f, 0x79, 0xcc, 0x36, 0x55 }; static const uint8_t chiptest_dac9e1195a0d_key_150[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_151[] = { 0x63, 0x90, 0x36, 0xf0, 0xad, 0x89, 0x82, 0x51, 0x58, 0xb0, 0x49, 0xca }; -static const uint8_t chiptest_dac9e1195a0d_ct_152[] = { 0x4f, 0x19, 0xc6, 0xa3, 0xbc, 0x09, 0x99, 0x34, +static const uint8_t chiptest_dac9e1195a0d_nonce_151[] = { 0x63, 0x90, 0x36, 0xf0, 0xad, 0x89, 0x82, 0x51, 0x58, 0xb0, 0x49, 0xca }; +static const uint8_t chiptest_dac9e1195a0d_ct_152[] = { 0x4f, 0x19, 0xc6, 0xa3, 0xbc, 0x09, 0x99, 0x34, 0xe3, 0x5b, 0x32, 0x9b, 0x89, 0xa8, 0x5e, 0x18 }; -static const uint8_t chiptest_dac9e1195a0d_tag_153[] = { 0x92, 0x62, 0xb1, 0x84, 0xe2, 0xec, 0xe1, 0xd4 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_154 = { .pt = chiptest_dac9e1195a0d_pt_148, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_149, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_150, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_151, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_152, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_153, - .tag_len = 8, - .tcId = 21, - .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_tag_153[] = { 0x92, 0x62, 0xb1, 0x84, 0xe2, 0xec, 0xe1, 0xd4 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_154 = { .pt = chiptest_dac9e1195a0d_pt_148, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_149, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_150, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_151, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_152, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_153, + .tag_len = 8, + .tcId = 21, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_155[] = { 0x33, 0x23, 0x11, 0xb6, 0xae, 0xb2, 0x15, 0x2e, 0xb8, 0x44, 0x59, 0x4f, 0x41, 0xf8, 0xec, 0x69 }; static const uint8_t chiptest_dac9e1195a0d_aad_156[] = { 0xa4, 0x08, 0xf7, 0x5d, 0xdc, 0x1a, 0x13, 0x31, 0x3d, 0xfb, 0x35, 0x5f, 0x79, 0xcc, 0x36, 0x55 }; static const uint8_t chiptest_dac9e1195a0d_key_157[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_158[] = { 0x63, 0x90, 0x36, 0xf0, 0xad, 0x89, 0x82, 0x51, 0x58, 0xb0, 0x49, 0xca }; -static const uint8_t chiptest_dac9e1195a0d_ct_159[] = { 0x4f, 0x19, 0xc6, 0xa3, 0xbc, 0x09, 0x99, 0x34, +static const uint8_t chiptest_dac9e1195a0d_nonce_158[] = { 0x63, 0x90, 0x36, 0xf0, 0xad, 0x89, 0x82, 0x51, 0x58, 0xb0, 0x49, 0xca }; +static const uint8_t chiptest_dac9e1195a0d_ct_159[] = { 0x4f, 0x19, 0xc6, 0xa3, 0xbc, 0x09, 0x99, 0x34, 0xe3, 0x5b, 0x32, 0x9b, 0x89, 0xa8, 0x5e, 0x18 }; -static const uint8_t chiptest_dac9e1195a0d_tag_160[] = { 0x0c, 0xc2, 0xc1, 0x5e, 0x0e, 0x93, 0x5a, 0x64, 0x9a, 0xfe, 0x4c, 0xce }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_161 = { .pt = chiptest_dac9e1195a0d_pt_155, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_156, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_157, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_158, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_159, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_160, - .tag_len = 12, - .tcId = 22, - .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_tag_160[] = { 0x0c, 0xc2, 0xc1, 0x5e, 0x0e, 0x93, 0x5a, 0x64, 0x9a, 0xfe, 0x4c, 0xce }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_161 = { .pt = chiptest_dac9e1195a0d_pt_155, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_156, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_157, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_158, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_159, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_160, + .tag_len = 12, + .tcId = 22, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_162[] = { 0x33, 0x23, 0x11, 0xb6, 0xae, 0xb2, 0x15, 0x2e, 0xb8, 0x44, 0x59, 0x4f, 0x41, 0xf8, 0xec, 0x69 }; static const uint8_t chiptest_dac9e1195a0d_aad_163[] = { 0xa4, 0x08, 0xf7, 0x5d, 0xdc, 0x1a, 0x13, 0x31, 0x3d, 0xfb, 0x35, 0x5f, 0x79, 0xcc, 0x36, 0x55 }; static const uint8_t chiptest_dac9e1195a0d_key_164[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_165[] = { 0x63, 0x90, 0x36, 0xf0, 0xad, 0x89, 0x82, 0x51, 0x58, 0xb0, 0x49, 0xca }; -static const uint8_t chiptest_dac9e1195a0d_ct_166[] = { 0x4f, 0x19, 0xc6, 0xa3, 0xbc, 0x09, 0x99, 0x34, +static const uint8_t chiptest_dac9e1195a0d_nonce_165[] = { 0x63, 0x90, 0x36, 0xf0, 0xad, 0x89, 0x82, 0x51, 0x58, 0xb0, 0x49, 0xca }; +static const uint8_t chiptest_dac9e1195a0d_ct_166[] = { 0x4f, 0x19, 0xc6, 0xa3, 0xbc, 0x09, 0x99, 0x34, 0xe3, 0x5b, 0x32, 0x9b, 0x89, 0xa8, 0x5e, 0x18 }; -static const uint8_t chiptest_dac9e1195a0d_tag_167[] = { 0xbd, 0x90, 0x92, 0xa8, 0xdb, 0x2e, 0x78, 0x0b, +static const uint8_t chiptest_dac9e1195a0d_tag_167[] = { 0xbd, 0x90, 0x92, 0xa8, 0xdb, 0x2e, 0x78, 0x0b, 0x5a, 0x93, 0xa0, 0xfb, 0xe3, 0x3a, 0x5a, 0x38 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_168 = { .pt = chiptest_dac9e1195a0d_pt_162, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_163, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_164, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_165, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_166, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_167, - .tag_len = 16, - .tcId = 23, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_169[] = { 0x3b, 0xc5, 0xc4, 0xda, 0x04, 0xd8, 0xa5, 0x15, 0x67, 0x9c, 0x5c, +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_168 = { .pt = chiptest_dac9e1195a0d_pt_162, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_163, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_164, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_165, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_166, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_167, + .tag_len = 16, + .tcId = 23, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_169[] = { 0x3b, 0xc5, 0xc4, 0xda, 0x04, 0xd8, 0xa5, 0x15, 0x67, 0x9c, 0x5c, 0x40, 0xc0, 0xfd, 0x7d, 0x9e, 0x2b, 0x52, 0x22, 0x3f, 0xeb, 0x1f, 0x61, 0x99, 0x78, 0xe7, 0xce, 0x84, 0xdc, 0x3f, 0xbe, 0x85, 0xf2 }; -static const uint8_t chiptest_dac9e1195a0d_aad_170[] = {}; -static const uint8_t chiptest_dac9e1195a0d_key_171[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_aad_170[] = {}; +static const uint8_t chiptest_dac9e1195a0d_key_171[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_172[] = { 0x7b, 0x05, 0xbc, 0x8b, 0xcf, 0xc1, 0x6c, 0xc1 }; -static const uint8_t chiptest_dac9e1195a0d_ct_173[] = { 0xf1, 0x46, 0xa7, 0xb0, 0xf4, 0xff, 0x02, 0x3a, 0x23, 0xc3, 0xfe, +static const uint8_t chiptest_dac9e1195a0d_nonce_172[] = { 0x7b, 0x05, 0xbc, 0x8b, 0xcf, 0xc1, 0x6c, 0xc1 }; +static const uint8_t chiptest_dac9e1195a0d_ct_173[] = { 0xf1, 0x46, 0xa7, 0xb0, 0xf4, 0xff, 0x02, 0x3a, 0x23, 0xc3, 0xfe, 0xd5, 0x60, 0x4c, 0xdf, 0xe5, 0x09, 0x3e, 0x3c, 0x7b, 0x91, 0x4a, 0x68, 0xa5, 0xab, 0xff, 0x1a, 0x14, 0x96, 0x1e, 0x82, 0xb3, 0xb9 }; -static const uint8_t chiptest_dac9e1195a0d_tag_174[] = { 0x32, 0x6f, 0xff, 0xcc, 0xce, 0x78, 0x97, 0x57 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_175 = { .pt = chiptest_dac9e1195a0d_pt_169, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_170, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_171, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_172, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_173, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_174, - .tag_len = 8, - .tcId = 24, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_176[] = { 0x3b, 0xc5, 0xc4, 0xda, 0x04, 0xd8, 0xa5, 0x15, 0x67, 0x9c, 0x5c, +static const uint8_t chiptest_dac9e1195a0d_tag_174[] = { 0x32, 0x6f, 0xff, 0xcc, 0xce, 0x78, 0x97, 0x57 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_175 = { .pt = chiptest_dac9e1195a0d_pt_169, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_170, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_171, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_172, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_173, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_174, + .tag_len = 8, + .tcId = 24, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_176[] = { 0x3b, 0xc5, 0xc4, 0xda, 0x04, 0xd8, 0xa5, 0x15, 0x67, 0x9c, 0x5c, 0x40, 0xc0, 0xfd, 0x7d, 0x9e, 0x2b, 0x52, 0x22, 0x3f, 0xeb, 0x1f, 0x61, 0x99, 0x78, 0xe7, 0xce, 0x84, 0xdc, 0x3f, 0xbe, 0x85, 0xf2 }; -static const uint8_t chiptest_dac9e1195a0d_aad_177[] = {}; -static const uint8_t chiptest_dac9e1195a0d_key_178[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_aad_177[] = {}; +static const uint8_t chiptest_dac9e1195a0d_key_178[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_179[] = { 0x7b, 0x05, 0xbc, 0x8b, 0xcf, 0xc1, 0x6c, 0xc1 }; -static const uint8_t chiptest_dac9e1195a0d_ct_180[] = { 0xf1, 0x46, 0xa7, 0xb0, 0xf4, 0xff, 0x02, 0x3a, 0x23, 0xc3, 0xfe, +static const uint8_t chiptest_dac9e1195a0d_nonce_179[] = { 0x7b, 0x05, 0xbc, 0x8b, 0xcf, 0xc1, 0x6c, 0xc1 }; +static const uint8_t chiptest_dac9e1195a0d_ct_180[] = { 0xf1, 0x46, 0xa7, 0xb0, 0xf4, 0xff, 0x02, 0x3a, 0x23, 0xc3, 0xfe, 0xd5, 0x60, 0x4c, 0xdf, 0xe5, 0x09, 0x3e, 0x3c, 0x7b, 0x91, 0x4a, 0x68, 0xa5, 0xab, 0xff, 0x1a, 0x14, 0x96, 0x1e, 0x82, 0xb3, 0xb9 }; -static const uint8_t chiptest_dac9e1195a0d_tag_181[] = { 0x5d, 0xca, 0x99, 0xed, 0x22, 0x49, 0x97, 0x05, 0x48, 0x57, 0x6e, 0x8b }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_182 = { .pt = chiptest_dac9e1195a0d_pt_176, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_177, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_178, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_179, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_180, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_181, - .tag_len = 12, - .tcId = 25, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_183[] = { 0x3b, 0xc5, 0xc4, 0xda, 0x04, 0xd8, 0xa5, 0x15, 0x67, 0x9c, 0x5c, +static const uint8_t chiptest_dac9e1195a0d_tag_181[] = { 0x5d, 0xca, 0x99, 0xed, 0x22, 0x49, 0x97, 0x05, 0x48, 0x57, 0x6e, 0x8b }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_182 = { .pt = chiptest_dac9e1195a0d_pt_176, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_177, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_178, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_179, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_180, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_181, + .tag_len = 12, + .tcId = 25, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_183[] = { 0x3b, 0xc5, 0xc4, 0xda, 0x04, 0xd8, 0xa5, 0x15, 0x67, 0x9c, 0x5c, 0x40, 0xc0, 0xfd, 0x7d, 0x9e, 0x2b, 0x52, 0x22, 0x3f, 0xeb, 0x1f, 0x61, 0x99, 0x78, 0xe7, 0xce, 0x84, 0xdc, 0x3f, 0xbe, 0x85, 0xf2 }; -static const uint8_t chiptest_dac9e1195a0d_aad_184[] = {}; -static const uint8_t chiptest_dac9e1195a0d_key_185[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_aad_184[] = {}; +static const uint8_t chiptest_dac9e1195a0d_key_185[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_186[] = { 0x7b, 0x05, 0xbc, 0x8b, 0xcf, 0xc1, 0x6c, 0xc1 }; -static const uint8_t chiptest_dac9e1195a0d_ct_187[] = { 0xf1, 0x46, 0xa7, 0xb0, 0xf4, 0xff, 0x02, 0x3a, 0x23, 0xc3, 0xfe, +static const uint8_t chiptest_dac9e1195a0d_nonce_186[] = { 0x7b, 0x05, 0xbc, 0x8b, 0xcf, 0xc1, 0x6c, 0xc1 }; +static const uint8_t chiptest_dac9e1195a0d_ct_187[] = { 0xf1, 0x46, 0xa7, 0xb0, 0xf4, 0xff, 0x02, 0x3a, 0x23, 0xc3, 0xfe, 0xd5, 0x60, 0x4c, 0xdf, 0xe5, 0x09, 0x3e, 0x3c, 0x7b, 0x91, 0x4a, 0x68, 0xa5, 0xab, 0xff, 0x1a, 0x14, 0x96, 0x1e, 0x82, 0xb3, 0xb9 }; -static const uint8_t chiptest_dac9e1195a0d_tag_188[] = { 0x31, 0x4c, 0xc7, 0xf3, 0x36, 0x41, 0x54, 0x55, +static const uint8_t chiptest_dac9e1195a0d_tag_188[] = { 0x31, 0x4c, 0xc7, 0xf3, 0x36, 0x41, 0x54, 0x55, 0xd8, 0xf5, 0xfb, 0x36, 0xea, 0x1b, 0x73, 0xd8 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_189 = { .pt = chiptest_dac9e1195a0d_pt_183, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_184, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_185, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_186, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_187, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_188, - .tag_len = 16, - .tcId = 26, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_190[] = { 0x58, 0x07, 0xa2, 0x32, 0x31, 0x77, 0xa6, 0xba, 0xc6, 0x77, 0x3c, +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_189 = { .pt = chiptest_dac9e1195a0d_pt_183, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_184, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_185, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_186, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_187, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_188, + .tag_len = 16, + .tcId = 26, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_190[] = { 0x58, 0x07, 0xa2, 0x32, 0x31, 0x77, 0xa6, 0xba, 0xc6, 0x77, 0x3c, 0xd9, 0x28, 0x9b, 0xc1, 0x20, 0x14, 0xb8, 0x95, 0xa4, 0xbc, 0xa7, 0x8f, 0x93, 0x50, 0x86, 0xe1, 0x49, 0x7a, 0x38, 0xcc, 0x02, 0x42 }; -static const uint8_t chiptest_dac9e1195a0d_aad_191[] = {}; -static const uint8_t chiptest_dac9e1195a0d_key_192[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_aad_191[] = {}; +static const uint8_t chiptest_dac9e1195a0d_key_192[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_193[] = { 0xee, 0xbc, 0x7d, 0x0c, 0xce, 0x8d, 0x7f, 0xd6, 0xa5, 0x72, 0x6e, 0x49 }; -static const uint8_t chiptest_dac9e1195a0d_ct_194[] = { 0xb4, 0x48, 0x21, 0x1c, 0x9d, 0xa8, 0xc3, 0x31, 0x6c, 0x52, 0x69, +static const uint8_t chiptest_dac9e1195a0d_nonce_193[] = { 0xee, 0xbc, 0x7d, 0x0c, 0xce, 0x8d, 0x7f, 0xd6, 0xa5, 0x72, 0x6e, 0x49 }; +static const uint8_t chiptest_dac9e1195a0d_ct_194[] = { 0xb4, 0x48, 0x21, 0x1c, 0x9d, 0xa8, 0xc3, 0x31, 0x6c, 0x52, 0x69, 0xe5, 0xc4, 0xf6, 0x65, 0x78, 0x67, 0x3f, 0x1d, 0xfc, 0x03, 0x8a, 0x4f, 0x3f, 0x13, 0x2c, 0x85, 0x76, 0x2a, 0x89, 0x32, 0x06, 0xd4 }; -static const uint8_t chiptest_dac9e1195a0d_tag_195[] = { 0xae, 0x93, 0x77, 0x15, 0xa6, 0x5b, 0x80, 0xd5 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_196 = { .pt = chiptest_dac9e1195a0d_pt_190, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_191, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_192, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_193, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_194, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_195, - .tag_len = 8, - .tcId = 27, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_197[] = { 0x58, 0x07, 0xa2, 0x32, 0x31, 0x77, 0xa6, 0xba, 0xc6, 0x77, 0x3c, +static const uint8_t chiptest_dac9e1195a0d_tag_195[] = { 0xae, 0x93, 0x77, 0x15, 0xa6, 0x5b, 0x80, 0xd5 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_196 = { .pt = chiptest_dac9e1195a0d_pt_190, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_191, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_192, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_193, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_194, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_195, + .tag_len = 8, + .tcId = 27, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_197[] = { 0x58, 0x07, 0xa2, 0x32, 0x31, 0x77, 0xa6, 0xba, 0xc6, 0x77, 0x3c, 0xd9, 0x28, 0x9b, 0xc1, 0x20, 0x14, 0xb8, 0x95, 0xa4, 0xbc, 0xa7, 0x8f, 0x93, 0x50, 0x86, 0xe1, 0x49, 0x7a, 0x38, 0xcc, 0x02, 0x42 }; -static const uint8_t chiptest_dac9e1195a0d_aad_198[] = {}; -static const uint8_t chiptest_dac9e1195a0d_key_199[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_aad_198[] = {}; +static const uint8_t chiptest_dac9e1195a0d_key_199[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_200[] = { 0xee, 0xbc, 0x7d, 0x0c, 0xce, 0x8d, 0x7f, 0xd6, 0xa5, 0x72, 0x6e, 0x49 }; -static const uint8_t chiptest_dac9e1195a0d_ct_201[] = { 0xb4, 0x48, 0x21, 0x1c, 0x9d, 0xa8, 0xc3, 0x31, 0x6c, 0x52, 0x69, +static const uint8_t chiptest_dac9e1195a0d_nonce_200[] = { 0xee, 0xbc, 0x7d, 0x0c, 0xce, 0x8d, 0x7f, 0xd6, 0xa5, 0x72, 0x6e, 0x49 }; +static const uint8_t chiptest_dac9e1195a0d_ct_201[] = { 0xb4, 0x48, 0x21, 0x1c, 0x9d, 0xa8, 0xc3, 0x31, 0x6c, 0x52, 0x69, 0xe5, 0xc4, 0xf6, 0x65, 0x78, 0x67, 0x3f, 0x1d, 0xfc, 0x03, 0x8a, 0x4f, 0x3f, 0x13, 0x2c, 0x85, 0x76, 0x2a, 0x89, 0x32, 0x06, 0xd4 }; -static const uint8_t chiptest_dac9e1195a0d_tag_202[] = { 0xc4, 0xa7, 0xd3, 0x61, 0x19, 0xeb, 0x20, 0x96, 0xaf, 0x5b, 0x39, 0x73 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_203 = { .pt = chiptest_dac9e1195a0d_pt_197, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_198, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_199, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_200, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_201, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_202, - .tag_len = 12, - .tcId = 28, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_204[] = { 0x58, 0x07, 0xa2, 0x32, 0x31, 0x77, 0xa6, 0xba, 0xc6, 0x77, 0x3c, +static const uint8_t chiptest_dac9e1195a0d_tag_202[] = { 0xc4, 0xa7, 0xd3, 0x61, 0x19, 0xeb, 0x20, 0x96, 0xaf, 0x5b, 0x39, 0x73 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_203 = { .pt = chiptest_dac9e1195a0d_pt_197, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_198, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_199, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_200, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_201, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_202, + .tag_len = 12, + .tcId = 28, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_204[] = { 0x58, 0x07, 0xa2, 0x32, 0x31, 0x77, 0xa6, 0xba, 0xc6, 0x77, 0x3c, 0xd9, 0x28, 0x9b, 0xc1, 0x20, 0x14, 0xb8, 0x95, 0xa4, 0xbc, 0xa7, 0x8f, 0x93, 0x50, 0x86, 0xe1, 0x49, 0x7a, 0x38, 0xcc, 0x02, 0x42 }; -static const uint8_t chiptest_dac9e1195a0d_aad_205[] = {}; -static const uint8_t chiptest_dac9e1195a0d_key_206[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_aad_205[] = {}; +static const uint8_t chiptest_dac9e1195a0d_key_206[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_207[] = { 0xee, 0xbc, 0x7d, 0x0c, 0xce, 0x8d, 0x7f, 0xd6, 0xa5, 0x72, 0x6e, 0x49 }; -static const uint8_t chiptest_dac9e1195a0d_ct_208[] = { 0xb4, 0x48, 0x21, 0x1c, 0x9d, 0xa8, 0xc3, 0x31, 0x6c, 0x52, 0x69, +static const uint8_t chiptest_dac9e1195a0d_nonce_207[] = { 0xee, 0xbc, 0x7d, 0x0c, 0xce, 0x8d, 0x7f, 0xd6, 0xa5, 0x72, 0x6e, 0x49 }; +static const uint8_t chiptest_dac9e1195a0d_ct_208[] = { 0xb4, 0x48, 0x21, 0x1c, 0x9d, 0xa8, 0xc3, 0x31, 0x6c, 0x52, 0x69, 0xe5, 0xc4, 0xf6, 0x65, 0x78, 0x67, 0x3f, 0x1d, 0xfc, 0x03, 0x8a, 0x4f, 0x3f, 0x13, 0x2c, 0x85, 0x76, 0x2a, 0x89, 0x32, 0x06, 0xd4 }; -static const uint8_t chiptest_dac9e1195a0d_tag_209[] = { 0x09, 0xbd, 0x22, 0x93, 0x58, 0xcb, 0x85, 0x4a, +static const uint8_t chiptest_dac9e1195a0d_tag_209[] = { 0x09, 0xbd, 0x22, 0x93, 0x58, 0xcb, 0x85, 0x4a, 0x72, 0x2d, 0xc1, 0x5d, 0x98, 0x32, 0x7c, 0xe6 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_210 = { .pt = chiptest_dac9e1195a0d_pt_204, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_205, - .aad_len = 0, - .key = chiptest_dac9e1195a0d_key_206, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_207, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_208, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_209, - .tag_len = 16, - .tcId = 29, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_211[] = { 0x84, 0x4f, 0xf8, 0x35, 0xe3, 0xac, 0x66, 0x7b, 0x28, 0x84, 0xf3, +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_210 = { .pt = chiptest_dac9e1195a0d_pt_204, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_205, + .aad_len = 0, + .key = chiptest_dac9e1195a0d_key_206, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_207, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_208, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_209, + .tag_len = 16, + .tcId = 29, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_211[] = { 0x84, 0x4f, 0xf8, 0x35, 0xe3, 0xac, 0x66, 0x7b, 0x28, 0x84, 0xf3, 0x47, 0xf8, 0x88, 0xf5, 0x70, 0x91, 0x9d, 0xab, 0xc3, 0xd9, 0x75, 0x54, 0xe0, 0x87, 0x9c, 0xc5, 0x89, 0x43, 0x36, 0xcc, 0x19, 0x2d }; -static const uint8_t chiptest_dac9e1195a0d_aad_212[] = { 0x62, 0x55, 0xa0, 0x07, 0x9e, 0x72, 0xc9, 0x5c, +static const uint8_t chiptest_dac9e1195a0d_aad_212[] = { 0x62, 0x55, 0xa0, 0x07, 0x9e, 0x72, 0xc9, 0x5c, 0x20, 0xf7, 0x0b, 0x6a, 0x09, 0xbb, 0x54, 0x13 }; -static const uint8_t chiptest_dac9e1195a0d_key_213[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_key_213[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_214[] = { 0x2d, 0xbf, 0xc3, 0xa1, 0x2e, 0x4d, 0x2a, 0x86 }; -static const uint8_t chiptest_dac9e1195a0d_ct_215[] = { 0x2e, 0x6c, 0x47, 0x78, 0xf0, 0xcd, 0x09, 0x50, 0x95, 0xfa, 0xb4, +static const uint8_t chiptest_dac9e1195a0d_nonce_214[] = { 0x2d, 0xbf, 0xc3, 0xa1, 0x2e, 0x4d, 0x2a, 0x86 }; +static const uint8_t chiptest_dac9e1195a0d_ct_215[] = { 0x2e, 0x6c, 0x47, 0x78, 0xf0, 0xcd, 0x09, 0x50, 0x95, 0xfa, 0xb4, 0xfb, 0x68, 0xb5, 0x59, 0xbf, 0xe6, 0xff, 0x2d, 0x09, 0xea, 0x7b, 0x66, 0x45, 0xfc, 0x1a, 0x25, 0x59, 0x5f, 0xd4, 0x48, 0x3e, 0xea }; -static const uint8_t chiptest_dac9e1195a0d_tag_216[] = { 0xe9, 0xb7, 0x04, 0x88, 0xaa, 0xf0, 0x23, 0x91 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_217 = { .pt = chiptest_dac9e1195a0d_pt_211, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_212, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_213, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_214, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_215, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_216, - .tag_len = 8, - .tcId = 30, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_218[] = { 0x84, 0x4f, 0xf8, 0x35, 0xe3, 0xac, 0x66, 0x7b, 0x28, 0x84, 0xf3, +static const uint8_t chiptest_dac9e1195a0d_tag_216[] = { 0xe9, 0xb7, 0x04, 0x88, 0xaa, 0xf0, 0x23, 0x91 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_217 = { .pt = chiptest_dac9e1195a0d_pt_211, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_212, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_213, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_214, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_215, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_216, + .tag_len = 8, + .tcId = 30, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_218[] = { 0x84, 0x4f, 0xf8, 0x35, 0xe3, 0xac, 0x66, 0x7b, 0x28, 0x84, 0xf3, 0x47, 0xf8, 0x88, 0xf5, 0x70, 0x91, 0x9d, 0xab, 0xc3, 0xd9, 0x75, 0x54, 0xe0, 0x87, 0x9c, 0xc5, 0x89, 0x43, 0x36, 0xcc, 0x19, 0x2d }; -static const uint8_t chiptest_dac9e1195a0d_aad_219[] = { 0x62, 0x55, 0xa0, 0x07, 0x9e, 0x72, 0xc9, 0x5c, +static const uint8_t chiptest_dac9e1195a0d_aad_219[] = { 0x62, 0x55, 0xa0, 0x07, 0x9e, 0x72, 0xc9, 0x5c, 0x20, 0xf7, 0x0b, 0x6a, 0x09, 0xbb, 0x54, 0x13 }; -static const uint8_t chiptest_dac9e1195a0d_key_220[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_key_220[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_221[] = { 0x2d, 0xbf, 0xc3, 0xa1, 0x2e, 0x4d, 0x2a, 0x86 }; -static const uint8_t chiptest_dac9e1195a0d_ct_222[] = { 0x2e, 0x6c, 0x47, 0x78, 0xf0, 0xcd, 0x09, 0x50, 0x95, 0xfa, 0xb4, +static const uint8_t chiptest_dac9e1195a0d_nonce_221[] = { 0x2d, 0xbf, 0xc3, 0xa1, 0x2e, 0x4d, 0x2a, 0x86 }; +static const uint8_t chiptest_dac9e1195a0d_ct_222[] = { 0x2e, 0x6c, 0x47, 0x78, 0xf0, 0xcd, 0x09, 0x50, 0x95, 0xfa, 0xb4, 0xfb, 0x68, 0xb5, 0x59, 0xbf, 0xe6, 0xff, 0x2d, 0x09, 0xea, 0x7b, 0x66, 0x45, 0xfc, 0x1a, 0x25, 0x59, 0x5f, 0xd4, 0x48, 0x3e, 0xea }; -static const uint8_t chiptest_dac9e1195a0d_tag_223[] = { 0x1e, 0xe1, 0xda, 0x23, 0xcf, 0x3d, 0x1d, 0xb0, 0xd2, 0x01, 0x0e, 0x3d }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_224 = { .pt = chiptest_dac9e1195a0d_pt_218, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_219, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_220, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_221, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_222, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_223, - .tag_len = 12, - .tcId = 31, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_225[] = { 0x84, 0x4f, 0xf8, 0x35, 0xe3, 0xac, 0x66, 0x7b, 0x28, 0x84, 0xf3, +static const uint8_t chiptest_dac9e1195a0d_tag_223[] = { 0x1e, 0xe1, 0xda, 0x23, 0xcf, 0x3d, 0x1d, 0xb0, 0xd2, 0x01, 0x0e, 0x3d }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_224 = { .pt = chiptest_dac9e1195a0d_pt_218, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_219, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_220, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_221, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_222, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_223, + .tag_len = 12, + .tcId = 31, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_225[] = { 0x84, 0x4f, 0xf8, 0x35, 0xe3, 0xac, 0x66, 0x7b, 0x28, 0x84, 0xf3, 0x47, 0xf8, 0x88, 0xf5, 0x70, 0x91, 0x9d, 0xab, 0xc3, 0xd9, 0x75, 0x54, 0xe0, 0x87, 0x9c, 0xc5, 0x89, 0x43, 0x36, 0xcc, 0x19, 0x2d }; -static const uint8_t chiptest_dac9e1195a0d_aad_226[] = { 0x62, 0x55, 0xa0, 0x07, 0x9e, 0x72, 0xc9, 0x5c, +static const uint8_t chiptest_dac9e1195a0d_aad_226[] = { 0x62, 0x55, 0xa0, 0x07, 0x9e, 0x72, 0xc9, 0x5c, 0x20, 0xf7, 0x0b, 0x6a, 0x09, 0xbb, 0x54, 0x13 }; -static const uint8_t chiptest_dac9e1195a0d_key_227[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_key_227[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_228[] = { 0x2d, 0xbf, 0xc3, 0xa1, 0x2e, 0x4d, 0x2a, 0x86 }; -static const uint8_t chiptest_dac9e1195a0d_ct_229[] = { 0x2e, 0x6c, 0x47, 0x78, 0xf0, 0xcd, 0x09, 0x50, 0x95, 0xfa, 0xb4, +static const uint8_t chiptest_dac9e1195a0d_nonce_228[] = { 0x2d, 0xbf, 0xc3, 0xa1, 0x2e, 0x4d, 0x2a, 0x86 }; +static const uint8_t chiptest_dac9e1195a0d_ct_229[] = { 0x2e, 0x6c, 0x47, 0x78, 0xf0, 0xcd, 0x09, 0x50, 0x95, 0xfa, 0xb4, 0xfb, 0x68, 0xb5, 0x59, 0xbf, 0xe6, 0xff, 0x2d, 0x09, 0xea, 0x7b, 0x66, 0x45, 0xfc, 0x1a, 0x25, 0x59, 0x5f, 0xd4, 0x48, 0x3e, 0xea }; -static const uint8_t chiptest_dac9e1195a0d_tag_230[] = { 0xa5, 0x63, 0x5f, 0x07, 0x86, 0xe5, 0x08, 0x8c, +static const uint8_t chiptest_dac9e1195a0d_tag_230[] = { 0xa5, 0x63, 0x5f, 0x07, 0x86, 0xe5, 0x08, 0x8c, 0xf9, 0x90, 0x07, 0x20, 0x59, 0x94, 0x5f, 0xe9 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_231 = { .pt = chiptest_dac9e1195a0d_pt_225, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_226, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_227, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_228, - .iv_len = 8, - .ct = chiptest_dac9e1195a0d_ct_229, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_230, - .tag_len = 16, - .tcId = 32, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_232[] = { 0xd8, 0xc1, 0x36, 0xcc, 0x07, 0x01, 0x9d, 0x34, 0xcd, 0xca, 0xd0, +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_231 = { .pt = chiptest_dac9e1195a0d_pt_225, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_226, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_227, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_228, + .nonce_len = 8, + .ct = chiptest_dac9e1195a0d_ct_229, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_230, + .tag_len = 16, + .tcId = 32, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_232[] = { 0xd8, 0xc1, 0x36, 0xcc, 0x07, 0x01, 0x9d, 0x34, 0xcd, 0xca, 0xd0, 0xa0, 0x42, 0xfc, 0x3d, 0x75, 0x19, 0xe3, 0x0b, 0x5d, 0xdc, 0xb9, 0x10, 0xde, 0x53, 0xe6, 0x24, 0x12, 0x36, 0x36, 0xda, 0x52, 0x7b }; -static const uint8_t chiptest_dac9e1195a0d_aad_233[] = { 0x89, 0x3c, 0xd3, 0xe3, 0x53, 0x4d, 0xe7, 0x0d, +static const uint8_t chiptest_dac9e1195a0d_aad_233[] = { 0x89, 0x3c, 0xd3, 0xe3, 0x53, 0x4d, 0xe7, 0x0d, 0x0f, 0x29, 0x39, 0xe7, 0xae, 0x69, 0x62, 0x7d }; -static const uint8_t chiptest_dac9e1195a0d_key_234[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_key_234[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_235[] = { 0xb9, 0xb2, 0xeb, 0x2f, 0x55, 0x59, 0xba, 0xfd, 0x5d, 0xbb, 0xda, 0xf3 }; -static const uint8_t chiptest_dac9e1195a0d_ct_236[] = { 0xf9, 0x9f, 0x6a, 0x7c, 0x88, 0x86, 0x4d, 0x21, 0x2c, 0x12, 0x27, +static const uint8_t chiptest_dac9e1195a0d_nonce_235[] = { 0xb9, 0xb2, 0xeb, 0x2f, 0x55, 0x59, 0xba, 0xfd, 0x5d, 0xbb, 0xda, 0xf3 }; +static const uint8_t chiptest_dac9e1195a0d_ct_236[] = { 0xf9, 0x9f, 0x6a, 0x7c, 0x88, 0x86, 0x4d, 0x21, 0x2c, 0x12, 0x27, 0x91, 0x70, 0x23, 0xda, 0x36, 0xf1, 0xfa, 0x11, 0xf8, 0x26, 0x2d, 0x75, 0xb6, 0xc2, 0x0c, 0x4c, 0x19, 0xdb, 0x92, 0x14, 0xcc, 0x19 }; -static const uint8_t chiptest_dac9e1195a0d_tag_237[] = { 0x61, 0xaf, 0x0a, 0xf3, 0xe3, 0x2a, 0x8a, 0x82 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_238 = { .pt = chiptest_dac9e1195a0d_pt_232, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_233, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_234, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_235, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_236, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_237, - .tag_len = 8, - .tcId = 33, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_239[] = { 0xd8, 0xc1, 0x36, 0xcc, 0x07, 0x01, 0x9d, 0x34, 0xcd, 0xca, 0xd0, +static const uint8_t chiptest_dac9e1195a0d_tag_237[] = { 0x61, 0xaf, 0x0a, 0xf3, 0xe3, 0x2a, 0x8a, 0x82 }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_238 = { .pt = chiptest_dac9e1195a0d_pt_232, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_233, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_234, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_235, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_236, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_237, + .tag_len = 8, + .tcId = 33, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_239[] = { 0xd8, 0xc1, 0x36, 0xcc, 0x07, 0x01, 0x9d, 0x34, 0xcd, 0xca, 0xd0, 0xa0, 0x42, 0xfc, 0x3d, 0x75, 0x19, 0xe3, 0x0b, 0x5d, 0xdc, 0xb9, 0x10, 0xde, 0x53, 0xe6, 0x24, 0x12, 0x36, 0x36, 0xda, 0x52, 0x7b }; -static const uint8_t chiptest_dac9e1195a0d_aad_240[] = { 0x89, 0x3c, 0xd3, 0xe3, 0x53, 0x4d, 0xe7, 0x0d, +static const uint8_t chiptest_dac9e1195a0d_aad_240[] = { 0x89, 0x3c, 0xd3, 0xe3, 0x53, 0x4d, 0xe7, 0x0d, 0x0f, 0x29, 0x39, 0xe7, 0xae, 0x69, 0x62, 0x7d }; -static const uint8_t chiptest_dac9e1195a0d_key_241[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_key_241[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_242[] = { 0xb9, 0xb2, 0xeb, 0x2f, 0x55, 0x59, 0xba, 0xfd, 0x5d, 0xbb, 0xda, 0xf3 }; -static const uint8_t chiptest_dac9e1195a0d_ct_243[] = { 0xf9, 0x9f, 0x6a, 0x7c, 0x88, 0x86, 0x4d, 0x21, 0x2c, 0x12, 0x27, +static const uint8_t chiptest_dac9e1195a0d_nonce_242[] = { 0xb9, 0xb2, 0xeb, 0x2f, 0x55, 0x59, 0xba, 0xfd, 0x5d, 0xbb, 0xda, 0xf3 }; +static const uint8_t chiptest_dac9e1195a0d_ct_243[] = { 0xf9, 0x9f, 0x6a, 0x7c, 0x88, 0x86, 0x4d, 0x21, 0x2c, 0x12, 0x27, 0x91, 0x70, 0x23, 0xda, 0x36, 0xf1, 0xfa, 0x11, 0xf8, 0x26, 0x2d, 0x75, 0xb6, 0xc2, 0x0c, 0x4c, 0x19, 0xdb, 0x92, 0x14, 0xcc, 0x19 }; -static const uint8_t chiptest_dac9e1195a0d_tag_244[] = { 0x97, 0x66, 0x01, 0x50, 0x02, 0xd8, 0x68, 0x6c, 0x12, 0xd0, 0x2c, 0x3d }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_245 = { .pt = chiptest_dac9e1195a0d_pt_239, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_240, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_241, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_242, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_243, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_244, - .tag_len = 12, - .tcId = 34, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_dac9e1195a0d_pt_246[] = { 0xd8, 0xc1, 0x36, 0xcc, 0x07, 0x01, 0x9d, 0x34, 0xcd, 0xca, 0xd0, +static const uint8_t chiptest_dac9e1195a0d_tag_244[] = { 0x97, 0x66, 0x01, 0x50, 0x02, 0xd8, 0x68, 0x6c, 0x12, 0xd0, 0x2c, 0x3d }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_245 = { .pt = chiptest_dac9e1195a0d_pt_239, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_240, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_241, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_242, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_243, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_244, + .tag_len = 12, + .tcId = 34, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_dac9e1195a0d_pt_246[] = { 0xd8, 0xc1, 0x36, 0xcc, 0x07, 0x01, 0x9d, 0x34, 0xcd, 0xca, 0xd0, 0xa0, 0x42, 0xfc, 0x3d, 0x75, 0x19, 0xe3, 0x0b, 0x5d, 0xdc, 0xb9, 0x10, 0xde, 0x53, 0xe6, 0x24, 0x12, 0x36, 0x36, 0xda, 0x52, 0x7b }; -static const uint8_t chiptest_dac9e1195a0d_aad_247[] = { 0x89, 0x3c, 0xd3, 0xe3, 0x53, 0x4d, 0xe7, 0x0d, +static const uint8_t chiptest_dac9e1195a0d_aad_247[] = { 0x89, 0x3c, 0xd3, 0xe3, 0x53, 0x4d, 0xe7, 0x0d, 0x0f, 0x29, 0x39, 0xe7, 0xae, 0x69, 0x62, 0x7d }; -static const uint8_t chiptest_dac9e1195a0d_key_248[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, +static const uint8_t chiptest_dac9e1195a0d_key_248[] = { 0x04, 0xe1, 0xaf, 0x8f, 0x15, 0xe2, 0x16, 0x4e, 0xdb, 0x2d, 0xfd, 0xfe, 0xa2, 0xc4, 0x8b, 0xcf }; -static const uint8_t chiptest_dac9e1195a0d_iv_249[] = { 0xb9, 0xb2, 0xeb, 0x2f, 0x55, 0x59, 0xba, 0xfd, 0x5d, 0xbb, 0xda, 0xf3 }; -static const uint8_t chiptest_dac9e1195a0d_ct_250[] = { 0xf9, 0x9f, 0x6a, 0x7c, 0x88, 0x86, 0x4d, 0x21, 0x2c, 0x12, 0x27, +static const uint8_t chiptest_dac9e1195a0d_nonce_249[] = { 0xb9, 0xb2, 0xeb, 0x2f, 0x55, 0x59, 0xba, 0xfd, 0x5d, 0xbb, 0xda, 0xf3 }; +static const uint8_t chiptest_dac9e1195a0d_ct_250[] = { 0xf9, 0x9f, 0x6a, 0x7c, 0x88, 0x86, 0x4d, 0x21, 0x2c, 0x12, 0x27, 0x91, 0x70, 0x23, 0xda, 0x36, 0xf1, 0xfa, 0x11, 0xf8, 0x26, 0x2d, 0x75, 0xb6, 0xc2, 0x0c, 0x4c, 0x19, 0xdb, 0x92, 0x14, 0xcc, 0x19 }; -static const uint8_t chiptest_dac9e1195a0d_tag_251[] = { 0x9e, 0x7b, 0x72, 0x96, 0x6c, 0x9d, 0xbc, 0x93, +static const uint8_t chiptest_dac9e1195a0d_tag_251[] = { 0x9e, 0x7b, 0x72, 0x96, 0x6c, 0x9d, 0xbc, 0x93, 0xdb, 0x0e, 0xa9, 0x92, 0xa0, 0x8c, 0x9c, 0xad }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_252 = { .pt = chiptest_dac9e1195a0d_pt_246, - .pt_len = 33, - .aad = chiptest_dac9e1195a0d_aad_247, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_248, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_249, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_250, - .ct_len = 33, - .tag = chiptest_dac9e1195a0d_tag_251, - .tag_len = 16, - .tcId = 35, - .result = CHIP_NO_ERROR }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_252 = { .pt = chiptest_dac9e1195a0d_pt_246, + .pt_len = 33, + .aad = chiptest_dac9e1195a0d_aad_247, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_248, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_249, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_250, + .ct_len = 33, + .tag = chiptest_dac9e1195a0d_tag_251, + .tag_len = 16, + .tcId = 35, + .result = CHIP_NO_ERROR }; static const uint8_t chiptest_dac9e1195a0d_pt_253[] = { 0x31, 0x5e, 0x88, 0xf4, 0x83, 0x2d, 0x0c, 0x1d, 0xb4, 0xd6, 0x22, 0xa7, 0x49, 0x97, 0x27, 0x6e }; static const uint8_t chiptest_dac9e1195a0d_aad_254[] = { 0x0f, 0x9d, 0xfc, 0x66, 0x19, 0x6e, 0xc5, 0x8b, 0xd9, 0x32, 0x8d, 0xc9, 0x4f, 0xea, 0x9f, 0xe2 }; static const uint8_t chiptest_dac9e1195a0d_key_255[] = { 0xb0, 0x40, 0x51, 0x6c, 0xe6, 0x32, 0x48, 0xb3, 0xfc, 0xf5, 0x00, 0x98, 0x48, 0xc0, 0xdb, 0xf3 }; -static const uint8_t chiptest_dac9e1195a0d_iv_256[] = { 0x30, 0x0d, 0xb6, 0x16, 0xc5, 0xb5, 0xe5, 0xde, 0xb4, 0xf8, 0x90, 0x79 }; -static const uint8_t chiptest_dac9e1195a0d_ct_257[] = { 0x84, 0x15, 0x9c, 0xfd, 0xb7, 0xfd, 0xab, 0x6a, +static const uint8_t chiptest_dac9e1195a0d_nonce_256[] = { 0x30, 0x0d, 0xb6, 0x16, 0xc5, 0xb5, 0xe5, 0xde, 0xb4, 0xf8, 0x90, 0x79 }; +static const uint8_t chiptest_dac9e1195a0d_ct_257[] = { 0x84, 0x15, 0x9c, 0xfd, 0xb7, 0xfd, 0xab, 0x6a, 0x11, 0x3e, 0x66, 0x55, 0xfe, 0xf4, 0x17, 0x16 }; -static const uint8_t chiptest_dac9e1195a0d_tag_258[] = { 0xc8, 0x50, 0x01, 0xbe, 0xfc, 0x4d, 0xe3, 0x19, +static const uint8_t chiptest_dac9e1195a0d_tag_258[] = { 0xc8, 0x50, 0x01, 0xbe, 0xfc, 0x4d, 0xe3, 0x19, 0xea, 0x9f, 0x01, 0x6a, 0xde, 0xf5, 0x6f, 0xe3 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_259 = { .pt = chiptest_dac9e1195a0d_pt_253, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_254, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_255, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_256, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_257, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_258, - .tag_len = 16, - .tcId = 36, - .result = CHIP_ERROR_INTERNAL }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_259 = { .pt = chiptest_dac9e1195a0d_pt_253, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_254, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_255, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_256, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_257, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_258, + .tag_len = 16, + .tcId = 36, + .result = CHIP_ERROR_INTERNAL }; static const uint8_t chiptest_dac9e1195a0d_pt_260[] = { 0x31, 0x5e, 0x88, 0xf4, 0x83, 0x2d, 0x0c, 0x1d, 0xb4, 0xd6, 0x22, 0xa7, 0x49, 0x97, 0x27, 0x6e }; static const uint8_t chiptest_dac9e1195a0d_aad_261[] = { 0x0f, 0x9d, 0xfc, 0x66, 0x19, 0x6e, 0xc5, 0x8b, 0xd9, 0x32, 0x8d, 0xc9, 0x4f, 0xea, 0x9f, 0xe2 }; static const uint8_t chiptest_dac9e1195a0d_key_262[] = { 0xb0, 0x40, 0x51, 0x6c, 0xe6, 0x32, 0x48, 0xb3, 0xfc, 0xf5, 0x00, 0x98, 0x48, 0xc0, 0xdb, 0xf3 }; -static const uint8_t chiptest_dac9e1195a0d_iv_263[] = { 0x30, 0x0d, 0xb6, 0x16, 0xc5, 0xb5, 0xe5, 0xde, 0xb4, 0xf8, 0x90, 0x79 }; -static const uint8_t chiptest_dac9e1195a0d_ct_264[] = { 0x85, 0x15, 0x9c, 0xfd, 0xb7, 0xfd, 0xab, 0x6a, +static const uint8_t chiptest_dac9e1195a0d_nonce_263[] = { 0x30, 0x0d, 0xb6, 0x16, 0xc5, 0xb5, 0xe5, 0xde, 0xb4, 0xf8, 0x90, 0x79 }; +static const uint8_t chiptest_dac9e1195a0d_ct_264[] = { 0x85, 0x15, 0x9c, 0xfd, 0xb7, 0xfd, 0xab, 0x6a, 0x11, 0x3e, 0x66, 0x55, 0xfe, 0xf4, 0x17, 0x16 }; -static const uint8_t chiptest_dac9e1195a0d_tag_265[] = { 0xc7, 0x50, 0x01, 0xbe, 0xfc, 0x4d, 0xe3, 0x19, +static const uint8_t chiptest_dac9e1195a0d_tag_265[] = { 0xc7, 0x50, 0x01, 0xbe, 0xfc, 0x4d, 0xe3, 0x19, 0xea, 0x9f, 0x01, 0x6a, 0xde, 0xf5, 0x6f, 0xe3 }; -static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_266 = { .pt = chiptest_dac9e1195a0d_pt_260, - .pt_len = 16, - .aad = chiptest_dac9e1195a0d_aad_261, - .aad_len = 16, - .key = chiptest_dac9e1195a0d_key_262, - .key_len = 16, - .iv = chiptest_dac9e1195a0d_iv_263, - .iv_len = 12, - .ct = chiptest_dac9e1195a0d_ct_264, - .ct_len = 16, - .tag = chiptest_dac9e1195a0d_tag_265, - .tag_len = 16, - .tcId = 37, - .result = CHIP_ERROR_INTERNAL }; +static const struct ccm_128_test_vector chiptest_dac9e1195a0d_test_vector_266 = { .pt = chiptest_dac9e1195a0d_pt_260, + .pt_len = 16, + .aad = chiptest_dac9e1195a0d_aad_261, + .aad_len = 16, + .key = chiptest_dac9e1195a0d_key_262, + .key_len = 16, + .nonce = chiptest_dac9e1195a0d_nonce_263, + .nonce_len = 12, + .ct = chiptest_dac9e1195a0d_ct_264, + .ct_len = 16, + .tag = chiptest_dac9e1195a0d_tag_265, + .tag_len = 16, + .tcId = 37, + .result = CHIP_ERROR_INTERNAL }; static const struct ccm_128_test_vector * ccm_128_test_vectors[] = { &chiptest_dac9e1195a0d_test_vector_7, &chiptest_dac9e1195a0d_test_vector_14, &chiptest_dac9e1195a0d_test_vector_21, &chiptest_dac9e1195a0d_test_vector_28, &chiptest_dac9e1195a0d_test_vector_35, &chiptest_dac9e1195a0d_test_vector_42, diff --git a/src/crypto/tests/AES_CCM_256_test_vectors.h b/src/crypto/tests/AES_CCM_256_test_vectors.h index 7db78e3528d59b..24ffdbb15dbadc 100644 --- a/src/crypto/tests/AES_CCM_256_test_vectors.h +++ b/src/crypto/tests/AES_CCM_256_test_vectors.h @@ -31,8 +31,8 @@ typedef struct ccm_test_vector size_t pt_len; const uint8_t * ct; size_t ct_len; - const uint8_t * iv; - size_t iv_len; + const uint8_t * nonce; + size_t nonce_len; const uint8_t * aad; size_t aad_len; const uint8_t * tag; @@ -41,1619 +41,1592 @@ typedef struct ccm_test_vector CHIP_ERROR result; } ccm_test_vector; -static const uint8_t chiptest_12cb0ed34854_key_1[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_key_1[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_2[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_3[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_4[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_5[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_6[] = { 0xfd, 0x9c, 0x65, 0x82, 0xe4, 0x1c, 0xfa, 0x32 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_7 = { .key = chiptest_12cb0ed34854_key_1, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_2, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_3, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_4, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_5, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_6, - .tag_len = 8, - .tcId = 1, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_8[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_pt_2[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_3[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_4[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_5[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_6[] = { 0xfd, 0x9c, 0x65, 0x82, 0xe4, 0x1c, 0xfa, 0x32 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_7 = { .key = chiptest_12cb0ed34854_key_1, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_2, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_3, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_4, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_5, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_6, + .tag_len = 8, + .tcId = 1, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_8[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_9[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_10[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_11[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_12[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_13[] = { 0x0d, 0xf6, 0xaa, 0x1e, 0xe8, 0x81, 0x20, 0x1f, 0x44, 0xd4, 0x84, 0x54 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_14 = { .key = chiptest_12cb0ed34854_key_8, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_9, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_10, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_11, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_12, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_13, - .tag_len = 12, - .tcId = 2, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_15[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_pt_9[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_10[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_11[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_12[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_13[] = { 0x0d, 0xf6, 0xaa, 0x1e, 0xe8, 0x81, 0x20, 0x1f, 0x44, 0xd4, 0x84, 0x54 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_14 = { .key = chiptest_12cb0ed34854_key_8, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_9, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_10, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_11, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_12, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_13, + .tag_len = 12, + .tcId = 2, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_15[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_16[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_17[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_18[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_19[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_20[] = { 0xe6, 0x85, 0x9c, 0x92, 0xca, 0x23, 0x66, 0xbe, +static const uint8_t chiptest_12cb0ed34854_pt_16[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_17[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_18[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_19[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_20[] = { 0xe6, 0x85, 0x9c, 0x92, 0xca, 0x23, 0x66, 0xbe, 0x08, 0xb5, 0xaa, 0xbd, 0x0e, 0x21, 0x96, 0xc1 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_21 = { .key = chiptest_12cb0ed34854_key_15, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_16, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_17, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_18, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_19, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_20, - .tag_len = 16, - .tcId = 3, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_22[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_21 = { .key = chiptest_12cb0ed34854_key_15, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_16, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_17, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_18, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_19, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_20, + .tag_len = 16, + .tcId = 3, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_22[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_23[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_24[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_25[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_26[] = { 0x7c }; -static const uint8_t chiptest_12cb0ed34854_tag_27[] = { 0xe7, 0xbc, 0x88, 0x63, 0xab, 0x75, 0x31, 0x12 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_28 = { .key = chiptest_12cb0ed34854_key_22, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_23, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_24, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_25, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_26, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_27, - .tag_len = 8, - .tcId = 4, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_29[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_pt_23[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_24[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_25[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_26[] = { 0x7c }; +static const uint8_t chiptest_12cb0ed34854_tag_27[] = { 0xe7, 0xbc, 0x88, 0x63, 0xab, 0x75, 0x31, 0x12 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_28 = { .key = chiptest_12cb0ed34854_key_22, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_23, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_24, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_25, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_26, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_27, + .tag_len = 8, + .tcId = 4, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_29[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_30[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_31[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_32[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_33[] = { 0x7c }; -static const uint8_t chiptest_12cb0ed34854_tag_34[] = { 0x96, 0xe8, 0x1c, 0x45, 0xea, 0xe6, 0x9a, 0xbe, 0x1e, 0x0c, 0x90, 0xe4 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_35 = { .key = chiptest_12cb0ed34854_key_29, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_30, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_31, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_32, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_33, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_34, - .tag_len = 12, - .tcId = 5, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_36[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_pt_30[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_31[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_32[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_33[] = { 0x7c }; +static const uint8_t chiptest_12cb0ed34854_tag_34[] = { 0x96, 0xe8, 0x1c, 0x45, 0xea, 0xe6, 0x9a, 0xbe, 0x1e, 0x0c, 0x90, 0xe4 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_35 = { .key = chiptest_12cb0ed34854_key_29, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_30, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_31, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_32, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_33, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_34, + .tag_len = 12, + .tcId = 5, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_36[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_37[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_38[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_39[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_40[] = { 0x7c }; -static const uint8_t chiptest_12cb0ed34854_tag_41[] = { 0xfd, 0xe6, 0xa4, 0x32, 0x05, 0xb1, 0xe2, 0x74, +static const uint8_t chiptest_12cb0ed34854_pt_37[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_38[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_39[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_40[] = { 0x7c }; +static const uint8_t chiptest_12cb0ed34854_tag_41[] = { 0xfd, 0xe6, 0xa4, 0x32, 0x05, 0xb1, 0xe2, 0x74, 0x20, 0x4c, 0x6e, 0x3f, 0x66, 0xd0, 0x69, 0xbd }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_42 = { .key = chiptest_12cb0ed34854_key_36, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_37, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_38, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_39, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_40, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_41, - .tag_len = 16, - .tcId = 6, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_43[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_42 = { .key = chiptest_12cb0ed34854_key_36, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_37, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_38, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_39, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_40, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_41, + .tag_len = 16, + .tcId = 6, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_43[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_44[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_45[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_46[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_47[] = { 0xa1, 0xd0, 0x44, 0x40, 0xaa, 0x76, 0x31, 0x6e, 0x97, 0xdd, 0x6c, +static const uint8_t chiptest_12cb0ed34854_pt_44[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_45[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_46[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_47[] = { 0xa1, 0xd0, 0x44, 0x40, 0xaa, 0x76, 0x31, 0x6e, 0x97, 0xdd, 0x6c, 0xcb, 0x7f, 0x2e, 0xb2, 0x1f, 0x1f, 0x1d, 0x9d, 0x6b, 0x73, 0xde, 0xeb, 0x56, 0x04, 0xab, 0xb5, 0x6e, 0x45, 0x45, 0x54, 0x4d }; -static const uint8_t chiptest_12cb0ed34854_tag_48[] = { 0xcd, 0x32, 0xdf, 0x9d, 0xa5, 0xb5, 0x53, 0x2c }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_49 = { .key = chiptest_12cb0ed34854_key_43, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_44, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_45, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_46, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_47, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_48, - .tag_len = 8, - .tcId = 7, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_50[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_48[] = { 0xcd, 0x32, 0xdf, 0x9d, 0xa5, 0xb5, 0x53, 0x2c }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_49 = { .key = chiptest_12cb0ed34854_key_43, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_44, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_45, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_46, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_47, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_48, + .tag_len = 8, + .tcId = 7, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_50[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_51[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_52[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_53[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_54[] = { 0xa1, 0xd0, 0x44, 0x40, 0xaa, 0x76, 0x31, 0x6e, 0x97, 0xdd, 0x6c, +static const uint8_t chiptest_12cb0ed34854_pt_51[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_52[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_53[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_54[] = { 0xa1, 0xd0, 0x44, 0x40, 0xaa, 0x76, 0x31, 0x6e, 0x97, 0xdd, 0x6c, 0xcb, 0x7f, 0x2e, 0xb2, 0x1f, 0x1f, 0x1d, 0x9d, 0x6b, 0x73, 0xde, 0xeb, 0x56, 0x04, 0xab, 0xb5, 0x6e, 0x45, 0x45, 0x54, 0x4d }; -static const uint8_t chiptest_12cb0ed34854_tag_55[] = { 0x98, 0x1b, 0x39, 0xe4, 0xd9, 0x48, 0xd0, 0x6c, 0x5c, 0x73, 0x24, 0x5f }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_56 = { .key = chiptest_12cb0ed34854_key_50, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_51, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_52, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_53, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_54, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_55, - .tag_len = 12, - .tcId = 8, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_57[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_55[] = { 0x98, 0x1b, 0x39, 0xe4, 0xd9, 0x48, 0xd0, 0x6c, 0x5c, 0x73, 0x24, 0x5f }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_56 = { .key = chiptest_12cb0ed34854_key_50, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_51, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_52, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_53, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_54, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_55, + .tag_len = 12, + .tcId = 8, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_57[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_58[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_59[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_60[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_61[] = { 0xa1, 0xd0, 0x44, 0x40, 0xaa, 0x76, 0x31, 0x6e, 0x97, 0xdd, 0x6c, +static const uint8_t chiptest_12cb0ed34854_pt_58[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_59[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_60[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_61[] = { 0xa1, 0xd0, 0x44, 0x40, 0xaa, 0x76, 0x31, 0x6e, 0x97, 0xdd, 0x6c, 0xcb, 0x7f, 0x2e, 0xb2, 0x1f, 0x1f, 0x1d, 0x9d, 0x6b, 0x73, 0xde, 0xeb, 0x56, 0x04, 0xab, 0xb5, 0x6e, 0x45, 0x45, 0x54, 0x4d }; -static const uint8_t chiptest_12cb0ed34854_tag_62[] = { 0x3c, 0x0e, 0xc0, 0x5f, 0xa3, 0xbd, 0x3b, 0x44, +static const uint8_t chiptest_12cb0ed34854_tag_62[] = { 0x3c, 0x0e, 0xc0, 0x5f, 0xa3, 0xbd, 0x3b, 0x44, 0xd8, 0x91, 0x6d, 0x91, 0x0a, 0xb5, 0x65, 0xd9 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_63 = { .key = chiptest_12cb0ed34854_key_57, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_58, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_59, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_60, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_61, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_62, - .tag_len = 16, - .tcId = 9, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_64[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_63 = { .key = chiptest_12cb0ed34854_key_57, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_58, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_59, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_60, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_61, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_62, + .tag_len = 16, + .tcId = 9, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_64[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_65[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_65[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_66[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_66[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_67[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_68[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_69[] = { 0xdc, 0xd2, 0x22, 0xd3, 0xa8, 0xfe, 0x64, 0x31 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_70 = { .key = chiptest_12cb0ed34854_key_64, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_65, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_66, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_67, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_68, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_69, - .tag_len = 8, - .tcId = 10, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_71[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_67[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_68[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_69[] = { 0xdc, 0xd2, 0x22, 0xd3, 0xa8, 0xfe, 0x64, 0x31 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_70 = { .key = chiptest_12cb0ed34854_key_64, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_65, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_66, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_67, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_68, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_69, + .tag_len = 8, + .tcId = 10, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_71[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_72[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_72[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_73[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_73[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_74[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_75[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_76[] = { 0xdf, 0x33, 0xdd, 0x45, 0x15, 0x16, 0x84, 0x18, 0x2e, 0x30, 0x64, 0x27 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_77 = { .key = chiptest_12cb0ed34854_key_71, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_72, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_73, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_74, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_75, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_76, - .tag_len = 12, - .tcId = 11, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_78[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_74[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_75[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_76[] = { 0xdf, 0x33, 0xdd, 0x45, 0x15, 0x16, 0x84, 0x18, 0x2e, 0x30, 0x64, 0x27 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_77 = { .key = chiptest_12cb0ed34854_key_71, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_72, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_73, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_74, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_75, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_76, + .tag_len = 12, + .tcId = 11, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_78[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_79[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_79[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_80[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_80[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_81[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_82[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_83[] = { 0xdd, 0x5c, 0xac, 0xb1, 0x27, 0x41, 0xf5, 0x2b, +static const uint8_t chiptest_12cb0ed34854_nonce_81[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_82[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_83[] = { 0xdd, 0x5c, 0xac, 0xb1, 0x27, 0x41, 0xf5, 0x2b, 0xa4, 0x51, 0xef, 0x8b, 0x5e, 0x66, 0xac, 0x9e }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_84 = { .key = chiptest_12cb0ed34854_key_78, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_79, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_80, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_81, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_82, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_83, - .tag_len = 16, - .tcId = 12, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_85[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_84 = { .key = chiptest_12cb0ed34854_key_78, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_79, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_80, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_81, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_82, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_83, + .tag_len = 16, + .tcId = 12, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_85[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_86[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_86[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_87[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_87[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_88[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_89[] = { 0xda }; -static const uint8_t chiptest_12cb0ed34854_tag_90[] = { 0x84, 0x8d, 0x7b, 0xc1, 0x4a, 0x42, 0xbb, 0x56 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_91 = { .key = chiptest_12cb0ed34854_key_85, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_86, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_87, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_88, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_89, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_90, - .tag_len = 8, - .tcId = 13, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_92[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_88[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_89[] = { 0xda }; +static const uint8_t chiptest_12cb0ed34854_tag_90[] = { 0x84, 0x8d, 0x7b, 0xc1, 0x4a, 0x42, 0xbb, 0x56 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_91 = { .key = chiptest_12cb0ed34854_key_85, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_86, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_87, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_88, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_89, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_90, + .tag_len = 8, + .tcId = 13, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_92[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_93[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_93[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_94[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_94[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_95[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_96[] = { 0xda }; -static const uint8_t chiptest_12cb0ed34854_tag_97[] = { 0x43, 0x46, 0x00, 0xf5, 0xb7, 0xc5, 0x59, 0x85, 0x12, 0x79, 0xea, 0xfe }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_98 = { .key = chiptest_12cb0ed34854_key_92, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_93, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_94, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_95, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_96, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_97, - .tag_len = 12, - .tcId = 14, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_99[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_95[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_96[] = { 0xda }; +static const uint8_t chiptest_12cb0ed34854_tag_97[] = { 0x43, 0x46, 0x00, 0xf5, 0xb7, 0xc5, 0x59, 0x85, 0x12, 0x79, 0xea, 0xfe }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_98 = { .key = chiptest_12cb0ed34854_key_92, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_93, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_94, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_95, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_96, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_97, + .tag_len = 12, + .tcId = 14, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_99[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_100[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_100[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_101[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_101[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_102[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_103[] = { 0xda }; -static const uint8_t chiptest_12cb0ed34854_tag_104[] = { 0x10, 0x8d, 0x3c, 0xcf, 0xee, 0x1c, 0xed, 0xcd, +static const uint8_t chiptest_12cb0ed34854_nonce_102[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_103[] = { 0xda }; +static const uint8_t chiptest_12cb0ed34854_tag_104[] = { 0x10, 0x8d, 0x3c, 0xcf, 0xee, 0x1c, 0xed, 0xcd, 0x1e, 0xef, 0x8c, 0x6b, 0xda, 0xbf, 0xa4, 0xf9 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_105 = { .key = chiptest_12cb0ed34854_key_99, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_100, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_101, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_102, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_103, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_104, - .tag_len = 16, - .tcId = 15, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_106[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_105 = { .key = chiptest_12cb0ed34854_key_99, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_100, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_101, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_102, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_103, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_104, + .tag_len = 16, + .tcId = 15, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_106[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_107[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_107[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_108[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_108[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_109[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_110[] = { 0x67, 0xc0, 0xf4, 0xac, 0xb9, 0x6f, 0x73, 0x5e, 0xd0, 0xa2, 0xcf, +static const uint8_t chiptest_12cb0ed34854_nonce_109[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_110[] = { 0x67, 0xc0, 0xf4, 0xac, 0xb9, 0x6f, 0x73, 0x5e, 0xd0, 0xa2, 0xcf, 0x95, 0x8a, 0x7c, 0xc3, 0xc5, 0xf7, 0x96, 0xf5, 0xde, 0x40, 0xcd, 0x99, 0x8f, 0xdd, 0xb9, 0xa3, 0x0b, 0x2f, 0x6e, 0x74, 0x5f }; -static const uint8_t chiptest_12cb0ed34854_tag_111[] = { 0xee, 0xfd, 0x63, 0x48, 0xf1, 0x79, 0x34, 0x5f }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_112 = { .key = chiptest_12cb0ed34854_key_106, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_107, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_108, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_109, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_110, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_111, - .tag_len = 8, - .tcId = 16, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_113[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_111[] = { 0xee, 0xfd, 0x63, 0x48, 0xf1, 0x79, 0x34, 0x5f }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_112 = { .key = chiptest_12cb0ed34854_key_106, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_107, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_108, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_109, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_110, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_111, + .tag_len = 8, + .tcId = 16, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_113[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_114[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_114[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_115[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_115[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_116[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_117[] = { 0x67, 0xc0, 0xf4, 0xac, 0xb9, 0x6f, 0x73, 0x5e, 0xd0, 0xa2, 0xcf, +static const uint8_t chiptest_12cb0ed34854_nonce_116[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_117[] = { 0x67, 0xc0, 0xf4, 0xac, 0xb9, 0x6f, 0x73, 0x5e, 0xd0, 0xa2, 0xcf, 0x95, 0x8a, 0x7c, 0xc3, 0xc5, 0xf7, 0x96, 0xf5, 0xde, 0x40, 0xcd, 0x99, 0x8f, 0xdd, 0xb9, 0xa3, 0x0b, 0x2f, 0x6e, 0x74, 0x5f }; -static const uint8_t chiptest_12cb0ed34854_tag_118[] = { 0x19, 0xb6, 0x25, 0x1d, 0xbf, 0x0b, 0x07, 0x43, 0x46, 0xfc, 0xd1, 0x62 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_119 = { .key = chiptest_12cb0ed34854_key_113, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_114, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_115, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_116, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_117, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_118, - .tag_len = 12, - .tcId = 17, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_120[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_118[] = { 0x19, 0xb6, 0x25, 0x1d, 0xbf, 0x0b, 0x07, 0x43, 0x46, 0xfc, 0xd1, 0x62 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_119 = { .key = chiptest_12cb0ed34854_key_113, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_114, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_115, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_116, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_117, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_118, + .tag_len = 12, + .tcId = 17, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_120[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_121[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, +static const uint8_t chiptest_12cb0ed34854_pt_121[] = { 0xe4, 0xe6, 0xfe, 0x17, 0xc6, 0xd6, 0xd0, 0xc8, 0x04, 0x34, 0x34, 0xfc, 0x09, 0x1a, 0xda, 0xc7 }; -static const uint8_t chiptest_12cb0ed34854_ct_122[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, +static const uint8_t chiptest_12cb0ed34854_ct_122[] = { 0xb3, 0xf7, 0x94, 0x08, 0xd1, 0xdf, 0x32, 0x5d, 0xa3, 0x77, 0x90, 0xf4, 0x7d, 0x48, 0xce, 0xf9 }; -static const uint8_t chiptest_12cb0ed34854_iv_123[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_124[] = { 0x67, 0xc0, 0xf4, 0xac, 0xb9, 0x6f, 0x73, 0x5e, 0xd0, 0xa2, 0xcf, +static const uint8_t chiptest_12cb0ed34854_nonce_123[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_124[] = { 0x67, 0xc0, 0xf4, 0xac, 0xb9, 0x6f, 0x73, 0x5e, 0xd0, 0xa2, 0xcf, 0x95, 0x8a, 0x7c, 0xc3, 0xc5, 0xf7, 0x96, 0xf5, 0xde, 0x40, 0xcd, 0x99, 0x8f, 0xdd, 0xb9, 0xa3, 0x0b, 0x2f, 0x6e, 0x74, 0x5f }; -static const uint8_t chiptest_12cb0ed34854_tag_125[] = { 0x96, 0x42, 0x3d, 0x41, 0xbb, 0x98, 0x05, 0x37, +static const uint8_t chiptest_12cb0ed34854_tag_125[] = { 0x96, 0x42, 0x3d, 0x41, 0xbb, 0x98, 0x05, 0x37, 0x1f, 0x3f, 0x78, 0x4f, 0xa4, 0x76, 0xa4, 0x79 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_126 = { .key = chiptest_12cb0ed34854_key_120, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_121, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_122, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_123, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_124, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_125, - .tag_len = 16, - .tcId = 18, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_127[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_126 = { .key = chiptest_12cb0ed34854_key_120, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_121, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_122, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_123, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_124, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_125, + .tag_len = 16, + .tcId = 18, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_127[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_128[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_128[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_129[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_129[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_130[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_131[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_132[] = { 0x0e, 0x87, 0x96, 0xd6, 0x32, 0xc9, 0xb3, 0x2e }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_133 = { .key = chiptest_12cb0ed34854_key_127, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_128, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_129, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_130, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_131, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_132, - .tag_len = 8, - .tcId = 19, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_134[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_130[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_131[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_132[] = { 0x0e, 0x87, 0x96, 0xd6, 0x32, 0xc9, 0xb3, 0x2e }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_133 = { .key = chiptest_12cb0ed34854_key_127, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_128, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_129, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_130, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_131, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_132, + .tag_len = 8, + .tcId = 19, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_134[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_135[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_135[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_136[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_136[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_137[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_138[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_139[] = { 0x4f, 0x3a, 0x4c, 0x11, 0x07, 0x44, 0x86, 0x9e, 0xd1, 0x4d, 0x53, 0xaa }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_140 = { .key = chiptest_12cb0ed34854_key_134, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_135, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_136, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_137, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_138, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_139, - .tag_len = 12, - .tcId = 20, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_141[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_137[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_138[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_139[] = { 0x4f, 0x3a, 0x4c, 0x11, 0x07, 0x44, 0x86, 0x9e, 0xd1, 0x4d, 0x53, 0xaa }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_140 = { .key = chiptest_12cb0ed34854_key_134, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_135, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_136, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_137, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_138, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_139, + .tag_len = 12, + .tcId = 20, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_141[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_142[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_142[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_143[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_143[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_144[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_145[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_146[] = { 0xab, 0x73, 0x1f, 0xc8, 0x0a, 0xde, 0x38, 0xf1, +static const uint8_t chiptest_12cb0ed34854_nonce_144[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_145[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_146[] = { 0xab, 0x73, 0x1f, 0xc8, 0x0a, 0xde, 0x38, 0xf1, 0xa9, 0x84, 0x60, 0x6e, 0xae, 0x05, 0xa0, 0x2b }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_147 = { .key = chiptest_12cb0ed34854_key_141, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_142, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_143, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_144, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_145, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_146, - .tag_len = 16, - .tcId = 21, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_148[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_147 = { .key = chiptest_12cb0ed34854_key_141, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_142, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_143, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_144, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_145, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_146, + .tag_len = 16, + .tcId = 21, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_148[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_149[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_149[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_150[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_150[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_151[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_152[] = { 0xf2 }; -static const uint8_t chiptest_12cb0ed34854_tag_153[] = { 0x5f, 0x5e, 0xce, 0x87, 0x2f, 0x03, 0xe5, 0x07 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_154 = { .key = chiptest_12cb0ed34854_key_148, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_149, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_150, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_151, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_152, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_153, - .tag_len = 8, - .tcId = 22, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_155[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_151[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_152[] = { 0xf2 }; +static const uint8_t chiptest_12cb0ed34854_tag_153[] = { 0x5f, 0x5e, 0xce, 0x87, 0x2f, 0x03, 0xe5, 0x07 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_154 = { .key = chiptest_12cb0ed34854_key_148, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_149, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_150, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_151, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_152, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_153, + .tag_len = 8, + .tcId = 22, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_155[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_156[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_156[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_157[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_157[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_158[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_159[] = { 0xf2 }; -static const uint8_t chiptest_12cb0ed34854_tag_160[] = { 0x48, 0x35, 0x5c, 0xc2, 0xb4, 0x61, 0x8b, 0xd2, 0x4e, 0xa3, 0xe4, 0xc0 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_161 = { .key = chiptest_12cb0ed34854_key_155, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_156, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_157, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_158, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_159, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_160, - .tag_len = 12, - .tcId = 23, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_162[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_158[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_159[] = { 0xf2 }; +static const uint8_t chiptest_12cb0ed34854_tag_160[] = { 0x48, 0x35, 0x5c, 0xc2, 0xb4, 0x61, 0x8b, 0xd2, 0x4e, 0xa3, 0xe4, 0xc0 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_161 = { .key = chiptest_12cb0ed34854_key_155, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_156, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_157, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_158, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_159, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_160, + .tag_len = 12, + .tcId = 23, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_162[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_163[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_163[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_164[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_164[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_165[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_166[] = { 0xf2 }; -static const uint8_t chiptest_12cb0ed34854_tag_167[] = { 0xf0, 0x89, 0x5d, 0xfa, 0x19, 0x3e, 0x56, 0x29, +static const uint8_t chiptest_12cb0ed34854_nonce_165[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_166[] = { 0xf2 }; +static const uint8_t chiptest_12cb0ed34854_tag_167[] = { 0xf0, 0x89, 0x5d, 0xfa, 0x19, 0x3e, 0x56, 0x29, 0x62, 0x25, 0x5e, 0x24, 0xf5, 0x76, 0x57, 0x73 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_168 = { .key = chiptest_12cb0ed34854_key_162, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_163, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_164, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_165, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_166, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_167, - .tag_len = 16, - .tcId = 24, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_169[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_168 = { .key = chiptest_12cb0ed34854_key_162, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_163, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_164, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_165, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_166, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_167, + .tag_len = 16, + .tcId = 24, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_169[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_170[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_170[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_171[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_171[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_172[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_173[] = { 0x2d, 0x1e, 0x30, 0xdd, 0x3b, 0xbf, 0x40, 0xb2, 0xcd, 0x7c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_nonce_172[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_173[] = { 0x2d, 0x1e, 0x30, 0xdd, 0x3b, 0xbf, 0x40, 0xb2, 0xcd, 0x7c, 0x3d, 0x57, 0x45, 0xd5, 0x36, 0xcf, 0x38, 0x5e, 0x8c, 0xe5, 0xea, 0xf9, 0x40, 0xf4, 0x79, 0xf9, 0x73, 0x0e, 0x4c, 0x55, 0xef, 0x87 }; -static const uint8_t chiptest_12cb0ed34854_tag_174[] = { 0x6a, 0x91, 0xf2, 0x05, 0xd1, 0x27, 0x02, 0x24 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_175 = { .key = chiptest_12cb0ed34854_key_169, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_170, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_171, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_172, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_173, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_174, - .tag_len = 8, - .tcId = 25, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_176[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_174[] = { 0x6a, 0x91, 0xf2, 0x05, 0xd1, 0x27, 0x02, 0x24 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_175 = { .key = chiptest_12cb0ed34854_key_169, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_170, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_171, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_172, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_173, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_174, + .tag_len = 8, + .tcId = 25, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_176[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_177[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_177[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_178[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_178[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_179[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_180[] = { 0x2d, 0x1e, 0x30, 0xdd, 0x3b, 0xbf, 0x40, 0xb2, 0xcd, 0x7c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_nonce_179[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_180[] = { 0x2d, 0x1e, 0x30, 0xdd, 0x3b, 0xbf, 0x40, 0xb2, 0xcd, 0x7c, 0x3d, 0x57, 0x45, 0xd5, 0x36, 0xcf, 0x38, 0x5e, 0x8c, 0xe5, 0xea, 0xf9, 0x40, 0xf4, 0x79, 0xf9, 0x73, 0x0e, 0x4c, 0x55, 0xef, 0x87 }; -static const uint8_t chiptest_12cb0ed34854_tag_181[] = { 0xab, 0x65, 0x12, 0xab, 0x92, 0xf5, 0x89, 0x98, 0x5d, 0x72, 0xa0, 0xfd }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_182 = { .key = chiptest_12cb0ed34854_key_176, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_177, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_178, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_179, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_180, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_181, - .tag_len = 12, - .tcId = 26, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_183[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_181[] = { 0xab, 0x65, 0x12, 0xab, 0x92, 0xf5, 0x89, 0x98, 0x5d, 0x72, 0xa0, 0xfd }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_182 = { .key = chiptest_12cb0ed34854_key_176, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_177, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_178, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_179, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_180, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_181, + .tag_len = 12, + .tcId = 26, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_183[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_184[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_184[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_185[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_185[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xec, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_186[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_187[] = { 0x2d, 0x1e, 0x30, 0xdd, 0x3b, 0xbf, 0x40, 0xb2, 0xcd, 0x7c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_nonce_186[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_187[] = { 0x2d, 0x1e, 0x30, 0xdd, 0x3b, 0xbf, 0x40, 0xb2, 0xcd, 0x7c, 0x3d, 0x57, 0x45, 0xd5, 0x36, 0xcf, 0x38, 0x5e, 0x8c, 0xe5, 0xea, 0xf9, 0x40, 0xf4, 0x79, 0xf9, 0x73, 0x0e, 0x4c, 0x55, 0xef, 0x87 }; -static const uint8_t chiptest_12cb0ed34854_tag_188[] = { 0xe1, 0x75, 0xe0, 0x33, 0x4b, 0x4e, 0x23, 0x4c, +static const uint8_t chiptest_12cb0ed34854_tag_188[] = { 0xe1, 0x75, 0xe0, 0x33, 0x4b, 0x4e, 0x23, 0x4c, 0x1e, 0xce, 0x5c, 0x73, 0x9e, 0xd1, 0x2c, 0x28 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_189 = { .key = chiptest_12cb0ed34854_key_183, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_184, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_185, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_186, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_187, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_188, - .tag_len = 16, - .tcId = 27, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_190[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_189 = { .key = chiptest_12cb0ed34854_key_183, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_184, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_185, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_186, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_187, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_188, + .tag_len = 16, + .tcId = 27, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_190[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_191[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_192[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_193[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_194[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_195[] = { 0x42, 0x26, 0x5a, 0xcf, 0xad, 0xa3, 0x71, 0xd5 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_196 = { .key = chiptest_12cb0ed34854_key_190, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_191, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_192, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_193, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_194, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_195, - .tag_len = 8, - .tcId = 28, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_197[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_pt_191[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_192[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_193[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_194[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_195[] = { 0x42, 0x26, 0x5a, 0xcf, 0xad, 0xa3, 0x71, 0xd5 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_196 = { .key = chiptest_12cb0ed34854_key_190, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_191, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_192, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_193, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_194, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_195, + .tag_len = 8, + .tcId = 28, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_197[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_198[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_199[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_200[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_201[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_202[] = { 0x1c, 0xec, 0x5b, 0xff, 0xcf, 0xb4, 0xd7, 0x02, 0x34, 0xb3, 0xb0, 0x41 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_203 = { .key = chiptest_12cb0ed34854_key_197, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_198, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_199, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_200, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_201, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_202, - .tag_len = 12, - .tcId = 29, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_204[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_pt_198[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_199[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_200[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_201[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_202[] = { 0x1c, 0xec, 0x5b, 0xff, 0xcf, 0xb4, 0xd7, 0x02, 0x34, 0xb3, 0xb0, 0x41 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_203 = { .key = chiptest_12cb0ed34854_key_197, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_198, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_199, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_200, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_201, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_202, + .tag_len = 12, + .tcId = 29, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_204[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_205[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_206[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_207[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_208[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_209[] = { 0x5d, 0x79, 0x73, 0xc2, 0x5f, 0xe1, 0x6d, 0x69, +static const uint8_t chiptest_12cb0ed34854_pt_205[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_206[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_207[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_208[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_209[] = { 0x5d, 0x79, 0x73, 0xc2, 0x5f, 0xe1, 0x6d, 0x69, 0x40, 0xfb, 0xca, 0xff, 0x79, 0x86, 0xe3, 0x3e }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_210 = { .key = chiptest_12cb0ed34854_key_204, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_205, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_206, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_207, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_208, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_209, - .tag_len = 16, - .tcId = 30, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_211[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_210 = { .key = chiptest_12cb0ed34854_key_204, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_205, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_206, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_207, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_208, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_209, + .tag_len = 16, + .tcId = 30, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_211[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_212[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_213[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_214[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_215[] = { 0xeb }; -static const uint8_t chiptest_12cb0ed34854_tag_216[] = { 0xaf, 0xc6, 0xf9, 0x48, 0xae, 0x21, 0xc2, 0x7c }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_217 = { .key = chiptest_12cb0ed34854_key_211, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_212, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_213, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_214, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_215, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_216, - .tag_len = 8, - .tcId = 31, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_218[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_pt_212[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_213[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_214[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_215[] = { 0xeb }; +static const uint8_t chiptest_12cb0ed34854_tag_216[] = { 0xaf, 0xc6, 0xf9, 0x48, 0xae, 0x21, 0xc2, 0x7c }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_217 = { .key = chiptest_12cb0ed34854_key_211, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_212, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_213, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_214, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_215, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_216, + .tag_len = 8, + .tcId = 31, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_218[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_219[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_220[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_221[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_222[] = { 0xeb }; -static const uint8_t chiptest_12cb0ed34854_tag_223[] = { 0xd7, 0x71, 0x56, 0x7f, 0xee, 0x7b, 0x52, 0x2a, 0x95, 0x6a, 0x86, 0x5e }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_224 = { .key = chiptest_12cb0ed34854_key_218, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_219, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_220, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_221, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_222, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_223, - .tag_len = 12, - .tcId = 32, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_225[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_pt_219[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_220[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_221[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_222[] = { 0xeb }; +static const uint8_t chiptest_12cb0ed34854_tag_223[] = { 0xd7, 0x71, 0x56, 0x7f, 0xee, 0x7b, 0x52, 0x2a, 0x95, 0x6a, 0x86, 0x5e }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_224 = { .key = chiptest_12cb0ed34854_key_218, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_219, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_220, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_221, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_222, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_223, + .tag_len = 12, + .tcId = 32, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_225[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_226[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_227[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_228[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_229[] = { 0xeb }; -static const uint8_t chiptest_12cb0ed34854_tag_230[] = { 0x6a, 0x94, 0x0c, 0x32, 0x1a, 0xa4, 0x22, 0xd6, +static const uint8_t chiptest_12cb0ed34854_pt_226[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_227[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_228[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_229[] = { 0xeb }; +static const uint8_t chiptest_12cb0ed34854_tag_230[] = { 0x6a, 0x94, 0x0c, 0x32, 0x1a, 0xa4, 0x22, 0xd6, 0x34, 0x6b, 0x83, 0x9f, 0x88, 0x90, 0x0d, 0xd0 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_231 = { .key = chiptest_12cb0ed34854_key_225, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_226, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_227, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_228, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_229, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_230, - .tag_len = 16, - .tcId = 33, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_232[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_231 = { .key = chiptest_12cb0ed34854_key_225, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_226, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_227, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_228, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_229, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_230, + .tag_len = 16, + .tcId = 33, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_232[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_233[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_234[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_235[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_236[] = { 0x7e, 0x39, 0xdd, 0x42, 0xab, 0xd1, 0xca, 0x47, 0x38, 0x3f, 0x31, +static const uint8_t chiptest_12cb0ed34854_pt_233[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_234[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_235[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_236[] = { 0x7e, 0x39, 0xdd, 0x42, 0xab, 0xd1, 0xca, 0x47, 0x38, 0x3f, 0x31, 0xb5, 0x2c, 0x12, 0x4a, 0x5d, 0xba, 0xc4, 0xfe, 0x43, 0xb3, 0x0d, 0xed, 0x71, 0xb6, 0xca, 0x05, 0x40, 0x14, 0xbf, 0xb6, 0x00 }; -static const uint8_t chiptest_12cb0ed34854_tag_237[] = { 0xa3, 0x8f, 0x71, 0x32, 0xfa, 0xb8, 0x43, 0xea }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_238 = { .key = chiptest_12cb0ed34854_key_232, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_233, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_234, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_235, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_236, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_237, - .tag_len = 8, - .tcId = 34, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_239[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_237[] = { 0xa3, 0x8f, 0x71, 0x32, 0xfa, 0xb8, 0x43, 0xea }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_238 = { .key = chiptest_12cb0ed34854_key_232, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_233, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_234, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_235, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_236, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_237, + .tag_len = 8, + .tcId = 34, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_239[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_240[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_241[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_242[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_243[] = { 0x7e, 0x39, 0xdd, 0x42, 0xab, 0xd1, 0xca, 0x47, 0x38, 0x3f, 0x31, +static const uint8_t chiptest_12cb0ed34854_pt_240[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_241[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_242[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_243[] = { 0x7e, 0x39, 0xdd, 0x42, 0xab, 0xd1, 0xca, 0x47, 0x38, 0x3f, 0x31, 0xb5, 0x2c, 0x12, 0x4a, 0x5d, 0xba, 0xc4, 0xfe, 0x43, 0xb3, 0x0d, 0xed, 0x71, 0xb6, 0xca, 0x05, 0x40, 0x14, 0xbf, 0xb6, 0x00 }; -static const uint8_t chiptest_12cb0ed34854_tag_244[] = { 0x59, 0xe5, 0xf7, 0x0c, 0x8e, 0x86, 0x32, 0x6b, 0x61, 0x66, 0x77, 0x7c }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_245 = { .key = chiptest_12cb0ed34854_key_239, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_240, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_241, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_242, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_243, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_244, - .tag_len = 12, - .tcId = 35, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_246[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_244[] = { 0x59, 0xe5, 0xf7, 0x0c, 0x8e, 0x86, 0x32, 0x6b, 0x61, 0x66, 0x77, 0x7c }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_245 = { .key = chiptest_12cb0ed34854_key_239, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_240, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_241, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_242, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_243, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_244, + .tag_len = 12, + .tcId = 35, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_246[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_247[] = {}; -static const uint8_t chiptest_12cb0ed34854_ct_248[] = {}; -static const uint8_t chiptest_12cb0ed34854_iv_249[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_250[] = { 0x7e, 0x39, 0xdd, 0x42, 0xab, 0xd1, 0xca, 0x47, 0x38, 0x3f, 0x31, +static const uint8_t chiptest_12cb0ed34854_pt_247[] = {}; +static const uint8_t chiptest_12cb0ed34854_ct_248[] = {}; +static const uint8_t chiptest_12cb0ed34854_nonce_249[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_250[] = { 0x7e, 0x39, 0xdd, 0x42, 0xab, 0xd1, 0xca, 0x47, 0x38, 0x3f, 0x31, 0xb5, 0x2c, 0x12, 0x4a, 0x5d, 0xba, 0xc4, 0xfe, 0x43, 0xb3, 0x0d, 0xed, 0x71, 0xb6, 0xca, 0x05, 0x40, 0x14, 0xbf, 0xb6, 0x00 }; -static const uint8_t chiptest_12cb0ed34854_tag_251[] = { 0x25, 0x46, 0x20, 0x97, 0x7f, 0x47, 0xbf, 0xd6, +static const uint8_t chiptest_12cb0ed34854_tag_251[] = { 0x25, 0x46, 0x20, 0x97, 0x7f, 0x47, 0xbf, 0xd6, 0x74, 0x30, 0xf3, 0xed, 0x01, 0xbc, 0x6b, 0x31 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_252 = { .key = chiptest_12cb0ed34854_key_246, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_247, - .pt_len = 0, - .ct = chiptest_12cb0ed34854_ct_248, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_249, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_250, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_251, - .tag_len = 16, - .tcId = 36, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_253[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_252 = { .key = chiptest_12cb0ed34854_key_246, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_247, + .pt_len = 0, + .ct = chiptest_12cb0ed34854_ct_248, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_249, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_250, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_251, + .tag_len = 16, + .tcId = 36, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_253[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_254[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_254[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_255[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_255[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_256[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_257[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_258[] = { 0x43, 0xd5, 0xd9, 0x8c, 0xa0, 0xa2, 0x25, 0x50 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_259 = { .key = chiptest_12cb0ed34854_key_253, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_254, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_255, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_256, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_257, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_258, - .tag_len = 8, - .tcId = 37, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_260[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_256[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_257[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_258[] = { 0x43, 0xd5, 0xd9, 0x8c, 0xa0, 0xa2, 0x25, 0x50 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_259 = { .key = chiptest_12cb0ed34854_key_253, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_254, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_255, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_256, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_257, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_258, + .tag_len = 8, + .tcId = 37, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_260[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_261[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_261[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_262[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_262[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_263[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_264[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_265[] = { 0x80, 0x8f, 0x50, 0x04, 0xad, 0x52, 0xb0, 0x37, 0xbc, 0x38, 0xe1, 0xa5 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_266 = { .key = chiptest_12cb0ed34854_key_260, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_261, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_262, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_263, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_264, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_265, - .tag_len = 12, - .tcId = 38, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_267[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_263[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_264[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_265[] = { 0x80, 0x8f, 0x50, 0x04, 0xad, 0x52, 0xb0, 0x37, 0xbc, 0x38, 0xe1, 0xa5 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_266 = { .key = chiptest_12cb0ed34854_key_260, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_261, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_262, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_263, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_264, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_265, + .tag_len = 12, + .tcId = 38, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_267[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_268[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_268[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_269[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_269[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_270[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_271[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_272[] = { 0x1f, 0x0b, 0x8f, 0x8b, 0x7d, 0xf5, 0x46, 0xa9, +static const uint8_t chiptest_12cb0ed34854_nonce_270[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_271[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_272[] = { 0x1f, 0x0b, 0x8f, 0x8b, 0x7d, 0xf5, 0x46, 0xa9, 0x93, 0x36, 0x6a, 0x02, 0x6f, 0x0c, 0x2d, 0x61 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_273 = { .key = chiptest_12cb0ed34854_key_267, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_268, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_269, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_270, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_271, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_272, - .tag_len = 16, - .tcId = 39, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_274[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_273 = { .key = chiptest_12cb0ed34854_key_267, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_268, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_269, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_270, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_271, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_272, + .tag_len = 16, + .tcId = 39, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_274[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_275[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_275[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_276[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_276[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_277[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_278[] = { 0xaa }; -static const uint8_t chiptest_12cb0ed34854_tag_279[] = { 0xd8, 0x57, 0x1b, 0x1e, 0x92, 0xf4, 0x58, 0x27 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_280 = { .key = chiptest_12cb0ed34854_key_274, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_275, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_276, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_277, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_278, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_279, - .tag_len = 8, - .tcId = 40, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_281[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_277[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_278[] = { 0xaa }; +static const uint8_t chiptest_12cb0ed34854_tag_279[] = { 0xd8, 0x57, 0x1b, 0x1e, 0x92, 0xf4, 0x58, 0x27 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_280 = { .key = chiptest_12cb0ed34854_key_274, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_275, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_276, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_277, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_278, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_279, + .tag_len = 8, + .tcId = 40, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_281[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_282[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_282[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_283[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_283[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_284[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_285[] = { 0xaa }; -static const uint8_t chiptest_12cb0ed34854_tag_286[] = { 0xef, 0xbf, 0xf4, 0xb4, 0x81, 0xb8, 0xc3, 0xd4, 0x55, 0xed, 0x75, 0x11 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_287 = { .key = chiptest_12cb0ed34854_key_281, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_282, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_283, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_284, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_285, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_286, - .tag_len = 12, - .tcId = 41, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_288[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_284[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_285[] = { 0xaa }; +static const uint8_t chiptest_12cb0ed34854_tag_286[] = { 0xef, 0xbf, 0xf4, 0xb4, 0x81, 0xb8, 0xc3, 0xd4, 0x55, 0xed, 0x75, 0x11 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_287 = { .key = chiptest_12cb0ed34854_key_281, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_282, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_283, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_284, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_285, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_286, + .tag_len = 12, + .tcId = 41, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_288[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_289[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_289[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_290[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_290[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_291[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_292[] = { 0xaa }; -static const uint8_t chiptest_12cb0ed34854_tag_293[] = { 0x67, 0x15, 0x75, 0xcd, 0xb2, 0xd9, 0x80, 0xae, +static const uint8_t chiptest_12cb0ed34854_nonce_291[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_292[] = { 0xaa }; +static const uint8_t chiptest_12cb0ed34854_tag_293[] = { 0x67, 0x15, 0x75, 0xcd, 0xb2, 0xd9, 0x80, 0xae, 0x02, 0x3a, 0x1f, 0xd6, 0xc1, 0xa6, 0x67, 0x52 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_294 = { .key = chiptest_12cb0ed34854_key_288, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_289, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_290, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_291, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_292, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_293, - .tag_len = 16, - .tcId = 42, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_295[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_294 = { .key = chiptest_12cb0ed34854_key_288, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_289, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_290, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_291, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_292, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_293, + .tag_len = 16, + .tcId = 42, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_295[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_296[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_296[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_297[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_297[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_298[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_299[] = { 0x97, 0x40, 0xdd, 0x5c, 0xa3, 0x0d, 0x59, 0x86, 0x7b, 0x01, 0x0f, +static const uint8_t chiptest_12cb0ed34854_nonce_298[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_299[] = { 0x97, 0x40, 0xdd, 0x5c, 0xa3, 0x0d, 0x59, 0x86, 0x7b, 0x01, 0x0f, 0xe3, 0x1a, 0xda, 0x21, 0x41, 0x4c, 0xfd, 0x30, 0xa4, 0x4a, 0x2a, 0xa0, 0x2a, 0x46, 0xcb, 0xfd, 0xaf, 0x94, 0x7e, 0x0a, 0x3b }; -static const uint8_t chiptest_12cb0ed34854_tag_300[] = { 0xcf, 0x82, 0x65, 0x1d, 0x06, 0x79, 0xae, 0x2f }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_301 = { .key = chiptest_12cb0ed34854_key_295, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_296, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_297, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_298, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_299, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_300, - .tag_len = 8, - .tcId = 43, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_302[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_300[] = { 0xcf, 0x82, 0x65, 0x1d, 0x06, 0x79, 0xae, 0x2f }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_301 = { .key = chiptest_12cb0ed34854_key_295, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_296, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_297, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_298, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_299, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_300, + .tag_len = 8, + .tcId = 43, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_302[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_303[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_303[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_304[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_304[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_305[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_306[] = { 0x97, 0x40, 0xdd, 0x5c, 0xa3, 0x0d, 0x59, 0x86, 0x7b, 0x01, 0x0f, +static const uint8_t chiptest_12cb0ed34854_nonce_305[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_306[] = { 0x97, 0x40, 0xdd, 0x5c, 0xa3, 0x0d, 0x59, 0x86, 0x7b, 0x01, 0x0f, 0xe3, 0x1a, 0xda, 0x21, 0x41, 0x4c, 0xfd, 0x30, 0xa4, 0x4a, 0x2a, 0xa0, 0x2a, 0x46, 0xcb, 0xfd, 0xaf, 0x94, 0x7e, 0x0a, 0x3b }; -static const uint8_t chiptest_12cb0ed34854_tag_307[] = { 0x2c, 0x03, 0xb6, 0x3a, 0xf7, 0x2a, 0x9c, 0x39, 0x24, 0x55, 0xd3, 0x43 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_308 = { .key = chiptest_12cb0ed34854_key_302, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_303, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_304, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_305, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_306, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_307, - .tag_len = 12, - .tcId = 44, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_309[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_307[] = { 0x2c, 0x03, 0xb6, 0x3a, 0xf7, 0x2a, 0x9c, 0x39, 0x24, 0x55, 0xd3, 0x43 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_308 = { .key = chiptest_12cb0ed34854_key_302, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_303, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_304, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_305, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_306, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_307, + .tag_len = 12, + .tcId = 44, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_309[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_310[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, +static const uint8_t chiptest_12cb0ed34854_pt_310[] = { 0xae, 0x0d, 0x82, 0x7b, 0xb5, 0xc3, 0x76, 0x7a, 0x7f, 0xec, 0x3e, 0x96, 0xcc, 0x3f, 0x4a, 0x3c }; -static const uint8_t chiptest_12cb0ed34854_ct_311[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_311[] = { 0x62, 0xc5, 0x1e, 0x87, 0x8e, 0xc5, 0x90, 0xa4, 0x87, 0x74, 0xa7, 0x42, 0x37, 0x8b, 0x4e, 0xd4 }; -static const uint8_t chiptest_12cb0ed34854_iv_312[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_313[] = { 0x97, 0x40, 0xdd, 0x5c, 0xa3, 0x0d, 0x59, 0x86, 0x7b, 0x01, 0x0f, +static const uint8_t chiptest_12cb0ed34854_nonce_312[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_313[] = { 0x97, 0x40, 0xdd, 0x5c, 0xa3, 0x0d, 0x59, 0x86, 0x7b, 0x01, 0x0f, 0xe3, 0x1a, 0xda, 0x21, 0x41, 0x4c, 0xfd, 0x30, 0xa4, 0x4a, 0x2a, 0xa0, 0x2a, 0x46, 0xcb, 0xfd, 0xaf, 0x94, 0x7e, 0x0a, 0x3b }; -static const uint8_t chiptest_12cb0ed34854_tag_314[] = { 0x02, 0x24, 0xde, 0x7c, 0xeb, 0x9d, 0xe4, 0x6c, +static const uint8_t chiptest_12cb0ed34854_tag_314[] = { 0x02, 0x24, 0xde, 0x7c, 0xeb, 0x9d, 0xe4, 0x6c, 0xad, 0xee, 0xb9, 0x91, 0x17, 0x78, 0xdd, 0x5c }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_315 = { .key = chiptest_12cb0ed34854_key_309, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_310, - .pt_len = 16, - .ct = chiptest_12cb0ed34854_ct_311, - .ct_len = 16, - .iv = chiptest_12cb0ed34854_iv_312, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_313, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_314, - .tag_len = 16, - .tcId = 45, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_316[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_315 = { .key = chiptest_12cb0ed34854_key_309, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_310, + .pt_len = 16, + .ct = chiptest_12cb0ed34854_ct_311, + .ct_len = 16, + .nonce = chiptest_12cb0ed34854_nonce_312, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_313, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_314, + .tag_len = 16, + .tcId = 45, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_316[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_317[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_317[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_318[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_318[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_319[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_320[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_321[] = { 0xeb, 0x2e, 0x20, 0xb6, 0x30, 0x40, 0x48, 0x7e }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_322 = { .key = chiptest_12cb0ed34854_key_316, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_317, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_318, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_319, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_320, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_321, - .tag_len = 8, - .tcId = 46, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_323[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_319[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_320[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_321[] = { 0xeb, 0x2e, 0x20, 0xb6, 0x30, 0x40, 0x48, 0x7e }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_322 = { .key = chiptest_12cb0ed34854_key_316, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_317, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_318, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_319, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_320, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_321, + .tag_len = 8, + .tcId = 46, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_323[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_324[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_324[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_325[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_325[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_326[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_327[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_328[] = { 0x6a, 0xa7, 0xc4, 0x5d, 0x28, 0x5e, 0xce, 0x89, 0xd3, 0xe6, 0x99, 0x80 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_329 = { .key = chiptest_12cb0ed34854_key_323, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_324, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_325, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_326, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_327, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_328, - .tag_len = 12, - .tcId = 47, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_330[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_326[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_327[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_328[] = { 0x6a, 0xa7, 0xc4, 0x5d, 0x28, 0x5e, 0xce, 0x89, 0xd3, 0xe6, 0x99, 0x80 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_329 = { .key = chiptest_12cb0ed34854_key_323, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_324, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_325, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_326, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_327, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_328, + .tag_len = 12, + .tcId = 47, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_330[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_331[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_331[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_332[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_332[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_333[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_334[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_335[] = { 0xfe, 0xbb, 0xb8, 0xc8, 0xf1, 0xce, 0x2a, 0xbd, +static const uint8_t chiptest_12cb0ed34854_nonce_333[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_334[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_335[] = { 0xfe, 0xbb, 0xb8, 0xc8, 0xf1, 0xce, 0x2a, 0xbd, 0x6f, 0x7e, 0x4c, 0x94, 0x20, 0x59, 0xc6, 0x50 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_336 = { .key = chiptest_12cb0ed34854_key_330, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_331, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_332, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_333, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_334, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_335, - .tag_len = 16, - .tcId = 48, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_337[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_336 = { .key = chiptest_12cb0ed34854_key_330, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_331, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_332, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_333, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_334, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_335, + .tag_len = 16, + .tcId = 48, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_337[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_338[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_338[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_339[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_339[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_340[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_341[] = { 0x2e }; -static const uint8_t chiptest_12cb0ed34854_tag_342[] = { 0xa6, 0xfe, 0xf8, 0xd7, 0x72, 0x8a, 0xb1, 0xe2 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_343 = { .key = chiptest_12cb0ed34854_key_337, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_338, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_339, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_340, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_341, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_342, - .tag_len = 8, - .tcId = 49, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_344[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_340[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_341[] = { 0x2e }; +static const uint8_t chiptest_12cb0ed34854_tag_342[] = { 0xa6, 0xfe, 0xf8, 0xd7, 0x72, 0x8a, 0xb1, 0xe2 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_343 = { .key = chiptest_12cb0ed34854_key_337, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_338, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_339, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_340, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_341, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_342, + .tag_len = 8, + .tcId = 49, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_344[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_345[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_345[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_346[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_346[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_347[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_348[] = { 0x2e }; -static const uint8_t chiptest_12cb0ed34854_tag_349[] = { 0xc4, 0xce, 0x9d, 0xc5, 0xbc, 0x36, 0xb7, 0xa0, 0xc0, 0x35, 0x6f, 0xd6 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_350 = { .key = chiptest_12cb0ed34854_key_344, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_345, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_346, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_347, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_348, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_349, - .tag_len = 12, - .tcId = 50, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_351[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_nonce_347[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_348[] = { 0x2e }; +static const uint8_t chiptest_12cb0ed34854_tag_349[] = { 0xc4, 0xce, 0x9d, 0xc5, 0xbc, 0x36, 0xb7, 0xa0, 0xc0, 0x35, 0x6f, 0xd6 }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_350 = { .key = chiptest_12cb0ed34854_key_344, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_345, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_346, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_347, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_348, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_349, + .tag_len = 12, + .tcId = 50, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_351[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_352[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_352[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_353[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_353[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_354[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_355[] = { 0x2e }; -static const uint8_t chiptest_12cb0ed34854_tag_356[] = { 0xd4, 0x35, 0x7e, 0x1a, 0x3e, 0x22, 0xd0, 0x37, +static const uint8_t chiptest_12cb0ed34854_nonce_354[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_355[] = { 0x2e }; +static const uint8_t chiptest_12cb0ed34854_tag_356[] = { 0xd4, 0x35, 0x7e, 0x1a, 0x3e, 0x22, 0xd0, 0x37, 0x25, 0x9d, 0x7b, 0xb0, 0x86, 0x32, 0x0a, 0x81 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_357 = { .key = chiptest_12cb0ed34854_key_351, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_352, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_353, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_354, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_355, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_356, - .tag_len = 16, - .tcId = 51, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_358[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_357 = { .key = chiptest_12cb0ed34854_key_351, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_352, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_353, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_354, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_355, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_356, + .tag_len = 16, + .tcId = 51, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_358[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_359[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_359[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_360[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_360[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_361[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_362[] = { 0x98, 0x5b, 0xf0, 0x38, 0x16, 0xe9, 0x29, 0xce, 0x66, 0x81, 0x0d, +static const uint8_t chiptest_12cb0ed34854_nonce_361[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_362[] = { 0x98, 0x5b, 0xf0, 0x38, 0x16, 0xe9, 0x29, 0xce, 0x66, 0x81, 0x0d, 0x7e, 0x1a, 0x78, 0x46, 0xc9, 0x1e, 0x05, 0x68, 0x6d, 0x0e, 0xcf, 0x8f, 0x94, 0x31, 0x0a, 0x37, 0xa1, 0xc0, 0x76, 0x1b, 0x04 }; -static const uint8_t chiptest_12cb0ed34854_tag_363[] = { 0x5f, 0x56, 0xb2, 0x9e, 0xc3, 0xdd, 0x21, 0x2d }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_364 = { .key = chiptest_12cb0ed34854_key_358, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_359, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_360, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_361, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_362, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_363, - .tag_len = 8, - .tcId = 52, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_365[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_363[] = { 0x5f, 0x56, 0xb2, 0x9e, 0xc3, 0xdd, 0x21, 0x2d }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_364 = { .key = chiptest_12cb0ed34854_key_358, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_359, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_360, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_361, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_362, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_363, + .tag_len = 8, + .tcId = 52, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_365[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_366[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_366[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_367[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_367[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_368[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_369[] = { 0x98, 0x5b, 0xf0, 0x38, 0x16, 0xe9, 0x29, 0xce, 0x66, 0x81, 0x0d, +static const uint8_t chiptest_12cb0ed34854_nonce_368[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_369[] = { 0x98, 0x5b, 0xf0, 0x38, 0x16, 0xe9, 0x29, 0xce, 0x66, 0x81, 0x0d, 0x7e, 0x1a, 0x78, 0x46, 0xc9, 0x1e, 0x05, 0x68, 0x6d, 0x0e, 0xcf, 0x8f, 0x94, 0x31, 0x0a, 0x37, 0xa1, 0xc0, 0x76, 0x1b, 0x04 }; -static const uint8_t chiptest_12cb0ed34854_tag_370[] = { 0x11, 0xcf, 0x30, 0xd3, 0xdf, 0x32, 0x4b, 0xa0, 0xe4, 0x82, 0x64, 0x8a }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_371 = { .key = chiptest_12cb0ed34854_key_365, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_366, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_367, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_368, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_369, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_370, - .tag_len = 12, - .tcId = 53, - .result = CHIP_NO_ERROR }; -static const uint8_t chiptest_12cb0ed34854_key_372[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_tag_370[] = { 0x11, 0xcf, 0x30, 0xd3, 0xdf, 0x32, 0x4b, 0xa0, 0xe4, 0x82, 0x64, 0x8a }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_371 = { .key = chiptest_12cb0ed34854_key_365, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_366, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_367, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_368, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_369, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_370, + .tag_len = 12, + .tcId = 53, + .result = CHIP_NO_ERROR }; +static const uint8_t chiptest_12cb0ed34854_key_372[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_373[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_373[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_374[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_374[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x70, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_375[] = { - 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 -}; -static const uint8_t chiptest_12cb0ed34854_aad_376[] = { 0x98, 0x5b, 0xf0, 0x38, 0x16, 0xe9, 0x29, 0xce, 0x66, 0x81, 0x0d, +static const uint8_t chiptest_12cb0ed34854_nonce_375[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_376[] = { 0x98, 0x5b, 0xf0, 0x38, 0x16, 0xe9, 0x29, 0xce, 0x66, 0x81, 0x0d, 0x7e, 0x1a, 0x78, 0x46, 0xc9, 0x1e, 0x05, 0x68, 0x6d, 0x0e, 0xcf, 0x8f, 0x94, 0x31, 0x0a, 0x37, 0xa1, 0xc0, 0x76, 0x1b, 0x04 }; -static const uint8_t chiptest_12cb0ed34854_tag_377[] = { 0x07, 0x57, 0x3b, 0xc7, 0x7f, 0xa9, 0x58, 0x63, +static const uint8_t chiptest_12cb0ed34854_tag_377[] = { 0x07, 0x57, 0x3b, 0xc7, 0x7f, 0xa9, 0x58, 0x63, 0xde, 0xc4, 0x16, 0xd6, 0xbe, 0x3b, 0x1e, 0xb3 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_378 = { .key = chiptest_12cb0ed34854_key_372, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_373, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_374, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_375, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_376, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_377, - .tag_len = 16, - .tcId = 54, - .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_379 = { .key = chiptest_12cb0ed34854_key_1, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_4, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_5, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_6, - .tag_len = 8, - .tcId = 1, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_378 = { .key = chiptest_12cb0ed34854_key_372, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_373, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_374, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_375, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_376, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_377, + .tag_len = 16, + .tcId = 54, + .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_379 = { .key = chiptest_12cb0ed34854_key_1, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_4, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_5, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_6, + .tag_len = 8, + .tcId = 1, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_380 = { .key = chiptest_12cb0ed34854_key_8, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_11, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_12, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_13, - .tag_len = 12, - .tcId = 2, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_380 = { .key = chiptest_12cb0ed34854_key_8, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_11, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_12, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_13, + .tag_len = 12, + .tcId = 2, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_381 = { .key = chiptest_12cb0ed34854_key_15, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_18, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_19, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_20, - .tag_len = 16, - .tcId = 3, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_381 = { .key = chiptest_12cb0ed34854_key_15, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_18, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_19, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_20, + .tag_len = 16, + .tcId = 3, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_382 = { .key = chiptest_12cb0ed34854_key_22, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_25, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_26, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_27, - .tag_len = 8, - .tcId = 4, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_382 = { .key = chiptest_12cb0ed34854_key_22, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_25, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_26, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_27, + .tag_len = 8, + .tcId = 4, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_383 = { .key = chiptest_12cb0ed34854_key_29, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_32, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_33, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_34, - .tag_len = 12, - .tcId = 5, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_383 = { .key = chiptest_12cb0ed34854_key_29, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_32, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_33, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_34, + .tag_len = 12, + .tcId = 5, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_384 = { .key = chiptest_12cb0ed34854_key_36, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_39, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_40, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_41, - .tag_len = 16, - .tcId = 6, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_384 = { .key = chiptest_12cb0ed34854_key_36, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_39, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_40, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_41, + .tag_len = 16, + .tcId = 6, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_385 = { .key = chiptest_12cb0ed34854_key_190, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_193, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_194, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_195, - .tag_len = 8, - .tcId = 28, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_385 = { .key = chiptest_12cb0ed34854_key_190, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_193, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_194, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_195, + .tag_len = 8, + .tcId = 28, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_386 = { .key = chiptest_12cb0ed34854_key_197, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_200, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_201, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_202, - .tag_len = 12, - .tcId = 29, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_386 = { .key = chiptest_12cb0ed34854_key_197, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_200, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_201, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_202, + .tag_len = 12, + .tcId = 29, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_387 = { .key = chiptest_12cb0ed34854_key_204, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_207, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_208, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_209, - .tag_len = 16, - .tcId = 30, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_387 = { .key = chiptest_12cb0ed34854_key_204, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_207, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_208, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_209, + .tag_len = 16, + .tcId = 30, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_388 = { .key = chiptest_12cb0ed34854_key_218, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_221, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_222, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_223, - .tag_len = 12, - .tcId = 32, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_388 = { .key = chiptest_12cb0ed34854_key_218, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_221, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_222, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_223, + .tag_len = 12, + .tcId = 32, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_389 = { .key = chiptest_12cb0ed34854_key_225, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_228, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_229, - .aad_len = 1, - .tag = chiptest_12cb0ed34854_tag_230, - .tag_len = 16, - .tcId = 33, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_389 = { .key = chiptest_12cb0ed34854_key_225, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_228, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_229, + .aad_len = 1, + .tag = chiptest_12cb0ed34854_tag_230, + .tag_len = 16, + .tcId = 33, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_390 = { .key = chiptest_12cb0ed34854_key_239, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_242, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_243, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_244, - .tag_len = 12, - .tcId = 35, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_390 = { .key = chiptest_12cb0ed34854_key_239, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_242, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_243, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_244, + .tag_len = 12, + .tcId = 35, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_391 = { .key = chiptest_12cb0ed34854_key_246, - .key_len = 32, - .pt = nullptr, - .pt_len = 0, - .ct = nullptr, - .ct_len = 0, - .iv = chiptest_12cb0ed34854_iv_249, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_250, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_251, - .tag_len = 16, - .tcId = 36, - .result = CHIP_NO_ERROR }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_391 = { .key = chiptest_12cb0ed34854_key_246, + .key_len = 32, + .pt = nullptr, + .pt_len = 0, + .ct = nullptr, + .ct_len = 0, + .nonce = chiptest_12cb0ed34854_nonce_249, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_250, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_251, + .tag_len = 16, + .tcId = 36, + .result = CHIP_NO_ERROR }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_392 = { .key = chiptest_12cb0ed34854_key_246, - .key_len = 32, - .pt = nullptr, - .pt_len = 8, - .ct = nullptr, - .ct_len = 8, - .iv = chiptest_12cb0ed34854_iv_249, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_250, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_251, - .tag_len = 16, - .tcId = 36, - .result = CHIP_ERROR_INVALID_ARGUMENT }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_392 = { .key = chiptest_12cb0ed34854_key_246, + .key_len = 32, + .pt = nullptr, + .pt_len = 8, + .ct = nullptr, + .ct_len = 8, + .nonce = chiptest_12cb0ed34854_nonce_249, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_250, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_251, + .tag_len = 16, + .tcId = 36, + .result = CHIP_ERROR_INVALID_ARGUMENT }; static const struct ccm_test_vector * ccm_test_vectors[] = { &chiptest_12cb0ed34854_test_vector_7, &chiptest_12cb0ed34854_test_vector_14, &chiptest_12cb0ed34854_test_vector_21, @@ -1682,64 +1655,64 @@ static const struct ccm_test_vector * ccm_test_vectors[] = { }; // These are some invalid vectors where the ct bits have been flipped. -static const uint8_t chiptest_12cb0ed34854_key_3721[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_key_3721[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_3731[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, +static const uint8_t chiptest_12cb0ed34854_pt_3731[] = { 0xee, 0xc3, 0xe6, 0xc0, 0xe5, 0x62, 0xa7, 0xea, 0xe0, 0x5c, 0x3d, 0xc4, 0xd8, 0x8f, 0x58, 0x98, 0x58, 0x17, 0xcb, 0x02, 0xa5, 0xae, 0x72, 0x03, 0xce, 0x79, 0x9f, 0x73, 0x4d, 0xfd, 0x25, 0xfa, 0x9a }; -static const uint8_t chiptest_12cb0ed34854_ct_3741[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, +static const uint8_t chiptest_12cb0ed34854_ct_3741[] = { 0x22, 0x0b, 0x7a, 0x3c, 0xde, 0x64, 0x41, 0x34, 0x18, 0xc4, 0xa4, 0x10, 0x23, 0x3b, 0x5c, 0x71, 0x85, 0x0e, 0x74, 0x40, 0xb9, 0x4b, 0x03, 0xad, 0xaa, 0xd7, 0x76, 0x6c, 0xe7, 0x13, 0xc5, 0x6d, 0xff }; -static const uint8_t chiptest_12cb0ed34854_iv_3751[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, - 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; -static const uint8_t chiptest_12cb0ed34854_aad_3761[] = { 0x98, 0x5b, 0xf0, 0x38, 0x16, 0xe9, 0x29, 0xce, 0x66, 0x81, 0x0d, +static const uint8_t chiptest_12cb0ed34854_nonce_3751[] = { 0x95, 0xf9, 0x61, 0x8a, 0x2c, 0x8f, 0x0d, + 0x28, 0xb5, 0xbb, 0xe5, 0x8c, 0xe9 }; +static const uint8_t chiptest_12cb0ed34854_aad_3761[] = { 0x98, 0x5b, 0xf0, 0x38, 0x16, 0xe9, 0x29, 0xce, 0x66, 0x81, 0x0d, 0x7e, 0x1a, 0x78, 0x46, 0xc9, 0x1e, 0x05, 0x68, 0x6d, 0x0e, 0xcf, 0x8f, 0x94, 0x31, 0x0a, 0x37, 0xa1, 0xc0, 0x76, 0x1b, 0x04 }; -static const uint8_t chiptest_12cb0ed34854_tag_3771[] = { 0x07, 0x57, 0x3b, 0xc7, 0x7f, 0xa9, 0x58, 0x63, +static const uint8_t chiptest_12cb0ed34854_tag_3771[] = { 0x07, 0x57, 0x3b, 0xc7, 0x7f, 0xa9, 0x58, 0x63, 0xde, 0xc4, 0x16, 0xd6, 0xbe, 0x3b, 0x1e, 0xb3 }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_3781 = { .key = chiptest_12cb0ed34854_key_3721, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_3731, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_3741, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_3751, - .iv_len = 13, - .aad = chiptest_12cb0ed34854_aad_3761, - .aad_len = 32, - .tag = chiptest_12cb0ed34854_tag_3771, - .tag_len = 16, - .tcId = 54, - .result = CHIP_ERROR_INTERNAL }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_3781 = { .key = chiptest_12cb0ed34854_key_3721, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_3731, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_3741, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_3751, + .nonce_len = 13, + .aad = chiptest_12cb0ed34854_aad_3761, + .aad_len = 32, + .tag = chiptest_12cb0ed34854_tag_3771, + .tag_len = 16, + .tcId = 54, + .result = CHIP_ERROR_INTERNAL }; -static const uint8_t chiptest_12cb0ed34854_key_1411[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, +static const uint8_t chiptest_12cb0ed34854_key_1411[] = { 0x4a, 0x45, 0x65, 0x85, 0xb8, 0xd3, 0xd2, 0xf2, 0x39, 0x51, 0xf2, 0x74, 0xbd, 0x98, 0xe6, 0x65, 0x5e, 0xd5, 0x3f, 0x3c, 0xec, 0x05, 0xa4, 0x65, 0xd0, 0x20, 0xb0, 0xdf, 0x6a, 0x33, 0x45, 0xd5 }; -static const uint8_t chiptest_12cb0ed34854_pt_1421[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, +static const uint8_t chiptest_12cb0ed34854_pt_1421[] = { 0xcd, 0x59, 0xde, 0x72, 0x61, 0x2d, 0x17, 0x54, 0xf8, 0x26, 0xe1, 0x99, 0x65, 0x6b, 0x47, 0x21, 0x50, 0xd8, 0xf5, 0x9a, 0xf1, 0x5f, 0xba, 0x7d, 0x49, 0xd7, 0xa3, 0x2b, 0x7f, 0xb4, 0x11, 0x30, 0x03 }; -static const uint8_t chiptest_12cb0ed34854_ct_1431[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, +static const uint8_t chiptest_12cb0ed34854_ct_1431[] = { 0x9a, 0x48, 0xb4, 0x6d, 0x76, 0x24, 0xf5, 0xc1, 0x5f, 0x65, 0x45, 0x91, 0x11, 0x39, 0x53, 0x1f, 0x2b, 0x25, 0xed, 0xcf, 0x6a, 0x9c, 0xfd, 0x27, 0x9b, 0x16, 0x28, 0xcd, 0xa4, 0x5f, 0x58, 0xd0, 0x3e }; -static const uint8_t chiptest_12cb0ed34854_iv_1441[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; -static const uint8_t chiptest_12cb0ed34854_aad_1451[] = {}; -static const uint8_t chiptest_12cb0ed34854_tag_1461[] = { 0xab, 0x73, 0x1f, 0xc8, 0x0a, 0xde, 0x38, 0xf1, +static const uint8_t chiptest_12cb0ed34854_nonce_1441[] = { 0xaf, 0x38, 0xfc, 0xd0, 0x6b, 0x87, 0x80 }; +static const uint8_t chiptest_12cb0ed34854_aad_1451[] = {}; +static const uint8_t chiptest_12cb0ed34854_tag_1461[] = { 0xab, 0x73, 0x1f, 0xc8, 0x0a, 0xde, 0x38, 0xf1, 0xa9, 0x84, 0x60, 0x6e, 0xae, 0x05, 0xa0, 0x2b }; -static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_1471 = { .key = chiptest_12cb0ed34854_key_1411, - .key_len = 32, - .pt = chiptest_12cb0ed34854_pt_1421, - .pt_len = 33, - .ct = chiptest_12cb0ed34854_ct_1431, - .ct_len = 33, - .iv = chiptest_12cb0ed34854_iv_1441, - .iv_len = 7, - .aad = chiptest_12cb0ed34854_aad_1451, - .aad_len = 0, - .tag = chiptest_12cb0ed34854_tag_1461, - .tag_len = 16, - .tcId = 21, - .result = CHIP_ERROR_INTERNAL }; +static const struct ccm_test_vector chiptest_12cb0ed34854_test_vector_1471 = { .key = chiptest_12cb0ed34854_key_1411, + .key_len = 32, + .pt = chiptest_12cb0ed34854_pt_1421, + .pt_len = 33, + .ct = chiptest_12cb0ed34854_ct_1431, + .ct_len = 33, + .nonce = chiptest_12cb0ed34854_nonce_1441, + .nonce_len = 7, + .aad = chiptest_12cb0ed34854_aad_1451, + .aad_len = 0, + .tag = chiptest_12cb0ed34854_tag_1461, + .tag_len = 16, + .tcId = 21, + .result = CHIP_ERROR_INTERNAL }; static const struct ccm_test_vector * ccm_invalid_test_vectors[] = { &chiptest_12cb0ed34854_test_vector_3781, &chiptest_12cb0ed34854_test_vector_1471 }; diff --git a/src/crypto/tests/CHIPCryptoPALTest.cpp b/src/crypto/tests/CHIPCryptoPALTest.cpp index ad2bd75f91c84e..c7c557cd6061d4 100644 --- a/src/crypto/tests/CHIPCryptoPALTest.cpp +++ b/src/crypto/tests/CHIPCryptoPALTest.cpp @@ -179,7 +179,7 @@ static void TestAES_CCM_256EncryptTestVectors(nlTestSuite * inSuite, void * inCo NL_TEST_ASSERT(inSuite, out_tag); CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, vector->key, vector->key_len, - vector->iv, vector->iv_len, out_ct_ptr, out_tag.Get(), vector->tag_len); + vector->nonce, vector->nonce_len, out_ct_ptr, out_tag.Get(), vector->tag_len); NL_TEST_ASSERT(inSuite, err == vector->result); if (vector->result == CHIP_NO_ERROR) @@ -223,7 +223,7 @@ static void TestAES_CCM_256DecryptTestVectors(nlTestSuite * inSuite, void * inCo out_pt_ptr = out_pt.Get(); } CHIP_ERROR err = AES_CCM_decrypt(vector->ct, vector->ct_len, vector->aad, vector->aad_len, vector->tag, vector->tag_len, - vector->key, vector->key_len, vector->iv, vector->iv_len, out_pt_ptr); + vector->key, vector->key_len, vector->nonce, vector->nonce_len, out_pt_ptr); NL_TEST_ASSERT(inSuite, err == vector->result); @@ -259,8 +259,8 @@ static void TestAES_CCM_256EncryptNilKey(nlTestSuite * inSuite, void * inContext out_tag.Alloc(vector->tag_len); NL_TEST_ASSERT(inSuite, out_tag); - CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, nullptr, 32, vector->iv, - vector->iv_len, out_ct.Get(), out_tag.Get(), vector->tag_len); + CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, nullptr, 32, vector->nonce, + vector->nonce_len, out_ct.Get(), out_tag.Get(), vector->tag_len); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -268,7 +268,7 @@ static void TestAES_CCM_256EncryptNilKey(nlTestSuite * inSuite, void * inContext NL_TEST_ASSERT(inSuite, numOfTestsRan > 0); } -static void TestAES_CCM_256EncryptInvalidIVLen(nlTestSuite * inSuite, void * inContext) +static void TestAES_CCM_256EncryptInvalidNonceLen(nlTestSuite * inSuite, void * inContext) { HeapChecker heapChecker(inSuite); int numOfTestVectors = ArraySize(ccm_test_vectors); @@ -287,7 +287,7 @@ static void TestAES_CCM_256EncryptInvalidIVLen(nlTestSuite * inSuite, void * inC NL_TEST_ASSERT(inSuite, out_tag); CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, vector->key, vector->key_len, - vector->iv, 0, out_ct.Get(), out_tag.Get(), vector->tag_len); + vector->nonce, 0, out_ct.Get(), out_tag.Get(), vector->tag_len); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -314,7 +314,7 @@ static void TestAES_CCM_256EncryptInvalidTagLen(nlTestSuite * inSuite, void * in NL_TEST_ASSERT(inSuite, out_tag); CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, vector->key, vector->key_len, - vector->iv, vector->iv_len, out_ct.Get(), out_tag.Get(), 13); + vector->nonce, vector->nonce_len, out_ct.Get(), out_tag.Get(), 13); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -337,7 +337,7 @@ static void TestAES_CCM_256DecryptInvalidKey(nlTestSuite * inSuite, void * inCon out_pt.Alloc(vector->pt_len); NL_TEST_ASSERT(inSuite, out_pt); CHIP_ERROR err = AES_CCM_decrypt(vector->ct, vector->ct_len, vector->aad, vector->aad_len, vector->tag, vector->tag_len, - nullptr, 32, vector->iv, vector->iv_len, out_pt.Get()); + nullptr, 32, vector->nonce, vector->nonce_len, out_pt.Get()); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -345,7 +345,7 @@ static void TestAES_CCM_256DecryptInvalidKey(nlTestSuite * inSuite, void * inCon NL_TEST_ASSERT(inSuite, numOfTestsRan > 0); } -static void TestAES_CCM_256DecryptInvalidIVLen(nlTestSuite * inSuite, void * inContext) +static void TestAES_CCM_256DecryptInvalidNonceLen(nlTestSuite * inSuite, void * inContext) { HeapChecker heapChecker(inSuite); int numOfTestVectors = ArraySize(ccm_test_vectors); @@ -360,7 +360,7 @@ static void TestAES_CCM_256DecryptInvalidIVLen(nlTestSuite * inSuite, void * inC out_pt.Alloc(vector->pt_len); NL_TEST_ASSERT(inSuite, out_pt); CHIP_ERROR err = AES_CCM_decrypt(vector->ct, vector->ct_len, vector->aad, vector->aad_len, vector->tag, vector->tag_len, - vector->key, vector->key_len, vector->iv, 0, out_pt.Get()); + vector->key, vector->key_len, vector->nonce, 0, out_pt.Get()); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -383,7 +383,7 @@ static void TestAES_CCM_256DecryptInvalidTestVectors(nlTestSuite * inSuite, void out_pt.Alloc(vector->pt_len); NL_TEST_ASSERT(inSuite, out_pt); CHIP_ERROR err = AES_CCM_decrypt(vector->ct, vector->ct_len, vector->aad, vector->aad_len, vector->tag, vector->tag_len, - vector->key, vector->key_len, vector->iv, vector->iv_len, out_pt.Get()); + vector->key, vector->key_len, vector->nonce, vector->nonce_len, out_pt.Get()); bool arePTsEqual = memcmp(vector->pt, out_pt.Get(), vector->pt_len) == 0; NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INTERNAL); @@ -412,7 +412,7 @@ static void TestAES_CCM_128EncryptTestVectors(nlTestSuite * inSuite, void * inCo NL_TEST_ASSERT(inSuite, out_tag); CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, vector->key, vector->key_len, - vector->iv, vector->iv_len, out_ct.Get(), out_tag.Get(), vector->tag_len); + vector->nonce, vector->nonce_len, out_ct.Get(), out_tag.Get(), vector->tag_len); NL_TEST_ASSERT(inSuite, err == vector->result); if (vector->result == CHIP_NO_ERROR) @@ -450,7 +450,7 @@ static void TestAES_CCM_128DecryptTestVectors(nlTestSuite * inSuite, void * inCo out_pt.Alloc(vector->pt_len); NL_TEST_ASSERT(inSuite, out_pt); CHIP_ERROR err = AES_CCM_decrypt(vector->ct, vector->ct_len, vector->aad, vector->aad_len, vector->tag, vector->tag_len, - vector->key, vector->key_len, vector->iv, vector->iv_len, out_pt.Get()); + vector->key, vector->key_len, vector->nonce, vector->nonce_len, out_pt.Get()); NL_TEST_ASSERT(inSuite, err == vector->result); if (vector->result == CHIP_NO_ERROR) @@ -485,8 +485,8 @@ static void TestAES_CCM_128EncryptNilKey(nlTestSuite * inSuite, void * inContext out_tag.Alloc(vector->tag_len); NL_TEST_ASSERT(inSuite, out_tag); - CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, nullptr, 0, vector->iv, - vector->iv_len, out_ct.Get(), out_tag.Get(), vector->tag_len); + CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, nullptr, 0, vector->nonce, + vector->nonce_len, out_ct.Get(), out_tag.Get(), vector->tag_len); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -494,7 +494,7 @@ static void TestAES_CCM_128EncryptNilKey(nlTestSuite * inSuite, void * inContext NL_TEST_ASSERT(inSuite, numOfTestsRan > 0); } -static void TestAES_CCM_128EncryptInvalidIVLen(nlTestSuite * inSuite, void * inContext) +static void TestAES_CCM_128EncryptInvalidNonceLen(nlTestSuite * inSuite, void * inContext) { HeapChecker heapChecker(inSuite); int numOfTestVectors = ArraySize(ccm_128_test_vectors); @@ -513,7 +513,7 @@ static void TestAES_CCM_128EncryptInvalidIVLen(nlTestSuite * inSuite, void * inC NL_TEST_ASSERT(inSuite, out_tag); CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, vector->key, vector->key_len, - vector->iv, 0, out_ct.Get(), out_tag.Get(), vector->tag_len); + vector->nonce, 0, out_ct.Get(), out_tag.Get(), vector->tag_len); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -540,7 +540,7 @@ static void TestAES_CCM_128EncryptInvalidTagLen(nlTestSuite * inSuite, void * in NL_TEST_ASSERT(inSuite, out_tag); CHIP_ERROR err = AES_CCM_encrypt(vector->pt, vector->pt_len, vector->aad, vector->aad_len, vector->key, vector->key_len, - vector->iv, vector->iv_len, out_ct.Get(), out_tag.Get(), 13); + vector->nonce, vector->nonce_len, out_ct.Get(), out_tag.Get(), 13); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -563,7 +563,7 @@ static void TestAES_CCM_128DecryptInvalidKey(nlTestSuite * inSuite, void * inCon out_pt.Alloc(vector->pt_len); NL_TEST_ASSERT(inSuite, out_pt); CHIP_ERROR err = AES_CCM_decrypt(vector->ct, vector->ct_len, vector->aad, vector->aad_len, vector->tag, vector->tag_len, - nullptr, 0, vector->iv, vector->iv_len, out_pt.Get()); + nullptr, 0, vector->nonce, vector->nonce_len, out_pt.Get()); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -571,7 +571,7 @@ static void TestAES_CCM_128DecryptInvalidKey(nlTestSuite * inSuite, void * inCon NL_TEST_ASSERT(inSuite, numOfTestsRan > 0); } -static void TestAES_CCM_128DecryptInvalidIVLen(nlTestSuite * inSuite, void * inContext) +static void TestAES_CCM_128DecryptInvalidNonceLen(nlTestSuite * inSuite, void * inContext) { HeapChecker heapChecker(inSuite); int numOfTestVectors = ArraySize(ccm_128_test_vectors); @@ -586,7 +586,7 @@ static void TestAES_CCM_128DecryptInvalidIVLen(nlTestSuite * inSuite, void * inC out_pt.Alloc(vector->pt_len); NL_TEST_ASSERT(inSuite, out_pt); CHIP_ERROR err = AES_CCM_decrypt(vector->ct, vector->ct_len, vector->aad, vector->aad_len, vector->tag, vector->tag_len, - vector->key, vector->key_len, vector->iv, 0, out_pt.Get()); + vector->key, vector->key_len, vector->nonce, 0, out_pt.Get()); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); break; } @@ -2221,18 +2221,18 @@ static const nlTest sTests[] = { NL_TEST_DEF("Test encrypting AES-CCM-128 test vectors", TestAES_CCM_128EncryptTestVectors), NL_TEST_DEF("Test decrypting AES-CCM-128 test vectors", TestAES_CCM_128DecryptTestVectors), NL_TEST_DEF("Test encrypting AES-CCM-128 using nil key", TestAES_CCM_128EncryptNilKey), - NL_TEST_DEF("Test encrypting AES-CCM-128 using invalid IV", TestAES_CCM_128EncryptInvalidIVLen), + NL_TEST_DEF("Test encrypting AES-CCM-128 using invalid nonce", TestAES_CCM_128EncryptInvalidNonceLen), NL_TEST_DEF("Test encrypting AES-CCM-128 using invalid tag", TestAES_CCM_128EncryptInvalidTagLen), NL_TEST_DEF("Test decrypting AES-CCM-128 invalid key", TestAES_CCM_128DecryptInvalidKey), - NL_TEST_DEF("Test decrypting AES-CCM-128 invalid IV", TestAES_CCM_128DecryptInvalidIVLen), + NL_TEST_DEF("Test decrypting AES-CCM-128 invalid nonce", TestAES_CCM_128DecryptInvalidNonceLen), NL_TEST_DEF("Test decrypting AES-CCM-128 Containers", TestAES_CCM_128Containers), NL_TEST_DEF("Test encrypting AES-CCM-256 test vectors", TestAES_CCM_256EncryptTestVectors), NL_TEST_DEF("Test decrypting AES-CCM-256 test vectors", TestAES_CCM_256DecryptTestVectors), NL_TEST_DEF("Test encrypting AES-CCM-256 using nil key", TestAES_CCM_256EncryptNilKey), - NL_TEST_DEF("Test encrypting AES-CCM-256 using invalid IV", TestAES_CCM_256EncryptInvalidIVLen), + NL_TEST_DEF("Test encrypting AES-CCM-256 using invalid nonce", TestAES_CCM_256EncryptInvalidNonceLen), NL_TEST_DEF("Test encrypting AES-CCM-256 using invalid tag", TestAES_CCM_256EncryptInvalidTagLen), NL_TEST_DEF("Test decrypting AES-CCM-256 invalid key", TestAES_CCM_256DecryptInvalidKey), - NL_TEST_DEF("Test decrypting AES-CCM-256 invalid IV", TestAES_CCM_256DecryptInvalidIVLen), + NL_TEST_DEF("Test decrypting AES-CCM-256 invalid nonce", TestAES_CCM_256DecryptInvalidNonceLen), NL_TEST_DEF("Test decrypting AES-CCM-256 invalid vectors", TestAES_CCM_256DecryptInvalidTestVectors), NL_TEST_DEF("Test ASN.1 signature conversion routines", TestAsn1Conversions), NL_TEST_DEF("Test Integer to ASN.1 DER conversion", TestRawIntegerToDerValidCases), diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.h b/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.h index 49c4699089d4b9..93bb9a79e2bc03 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.h +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.h @@ -13,6 +13,11 @@ NS_ASSUME_NONNULL_BEGIN @interface TemperatureSensorViewController : UIViewController +/** + * Return the current controller, if any. + */ ++ (nullable TemperatureSensorViewController *)currentController; + @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.m index 1f657b9103aa2f..bb003b634505ba 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.m @@ -18,12 +18,15 @@ @interface TemperatureSensorViewController () @property (nonatomic, strong) UIButton * sendReportingSetup; @end +static TemperatureSensorViewController * _Nullable sCurrentController = nil; + @implementation TemperatureSensorViewController // MARK: UIViewController methods - (void)viewDidLoad { + sCurrentController = self; [super viewDidLoad]; [self setupUI]; @@ -33,6 +36,23 @@ - (void)viewDidLoad [self readCurrentTemperature]; } +- (void)viewWillDisappear:(BOOL)animated +{ + sCurrentController = nil; + [super viewWillDisappear:animated]; +} + +- (void)viewDidAppear:(BOOL)animated +{ + sCurrentController = self; + [super viewDidAppear:animated]; +} + ++ (nullable TemperatureSensorViewController *)currentController +{ + return sCurrentController; +} + - (IBAction)sendReportingSetup:(id)sender { NSLog(@"Status: User request to send reporting setup."); @@ -217,7 +237,10 @@ - (void)reportFromUserEnteredSettings if (report.error != nil) { NSLog(@"Error reading temperature: %@", report.error); } else { - [self updateTempInUI:((NSNumber *) report.value).shortValue]; + __auto_type controller = [TemperatureSensorViewController currentController]; + if (controller != nil) { + [controller updateTempInUI:((NSNumber *) report.value).shortValue]; + } } } } diff --git a/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.mm b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.mm index 080f648b61772d..32d9c97be8b776 100644 --- a/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.mm +++ b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.mm @@ -21,6 +21,7 @@ #import "CHIPDeviceControllerOverXPC+AttributeCache.h" #import "CHIPDevice_Internal.h" #import "CHIPError.h" +#import "CHIPError_Internal.h" #import "CHIPLogging.h" #include @@ -152,30 +153,20 @@ static CHIP_ERROR AppendAttibuteValueToArray( if (err == CHIP_NO_ERROR) { id obj = NSObjectFromCHIPTLV(&reader); if (obj) { - [array addObject:@{ - @"endpointId" : [NSNumber numberWithUnsignedShort:path.mEndpointId], - @"clusterId" : [NSNumber numberWithUnsignedLong:path.mClusterId], - @"attributeId" : [NSNumber numberWithUnsignedLong:path.mAttributeId], - @"status" : @0, - @"data" : obj - }]; + [array addObject:@ { kCHIPAttributePathKey : [[CHIPAttributePath alloc] initWithPath:path], kCHIPDataKey : obj }]; return CHIP_NO_ERROR; } CHIP_LOG_ERROR("Error: Cached value could not be converted to generic NSObject"); [array addObject:@ { - @"endpointId" : [NSNumber numberWithUnsignedShort:path.mEndpointId], - @"clusterId" : [NSNumber numberWithUnsignedLong:path.mClusterId], - @"attributeId" : [NSNumber numberWithUnsignedLong:path.mAttributeId], - @"status" : [NSNumber numberWithInteger:CHIP_ERROR_DECODE_FAILED.AsInteger()] + kCHIPAttributePathKey : [[CHIPAttributePath alloc] initWithPath:path], + kCHIPErrorKey : [CHIPError errorForCHIPErrorCode:CHIP_ERROR_DECODE_FAILED] }]; return CHIP_ERROR_DECODE_FAILED; } CHIP_LOG_ERROR("Error: Failed to read from attribute cache: %s", err.AsString()); [array addObject:@ { - @"endpointId" : [NSNumber numberWithUnsignedShort:path.mEndpointId], - @"clusterId" : [NSNumber numberWithUnsignedLong:path.mClusterId], - @"attributeId" : [NSNumber numberWithUnsignedLong:path.mAttributeId], - @"status" : [NSNumber numberWithInteger:err.AsInteger()] + kCHIPAttributePathKey : [[CHIPAttributePath alloc] initWithPath:path], + kCHIPErrorKey : [CHIPError errorForCHIPErrorCode:err] }]; return err; } diff --git a/src/darwin/Framework/CHIP/CHIPDevice.h b/src/darwin/Framework/CHIP/CHIPDevice.h index 2e28c868752799..74ba8bbf67bded 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.h +++ b/src/darwin/Framework/CHIP/CHIPDevice.h @@ -24,28 +24,72 @@ NS_ASSUME_NONNULL_BEGIN +/** + * Handler for read attribute response, write attribute response, invoke command response and reports. + * + * Handler will receive either values or error. Either one of the parameters will be nil. + * + * @param values Received values are an NSArray object with response-value element as described below. + * + * A response-value is an NSDictionary object with the following key values: + * + * kCHIPAttributePathKey : CHIPAttributePath object. Included for attribute value. + * kCHIPCommandPathKey : CHIPCommandPath object. Included for command response. + * kCHIPErrorKey : NSError object. Included to indicate an error. + * kCHIPDataKey: Data-value NSDictionary object. + * Included when there is data and when there is no error. + * The data-value is described below. + * + * A data-value is an NSDictionary object with the following key values: + * + * kCHIPTypeKey : data type. kCHIPSignedIntegerValueType, kCHIPUnsignedIntegerValueType, kCHIPBooleanValueType, + * kCHIPUTF8StringValueType, kCHIPOctetStringValueType, kCHIPFloatValueType, kCHIPDoubleValueType, + * kCHIPNullValueType, kCHIPStructureValueType or kCHIPArrayValueType. + * + * kCHIPValueKey : data value. Per each data type, data value shall be the following object: + * + * kCHIPSignedIntegerValueType: NSNumber object. + * kCHIPUnsignedIntegerValueType: NSNumber object. + * kCHIPBooleanValueType: NSNumber object. + * kCHIPUTF8StringValueType: NSString object. + * kCHIPOctetStringValueType: NSData object. + * kCHIPFloatValueType: NSNumber object. + * kCHIPDoubleValueType: NSNumber object. + * kCHIPNullValueType: "value" key will not be included. + * kCHIPStructureValueType: structure-value NSArray object. + * See below for the definition of structure-value. + * kCHIPArrayValueType: Array-value NSArray object. See below for the definition of array-value. + * + * A structure-value is an NSArray object with NSDictionary objects as its elements. Each dictionary element will + * contain the following key values. + * + * kCHIPContextTagKey : NSNumber object as context tag. + * kCHIPDataKey : Data-value NSDictionary object. + * + * An array-value is an NSArray object with NSDictionary objects as its elements. Each dictionary element will + * contain the following key values. + * + * kCHIPDataKey : Data-value NSDictionary object. + */ typedef void (^CHIPDeviceResponseHandler)(NSArray *> * _Nullable values, NSError * _Nullable error); +extern NSString * const kCHIPAttributePathKey; +extern NSString * const kCHIPCommandPathKey; +extern NSString * const kCHIPDataKey; +extern NSString * const kCHIPErrorKey; extern NSString * const kCHIPTypeKey; extern NSString * const kCHIPValueKey; -extern NSString * const kCHIPTagKey; -extern NSString * const kCHIPSignedIntegerValueTypeKey; -extern NSString * const kCHIPUnsignedIntegerValueTypeKey; -extern NSString * const kCHIPBooleanValueTypeKey; -extern NSString * const kCHIPUTF8StringValueTypeKey; -extern NSString * const kCHIPOctetStringValueTypeKey; -extern NSString * const kCHIPFloatValueTypeKey; -extern NSString * const kCHIPDoubleValueTypeKey; -extern NSString * const kCHIPNullValueTypeKey; -extern NSString * const kCHIPStructureValueTypeKey; -extern NSString * const kCHIPArrayValueTypeKey; -extern NSString * const kCHIPListValueTypeKey; -extern NSString * const kCHIPEndpointIdKey; -extern NSString * const kCHIPClusterIdKey; -extern NSString * const kCHIPAttributeIdKey; -extern NSString * const kCHIPCommandIdKey; -extern NSString * const kCHIPDataKey; -extern NSString * const kCHIPStatusKey; +extern NSString * const kCHIPContextTagKey; +extern NSString * const kCHIPSignedIntegerValueType; +extern NSString * const kCHIPUnsignedIntegerValueType; +extern NSString * const kCHIPBooleanValueType; +extern NSString * const kCHIPUTF8StringValueType; +extern NSString * const kCHIPOctetStringValueType; +extern NSString * const kCHIPFloatValueType; +extern NSString * const kCHIPDoubleValueType; +extern NSString * const kCHIPNullValueType; +extern NSString * const kCHIPStructureValueType; +extern NSString * const kCHIPArrayValueType; @interface CHIPDevice : NSObject @@ -81,17 +125,6 @@ extern NSString * const kCHIPStatusKey; /** * Read attribute in a designated attribute path - * - * @param completion response handler will receive either value or error. value will be an NSArray object with NSDictionary - * elements. Each NSDictionary will have "endpointId", "clusterId", "attributeId", "status" and "data" keys. "endpointId", - * "clusterId", "attributeId" and "status" will be mapped to NSNumber objects. "status" with 0 value indicates success and non-zero - * value indicates failure. "data" key is present only when "status" value is 0. "data" key will be mapped to an NSDictionary - * object, representing attribute value of the path. NSDictionary representing attribute value will contain "type" and "value" keys. - * "type" will be mapped to "SignedInteger", "UnsignedInteger", "UTF8String", "OctetString", "Float", - * "Double", "Boolean", "Null", "Structure", "Array" or "List. "value" will be mapped to an NSNumber, NSString, nil or NSArray - * instance. When "type" is "OctetStriing", "value" will be an NSData object. When "type" is "Structure", "Array" or "List", "value" - * will be NSArray with NSDictionary elements. Each NSDictionary element will have "tag" and "value" keys. "tag" will be mapped to - * an NSNumber value. "value" will be mapped to an NSDictionary instance representing any attribute value recursively. */ - (void)readAttributeWithEndpointId:(NSUInteger)endpointId clusterId:(NSUInteger)clusterId @@ -102,10 +135,8 @@ extern NSString * const kCHIPStatusKey; /** * Write to attribute in a designated attribute path * - * @param completion response handler will receive either value or error. value will be an NSArray object with NSDictionary - * elements. Each NSDictionary will have "endpointId", "clusterId", "attributeId" and "status" keys. "endpointId", "clusterId", - * "attributeId" and "status" will be mapped to NSNumber objects. "status" with 0 value indicates success and non-zero value - * indicates failure. + * @param value A data-value NSDictionary object as described in + * CHIPDeviceResponseHandler. */ - (void)writeAttributeWithEndpointId:(NSUInteger)endpointId clusterId:(NSUInteger)clusterId @@ -117,16 +148,10 @@ extern NSString * const kCHIPStatusKey; /** * Invoke a command with a designated command path * - * @param commandFields command fields object. The object must be an NSDictionary object representing attribute value - * as described in the readAttributeWithEndpointId:clusterId:attributeId:clientQueue:responseHandler: method. - * The attribute must be a Structure, i.e., the NSDictionary "type" key must have the value "Structure". - * - * @param completion response handler will receive either value or error. value will be an NSArray object with NSDictionary - * elements. Each NSDictionary will have "endpointId", "clusterId", "commandId", "status" and "responseData" keys. "endpointId", - * "clusterId", "attributeId" and "status" will be mapped to NSNumber objects. "status" with 0 value indicates success and non-zero - * value indicates failure. "responseData" key will be included only when "status" key has 0 value and there is response data for - * the command. "responseData" key value will be an NSDictionary object representing attribute value as described in the - * readAttributeWithEndpointId:clusterId:attributeId:clientQueue:responseHandler: method. + * @param commandFields command fields object. The object must be a data-value NSDictionary object + * as described in the CHIPDeviceResponseHandler. + * The attribute must be a Structure, i.e., + * the NSDictionary kCHIPTypeKey key must have the value kCHIPStructureValueType. */ - (void)invokeCommandWithEndpointId:(NSUInteger)endpointId clusterId:(NSUInteger)clusterId @@ -137,12 +162,6 @@ extern NSString * const kCHIPStatusKey; /** * Subscribe an attribute in a designated attribute path - * - * @param reportHandler handler for the reports. Note that only the report handler by the last call to this method per the same - * attribute path will receive reports. Report handler will receive either value or error. value will be an NSDictionary object. The - * NSDictionary object will have "endpointId", "clusterId", "attributeId" and "value" keys. "endpointId", "clusterId" and - * "attributeId" will be mapped to NSNumber objects. "value" key value will be an NSDictionary object representing attribute value - * as described in the readAttributeWithEndpointId:clusterId:attributeId:clientQueue:responseHandler: method. */ - (void)subscribeAttributeWithEndpointId:(NSUInteger)endpointId clusterId:(NSUInteger)clusterId @@ -150,8 +169,7 @@ extern NSString * const kCHIPStatusKey; minInterval:(NSUInteger)minInterval maxInterval:(NSUInteger)maxInterval clientQueue:(dispatch_queue_t)clientQueue - reportHandler:(void (^)(NSDictionary * _Nullable value, - NSError * _Nullable error))reportHandler + reportHandler:(CHIPDeviceResponseHandler)reportHandler subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler; /** @@ -170,6 +188,21 @@ extern NSString * const kCHIPStatusKey; @property (nonatomic, readonly, strong, nonnull) NSNumber * cluster; @property (nonatomic, readonly, strong, nonnull) NSNumber * attribute; ++ (instancetype)attributePathWithEndpointId:(NSNumber *)endpoint + clusterId:(NSNumber *)clusterId + attributeId:(NSNumber *)attributeId; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +@interface CHIPCommandPath : NSObject +@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint; +@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster; +@property (nonatomic, readonly, strong, nonnull) NSNumber * command; + ++ (instancetype)commandPathWithEndpointId:(NSNumber *)endpoint clusterId:(NSNumber *)clusterId commandId:(NSNumber *)commandId; + - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; @end diff --git a/src/darwin/Framework/CHIP/CHIPDevice.mm b/src/darwin/Framework/CHIP/CHIPDevice.mm index b123dc62a9f952..614a0f3235e20f 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.mm +++ b/src/darwin/Framework/CHIP/CHIPDevice.mm @@ -20,7 +20,10 @@ #import "CHIPDevice_Internal.h" #import "CHIPError_Internal.h" #import "CHIPLogging.h" +#include "app/ConcreteAttributePath.h" +#include "app/ConcreteCommandPath.h" #include "lib/core/CHIPError.h" +#include "lib/core/DataModelTypes.h" #include #include @@ -38,28 +41,25 @@ using namespace chip::app; using namespace chip::Protocols::InteractionModel; +NSString * const kCHIPAttributePathKey = @"attributePath"; +NSString * const kCHIPCommandPathKey = @"commandPath"; +NSString * const kCHIPDataKey = @"data"; +NSString * const kCHIPErrorKey = @"error"; NSString * const kCHIPTypeKey = @"type"; NSString * const kCHIPValueKey = @"value"; -NSString * const kCHIPTagKey = @"tag"; -NSString * const kCHIPSignedIntegerValueTypeKey = @"SignedInteger"; -NSString * const kCHIPUnsignedIntegerValueTypeKey = @"UnsignedInteger"; -NSString * const kCHIPBooleanValueTypeKey = @"Boolean"; -NSString * const kCHIPUTF8StringValueTypeKey = @"UTF8String"; -NSString * const kCHIPOctetStringValueTypeKey = @"OctetString"; -NSString * const kCHIPFloatValueTypeKey = @"Float"; -NSString * const kCHIPDoubleValueTypeKey = @"Double"; -NSString * const kCHIPNullValueTypeKey = @"Null"; -NSString * const kCHIPStructureValueTypeKey = @"Structure"; -NSString * const kCHIPArrayValueTypeKey = @"Array"; -NSString * const kCHIPListValueTypeKey = @"List"; -NSString * const kCHIPEndpointIdKey = @"endpointId"; -NSString * const kCHIPClusterIdKey = @"clusterId"; -NSString * const kCHIPAttributeIdKey = @"attributeId"; -NSString * const kCHIPCommandIdKey = @"commandId"; -NSString * const kCHIPDataKey = @"data"; -NSString * const kCHIPStatusKey = @"status"; - -class NSObjectAttributeCallbackBridge; +NSString * const kCHIPContextTagKey = @"contextTag"; +NSString * const kCHIPSignedIntegerValueType = @"SignedInteger"; +NSString * const kCHIPUnsignedIntegerValueType = @"UnsignedInteger"; +NSString * const kCHIPBooleanValueType = @"Boolean"; +NSString * const kCHIPUTF8StringValueType = @"UTF8String"; +NSString * const kCHIPOctetStringValueType = @"OctetString"; +NSString * const kCHIPFloatValueType = @"Float"; +NSString * const kCHIPDoubleValueType = @"Double"; +NSString * const kCHIPNullValueType = @"Null"; +NSString * const kCHIPStructureValueType = @"Structure"; +NSString * const kCHIPArrayValueType = @"Array"; + +class NSObjectDataValueCallbackBridge; @interface CHIPDevice () @@ -69,10 +69,6 @@ @interface CHIPDevice () @end -@interface CHIPAttributePath () -- (instancetype)initWithPath:(const ConcreteDataAttributePath &)path; -@end - @interface CHIPAttributeReport () - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(nullable id)value error:(nullable NSError *)error; @end @@ -124,11 +120,11 @@ static void PurgeReadClientContainers(uint64_t deviceId, dispatch_queue_t queue, dispatch_async(DeviceLayer::PlatformMgrImpl().GetWorkQueue(), ^{ for (CHIPReadClientContainer * container in listToDelete) { if (container.readClientPtr) { - delete container.readClientPtr; + Platform::Delete(container.readClientPtr); container.readClientPtr = nullptr; } if (container.pathParams) { - delete container.pathParams; + Platform::Delete(container.pathParams); container.pathParams = nullptr; } } @@ -157,15 +153,43 @@ static void PurgeCompletedReadClientContainers(uint64_t deviceId) [readClientContainersLock unlock]; } +#ifdef DEBUG +// This function is for unit testing only. This function closes all read clients. +static void CauseReadClientFailure(uint64_t deviceId, dispatch_queue_t queue, void (^_Nullable completion)(void)) +{ + InitializeReadClientContainers(); + + NSMutableArray * listToFail; + NSNumber * key = [NSNumber numberWithUnsignedLongLong:deviceId]; + [readClientContainersLock lock]; + listToFail = readClientContainers[key]; + [readClientContainers removeObjectForKey:key]; + [readClientContainersLock unlock]; + + dispatch_async(DeviceLayer::PlatformMgrImpl().GetWorkQueue(), ^{ + for (CHIPReadClientContainer * container in listToFail) { + // Send auto resubscribe request again by read clients, which must fail. + chip::app::ReadPrepareParams readParams; + if (container.readClientPtr) { + container.readClientPtr->SendAutoResubscribeRequest(std::move(readParams)); + } + } + if (completion) { + dispatch_async(queue, completion); + } + }); +} +#endif + @implementation CHIPReadClientContainer - (void)onDone { if (_readClientPtr) { - delete _readClientPtr; + Platform::Delete(_readClientPtr); _readClientPtr = nullptr; } if (_pathParams) { - delete _pathParams; + Platform::Delete(_pathParams); _pathParams = nullptr; } PurgeCompletedReadClientContainers(_deviceId); @@ -174,11 +198,11 @@ - (void)onDone - (void)dealloc { if (_readClientPtr) { - delete _readClientPtr; + Platform::Delete(_readClientPtr); _readClientPtr = nullptr; } if (_pathParams) { - delete _pathParams; + Platform::Delete(_pathParams); _pathParams = nullptr; } } @@ -337,7 +361,7 @@ id _Nullable NSObjectFromCHIPTLV(chip::TLV::TLVReader * data) CHIP_LOG_ERROR("Error(%s): TLV signed integer decoding failed", chip::ErrorStr(err)); return nil; } - return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPSignedIntegerValueTypeKey, kCHIPTypeKey, + return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPSignedIntegerValueType, kCHIPTypeKey, [NSNumber numberWithLongLong:val], kCHIPValueKey, nil]; } case chip::TLV::kTLVType_UnsignedInteger: { @@ -347,7 +371,7 @@ id _Nullable NSObjectFromCHIPTLV(chip::TLV::TLVReader * data) CHIP_LOG_ERROR("Error(%s): TLV unsigned integer decoding failed", chip::ErrorStr(err)); return nil; } - return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPUnsignedIntegerValueTypeKey, kCHIPTypeKey, + return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPUnsignedIntegerValueType, kCHIPTypeKey, [NSNumber numberWithUnsignedLongLong:val], kCHIPValueKey, nil]; } case chip::TLV::kTLVType_Boolean: { @@ -358,27 +382,34 @@ id _Nullable NSObjectFromCHIPTLV(chip::TLV::TLVReader * data) return nil; } return [NSDictionary - dictionaryWithObjectsAndKeys:kCHIPBooleanValueTypeKey, kCHIPTypeKey, [NSNumber numberWithBool:val], kCHIPValueKey, nil]; + dictionaryWithObjectsAndKeys:kCHIPBooleanValueType, kCHIPTypeKey, [NSNumber numberWithBool:val], kCHIPValueKey, nil]; } case chip::TLV::kTLVType_FloatingPointNumber: { + // Try float first + float floatValue; + CHIP_ERROR err = data->Get(floatValue); + if (err == CHIP_NO_ERROR) { + return @ { kCHIPTypeKey : kCHIPFloatValueType, kCHIPValueKey : [NSNumber numberWithFloat:floatValue] }; + } double val; - CHIP_ERROR err = data->Get(val); + err = data->Get(val); if (err != CHIP_NO_ERROR) { CHIP_LOG_ERROR("Error(%s): TLV floating point decoding failed", chip::ErrorStr(err)); return nil; } - return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPDoubleValueTypeKey, kCHIPTypeKey, [NSNumber numberWithDouble:val], - kCHIPValueKey, nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:kCHIPDoubleValueType, kCHIPTypeKey, [NSNumber numberWithDouble:val], kCHIPValueKey, nil]; } case chip::TLV::kTLVType_UTF8String: { + uint32_t len = data->GetLength(); const uint8_t * ptr; CHIP_ERROR err = data->GetDataPtr(ptr); if (err != CHIP_NO_ERROR) { CHIP_LOG_ERROR("Error(%s): TLV UTF8String decoding failed", chip::ErrorStr(err)); return nil; } - return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPUTF8StringValueTypeKey, kCHIPTypeKey, - [NSString stringWithUTF8String:(const char *) ptr], kCHIPValueKey, nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPUTF8StringValueType, kCHIPTypeKey, + [[NSString alloc] initWithBytes:ptr length:len encoding:NSUTF8StringEncoding], kCHIPValueKey, nil]; } case chip::TLV::kTLVType_ByteString: { uint32_t len = data->GetLength(); @@ -388,25 +419,21 @@ id _Nullable NSObjectFromCHIPTLV(chip::TLV::TLVReader * data) CHIP_LOG_ERROR("Error(%s): TLV ByteString decoding failed", chip::ErrorStr(err)); return nil; } - return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPOctetStringValueTypeKey, kCHIPTypeKey, + return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPOctetStringValueType, kCHIPTypeKey, [NSData dataWithBytes:ptr length:len], kCHIPValueKey, nil]; } case chip::TLV::kTLVType_Null: { - return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPNullValueTypeKey, kCHIPTypeKey, nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:kCHIPNullValueType, kCHIPTypeKey, nil]; } case chip::TLV::kTLVType_Structure: - case chip::TLV::kTLVType_Array: - case chip::TLV::kTLVType_List: { + case chip::TLV::kTLVType_Array: { NSString * typeName; switch (dataTLVType) { case chip::TLV::kTLVType_Structure: - typeName = kCHIPStructureValueTypeKey; + typeName = kCHIPStructureValueType; break; case chip::TLV::kTLVType_Array: - typeName = kCHIPArrayValueTypeKey; - break; - case chip::TLV::kTLVType_List: - typeName = kCHIPListValueTypeKey; + typeName = kCHIPArrayValueType; break; default: typeName = @"Unsupported"; @@ -426,8 +453,12 @@ id _Nullable NSObjectFromCHIPTLV(chip::TLV::TLVReader * data) CHIP_LOG_ERROR("Error when decoding TLV container"); return nil; } - [array addObject:[NSDictionary dictionaryWithObjectsAndKeys:value, kCHIPValueKey, - [NSNumber numberWithUnsignedLongLong:(unsigned long long) tag.mVal], kCHIPTagKey, nil]]; + NSMutableDictionary * arrayElement = [NSMutableDictionary dictionary]; + [arrayElement setObject:value forKey:kCHIPDataKey]; + if (dataTLVType == chip::TLV::kTLVType_Structure) { + [arrayElement setObject:[NSNumber numberWithUnsignedLong:TagNumFromTag(tag)] forKey:kCHIPContextTagKey]; + } + [array addObject:arrayElement]; } if (err != CHIP_END_OF_TLV) { CHIP_LOG_ERROR("Error(%s): TLV container decoding failed", chip::ErrorStr(err)); @@ -458,59 +489,59 @@ static CHIP_ERROR EncodeTLVFromObject(id object, chip::TLV::TLVWriter & writer, CHIP_LOG_ERROR("Error: Object to encode is corrupt"); return CHIP_ERROR_INVALID_ARGUMENT; } - if ([typeName isEqualToString:kCHIPSignedIntegerValueTypeKey]) { + if ([typeName isEqualToString:kCHIPSignedIntegerValueType]) { if (![value isKindOfClass:[NSNumber class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt signed integer type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; } - return writer.Put(tag, [value intValue]); + return writer.Put(tag, [value longLongValue]); } - if ([typeName isEqualToString:kCHIPUnsignedIntegerValueTypeKey]) { + if ([typeName isEqualToString:kCHIPUnsignedIntegerValueType]) { if (![value isKindOfClass:[NSNumber class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt unsigned integer type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; } - return writer.Put(tag, [value unsignedIntValue]); + return writer.Put(tag, [value unsignedLongLongValue]); } - if ([typeName isEqualToString:kCHIPBooleanValueTypeKey]) { + if ([typeName isEqualToString:kCHIPBooleanValueType]) { if (![value isKindOfClass:[NSNumber class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt boolean type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; } - return writer.Put(tag, [value unsignedIntValue] ? true : false); + return writer.Put(tag, static_cast([value boolValue])); } - if ([typeName isEqualToString:kCHIPFloatValueTypeKey]) { + if ([typeName isEqualToString:kCHIPFloatValueType]) { if (![value isKindOfClass:[NSNumber class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt float type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; } return writer.Put(tag, [value floatValue]); } - if ([typeName isEqualToString:kCHIPDoubleValueTypeKey]) { + if ([typeName isEqualToString:kCHIPDoubleValueType]) { if (![value isKindOfClass:[NSNumber class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt double type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; } return writer.Put(tag, [value doubleValue]); } - if ([typeName isEqualToString:kCHIPNullValueTypeKey]) { + if ([typeName isEqualToString:kCHIPNullValueType]) { return writer.PutNull(tag); } - if ([typeName isEqualToString:kCHIPUTF8StringValueTypeKey]) { + if ([typeName isEqualToString:kCHIPUTF8StringValueType]) { if (![value isKindOfClass:[NSString class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt UTF8 string type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; } return writer.PutString(tag, [value cStringUsingEncoding:NSUTF8StringEncoding]); } - if ([typeName isEqualToString:kCHIPOctetStringValueTypeKey]) { + if ([typeName isEqualToString:kCHIPOctetStringValueType]) { if (![value isKindOfClass:[NSData class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt octet string type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; } return writer.Put(tag, chip::ByteSpan(static_cast([value bytes]), [value length])); } - if ([typeName isEqualToString:kCHIPStructureValueTypeKey]) { + if ([typeName isEqualToString:kCHIPStructureValueType]) { if (![value isKindOfClass:[NSArray class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt structure type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; @@ -522,8 +553,8 @@ static CHIP_ERROR EncodeTLVFromObject(id object, chip::TLV::TLVWriter & writer, CHIP_LOG_ERROR("Error: Structure element to encode has corrupt type: %@", [element class]); return CHIP_ERROR_INVALID_ARGUMENT; } - NSNumber * elementTag = element[kCHIPTagKey]; - id elementValue = element[kCHIPValueKey]; + NSNumber * elementTag = element[kCHIPContextTagKey]; + id elementValue = element[kCHIPDataKey]; if (!elementTag || !elementValue) { CHIP_LOG_ERROR("Error: Structure element to encode has corrupt value: %@", element); return CHIP_ERROR_INVALID_ARGUMENT; @@ -533,7 +564,7 @@ static CHIP_ERROR EncodeTLVFromObject(id object, chip::TLV::TLVWriter & writer, ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } - if ([typeName isEqualToString:kCHIPArrayValueTypeKey]) { + if ([typeName isEqualToString:kCHIPArrayValueType]) { if (![value isKindOfClass:[NSArray class]]) { CHIP_LOG_ERROR("Error: Object to encode has corrupt array type: %@", [value class]); return CHIP_ERROR_INVALID_ARGUMENT; @@ -545,7 +576,7 @@ static CHIP_ERROR EncodeTLVFromObject(id object, chip::TLV::TLVWriter & writer, CHIP_LOG_ERROR("Error: Array element to encode has corrupt type: %@", [element class]); return CHIP_ERROR_INVALID_ARGUMENT; } - id elementValue = element[kCHIPValueKey]; + id elementValue = element[kCHIPDataKey]; if (!elementValue) { CHIP_LOG_ERROR("Error: Array element to encode has corrupt value: %@", element); return CHIP_ERROR_INVALID_ARGUMENT; @@ -555,36 +586,12 @@ static CHIP_ERROR EncodeTLVFromObject(id object, chip::TLV::TLVWriter & writer, ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } - if ([typeName isEqualToString:kCHIPListValueTypeKey]) { - if (![value isKindOfClass:[NSArray class]]) { - CHIP_LOG_ERROR("Error: Object to encode has corrupt list type: %@", [value class]); - return CHIP_ERROR_INVALID_ARGUMENT; - } - TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_List, outer)); - for (id element in value) { - if (![element isKindOfClass:[NSDictionary class]]) { - CHIP_LOG_ERROR("Error: List element to encode has corrupt type: %@", [element class]); - return CHIP_ERROR_INVALID_ARGUMENT; - } - NSNumber * elementTag = element[kCHIPTagKey]; - id elementValue = element[kCHIPValueKey]; - if (!elementValue) { - CHIP_LOG_ERROR("Error: Array element to encode has corrupt value: %@", element); - return CHIP_ERROR_INVALID_ARGUMENT; - } - ReturnErrorOnFailure(EncodeTLVFromObject(elementValue, writer, - elementTag ? chip::TLV::ContextTag((uint8_t)[elementTag unsignedCharValue]) : chip::TLV::AnonymousTag())); - } - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } CHIP_LOG_ERROR("Error: Unsupported type to encode: %@", typeName); return CHIP_ERROR_INVALID_ARGUMENT; } -// Callback type to pass attribute value as an NSObject -typedef void (*NSObjectAttributeCallback)(void * context, id value); +// Callback type to pass data value as an NSObject +typedef void (*NSObjectDataValueCallback)(void * context, id value); typedef void (*CHIPErrorCallback)(void * context, CHIP_ERROR error); // Rename to be generic for decode and encode @@ -623,12 +630,12 @@ CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const id _Nullable decodedObj; }; -// Callback bridge for NSObjectAttributeCallback -class NSObjectAttributeCallbackBridge : public CHIPCallbackBridge { +// Callback bridge for NSObjectDataValueCallback +class NSObjectDataValueCallbackBridge : public CHIPCallbackBridge { public: - NSObjectAttributeCallbackBridge( + NSObjectDataValueCallbackBridge( dispatch_queue_t queue, CHIPDeviceResponseHandler handler, CHIPActionBlock action, bool keepAlive = false) - : CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive) {}; + : CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive) {}; static void OnSuccessFn(void * context, id value) { DispatchSuccess(context, value); } }; @@ -698,15 +705,7 @@ void OnSubscriptionEstablished(uint64_t aSubscriptionId) override } } - void OnDeallocatePaths(chip::app::ReadPrepareParams && aReadPrepareParams) override - { - VerifyOrDie( - aReadPrepareParams.mAttributePathParamsListSize == 1 && aReadPrepareParams.mpAttributePathParamsList != nullptr); - chip::Platform::Delete(aReadPrepareParams.mpAttributePathParamsList); - - VerifyOrDie(aReadPrepareParams.mDataVersionFilterListSize == 1 && aReadPrepareParams.mpDataVersionFilterList != nullptr); - chip::Platform::Delete(aReadPrepareParams.mpDataVersionFilterList); - } + void OnDeallocatePaths(chip::app::ReadPrepareParams && aReadPrepareParams) override {} ClusterId mClusterId; AttributeId mAttributeId; @@ -724,9 +723,9 @@ - (void)readAttributeWithEndpointId:(NSUInteger)endpointId clientQueue:(dispatch_queue_t)clientQueue completion:(CHIPDeviceResponseHandler)completion { - new NSObjectAttributeCallbackBridge( + new NSObjectDataValueCallbackBridge( clientQueue, completion, ^(chip::Callback::Cancelable * success, chip::Callback::Cancelable * failure) { - auto successFn = chip::Callback::Callback::FromCancelable(success); + auto successFn = chip::Callback::Callback::FromCancelable(success); auto failureFn = chip::Callback::Callback::FromCancelable(failure); auto context = successFn->mContext; auto successCb = successFn->mCall; @@ -734,29 +733,25 @@ new NSObjectAttributeCallbackBridge( auto resultArray = [[NSMutableArray alloc] init]; auto resultSuccess = [[NSMutableArray alloc] init]; auto resultFailure = [[NSMutableArray alloc] init]; - auto onSuccessCb = [resultArray, resultSuccess]( - const app::ConcreteAttributePath & attribPath, const NSObjectData & aData) { - [resultArray - addObject:[[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:attribPath.mEndpointId], - kCHIPEndpointIdKey, [NSNumber numberWithUnsignedInt:attribPath.mClusterId], - kCHIPClusterIdKey, [NSNumber numberWithUnsignedInt:attribPath.mAttributeId], - kCHIPAttributeIdKey, aData.GetDecodedObject(), kCHIPDataKey, - [NSNumber numberWithUnsignedInt:0], kCHIPStatusKey, nil]]; - if ([resultSuccess count] == 0) { - [resultSuccess addObject:[NSNumber numberWithBool:YES]]; - } - }; + auto onSuccessCb + = [resultArray, resultSuccess](const app::ConcreteAttributePath & attribPath, const NSObjectData & aData) { + [resultArray addObject:@ { + kCHIPAttributePathKey : [[CHIPAttributePath alloc] initWithPath:attribPath], + kCHIPDataKey : aData.GetDecodedObject() + }]; + if ([resultSuccess count] == 0) { + [resultSuccess addObject:[NSNumber numberWithBool:YES]]; + } + }; auto onFailureCb = [resultArray, resultFailure](const app::ConcreteAttributePath * attribPath, CHIP_ERROR aError) { if (attribPath) { - [resultArray addObject:[[NSDictionary alloc] - initWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:attribPath->mEndpointId], - kCHIPEndpointIdKey, [NSNumber numberWithUnsignedInt:attribPath->mClusterId], - kCHIPClusterIdKey, [NSNumber numberWithUnsignedInt:attribPath->mAttributeId], - kCHIPAttributeIdKey, [NSNumber numberWithUnsignedInteger:aError.AsInteger()], - kCHIPStatusKey, nil]]; + [resultArray addObject:@ { + kCHIPAttributePathKey : [[CHIPAttributePath alloc] initWithPath:*attribPath], + kCHIPErrorKey : [CHIPError errorForCHIPErrorCode:aError] + }]; } else if ([resultFailure count] == 0) { - [resultFailure addObject:[NSNumber numberWithUnsignedInteger:aError.AsInteger()]]; + [resultFailure addObject:[CHIPError errorForCHIPErrorCode:aError]]; } }; @@ -778,12 +773,9 @@ new NSObjectAttributeCallbackBridge( // Failure if (failureCb) { if ([resultFailure count] > 0) { - failureCb( - context, CHIP_ERROR(static_cast([resultFailure[0] unsignedIntegerValue]))); + failureCb(context, [CHIPError errorToCHIPErrorCode:resultFailure[0]]); } else if ([resultArray count] > 0) { - failureCb(context, - CHIP_ERROR( - static_cast([resultArray[0][kCHIPStatusKey] unsignedIntegerValue]))); + failureCb(context, [CHIPError errorToCHIPErrorCode:resultArray[0][kCHIPErrorKey]]); } else { failureCb(context, CHIP_ERROR_READ_FAILED); } @@ -829,9 +821,9 @@ - (void)writeAttributeWithEndpointId:(NSUInteger)endpointId clientQueue:(dispatch_queue_t)clientQueue completion:(CHIPDeviceResponseHandler)completion { - new NSObjectAttributeCallbackBridge( + new NSObjectDataValueCallbackBridge( clientQueue, completion, ^(chip::Callback::Cancelable * success, chip::Callback::Cancelable * failure) { - auto successFn = chip::Callback::Callback::FromCancelable(success); + auto successFn = chip::Callback::Callback::FromCancelable(success); auto failureFn = chip::Callback::Callback::FromCancelable(failure); auto context = successFn->mContext; auto successCb = successFn->mCall; @@ -839,55 +831,46 @@ new NSObjectAttributeCallbackBridge( auto resultArray = [[NSMutableArray alloc] init]; auto resultSuccess = [[NSMutableArray alloc] init]; auto resultFailure = [[NSMutableArray alloc] init]; - auto onSuccessCb = [resultArray, resultSuccess](const app::ConcreteAttributePath & commandPath) { - [resultArray - addObject:[[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:commandPath.mEndpointId], - kCHIPEndpointIdKey, [NSNumber numberWithUnsignedInt:commandPath.mClusterId], - kCHIPClusterIdKey, [NSNumber numberWithUnsignedInt:commandPath.mAttributeId], - kCHIPAttributeIdKey, [NSNumber numberWithUnsignedInt:0], kCHIPStatusKey, nil]]; + auto onSuccessCb = [resultArray, resultSuccess](const app::ConcreteAttributePath & attribPath) { + [resultArray addObject:@ { kCHIPAttributePathKey : [[CHIPAttributePath alloc] initWithPath:attribPath] }]; if ([resultSuccess count] == 0) { [resultSuccess addObject:[NSNumber numberWithBool:YES]]; } }; - auto onFailureCb = [resultArray, resultFailure](const app::ConcreteAttributePath * commandPath, CHIP_ERROR aError) { - if (commandPath) { - [resultArray addObject:[[NSDictionary alloc] - initWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:commandPath->mEndpointId], - kCHIPEndpointIdKey, [NSNumber numberWithUnsignedInt:commandPath->mClusterId], - kCHIPClusterIdKey, [NSNumber numberWithUnsignedInt:commandPath->mAttributeId], - kCHIPAttributeIdKey, [NSNumber numberWithUnsignedInteger:aError.AsInteger()], - kCHIPStatusKey, nil]]; + auto onFailureCb = [resultArray, resultFailure](const app::ConcreteAttributePath * attribPath, CHIP_ERROR aError) { + if (attribPath) { + [resultArray addObject:@ { + kCHIPAttributePathKey : [[CHIPAttributePath alloc] initWithPath:*attribPath], + kCHIPErrorKey : [CHIPError errorForCHIPErrorCode:aError], + }]; } else { if ([resultFailure count] == 0) { - [resultFailure addObject:[NSNumber numberWithUnsignedInteger:aError.AsInteger()]]; + [resultFailure addObject:[CHIPError errorForCHIPErrorCode:aError]]; } } }; - auto onDoneCb = [context, successCb, failureCb, resultArray, resultSuccess, resultFailure]( - app::WriteClient * pWriteClient) { - if ([resultFailure count] > 0 || [resultSuccess count] == 0) { - // Failure - if (failureCb) { - if ([resultFailure count] > 0) { - failureCb( - context, CHIP_ERROR(static_cast([resultFailure[0] unsignedIntegerValue]))); - } else if ([resultArray count] > 0) { - failureCb(context, - CHIP_ERROR( - static_cast([resultArray[0][kCHIPStatusKey] unsignedIntegerValue]))); - } else { - failureCb(context, CHIP_ERROR_WRITE_FAILED); - } - } - } else { - // Success - if (successCb) { - successCb(context, resultArray); - } - } - }; + auto onDoneCb + = [context, successCb, failureCb, resultArray, resultSuccess, resultFailure](app::WriteClient * pWriteClient) { + if ([resultFailure count] > 0 || [resultSuccess count] == 0) { + // Failure + if (failureCb) { + if ([resultFailure count] > 0) { + failureCb(context, [CHIPError errorToCHIPErrorCode:resultFailure[0]]); + } else if ([resultArray count] > 0) { + failureCb(context, [CHIPError errorToCHIPErrorCode:resultArray[0][kCHIPErrorKey]]); + } else { + failureCb(context, CHIP_ERROR_WRITE_FAILED); + } + } + } else { + // Success + if (successCb) { + successCb(context, resultArray); + } + } + }; return chip::Controller::WriteAttribute([self internalDevice]->GetSecureSession().Value(), static_cast(endpointId), static_cast(clusterId), @@ -968,9 +951,9 @@ - (void)invokeCommandWithEndpointId:(NSUInteger)endpointId clientQueue:(dispatch_queue_t)clientQueue completion:(CHIPDeviceResponseHandler)completion { - new NSObjectAttributeCallbackBridge( + new NSObjectDataValueCallbackBridge( clientQueue, completion, ^(chip::Callback::Cancelable * success, chip::Callback::Cancelable * failure) { - auto successFn = chip::Callback::Callback::FromCancelable(success); + auto successFn = chip::Callback::Callback::FromCancelable(success); auto failureFn = chip::Callback::Callback::FromCancelable(failure); auto context = successFn->mContext; auto successCb = successFn->mCall; @@ -981,18 +964,12 @@ new NSObjectAttributeCallbackBridge( auto onSuccessCb = [resultArray, resultSuccess](const app::ConcreteCommandPath & commandPath, const app::StatusIB & status, const NSObjectData & responseData) { if (responseData.GetDecodedObject()) { - [resultArray addObject:[[NSDictionary alloc] - initWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:commandPath.mEndpointId], - kCHIPEndpointIdKey, [NSNumber numberWithUnsignedInt:commandPath.mClusterId], - kCHIPClusterIdKey, [NSNumber numberWithUnsignedInt:commandPath.mCommandId], - kCHIPCommandIdKey, [NSNumber numberWithUnsignedInt:0], kCHIPStatusKey, - responseData.GetDecodedObject(), kCHIPDataKey, nil]]; + [resultArray addObject:@ { + kCHIPCommandPathKey : [[CHIPCommandPath alloc] initWithPath:commandPath], + kCHIPDataKey : responseData.GetDecodedObject() + }]; } else { - [resultArray addObject:[[NSDictionary alloc] - initWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:commandPath.mEndpointId], - kCHIPEndpointIdKey, [NSNumber numberWithUnsignedInt:commandPath.mClusterId], - kCHIPClusterIdKey, [NSNumber numberWithUnsignedInt:commandPath.mCommandId], - kCHIPCommandIdKey, [NSNumber numberWithUnsignedInt:0], kCHIPStatusKey, nil]]; + [resultArray addObject:@ { kCHIPCommandPathKey : [[CHIPCommandPath alloc] initWithPath:commandPath] }]; } if ([resultSuccess count] == 0) { [resultSuccess addObject:[NSNumber numberWithBool:YES]]; @@ -1001,7 +978,7 @@ new NSObjectAttributeCallbackBridge( auto onFailureCb = [resultFailure](CHIP_ERROR aError) { if ([resultFailure count] == 0) { - [resultFailure addObject:[NSNumber numberWithUnsignedInteger:aError.AsInteger()]]; + [resultFailure addObject:[CHIPError errorForCHIPErrorCode:aError]]; } }; @@ -1019,8 +996,7 @@ new NSObjectAttributeCallbackBridge( // Failure if (failureCb) { if ([resultFailure count] > 0) { - failureCb( - context, CHIP_ERROR(static_cast([resultFailure[0] unsignedIntegerValue]))); + failureCb(context, [CHIPError errorToCHIPErrorCode:resultFailure[0]]); } else { failureCb(context, CHIP_ERROR_WRITE_FAILED); } @@ -1056,8 +1032,7 @@ - (void)subscribeAttributeWithEndpointId:(NSUInteger)endpointId minInterval:(NSUInteger)minInterval maxInterval:(NSUInteger)maxInterval clientQueue:(dispatch_queue_t)clientQueue - reportHandler:(void (^)(NSDictionary * _Nullable value, - NSError * _Nullable error))reportHandler + reportHandler:(CHIPDeviceResponseHandler)reportHandler subscriptionEstablished:(SubscriptionEstablishedHandler)subscriptionEstablishedHandler { dispatch_async(DeviceLayer::PlatformMgrImpl().GetWorkQueue(), ^{ @@ -1065,12 +1040,10 @@ - (void)subscribeAttributeWithEndpointId:(NSUInteger)endpointId id valueObject = data.GetDecodedObject(); app::ConcreteAttributePath pathCopy = attribPath; dispatch_async(clientQueue, ^{ - reportHandler(@ { - kCHIPEndpointIdKey : [NSNumber numberWithUnsignedShort:pathCopy.mEndpointId], - kCHIPClusterIdKey : [NSNumber numberWithUnsignedInt:pathCopy.mClusterId], - kCHIPAttributeIdKey : [NSNumber numberWithUnsignedInt:pathCopy.mAttributeId], - kCHIPValueKey : valueObject - }, + reportHandler( + @[ + @ { kCHIPAttributePathKey : [[CHIPAttributePath alloc] initWithPath:pathCopy], kCHIPDataKey : valueObject } + ], nil); }); }; @@ -1107,7 +1080,7 @@ - (void)subscribeAttributeWithEndpointId:(NSUInteger)endpointId CHIPReadClientContainer * container = [[CHIPReadClientContainer alloc] init]; container.deviceId = self.cppDevice->GetDeviceId(); - container.pathParams = new app::AttributePathParams(chipEndpointId, chipClusterId, chipAttributeId); + container.pathParams = Platform::New(chipEndpointId, chipClusterId, chipAttributeId); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); CHIP_ERROR err = CHIP_NO_ERROR; @@ -1124,7 +1097,7 @@ - (void)subscribeAttributeWithEndpointId:(NSUInteger)endpointId auto callback = chip::Platform::MakeUnique>( chipClusterId, chipAttributeId, onReportCb, onFailureCb, onDone, onEstablishedCb); - auto readClient = new app::ReadClient(engine, [self internalDevice]->GetExchangeManager(), + auto readClient = Platform::New(engine, [self internalDevice]->GetExchangeManager(), callback -> GetBufferedCallback(), chip::app::ReadClient::InteractionType::Subscribe); err = readClient->SendAutoResubscribeRequest(std::move(readParams)); @@ -1135,7 +1108,7 @@ - (void)subscribeAttributeWithEndpointId:(NSUInteger)endpointId reportHandler(nil, [CHIPError errorForCHIPErrorCode:err]); }); } - delete readClient; + Platform::Delete(readClient); return; } @@ -1153,6 +1126,15 @@ - (void)deregisterReportHandlersWithClientQueue:(dispatch_queue_t)clientQueue co PurgeReadClientContainers(self.cppDevice->GetDeviceId(), clientQueue, completion); } +#ifdef DEBUG +// This method is for unit testing only +- (void)failSubscribers:(dispatch_queue_t)clientQueue completion:(void (^)(void))completion +{ + CHIP_LOG_DEBUG("Causing failure in subscribers on purpose"); + CauseReadClientFailure(self.cppDevice->GetDeviceId(), clientQueue, completion); +} +#endif + // The following method is for unit testing purpose only + (id)CHIPEncodeAndDecodeNSObject:(id)object { @@ -1205,6 +1187,35 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path } return self; } + ++ (instancetype)attributePathWithEndpointId:(NSNumber *)endpoint clusterId:(NSNumber *)clusterId attributeId:(NSNumber *)attributeId +{ + ConcreteDataAttributePath path(static_cast([endpoint unsignedShortValue]), + static_cast([clusterId unsignedLongValue]), + static_cast([attributeId unsignedLongValue])); + + return [[CHIPAttributePath alloc] initWithPath:path]; +} +@end + +@implementation CHIPCommandPath +- (instancetype)initWithPath:(const ConcreteCommandPath &)path +{ + if (self = [super init]) { + _endpoint = @(path.mEndpointId); + _cluster = @(path.mClusterId); + _command = @(path.mCommandId); + } + return self; +} + ++ (instancetype)commandPathWithEndpointId:(NSNumber *)endpoint clusterId:(NSNumber *)clusterId commandId:(NSNumber *)commandId +{ + ConcreteCommandPath path(static_cast([endpoint unsignedShortValue]), + static_cast([clusterId unsignedLongValue]), static_cast([commandId unsignedLongValue])); + + return [[CHIPCommandPath alloc] initWithPath:path]; +} @end @implementation CHIPAttributeReport diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.h b/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.h index 77405ebfc04feb..58b2ff738da1e7 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.h +++ b/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.h @@ -35,8 +35,19 @@ NS_ASSUME_NONNULL_BEGIN + (CHIPDeviceController *)sharedControllerWithId:(id _Nullable)controllerId xpcConnectBlock:(NSXPCConnection * (^)(void) )connectBlock; -@end +/** + * Returns an encoded values object to send over XPC for read, write and command interactions + */ ++ (NSArray *> * _Nullable)encodeXPCResponseValues: + (NSArray *> * _Nullable)values; +/** + * Returns a decoded values object from a values object received from XPC for read, write and command interactions + */ ++ (NSArray *> * _Nullable)decodeXPCResponseValues: + (NSArray *> * _Nullable)values; + +@end /** * Protocol that remote object must support over XPC */ @@ -126,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)handleReportWithController:(id _Nullable)controller nodeId:(uint64_t)nodeId - value:(id _Nullable)value + values:(id _Nullable)values error:(NSError * _Nullable)error; @end diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.m b/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.m index 21ae2bd469e7c0..4c07d98846ded8 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.m +++ b/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.m @@ -17,10 +17,43 @@ #import "CHIPDeviceController+XPC.h" +#import "CHIPDevice.h" #import "CHIPDeviceControllerOverXPC.h" NS_ASSUME_NONNULL_BEGIN +static NSArray * _Nullable serializeAttributePath(CHIPAttributePath * _Nullable path) +{ + if (!path) { + return nil; + } + return @[ path.endpoint, path.cluster, path.attribute ]; +} + +static NSArray * _Nullable serializeCommandPath(CHIPCommandPath * _Nullable path) +{ + if (!path) { + return nil; + } + return @[ path.endpoint, path.cluster, path.command ]; +} + +static CHIPAttributePath * _Nullable deserializeAttributePath(NSArray * _Nullable pathArray) +{ + if (pathArray == nil || [pathArray count] != 3) { + return nil; + } + return [CHIPAttributePath attributePathWithEndpointId:pathArray[0] clusterId:pathArray[1] attributeId:pathArray[2]]; +} + +static CHIPCommandPath * _Nullable deserializeCommandPath(NSArray * _Nullable pathArray) +{ + if (pathArray == nil || [pathArray count] != 3) { + return nil; + } + return [CHIPCommandPath commandPathWithEndpointId:pathArray[0] clusterId:pathArray[1] commandId:pathArray[2]]; +} + @implementation CHIPDeviceController (XPC) + (CHIPDeviceController *)sharedControllerWithId:(id _Nullable)controllerId @@ -29,6 +62,55 @@ + (CHIPDeviceController *)sharedControllerWithId:(id _Nullable)contro return [CHIPDeviceControllerOverXPC sharedControllerWithId:controllerId xpcConnectBlock:connectBlock]; } ++ (NSArray *> * _Nullable)encodeXPCResponseValues: + (NSArray *> * _Nullable)values +{ + if (!values) { + return values; + } + NSMutableArray * result = [NSMutableArray array]; + for (NSDictionary * value in values) { + if (!value || (value[kCHIPAttributePathKey] == nil && value[kCHIPCommandPathKey] == nil)) { + [result addObject:value]; + continue; + } + NSMutableDictionary * resultValue = [NSMutableDictionary dictionaryWithCapacity:[value count]]; + [resultValue addEntriesFromDictionary:value]; + if (value[kCHIPAttributePathKey]) { + resultValue[kCHIPAttributePathKey] = serializeAttributePath(value[kCHIPAttributePathKey]); + } + if (value[kCHIPCommandPathKey]) { + resultValue[kCHIPCommandPathKey] = serializeCommandPath(value[kCHIPCommandPathKey]); + } + [result addObject:resultValue]; + } + return result; +} + ++ (NSArray *> * _Nullable)decodeXPCResponseValues: + (NSArray *> * _Nullable)values +{ + if (!values) { + return values; + } + NSMutableArray * result = [NSMutableArray array]; + for (NSDictionary * value in values) { + if (!value || (value[kCHIPAttributePathKey] == nil && value[kCHIPCommandPathKey] == nil)) { + [result addObject:value]; + } + NSMutableDictionary * resultValue = [NSMutableDictionary dictionaryWithCapacity:[value count]]; + [resultValue addEntriesFromDictionary:value]; + if (value[kCHIPAttributePathKey]) { + resultValue[kCHIPAttributePathKey] = deserializeAttributePath(value[kCHIPAttributePathKey]); + } + if (value[kCHIPCommandPathKey]) { + resultValue[kCHIPCommandPathKey] = deserializeCommandPath(value[kCHIPCommandPathKey]); + } + [result addObject:resultValue]; + } + return result; +} + @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.m b/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.m index 744a6c8aa12b1a..34cab94731bb4f 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.m +++ b/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.m @@ -95,24 +95,24 @@ - (void)readAttributeCacheWithNodeId:(uint64_t)nodeId completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); return; } - [self.xpcConnection - getProxyHandleWithCompletion:^(dispatch_queue_t _Nonnull queue, CHIPDeviceControllerXPCProxyHandle * _Nullable handle) { - if (handle) { - [handle.proxy readAttributeCacheWithController:self.controllerId - nodeId:nodeId - endpointId:endpointId - clusterId:clusterId - attributeId:attributeId - completion:^(id _Nullable values, NSError * _Nullable error) { - completion(values, error); - __auto_type handleRetainer = handle; - (void) handleRetainer; - }]; - } else { - CHIP_LOG_ERROR("Attribute cache read failed due to XPC connection failure"); - completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); - } - }]; + [self.xpcConnection getProxyHandleWithCompletion:^( + dispatch_queue_t _Nonnull queue, CHIPDeviceControllerXPCProxyHandle * _Nullable handle) { + if (handle) { + [handle.proxy readAttributeCacheWithController:self.controllerId + nodeId:nodeId + endpointId:endpointId + clusterId:clusterId + attributeId:attributeId + completion:^(id _Nullable values, NSError * _Nullable error) { + completion([CHIPDeviceController decodeXPCResponseValues:values], error); + __auto_type handleRetainer = handle; + (void) handleRetainer; + }]; + } else { + CHIP_LOG_ERROR("Attribute cache read failed due to XPC connection failure"); + completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); + } + }]; }); } diff --git a/src/darwin/Framework/CHIP/CHIPDeviceControllerXPCConnection.h b/src/darwin/Framework/CHIP/CHIPDeviceControllerXPCConnection.h index 9c7ff17b0806df..f1596a59e26070 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceControllerXPCConnection.h +++ b/src/darwin/Framework/CHIP/CHIPDeviceControllerXPCConnection.h @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN CHIPDeviceControllerXPCProxyHandle * _Nullable container))completion; - (void)registerReportHandlerWithController:(id)controller nodeId:(NSUInteger)nodeId - handler:(void (^)(id _Nullable value, NSError * _Nullable error))handler; + handler:(void (^)(id _Nullable values, NSError * _Nullable error))handler; - (void)deregisterReportHandlersWithController:(id)controller nodeId:(NSUInteger)nodeId completion:(void (^)(void))completion; diff --git a/src/darwin/Framework/CHIP/CHIPDeviceControllerXPCConnection.m b/src/darwin/Framework/CHIP/CHIPDeviceControllerXPCConnection.m index ea34191e7081aa..0082cd82d614d3 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceControllerXPCConnection.m +++ b/src/darwin/Framework/CHIP/CHIPDeviceControllerXPCConnection.m @@ -121,7 +121,7 @@ - (void)getProxyHandleWithCompletion:(void (^)(dispatch_queue_t queue, - (void)registerReportHandlerWithController:(id)controller nodeId:(NSUInteger)nodeId - handler:(void (^)(id _Nullable value, NSError * _Nullable error))handler + handler:(void (^)(id _Nullable values, NSError * _Nullable error))handler { dispatch_async(_workQueue, ^{ BOOL shouldRetainProxyForReport = ([self.reportRegistry count] == 0); @@ -170,7 +170,7 @@ - (void)deregisterReportHandlersWithController:(id)controller - (void)handleReportWithController:(id)controller nodeId:(NSUInteger)nodeId - value:(id _Nullable)value + values:(id _Nullable)values error:(NSError * _Nullable)error { dispatch_async(_workQueue, ^{ @@ -183,8 +183,8 @@ - (void)handleReportWithController:(id)controller if (!nodeArray) { return; } - for (void (^handler)(id _Nullable value, NSError * _Nullable error) in nodeArray) { - handler(value, error); + for (void (^handler)(id _Nullable values, NSError * _Nullable error) in nodeArray) { + handler(values, error); } }); } diff --git a/src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m b/src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m index bfae60253098a0..909d943cbced68 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m +++ b/src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m @@ -22,6 +22,8 @@ #import "CHIPError.h" #import "CHIPLogging.h" +NS_ASSUME_NONNULL_BEGIN + @interface CHIPDeviceOverXPC () @property (nonatomic, strong, readonly) id controller; @@ -73,7 +75,7 @@ - (void)readAttributeWithEndpointId:(NSUInteger)endpointId completion:^(id _Nullable values, NSError * _Nullable error) { dispatch_async(clientQueue, ^{ CHIP_LOG_DEBUG("Attribute read"); - completion(values, error); + completion([CHIPDeviceController decodeXPCResponseValues:values], error); // The following captures the proxy handle in the closure so that the // handle won't be released prior to block call. __auto_type handleRetainer = handle; @@ -109,7 +111,7 @@ - (void)writeAttributeWithEndpointId:(NSUInteger)endpointId completion:^(id _Nullable values, NSError * _Nullable error) { dispatch_async(clientQueue, ^{ CHIP_LOG_DEBUG("Attribute written"); - completion(values, error); + completion([CHIPDeviceController decodeXPCResponseValues:values], error); // The following captures the proxy handle in the closure so that the // handle won't be released prior to block call. __auto_type handleRetainer = handle; @@ -145,7 +147,7 @@ - (void)invokeCommandWithEndpointId:(NSUInteger)endpointId completion:^(id _Nullable values, NSError * _Nullable error) { dispatch_async(clientQueue, ^{ CHIP_LOG_DEBUG("Command invoked"); - completion(values, error); + completion([CHIPDeviceController decodeXPCResponseValues:values], error); // The following captures the proxy handle in the closure so that the // handle won't be released prior to block call. __auto_type handleRetainer = handle; @@ -167,8 +169,7 @@ - (void)subscribeAttributeWithEndpointId:(NSUInteger)endpointId minInterval:(NSUInteger)minInterval maxInterval:(NSUInteger)maxInterval clientQueue:(dispatch_queue_t)clientQueue - reportHandler:(void (^)(NSDictionary * _Nullable value, - NSError * _Nullable error))reportHandler + reportHandler:(CHIPDeviceResponseHandler)reportHandler subscriptionEstablished:(void (^_Nullable)(void))subscriptionEstablishedHandler { CHIP_LOG_DEBUG("Subscribing attribute ..."); @@ -179,21 +180,36 @@ - (void)subscribeAttributeWithEndpointId:(NSUInteger)endpointId [self.xpcConnection registerReportHandlerWithController:self.controller nodeId:self.nodeId - handler:^(id _Nullable value, NSError * _Nullable error) { - if (value && ![value isKindOfClass:[NSDictionary class]]) { + handler:^(id _Nullable values, NSError * _Nullable error) { + if (values && ![values isKindOfClass:[NSArray class]]) { CHIP_LOG_ERROR("Unsupported report format"); return; } - NSUInteger receivedEndpointId = [value[kCHIPEndpointIdKey] unsignedIntegerValue]; - NSUInteger receivedClusterId = [value[kCHIPClusterIdKey] unsignedIntegerValue]; - NSUInteger receivedAttributeId = [value[kCHIPAttributeIdKey] unsignedIntegerValue]; - if (error - || ((receivedEndpointId == endpointId || endpointId == 0xffff) - && (receivedClusterId == clusterId || clusterId == 0xffffffff) - && (receivedAttributeId == attributeId || attributeId == 0xffffffff))) { + if (!values) { + CHIP_LOG_DEBUG("Error report received"); + dispatch_async(clientQueue, ^{ + reportHandler(values, error); + }); + return; + } + __auto_type decodedValues = [CHIPDeviceController decodeXPCResponseValues:values]; + NSMutableArray *> * filteredValues = + [NSMutableArray arrayWithCapacity:[decodedValues count]]; + for (NSDictionary * decodedValue in decodedValues) { + CHIPAttributePath * attributePath = decodedValue[kCHIPAttributePathKey]; + if (([attributePath.endpoint unsignedIntegerValue] == endpointId + || endpointId == 0xffff) + && ([attributePath.cluster unsignedIntegerValue] == clusterId + || clusterId == 0xffffffff) + && ([attributePath.attribute unsignedIntegerValue] == attributeId + || attributeId == 0xffffffff)) { + [filteredValues addObject:decodedValue]; + } + } + if ([filteredValues count] > 0) { CHIP_LOG_DEBUG("Report received"); dispatch_async(clientQueue, ^{ - reportHandler(value, error); + reportHandler(filteredValues, error); }); } }]; @@ -235,3 +251,5 @@ - (void)deregisterReportHandlersWithClientQueue:(dispatch_queue_t)clientQueue co } @end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/CHIPDevice_Internal.h b/src/darwin/Framework/CHIP/CHIPDevice_Internal.h index 2f6a9ed8bbd3ec..ffbd98b7a591f1 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice_Internal.h +++ b/src/darwin/Framework/CHIP/CHIPDevice_Internal.h @@ -21,6 +21,8 @@ #import "CHIPDevice.h" #import +#include +#include #include NS_ASSUME_NONNULL_BEGIN @@ -32,6 +34,14 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface CHIPAttributePath () +- (instancetype)initWithPath:(const chip::app::ConcreteDataAttributePath &)path; +@end + +@interface CHIPCommandPath () +- (instancetype)initWithPath:(const chip::app::ConcreteCommandPath &)path; +@end + // Exported utility function id _Nullable NSObjectFromCHIPTLV(chip::TLV::TLVReader * data); diff --git a/src/darwin/Framework/CHIP/templates/CHIPClustersObjc.zapt b/src/darwin/Framework/CHIP/templates/CHIPClustersObjc.zapt index 5cb079ab400f33..4b7ea4d8cf83d2 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPClustersObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPClustersObjc.zapt @@ -60,7 +60,7 @@ subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEs {{#zcl_clusters}} {{#zcl_enums}} -typedef NS_ENUM(NSInteger, {{objCEnumName ../name label}}) { +typedef NS_ENUM({{asUnderlyingZclType type}}, {{objCEnumName ../name label}}) { {{#zcl_enum_items}} {{objCEnumName ../../name ../label}}{{objCEnumItemLabel label}} = {{asHex value 2}}, {{/zcl_enum_items}} @@ -68,7 +68,7 @@ typedef NS_ENUM(NSInteger, {{objCEnumName ../name label}}) { {{/zcl_enums}} {{#zcl_bitmaps}} -typedef NS_OPTIONS(NSUInteger, {{objCEnumName ../name label}}) { +typedef NS_OPTIONS({{asUnderlyingZclType type}}, {{objCEnumName ../name label}}) { {{#zcl_bitmap_items}} {{objCEnumName ../../name ../label}}{{objCEnumItemLabel label}} = {{asHex mask}}, {{/zcl_bitmap_items}} diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index 5330268f99c07d..567021807966ed 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -52,7 +52,6 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto & entry_0 = iter_0.GetValue(); CHIPAccessControlClusterAccessControlEntry * newElement_0; newElement_0 = [CHIPAccessControlClusterAccessControlEntry new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.privilege = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.privilege)]; newElement_0.authMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.authMode)]; if (entry_0.subjects.IsNull()) { @@ -110,6 +109,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader newElement_0.targets = array_3; } } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -136,8 +136,8 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto & entry_0 = iter_0.GetValue(); CHIPAccessControlClusterExtensionEntry * newElement_0; newElement_0 = [CHIPAccessControlClusterExtensionEntry new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.data = [NSData dataWithBytes:entry_0.data.data() length:entry_0.data.size()]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -1565,7 +1565,6 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto & entry_0 = iter_0.GetValue(); CHIPBindingClusterTargetStruct * newElement_0; newElement_0 = [CHIPBindingClusterTargetStruct new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; if (entry_0.node.HasValue()) { newElement_0.node = [NSNumber numberWithUnsignedLongLong:entry_0.node.Value()]; } else { @@ -1586,6 +1585,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader } else { newElement_0.cluster = nil; } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -3776,7 +3776,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; return value; } case Attributes::EnableOneTouchLocking::Id: { @@ -5219,9 +5219,9 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto & entry_0 = iter_0.GetValue(); CHIPGroupKeyManagementClusterGroupKeyMapStruct * newElement_0; newElement_0 = [CHIPGroupKeyManagementClusterGroupKeyMapStruct new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -5248,7 +5248,6 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto & entry_0 = iter_0.GetValue(); CHIPGroupKeyManagementClusterGroupInfoMapStruct * newElement_0; newElement_0 = [CHIPGroupKeyManagementClusterGroupInfoMapStruct new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; @@ -5273,6 +5272,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader } else { newElement_0.groupName = nil; } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -7697,13 +7697,13 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto & entry_0 = iter_0.GetValue(); CHIPOperationalCredentialsClusterNOCStruct * newElement_0; newElement_0 = [CHIPOperationalCredentialsClusterNOCStruct new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.noc = [NSData dataWithBytes:entry_0.noc.data() length:entry_0.noc.size()]; if (entry_0.icac.IsNull()) { newElement_0.icac = nil; } else { newElement_0.icac = [NSData dataWithBytes:entry_0.icac.Value().data() length:entry_0.icac.Value().size()]; } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -7730,7 +7730,6 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto & entry_0 = iter_0.GetValue(); CHIPOperationalCredentialsClusterFabricDescriptor * newElement_0; newElement_0 = [CHIPOperationalCredentialsClusterFabricDescriptor new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.rootPublicKey = [NSData dataWithBytes:entry_0.rootPublicKey.data() length:entry_0.rootPublicKey.size()]; newElement_0.vendorId = [NSNumber numberWithUnsignedShort:entry_0.vendorId]; @@ -7739,6 +7738,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() length:entry_0.label.size() encoding:NSUTF8StringEncoding]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -10325,7 +10325,6 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto & entry_0 = iter_0.GetValue(); CHIPTestClusterClusterTestFabricScoped * newElement_0; newElement_0 = [CHIPTestClusterClusterTestFabricScoped new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.fabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveInt8u]; if (entry_0.optionalFabricSensitiveInt8u.HasValue()) { newElement_0.optionalFabricSensitiveInt8u = @@ -10382,6 +10381,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader } newElement_0.fabricSensitiveInt8uList = array_2; } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index c16fbfaf47b22c..e61421d3d3a138 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -745,7 +745,6 @@ auto & entry_0 = iter_0.GetValue(); CHIPAccessControlClusterAccessControlEntry * newElement_0; newElement_0 = [CHIPAccessControlClusterAccessControlEntry new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.privilege = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.privilege)]; newElement_0.authMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.authMode)]; if (entry_0.subjects.IsNull()) { @@ -803,6 +802,7 @@ newElement_0.targets = array_3; } } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -842,8 +842,8 @@ auto & entry_0 = iter_0.GetValue(); CHIPAccessControlClusterExtensionEntry * newElement_0; newElement_0 = [CHIPAccessControlClusterExtensionEntry new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.data = [NSData dataWithBytes:entry_0.data.data() length:entry_0.data.size()]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -2134,7 +2134,6 @@ auto & entry_0 = iter_0.GetValue(); CHIPBindingClusterTargetStruct * newElement_0; newElement_0 = [CHIPBindingClusterTargetStruct new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; if (entry_0.node.HasValue()) { newElement_0.node = [NSNumber numberWithUnsignedLongLong:entry_0.node.Value()]; } else { @@ -2155,6 +2154,7 @@ } else { newElement_0.cluster = nil; } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -3702,6 +3702,30 @@ } } +void CHIPDoorLockSupportedOperatingModesAttributeCallbackBridge::OnSuccessFn( + void * context, chip::BitFlags value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedShort:value.Raw()]; + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + void CHIPDoorLockServerGeneratedCommandListListAttributeCallbackBridge::OnSuccessFn( void * context, const chip::app::DataModel::DecodableList & value) { @@ -4941,9 +4965,9 @@ auto & entry_0 = iter_0.GetValue(); CHIPGroupKeyManagementClusterGroupKeyMapStruct * newElement_0; newElement_0 = [CHIPGroupKeyManagementClusterGroupKeyMapStruct new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -4984,7 +5008,6 @@ auto & entry_0 = iter_0.GetValue(); CHIPGroupKeyManagementClusterGroupInfoMapStruct * newElement_0; newElement_0 = [CHIPGroupKeyManagementClusterGroupInfoMapStruct new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; @@ -5009,6 +5032,7 @@ } else { newElement_0.groupName = nil; } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -7072,13 +7096,13 @@ auto & entry_0 = iter_0.GetValue(); CHIPOperationalCredentialsClusterNOCStruct * newElement_0; newElement_0 = [CHIPOperationalCredentialsClusterNOCStruct new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.noc = [NSData dataWithBytes:entry_0.noc.data() length:entry_0.noc.size()]; if (entry_0.icac.IsNull()) { newElement_0.icac = nil; } else { newElement_0.icac = [NSData dataWithBytes:entry_0.icac.Value().data() length:entry_0.icac.Value().size()]; } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -7119,7 +7143,6 @@ auto & entry_0 = iter_0.GetValue(); CHIPOperationalCredentialsClusterFabricDescriptor * newElement_0; newElement_0 = [CHIPOperationalCredentialsClusterFabricDescriptor new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.rootPublicKey = [NSData dataWithBytes:entry_0.rootPublicKey.data() length:entry_0.rootPublicKey.size()]; newElement_0.vendorId = [NSNumber numberWithUnsignedShort:entry_0.vendorId]; newElement_0.fabricId = [NSNumber numberWithUnsignedLongLong:entry_0.fabricId]; @@ -7127,6 +7150,7 @@ newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() length:entry_0.label.size() encoding:NSUTF8StringEncoding]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -9024,7 +9048,6 @@ auto & entry_0 = iter_0.GetValue(); CHIPTestClusterClusterTestFabricScoped * newElement_0; newElement_0 = [CHIPTestClusterClusterTestFabricScoped new]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.fabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveInt8u]; if (entry_0.optionalFabricSensitiveInt8u.HasValue()) { newElement_0.optionalFabricSensitiveInt8u = @@ -9080,6 +9103,7 @@ } newElement_0.fabricSensitiveInt8uList = array_2; } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 0a9748496d1942..3b13366ce5ef45 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -564,6 +564,8 @@ typedef void (*ChannelLineupStructAttributeCallback)( void *, const chip::app::DataModel::Nullable &); typedef void (*ChannelCurrentChannelStructAttributeCallback)( void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockSupportedOperatingModesAttributeCallback)( + void *, chip::BitFlags); typedef void (*GeneralCommissioningBasicCommissioningInfoStructAttributeCallback)( void *, const chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfo::DecodableType &); typedef void (*MediaPlaybackSampledPositionStructAttributeCallback)( @@ -3367,6 +3369,34 @@ class CHIPDiagnosticLogsAttributeListListAttributeCallbackSubscriptionBridge SubscriptionEstablishedHandler mEstablishedHandler; }; +class CHIPDoorLockSupportedOperatingModesAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockSupportedOperatingModesAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::BitFlags value); +}; + +class CHIPDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge + : public CHIPDoorLockSupportedOperatingModesAttributeCallbackBridge +{ +public: + CHIPDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPDoorLockSupportedOperatingModesAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + class CHIPDoorLockServerGeneratedCommandListListAttributeCallbackBridge : public CHIPCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index d87818164bc742..d12a958085ba74 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -14849,7 +14849,7 @@ NS_ASSUME_NONNULL_BEGIN @end -typedef NS_ENUM(NSInteger, CHIPIdentifyEffectIdentifier) { +typedef NS_ENUM(uint8_t, CHIPIdentifyEffectIdentifier) { CHIPIdentifyEffectIdentifierBlink = 0x00, CHIPIdentifyEffectIdentifierBreathe = 0x01, CHIPIdentifyEffectIdentifierOkay = 0x02, @@ -14858,11 +14858,11 @@ typedef NS_ENUM(NSInteger, CHIPIdentifyEffectIdentifier) { CHIPIdentifyEffectIdentifierStopEffect = 0xFF, }; -typedef NS_ENUM(NSInteger, CHIPIdentifyEffectVariant) { +typedef NS_ENUM(uint8_t, CHIPIdentifyEffectVariant) { CHIPIdentifyEffectVariantDefault = 0x00, }; -typedef NS_ENUM(NSInteger, CHIPIdentifyType) { +typedef NS_ENUM(uint8_t, CHIPIdentifyType) { CHIPIdentifyTypeNone = 0x00, CHIPIdentifyTypeVisibleLight = 0x01, CHIPIdentifyTypeVisibleLED = 0x02, @@ -14871,50 +14871,50 @@ typedef NS_ENUM(NSInteger, CHIPIdentifyType) { CHIPIdentifyTypeActuator = 0x05, }; -typedef NS_OPTIONS(NSUInteger, CHIPScenesCopyMode) { +typedef NS_OPTIONS(uint8_t, CHIPScenesCopyMode) { CHIPScenesCopyModeCopyAllScenes = 0x1, }; -typedef NS_ENUM(NSInteger, CHIPOnOffDelayedAllOffEffectVariant) { +typedef NS_ENUM(uint8_t, CHIPOnOffDelayedAllOffEffectVariant) { CHIPOnOffDelayedAllOffEffectVariantFadeToOffIn0p8Seconds = 0x00, CHIPOnOffDelayedAllOffEffectVariantNoFade = 0x01, CHIPOnOffDelayedAllOffEffectVariant50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPOnOffDyingLightEffectVariant) { +typedef NS_ENUM(uint8_t, CHIPOnOffDyingLightEffectVariant) { CHIPOnOffDyingLightEffectVariant20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0x00, }; -typedef NS_ENUM(NSInteger, CHIPOnOffEffectIdentifier) { +typedef NS_ENUM(uint8_t, CHIPOnOffEffectIdentifier) { CHIPOnOffEffectIdentifierDelayedAllOff = 0x00, CHIPOnOffEffectIdentifierDyingLight = 0x01, }; -typedef NS_OPTIONS(NSUInteger, CHIPOnOffControl) { +typedef NS_OPTIONS(uint8_t, CHIPOnOffControl) { CHIPOnOffControlAcceptOnlyWhenOn = 0x1, }; -typedef NS_OPTIONS(NSUInteger, CHIPOnOffFeature) { +typedef NS_OPTIONS(uint32_t, CHIPOnOffFeature) { CHIPOnOffFeatureLighting = 0x1, }; -typedef NS_ENUM(NSInteger, CHIPLevelControlMoveMode) { +typedef NS_ENUM(uint8_t, CHIPLevelControlMoveMode) { CHIPLevelControlMoveModeUp = 0x00, CHIPLevelControlMoveModeDown = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPLevelControlStepMode) { +typedef NS_ENUM(uint8_t, CHIPLevelControlStepMode) { CHIPLevelControlStepModeUp = 0x00, CHIPLevelControlStepModeDown = 0x01, }; -typedef NS_OPTIONS(NSUInteger, CHIPLevelControlFeature) { +typedef NS_OPTIONS(uint32_t, CHIPLevelControlFeature) { CHIPLevelControlFeatureOnOff = 0x1, CHIPLevelControlFeatureLighting = 0x2, CHIPLevelControlFeatureFrequency = 0x4, }; -typedef NS_ENUM(NSInteger, CHIPApplianceControlApplianceStatus) { +typedef NS_ENUM(uint8_t, CHIPApplianceControlApplianceStatus) { CHIPApplianceControlApplianceStatusOff = 0x01, CHIPApplianceControlApplianceStatusStandBy = 0x02, CHIPApplianceControlApplianceStatusProgrammed = 0x03, @@ -14932,7 +14932,7 @@ typedef NS_ENUM(NSInteger, CHIPApplianceControlApplianceStatus) { CHIPApplianceControlApplianceStatusSuperheating = 0x0F, }; -typedef NS_ENUM(NSInteger, CHIPApplianceControlCommandIdentification) { +typedef NS_ENUM(uint8_t, CHIPApplianceControlCommandIdentification) { CHIPApplianceControlCommandIdentificationStart = 0x01, CHIPApplianceControlCommandIdentificationStop = 0x02, CHIPApplianceControlCommandIdentificationPause = 0x03, @@ -14946,7 +14946,7 @@ typedef NS_ENUM(NSInteger, CHIPApplianceControlCommandIdentification) { CHIPApplianceControlCommandIdentificationDisableEnergyControl = 0x0B, }; -typedef NS_ENUM(NSInteger, CHIPApplianceControlWarningEvent) { +typedef NS_ENUM(uint8_t, CHIPApplianceControlWarningEvent) { CHIPApplianceControlWarningEventWarning1OverallPowerAboveAvailablePowerLevel = 0x00, CHIPApplianceControlWarningEventWarning2OverallPowerAbovePowerThresholdLevel = 0x01, CHIPApplianceControlWarningEventWarning3OverallPowerBackBelowTheAvailablePowerLevel = 0x02, @@ -14954,24 +14954,24 @@ typedef NS_ENUM(NSInteger, CHIPApplianceControlWarningEvent) { CHIPApplianceControlWarningEventWarning5OverallPowerWillBePotentiallyAboveAvailablePowerLevelIfTheApplianceStarts = 0x04, }; -typedef NS_OPTIONS(NSUInteger, CHIPApplianceControlRemoteEnableFlagsAndDeviceStatus2) { +typedef NS_OPTIONS(uint8_t, CHIPApplianceControlRemoteEnableFlagsAndDeviceStatus2) { CHIPApplianceControlRemoteEnableFlagsAndDeviceStatus2RemoteEnableFlags = 0xF, CHIPApplianceControlRemoteEnableFlagsAndDeviceStatus2DeviceStatus2Structure = 0xF0, }; -typedef NS_ENUM(NSInteger, CHIPAccessControlAuthMode) { +typedef NS_ENUM(uint8_t, CHIPAccessControlAuthMode) { CHIPAccessControlAuthModePASE = 0x01, CHIPAccessControlAuthModeCASE = 0x02, CHIPAccessControlAuthModeGroup = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPAccessControlChangeType) { +typedef NS_ENUM(uint8_t, CHIPAccessControlChangeType) { CHIPAccessControlChangeTypeChanged = 0x00, CHIPAccessControlChangeTypeAdded = 0x01, CHIPAccessControlChangeTypeRemoved = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPAccessControlPrivilege) { +typedef NS_ENUM(uint8_t, CHIPAccessControlPrivilege) { CHIPAccessControlPrivilegeView = 0x01, CHIPAccessControlPrivilegeProxyView = 0x02, CHIPAccessControlPrivilegeOperate = 0x03, @@ -14979,19 +14979,19 @@ typedef NS_ENUM(NSInteger, CHIPAccessControlPrivilege) { CHIPAccessControlPrivilegeAdminister = 0x05, }; -typedef NS_ENUM(NSInteger, CHIPBridgedActionsActionError) { +typedef NS_ENUM(uint8_t, CHIPBridgedActionsActionError) { CHIPBridgedActionsActionErrorUnknown = 0x00, CHIPBridgedActionsActionErrorInterrupted = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPBridgedActionsActionState) { +typedef NS_ENUM(uint8_t, CHIPBridgedActionsActionState) { CHIPBridgedActionsActionStateInactive = 0x00, CHIPBridgedActionsActionStateActive = 0x01, CHIPBridgedActionsActionStatePaused = 0x02, CHIPBridgedActionsActionStateDisabled = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPBridgedActionsActionType) { +typedef NS_ENUM(uint8_t, CHIPBridgedActionsActionType) { CHIPBridgedActionsActionTypeOther = 0x00, CHIPBridgedActionsActionTypeScene = 0x01, CHIPBridgedActionsActionTypeSequence = 0x02, @@ -15001,13 +15001,13 @@ typedef NS_ENUM(NSInteger, CHIPBridgedActionsActionType) { CHIPBridgedActionsActionTypeAlarm = 0x06, }; -typedef NS_ENUM(NSInteger, CHIPBridgedActionsEndpointListType) { +typedef NS_ENUM(uint8_t, CHIPBridgedActionsEndpointListType) { CHIPBridgedActionsEndpointListTypeOther = 0x00, CHIPBridgedActionsEndpointListTypeRoom = 0x01, CHIPBridgedActionsEndpointListTypeZone = 0x02, }; -typedef NS_OPTIONS(NSUInteger, CHIPBridgedActionsCommandBits) { +typedef NS_OPTIONS(uint16_t, CHIPBridgedActionsCommandBits) { CHIPBridgedActionsCommandBitsInstantAction = 0x1, CHIPBridgedActionsCommandBitsInstantActionWithTransition = 0x2, CHIPBridgedActionsCommandBitsStartAction = 0x4, @@ -15022,33 +15022,33 @@ typedef NS_OPTIONS(NSUInteger, CHIPBridgedActionsCommandBits) { CHIPBridgedActionsCommandBitsDisableActionWithDuration = 0x800, }; -typedef NS_ENUM(NSInteger, CHIPOtaSoftwareUpdateProviderOTAApplyUpdateAction) { +typedef NS_ENUM(uint8_t, CHIPOtaSoftwareUpdateProviderOTAApplyUpdateAction) { CHIPOtaSoftwareUpdateProviderOTAApplyUpdateActionProceed = 0x00, CHIPOtaSoftwareUpdateProviderOTAApplyUpdateActionAwaitNextAction = 0x01, CHIPOtaSoftwareUpdateProviderOTAApplyUpdateActionDiscontinue = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPOtaSoftwareUpdateProviderOTADownloadProtocol) { +typedef NS_ENUM(uint8_t, CHIPOtaSoftwareUpdateProviderOTADownloadProtocol) { CHIPOtaSoftwareUpdateProviderOTADownloadProtocolBDXSynchronous = 0x00, CHIPOtaSoftwareUpdateProviderOTADownloadProtocolBDXAsynchronous = 0x01, CHIPOtaSoftwareUpdateProviderOTADownloadProtocolHTTPS = 0x02, CHIPOtaSoftwareUpdateProviderOTADownloadProtocolVendorSpecific = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPOtaSoftwareUpdateProviderOTAQueryStatus) { +typedef NS_ENUM(uint8_t, CHIPOtaSoftwareUpdateProviderOTAQueryStatus) { CHIPOtaSoftwareUpdateProviderOTAQueryStatusUpdateAvailable = 0x00, CHIPOtaSoftwareUpdateProviderOTAQueryStatusBusy = 0x01, CHIPOtaSoftwareUpdateProviderOTAQueryStatusNotAvailable = 0x02, CHIPOtaSoftwareUpdateProviderOTAQueryStatusDownloadProtocolNotSupported = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPOtaSoftwareUpdateRequestorOTAAnnouncementReason) { +typedef NS_ENUM(uint8_t, CHIPOtaSoftwareUpdateRequestorOTAAnnouncementReason) { CHIPOtaSoftwareUpdateRequestorOTAAnnouncementReasonSimpleAnnouncement = 0x00, CHIPOtaSoftwareUpdateRequestorOTAAnnouncementReasonUpdateAvailable = 0x01, CHIPOtaSoftwareUpdateRequestorOTAAnnouncementReasonUrgentUpdateAvailable = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPOtaSoftwareUpdateRequestorOTAChangeReason) { +typedef NS_ENUM(uint8_t, CHIPOtaSoftwareUpdateRequestorOTAChangeReason) { CHIPOtaSoftwareUpdateRequestorOTAChangeReasonUnknown = 0x00, CHIPOtaSoftwareUpdateRequestorOTAChangeReasonSuccess = 0x01, CHIPOtaSoftwareUpdateRequestorOTAChangeReasonFailure = 0x02, @@ -15056,7 +15056,7 @@ typedef NS_ENUM(NSInteger, CHIPOtaSoftwareUpdateRequestorOTAChangeReason) { CHIPOtaSoftwareUpdateRequestorOTAChangeReasonDelayByProvider = 0x04, }; -typedef NS_ENUM(NSInteger, CHIPOtaSoftwareUpdateRequestorOTAUpdateState) { +typedef NS_ENUM(uint8_t, CHIPOtaSoftwareUpdateRequestorOTAUpdateState) { CHIPOtaSoftwareUpdateRequestorOTAUpdateStateUnknown = 0x00, CHIPOtaSoftwareUpdateRequestorOTAUpdateStateIdle = 0x01, CHIPOtaSoftwareUpdateRequestorOTAUpdateStateQuerying = 0x02, @@ -15068,7 +15068,7 @@ typedef NS_ENUM(NSInteger, CHIPOtaSoftwareUpdateRequestorOTAUpdateState) { CHIPOtaSoftwareUpdateRequestorOTAUpdateStateDelayedOnUserConsent = 0x08, }; -typedef NS_ENUM(NSInteger, CHIPTimeFormatLocalizationCalendarType) { +typedef NS_ENUM(uint8_t, CHIPTimeFormatLocalizationCalendarType) { CHIPTimeFormatLocalizationCalendarTypeBuddhist = 0x00, CHIPTimeFormatLocalizationCalendarTypeChinese = 0x01, CHIPTimeFormatLocalizationCalendarTypeCoptic = 0x02, @@ -15083,22 +15083,22 @@ typedef NS_ENUM(NSInteger, CHIPTimeFormatLocalizationCalendarType) { CHIPTimeFormatLocalizationCalendarTypeTaiwanese = 0x0B, }; -typedef NS_ENUM(NSInteger, CHIPTimeFormatLocalizationHourFormat) { +typedef NS_ENUM(uint8_t, CHIPTimeFormatLocalizationHourFormat) { CHIPTimeFormatLocalizationHourFormat12hr = 0x00, CHIPTimeFormatLocalizationHourFormat24hr = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPUnitLocalizationTempUnit) { +typedef NS_ENUM(uint8_t, CHIPUnitLocalizationTempUnit) { CHIPUnitLocalizationTempUnitFahrenheit = 0x00, CHIPUnitLocalizationTempUnitCelsius = 0x01, CHIPUnitLocalizationTempUnitKelvin = 0x02, }; -typedef NS_OPTIONS(NSUInteger, CHIPUnitLocalizationFeature) { +typedef NS_OPTIONS(uint32_t, CHIPUnitLocalizationFeature) { CHIPUnitLocalizationFeatureTemperatureUnit = 0x1, }; -typedef NS_ENUM(NSInteger, CHIPPowerSourceBatChargeFaultType) { +typedef NS_ENUM(uint8_t, CHIPPowerSourceBatChargeFaultType) { CHIPPowerSourceBatChargeFaultTypeUnspecfied = 0x00, CHIPPowerSourceBatChargeFaultTypeAmbientTooHot = 0x01, CHIPPowerSourceBatChargeFaultTypeAmbientTooCold = 0x02, @@ -15112,58 +15112,58 @@ typedef NS_ENUM(NSInteger, CHIPPowerSourceBatChargeFaultType) { CHIPPowerSourceBatChargeFaultTypeSafetyTimeout = 0x0A, }; -typedef NS_ENUM(NSInteger, CHIPPowerSourceBatChargeLevel) { +typedef NS_ENUM(uint8_t, CHIPPowerSourceBatChargeLevel) { CHIPPowerSourceBatChargeLevelOk = 0x00, CHIPPowerSourceBatChargeLevelWarning = 0x01, CHIPPowerSourceBatChargeLevelCritical = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPPowerSourceBatChargeState) { +typedef NS_ENUM(uint8_t, CHIPPowerSourceBatChargeState) { CHIPPowerSourceBatChargeStateUnknown = 0x00, CHIPPowerSourceBatChargeStateIsCharging = 0x01, CHIPPowerSourceBatChargeStateIsAtFullCharge = 0x02, CHIPPowerSourceBatChargeStateIsNotCharging = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPPowerSourceBatFaultType) { +typedef NS_ENUM(uint8_t, CHIPPowerSourceBatFaultType) { CHIPPowerSourceBatFaultTypeUnspecfied = 0x00, CHIPPowerSourceBatFaultTypeOverTemp = 0x01, CHIPPowerSourceBatFaultTypeUnderTemp = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPPowerSourceBatReplaceability) { +typedef NS_ENUM(uint8_t, CHIPPowerSourceBatReplaceability) { CHIPPowerSourceBatReplaceabilityUnspecified = 0x00, CHIPPowerSourceBatReplaceabilityNotReplaceable = 0x01, CHIPPowerSourceBatReplaceabilityUserReplaceable = 0x02, CHIPPowerSourceBatReplaceabilityFactoryReplaceable = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPPowerSourceStatus) { +typedef NS_ENUM(uint8_t, CHIPPowerSourceStatus) { CHIPPowerSourceStatusUnspecfied = 0x00, CHIPPowerSourceStatusActive = 0x01, CHIPPowerSourceStatusStandby = 0x02, CHIPPowerSourceStatusUnavailable = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPPowerSourceWiredCurrentType) { +typedef NS_ENUM(uint8_t, CHIPPowerSourceWiredCurrentType) { CHIPPowerSourceWiredCurrentTypeAC = 0x00, CHIPPowerSourceWiredCurrentTypeDC = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPPowerSourceWiredFaultType) { +typedef NS_ENUM(uint8_t, CHIPPowerSourceWiredFaultType) { CHIPPowerSourceWiredFaultTypeUnspecfied = 0x00, CHIPPowerSourceWiredFaultTypeOverVoltage = 0x01, CHIPPowerSourceWiredFaultTypeUnderVoltage = 0x02, }; -typedef NS_OPTIONS(NSUInteger, CHIPPowerSourceFeature) { +typedef NS_OPTIONS(uint32_t, CHIPPowerSourceFeature) { CHIPPowerSourceFeatureWired = 0x1, CHIPPowerSourceFeatureBattery = 0x2, CHIPPowerSourceFeatureRechargeable = 0x4, CHIPPowerSourceFeatureReplaceable = 0x8, }; -typedef NS_ENUM(NSInteger, CHIPGeneralCommissioningCommissioningError) { +typedef NS_ENUM(uint8_t, CHIPGeneralCommissioningCommissioningError) { CHIPGeneralCommissioningCommissioningErrorOk = 0x00, CHIPGeneralCommissioningCommissioningErrorValueOutsideRange = 0x01, CHIPGeneralCommissioningCommissioningErrorInvalidAuthentication = 0x02, @@ -15171,13 +15171,13 @@ typedef NS_ENUM(NSInteger, CHIPGeneralCommissioningCommissioningError) { CHIPGeneralCommissioningCommissioningErrorBusyWithOtherAdmin = 0x04, }; -typedef NS_ENUM(NSInteger, CHIPGeneralCommissioningRegulatoryLocationType) { +typedef NS_ENUM(uint8_t, CHIPGeneralCommissioningRegulatoryLocationType) { CHIPGeneralCommissioningRegulatoryLocationTypeIndoor = 0x00, CHIPGeneralCommissioningRegulatoryLocationTypeOutdoor = 0x01, CHIPGeneralCommissioningRegulatoryLocationTypeIndoorOutdoor = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPNetworkCommissioningStatus) { +typedef NS_ENUM(uint8_t, CHIPNetworkCommissioningStatus) { CHIPNetworkCommissioningStatusSuccess = 0x00, CHIPNetworkCommissioningStatusOutOfRange = 0x01, CHIPNetworkCommissioningStatusBoundsExceeded = 0x02, @@ -15193,7 +15193,7 @@ typedef NS_ENUM(NSInteger, CHIPNetworkCommissioningStatus) { CHIPNetworkCommissioningStatusUnknownError = 0x0C, }; -typedef NS_ENUM(NSInteger, CHIPNetworkCommissioningWiFiBand) { +typedef NS_ENUM(uint8_t, CHIPNetworkCommissioningWiFiBand) { CHIPNetworkCommissioningWiFiBand2G4 = 0x00, CHIPNetworkCommissioningWiFiBand3G65 = 0x01, CHIPNetworkCommissioningWiFiBand5G = 0x02, @@ -15201,19 +15201,19 @@ typedef NS_ENUM(NSInteger, CHIPNetworkCommissioningWiFiBand) { CHIPNetworkCommissioningWiFiBand60G = 0x04, }; -typedef NS_OPTIONS(NSUInteger, CHIPNetworkCommissioningFeature) { +typedef NS_OPTIONS(uint32_t, CHIPNetworkCommissioningFeature) { CHIPNetworkCommissioningFeatureWiFiNetworkInterface = 0x1, CHIPNetworkCommissioningFeatureThreadNetworkInterface = 0x2, CHIPNetworkCommissioningFeatureEthernetNetworkInterface = 0x4, }; -typedef NS_ENUM(NSInteger, CHIPDiagnosticLogsLogsIntent) { +typedef NS_ENUM(uint8_t, CHIPDiagnosticLogsLogsIntent) { CHIPDiagnosticLogsLogsIntentEndUserSupport = 0x00, CHIPDiagnosticLogsLogsIntentNetworkDiag = 0x01, CHIPDiagnosticLogsLogsIntentCrashLogs = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPDiagnosticLogsLogsStatus) { +typedef NS_ENUM(uint8_t, CHIPDiagnosticLogsLogsStatus) { CHIPDiagnosticLogsLogsStatusSuccess = 0x00, CHIPDiagnosticLogsLogsStatusExhausted = 0x01, CHIPDiagnosticLogsLogsStatusNoLogs = 0x02, @@ -15221,12 +15221,12 @@ typedef NS_ENUM(NSInteger, CHIPDiagnosticLogsLogsStatus) { CHIPDiagnosticLogsLogsStatusDenied = 0x04, }; -typedef NS_ENUM(NSInteger, CHIPDiagnosticLogsLogsTransferProtocol) { +typedef NS_ENUM(uint8_t, CHIPDiagnosticLogsLogsTransferProtocol) { CHIPDiagnosticLogsLogsTransferProtocolResponsePayload = 0x00, CHIPDiagnosticLogsLogsTransferProtocolBDX = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsBootReasonType) { +typedef NS_ENUM(uint8_t, CHIPGeneralDiagnosticsBootReasonType) { CHIPGeneralDiagnosticsBootReasonTypeUnspecified = 0x00, CHIPGeneralDiagnosticsBootReasonTypePowerOnReboot = 0x01, CHIPGeneralDiagnosticsBootReasonTypeBrownOutReset = 0x02, @@ -15236,7 +15236,7 @@ typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsBootReasonType) { CHIPGeneralDiagnosticsBootReasonTypeSoftwareReset = 0x06, }; -typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsHardwareFaultType) { +typedef NS_ENUM(uint8_t, CHIPGeneralDiagnosticsHardwareFaultType) { CHIPGeneralDiagnosticsHardwareFaultTypeUnspecified = 0x00, CHIPGeneralDiagnosticsHardwareFaultTypeRadio = 0x01, CHIPGeneralDiagnosticsHardwareFaultTypeSensor = 0x02, @@ -15250,7 +15250,7 @@ typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsHardwareFaultType) { CHIPGeneralDiagnosticsHardwareFaultTypeTamperDetected = 0x0A, }; -typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsInterfaceType) { +typedef NS_ENUM(uint8_t, CHIPGeneralDiagnosticsInterfaceType) { CHIPGeneralDiagnosticsInterfaceTypeUnspecified = 0x00, CHIPGeneralDiagnosticsInterfaceTypeWiFi = 0x01, CHIPGeneralDiagnosticsInterfaceTypeEthernet = 0x02, @@ -15258,14 +15258,14 @@ typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsInterfaceType) { CHIPGeneralDiagnosticsInterfaceTypeThread = 0x04, }; -typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsNetworkFaultType) { +typedef NS_ENUM(uint8_t, CHIPGeneralDiagnosticsNetworkFaultType) { CHIPGeneralDiagnosticsNetworkFaultTypeUnspecified = 0x00, CHIPGeneralDiagnosticsNetworkFaultTypeHardwareFailure = 0x01, CHIPGeneralDiagnosticsNetworkFaultTypeNetworkJammed = 0x02, CHIPGeneralDiagnosticsNetworkFaultTypeConnectionFailed = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsRadioFaultType) { +typedef NS_ENUM(uint8_t, CHIPGeneralDiagnosticsRadioFaultType) { CHIPGeneralDiagnosticsRadioFaultTypeUnspecified = 0x00, CHIPGeneralDiagnosticsRadioFaultTypeWiFiFault = 0x01, CHIPGeneralDiagnosticsRadioFaultTypeCellularFault = 0x02, @@ -15275,14 +15275,14 @@ typedef NS_ENUM(NSInteger, CHIPGeneralDiagnosticsRadioFaultType) { CHIPGeneralDiagnosticsRadioFaultTypeEthernetFault = 0x06, }; -typedef NS_ENUM(NSInteger, CHIPThreadNetworkDiagnosticsNetworkFault) { +typedef NS_ENUM(uint8_t, CHIPThreadNetworkDiagnosticsNetworkFault) { CHIPThreadNetworkDiagnosticsNetworkFaultUnspecified = 0x00, CHIPThreadNetworkDiagnosticsNetworkFaultLinkDown = 0x01, CHIPThreadNetworkDiagnosticsNetworkFaultHardwareFailure = 0x02, CHIPThreadNetworkDiagnosticsNetworkFaultNetworkJammed = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPThreadNetworkDiagnosticsRoutingRole) { +typedef NS_ENUM(uint8_t, CHIPThreadNetworkDiagnosticsRoutingRole) { CHIPThreadNetworkDiagnosticsRoutingRoleUnspecified = 0x00, CHIPThreadNetworkDiagnosticsRoutingRoleUnassigned = 0x01, CHIPThreadNetworkDiagnosticsRoutingRoleSleepyEndDevice = 0x02, @@ -15292,26 +15292,26 @@ typedef NS_ENUM(NSInteger, CHIPThreadNetworkDiagnosticsRoutingRole) { CHIPThreadNetworkDiagnosticsRoutingRoleLeader = 0x06, }; -typedef NS_ENUM(NSInteger, CHIPThreadNetworkDiagnosticsThreadConnectionStatus) { +typedef NS_ENUM(uint8_t, CHIPThreadNetworkDiagnosticsThreadConnectionStatus) { CHIPThreadNetworkDiagnosticsThreadConnectionStatusConnected = 0x00, CHIPThreadNetworkDiagnosticsThreadConnectionStatusNotConnected = 0x01, }; -typedef NS_OPTIONS(NSUInteger, CHIPThreadNetworkDiagnosticsFeature) { +typedef NS_OPTIONS(uint32_t, CHIPThreadNetworkDiagnosticsFeature) { CHIPThreadNetworkDiagnosticsFeaturePacketCounts = 0x1, CHIPThreadNetworkDiagnosticsFeatureErrorCounts = 0x2, CHIPThreadNetworkDiagnosticsFeatureMLECounts = 0x4, CHIPThreadNetworkDiagnosticsFeatureMACCounts = 0x8, }; -typedef NS_ENUM(NSInteger, CHIPWiFiNetworkDiagnosticsAssociationFailureCause) { +typedef NS_ENUM(uint8_t, CHIPWiFiNetworkDiagnosticsAssociationFailureCause) { CHIPWiFiNetworkDiagnosticsAssociationFailureCauseUnknown = 0x00, CHIPWiFiNetworkDiagnosticsAssociationFailureCauseAssociationFailed = 0x01, CHIPWiFiNetworkDiagnosticsAssociationFailureCauseAuthenticationFailed = 0x02, CHIPWiFiNetworkDiagnosticsAssociationFailureCauseSsidNotFound = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPWiFiNetworkDiagnosticsSecurityType) { +typedef NS_ENUM(uint8_t, CHIPWiFiNetworkDiagnosticsSecurityType) { CHIPWiFiNetworkDiagnosticsSecurityTypeUnspecified = 0x00, CHIPWiFiNetworkDiagnosticsSecurityTypeNone = 0x01, CHIPWiFiNetworkDiagnosticsSecurityTypeWEP = 0x02, @@ -15320,12 +15320,12 @@ typedef NS_ENUM(NSInteger, CHIPWiFiNetworkDiagnosticsSecurityType) { CHIPWiFiNetworkDiagnosticsSecurityTypeWPA3 = 0x05, }; -typedef NS_ENUM(NSInteger, CHIPWiFiNetworkDiagnosticsWiFiConnectionStatus) { +typedef NS_ENUM(uint8_t, CHIPWiFiNetworkDiagnosticsWiFiConnectionStatus) { CHIPWiFiNetworkDiagnosticsWiFiConnectionStatusConnected = 0x00, CHIPWiFiNetworkDiagnosticsWiFiConnectionStatusNotConnected = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPWiFiNetworkDiagnosticsWiFiVersionType) { +typedef NS_ENUM(uint8_t, CHIPWiFiNetworkDiagnosticsWiFiVersionType) { CHIPWiFiNetworkDiagnosticsWiFiVersionType80211a = 0x00, CHIPWiFiNetworkDiagnosticsWiFiVersionType80211b = 0x01, CHIPWiFiNetworkDiagnosticsWiFiVersionType80211g = 0x02, @@ -15334,7 +15334,7 @@ typedef NS_ENUM(NSInteger, CHIPWiFiNetworkDiagnosticsWiFiVersionType) { CHIPWiFiNetworkDiagnosticsWiFiVersionType80211ax = 0x05, }; -typedef NS_ENUM(NSInteger, CHIPEthernetNetworkDiagnosticsPHYRateType) { +typedef NS_ENUM(uint8_t, CHIPEthernetNetworkDiagnosticsPHYRateType) { CHIPEthernetNetworkDiagnosticsPHYRateType10M = 0x00, CHIPEthernetNetworkDiagnosticsPHYRateType100M = 0x01, CHIPEthernetNetworkDiagnosticsPHYRateType1000M = 0x02, @@ -15347,19 +15347,19 @@ typedef NS_ENUM(NSInteger, CHIPEthernetNetworkDiagnosticsPHYRateType) { CHIPEthernetNetworkDiagnosticsPHYRateType400G = 0x09, }; -typedef NS_ENUM(NSInteger, CHIPAdministratorCommissioningCommissioningWindowStatus) { +typedef NS_ENUM(uint8_t, CHIPAdministratorCommissioningCommissioningWindowStatus) { CHIPAdministratorCommissioningCommissioningWindowStatusWindowNotOpen = 0x00, CHIPAdministratorCommissioningCommissioningWindowStatusEnhancedWindowOpen = 0x01, CHIPAdministratorCommissioningCommissioningWindowStatusBasicWindowOpen = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPAdministratorCommissioningStatusCode) { +typedef NS_ENUM(uint8_t, CHIPAdministratorCommissioningStatusCode) { CHIPAdministratorCommissioningStatusCodeBusy = 0x01, CHIPAdministratorCommissioningStatusCodePAKEParameterError = 0x02, CHIPAdministratorCommissioningStatusCodeWindowNotOpen = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPOperationalCredentialsOperationalCertStatus) { +typedef NS_ENUM(uint8_t, CHIPOperationalCredentialsOperationalCertStatus) { CHIPOperationalCredentialsOperationalCertStatusSUCCESS = 0x00, CHIPOperationalCredentialsOperationalCertStatusInvalidPublicKey = 0x01, CHIPOperationalCredentialsOperationalCertStatusInvalidNodeOpId = 0x02, @@ -15372,12 +15372,12 @@ typedef NS_ENUM(NSInteger, CHIPOperationalCredentialsOperationalCertStatus) { CHIPOperationalCredentialsOperationalCertStatusInvalidFabricIndex = 0x0B, }; -typedef NS_ENUM(NSInteger, CHIPGroupKeyManagementGroupKeySecurityPolicy) { +typedef NS_ENUM(uint8_t, CHIPGroupKeyManagementGroupKeySecurityPolicy) { CHIPGroupKeyManagementGroupKeySecurityPolicyTrustFirst = 0x00, CHIPGroupKeyManagementGroupKeySecurityPolicyCacheAndSync = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlAlarmCode) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlAlarmCode) { CHIPDoorLockDlAlarmCodeLockJammed = 0x00, CHIPDoorLockDlAlarmCodeLockFactoryReset = 0x01, CHIPDoorLockDlAlarmCodeLockRadioPowerCycled = 0x03, @@ -15388,13 +15388,13 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlAlarmCode) { CHIPDoorLockDlAlarmCodeForcedUser = 0x08, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlCredentialRule) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlCredentialRule) { CHIPDoorLockDlCredentialRuleSingle = 0x00, CHIPDoorLockDlCredentialRuleDouble = 0x01, CHIPDoorLockDlCredentialRuleTri = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlCredentialType) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlCredentialType) { CHIPDoorLockDlCredentialTypeProgrammingPIN = 0x00, CHIPDoorLockDlCredentialTypePIN = 0x01, CHIPDoorLockDlCredentialTypeRFID = 0x02, @@ -15403,13 +15403,13 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlCredentialType) { CHIPDoorLockDlCredentialTypeFace = 0x05, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlDataOperationType) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlDataOperationType) { CHIPDoorLockDlDataOperationTypeAdd = 0x00, CHIPDoorLockDlDataOperationTypeClear = 0x01, CHIPDoorLockDlDataOperationTypeModify = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlDoorState) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlDoorState) { CHIPDoorLockDlDoorStateDoorOpen = 0x00, CHIPDoorLockDlDoorStateDoorClosed = 0x01, CHIPDoorLockDlDoorStateDoorJammed = 0x02, @@ -15418,7 +15418,7 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlDoorState) { CHIPDoorLockDlDoorStateDoorAjar = 0x05, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlLockDataType) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlLockDataType) { CHIPDoorLockDlLockDataTypeUnspecified = 0x00, CHIPDoorLockDlLockDataTypeProgrammingCode = 0x01, CHIPDoorLockDlLockDataTypeUserIndex = 0x02, @@ -15430,20 +15430,20 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlLockDataType) { CHIPDoorLockDlLockDataTypeFingerprint = 0x08, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlLockOperationType) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlLockOperationType) { CHIPDoorLockDlLockOperationTypeLock = 0x00, CHIPDoorLockDlLockOperationTypeUnlock = 0x01, CHIPDoorLockDlLockOperationTypeNonAccessUserEvent = 0x02, CHIPDoorLockDlLockOperationTypeForcedUserEvent = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlLockState) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlLockState) { CHIPDoorLockDlLockStateNotFullyLocked = 0x00, CHIPDoorLockDlLockStateLocked = 0x01, CHIPDoorLockDlLockStateUnlocked = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlLockType) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlLockType) { CHIPDoorLockDlLockTypeDeadBolt = 0x00, CHIPDoorLockDlLockTypeMagnetic = 0x01, CHIPDoorLockDlLockTypeOther = 0x02, @@ -15457,7 +15457,7 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlLockType) { CHIPDoorLockDlLockTypeDoorFurniture = 0x0A, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlOperatingMode) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlOperatingMode) { CHIPDoorLockDlOperatingModeNormal = 0x00, CHIPDoorLockDlOperatingModeVacation = 0x01, CHIPDoorLockDlOperatingModePrivacy = 0x02, @@ -15465,7 +15465,7 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlOperatingMode) { CHIPDoorLockDlOperatingModePassage = 0x04, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlOperationError) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlOperationError) { CHIPDoorLockDlOperationErrorUnspecified = 0x00, CHIPDoorLockDlOperationErrorInvalidCredential = 0x01, CHIPDoorLockDlOperationErrorDisabledUserDenied = 0x02, @@ -15473,7 +15473,7 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlOperationError) { CHIPDoorLockDlOperationErrorInsufficientBattery = 0x04, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlOperationSource) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlOperationSource) { CHIPDoorLockDlOperationSourceUnspecified = 0x00, CHIPDoorLockDlOperationSourceManual = 0x01, CHIPDoorLockDlOperationSourceProprietaryRemote = 0x02, @@ -15486,7 +15486,7 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlOperationSource) { CHIPDoorLockDlOperationSourceBiometric = 0x09, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlStatus) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlStatus) { CHIPDoorLockDlStatusSuccess = 0x00, CHIPDoorLockDlStatusFailure = 0x01, CHIPDoorLockDlStatusDuplicate = 0x02, @@ -15495,13 +15495,13 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlStatus) { CHIPDoorLockDlStatusNotFound = 0x8B, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlUserStatus) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlUserStatus) { CHIPDoorLockDlUserStatusAvailable = 0x00, CHIPDoorLockDlUserStatusOccupiedEnabled = 0x01, CHIPDoorLockDlUserStatusOccupiedDisabled = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockDlUserType) { +typedef NS_ENUM(uint8_t, CHIPDoorLockDlUserType) { CHIPDoorLockDlUserTypeUnrestrictedUser = 0x00, CHIPDoorLockDlUserTypeYearDayScheduleUser = 0x01, CHIPDoorLockDlUserTypeWeekDayScheduleUser = 0x02, @@ -15514,7 +15514,7 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockDlUserType) { CHIPDoorLockDlUserTypeRemoteOnlyUser = 0x09, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockOperationEventCode) { +typedef NS_ENUM(uint8_t, CHIPDoorLockOperationEventCode) { CHIPDoorLockOperationEventCodeUnknownOrMfgSpecific = 0x00, CHIPDoorLockOperationEventCodeLock = 0x01, CHIPDoorLockOperationEventCodeUnlock = 0x02, @@ -15532,7 +15532,7 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockOperationEventCode) { CHIPDoorLockOperationEventCodeManualUnlock = 0x0E, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockProgrammingEventCode) { +typedef NS_ENUM(uint8_t, CHIPDoorLockProgrammingEventCode) { CHIPDoorLockProgrammingEventCodeUnknownOrMfgSpecific = 0x00, CHIPDoorLockProgrammingEventCodeMasterCodeChanged = 0x01, CHIPDoorLockProgrammingEventCodePinAdded = 0x02, @@ -15542,21 +15542,21 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockProgrammingEventCode) { CHIPDoorLockProgrammingEventCodeIdDeleted = 0x06, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockSetPinOrIdStatus) { +typedef NS_ENUM(uint8_t, CHIPDoorLockSetPinOrIdStatus) { CHIPDoorLockSetPinOrIdStatusSuccess = 0x00, CHIPDoorLockSetPinOrIdStatusGeneralFailure = 0x01, CHIPDoorLockSetPinOrIdStatusMemoryFull = 0x02, CHIPDoorLockSetPinOrIdStatusDuplicateCodeError = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockUserStatus) { +typedef NS_ENUM(uint8_t, CHIPDoorLockUserStatus) { CHIPDoorLockUserStatusAvailable = 0x00, CHIPDoorLockUserStatusOccupiedEnabled = 0x01, CHIPDoorLockUserStatusOccupiedDisabled = 0x03, CHIPDoorLockUserStatusNotSupported = 0xFF, }; -typedef NS_ENUM(NSInteger, CHIPDoorLockUserType) { +typedef NS_ENUM(uint8_t, CHIPDoorLockUserType) { CHIPDoorLockUserTypeUnrestricted = 0x00, CHIPDoorLockUserTypeYearDayScheduleUser = 0x01, CHIPDoorLockUserTypeWeekDayScheduleUser = 0x02, @@ -15565,7 +15565,7 @@ typedef NS_ENUM(NSInteger, CHIPDoorLockUserType) { CHIPDoorLockUserTypeNotSupported = 0xFF, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlAlarmMask) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlAlarmMask) { CHIPDoorLockDlAlarmMaskLockingMechanismJammed = 0x1, CHIPDoorLockDlAlarmMaskLockResetToFactoryDefaults = 0x2, CHIPDoorLockDlAlarmMaskReserved = 0x4, @@ -15575,13 +15575,19 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlAlarmMask) { CHIPDoorLockDlAlarmMaskForcedDoorOpenUnderDoorLockedCondition = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlCredentialRulesSupport) { +typedef NS_OPTIONS(uint8_t, CHIPDoorLockDlCredentialRuleMask) { + CHIPDoorLockDlCredentialRuleMaskSingle = 0x1, + CHIPDoorLockDlCredentialRuleMaskDual = 0x2, + CHIPDoorLockDlCredentialRuleMaskTri = 0x4, +}; + +typedef NS_OPTIONS(uint8_t, CHIPDoorLockDlCredentialRulesSupport) { CHIPDoorLockDlCredentialRulesSupportSingle = 0x1, CHIPDoorLockDlCredentialRulesSupportDual = 0x2, CHIPDoorLockDlCredentialRulesSupportTri = 0x4, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlDaysMaskMap) { +typedef NS_OPTIONS(uint8_t, CHIPDoorLockDlDaysMaskMap) { CHIPDoorLockDlDaysMaskMapSunday = 0x1, CHIPDoorLockDlDaysMaskMapMonday = 0x2, CHIPDoorLockDlDaysMaskMapTuesday = 0x4, @@ -15591,7 +15597,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlDaysMaskMap) { CHIPDoorLockDlDaysMaskMapSaturday = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlDefaultConfigurationRegister) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlDefaultConfigurationRegister) { CHIPDoorLockDlDefaultConfigurationRegisterEnableLocalProgrammingEnabled = 0x1, CHIPDoorLockDlDefaultConfigurationRegisterKeypadInterfaceDefaultAccessEnabled = 0x2, CHIPDoorLockDlDefaultConfigurationRegisterRemoteInterfaceDefaultAccessIsEnabled = 0x4, @@ -15600,7 +15606,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlDefaultConfigurationRegister) { CHIPDoorLockDlDefaultConfigurationRegisterLEDSettingsSet = 0x80, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlKeypadOperationEventMask) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlKeypadOperationEventMask) { CHIPDoorLockDlKeypadOperationEventMaskUnknown = 0x1, CHIPDoorLockDlKeypadOperationEventMaskLock = 0x2, CHIPDoorLockDlKeypadOperationEventMaskUnlock = 0x4, @@ -15611,7 +15617,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlKeypadOperationEventMask) { CHIPDoorLockDlKeypadOperationEventMaskNonAccessUserOpEvent = 0x80, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlKeypadProgrammingEventMask) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlKeypadProgrammingEventMask) { CHIPDoorLockDlKeypadProgrammingEventMaskUnknown = 0x1, CHIPDoorLockDlKeypadProgrammingEventMaskProgrammingPINChanged = 0x2, CHIPDoorLockDlKeypadProgrammingEventMaskPINAdded = 0x4, @@ -15619,14 +15625,14 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlKeypadProgrammingEventMask) { CHIPDoorLockDlKeypadProgrammingEventMaskPINChanged = 0x10, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlLocalProgrammingFeatures) { +typedef NS_OPTIONS(uint8_t, CHIPDoorLockDlLocalProgrammingFeatures) { CHIPDoorLockDlLocalProgrammingFeaturesAddUsersCredentialsSchedulesLocally = 0x1, CHIPDoorLockDlLocalProgrammingFeaturesModifyUsersCredentialsSchedulesLocally = 0x2, CHIPDoorLockDlLocalProgrammingFeaturesClearUsersCredentialsSchedulesLocally = 0x4, CHIPDoorLockDlLocalProgrammingFeaturesAdjustLockSettingsLocally = 0x8, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlManualOperationEventMask) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlManualOperationEventMask) { CHIPDoorLockDlManualOperationEventMaskUnknown = 0x1, CHIPDoorLockDlManualOperationEventMaskThumbturnLock = 0x2, CHIPDoorLockDlManualOperationEventMaskThumbturnUnlock = 0x4, @@ -15640,7 +15646,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlManualOperationEventMask) { CHIPDoorLockDlManualOperationEventMaskManualUnlock = 0x400, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlRFIDOperationEventMask) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlRFIDOperationEventMask) { CHIPDoorLockDlRFIDOperationEventMaskUnknown = 0x1, CHIPDoorLockDlRFIDOperationEventMaskLock = 0x2, CHIPDoorLockDlRFIDOperationEventMaskUnlock = 0x4, @@ -15650,13 +15656,13 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlRFIDOperationEventMask) { CHIPDoorLockDlRFIDOperationEventMaskUnlockInvalidSchedule = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlRFIDProgrammingEventMask) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlRFIDProgrammingEventMask) { CHIPDoorLockDlRFIDProgrammingEventMaskUnknown = 0x1, CHIPDoorLockDlRFIDProgrammingEventMaskRFIDCodeAdded = 0x20, CHIPDoorLockDlRFIDProgrammingEventMaskRFIDCodeCleared = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlRemoteOperationEventMask) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlRemoteOperationEventMask) { CHIPDoorLockDlRemoteOperationEventMaskUnknown = 0x1, CHIPDoorLockDlRemoteOperationEventMaskLock = 0x2, CHIPDoorLockDlRemoteOperationEventMaskUnlock = 0x4, @@ -15666,7 +15672,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlRemoteOperationEventMask) { CHIPDoorLockDlRemoteOperationEventMaskUnlockInvalidSchedule = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlRemoteProgrammingEventMask) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlRemoteProgrammingEventMask) { CHIPDoorLockDlRemoteProgrammingEventMaskUnknown = 0x1, CHIPDoorLockDlRemoteProgrammingEventMaskProgrammingPINChanged = 0x2, CHIPDoorLockDlRemoteProgrammingEventMaskPINAdded = 0x4, @@ -15676,7 +15682,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlRemoteProgrammingEventMask) { CHIPDoorLockDlRemoteProgrammingEventMaskRFIDCodeCleared = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlSupportedOperatingModes) { +typedef NS_OPTIONS(uint16_t, CHIPDoorLockDlSupportedOperatingModes) { CHIPDoorLockDlSupportedOperatingModesNormal = 0x1, CHIPDoorLockDlSupportedOperatingModesVacation = 0x2, CHIPDoorLockDlSupportedOperatingModesPrivacy = 0x4, @@ -15684,7 +15690,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDlSupportedOperatingModes) { CHIPDoorLockDlSupportedOperatingModesPassage = 0x10, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDayOfWeek) { +typedef NS_OPTIONS(uint8_t, CHIPDoorLockDayOfWeek) { CHIPDoorLockDayOfWeekSunday = 0x1, CHIPDoorLockDayOfWeekMonday = 0x2, CHIPDoorLockDayOfWeekTuesday = 0x4, @@ -15694,7 +15700,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockDayOfWeek) { CHIPDoorLockDayOfWeekSaturday = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPDoorLockFeature) { +typedef NS_OPTIONS(uint32_t, CHIPDoorLockFeature) { CHIPDoorLockFeaturePINCredentials = 0x1, CHIPDoorLockFeatureRFIDCredentials = 0x2, CHIPDoorLockFeatureFingerCredentials = 0x4, @@ -15707,7 +15713,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPDoorLockFeature) { CHIPDoorLockFeatureNotifications = 0x200, }; -typedef NS_OPTIONS(NSUInteger, CHIPWindowCoveringWcConfigStatus) { +typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringWcConfigStatus) { CHIPWindowCoveringWcConfigStatusOperational = 0x1, CHIPWindowCoveringWcConfigStatusOnline = 0x2, CHIPWindowCoveringWcConfigStatusOpenAndUpCommandsReversed = 0x4, @@ -15717,7 +15723,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPWindowCoveringWcConfigStatus) { CHIPWindowCoveringWcConfigStatusTiltEncoderControlled = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPWindowCoveringWcFeature) { +typedef NS_OPTIONS(uint32_t, CHIPWindowCoveringWcFeature) { CHIPWindowCoveringWcFeatureLift = 0x1, CHIPWindowCoveringWcFeatureTilt = 0x2, CHIPWindowCoveringWcFeaturePositionAwareLift = 0x4, @@ -15725,20 +15731,20 @@ typedef NS_OPTIONS(NSUInteger, CHIPWindowCoveringWcFeature) { CHIPWindowCoveringWcFeaturePositionAwareTilt = 0x10, }; -typedef NS_OPTIONS(NSUInteger, CHIPWindowCoveringWcMode) { +typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringWcMode) { CHIPWindowCoveringWcModeMotorDirectionReversed = 0x1, CHIPWindowCoveringWcModeCalibrationMode = 0x2, CHIPWindowCoveringWcModeMaintenanceMode = 0x4, CHIPWindowCoveringWcModeLEDFeedback = 0x8, }; -typedef NS_OPTIONS(NSUInteger, CHIPWindowCoveringWcOperationalStatus) { +typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringWcOperationalStatus) { CHIPWindowCoveringWcOperationalStatusGlobal = 0x3, CHIPWindowCoveringWcOperationalStatusLift = 0xC, CHIPWindowCoveringWcOperationalStatusTilt = 0x30, }; -typedef NS_OPTIONS(NSUInteger, CHIPWindowCoveringWcSafetyStatus) { +typedef NS_OPTIONS(uint16_t, CHIPWindowCoveringWcSafetyStatus) { CHIPWindowCoveringWcSafetyStatusRemoteLockout = 0x1, CHIPWindowCoveringWcSafetyStatusTamperDetection = 0x2, CHIPWindowCoveringWcSafetyStatusFailedCommunication = 0x4, @@ -15753,7 +15759,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPWindowCoveringWcSafetyStatus) { CHIPWindowCoveringWcSafetyStatusProtection = 0x800, }; -typedef NS_ENUM(NSInteger, CHIPPumpConfigurationAndControlPumpControlMode) { +typedef NS_ENUM(uint8_t, CHIPPumpConfigurationAndControlPumpControlMode) { CHIPPumpConfigurationAndControlPumpControlModeConstantSpeed = 0x00, CHIPPumpConfigurationAndControlPumpControlModeConstantPressure = 0x01, CHIPPumpConfigurationAndControlPumpControlModeProportionalPressure = 0x02, @@ -15762,14 +15768,14 @@ typedef NS_ENUM(NSInteger, CHIPPumpConfigurationAndControlPumpControlMode) { CHIPPumpConfigurationAndControlPumpControlModeAutomatic = 0x07, }; -typedef NS_ENUM(NSInteger, CHIPPumpConfigurationAndControlPumpOperationMode) { +typedef NS_ENUM(uint8_t, CHIPPumpConfigurationAndControlPumpOperationMode) { CHIPPumpConfigurationAndControlPumpOperationModeNormal = 0x00, CHIPPumpConfigurationAndControlPumpOperationModeMinimum = 0x01, CHIPPumpConfigurationAndControlPumpOperationModeMaximum = 0x02, CHIPPumpConfigurationAndControlPumpOperationModeLocal = 0x03, }; -typedef NS_OPTIONS(NSUInteger, CHIPPumpConfigurationAndControlPumpStatus) { +typedef NS_OPTIONS(uint16_t, CHIPPumpConfigurationAndControlPumpStatus) { CHIPPumpConfigurationAndControlPumpStatusDeviceFault = 0x1, CHIPPumpConfigurationAndControlPumpStatusSupplyfault = 0x2, CHIPPumpConfigurationAndControlPumpStatusSpeedLow = 0x4, @@ -15781,13 +15787,13 @@ typedef NS_OPTIONS(NSUInteger, CHIPPumpConfigurationAndControlPumpStatus) { CHIPPumpConfigurationAndControlPumpStatusRemoteTemperature = 0x100, }; -typedef NS_ENUM(NSInteger, CHIPThermostatSetpointAdjustMode) { +typedef NS_ENUM(uint8_t, CHIPThermostatSetpointAdjustMode) { CHIPThermostatSetpointAdjustModeHeatSetpoint = 0x00, CHIPThermostatSetpointAdjustModeCoolSetpoint = 0x01, CHIPThermostatSetpointAdjustModeHeatAndCoolSetpoints = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPThermostatControlSequence) { +typedef NS_ENUM(uint8_t, CHIPThermostatControlSequence) { CHIPThermostatControlSequenceCoolingOnly = 0x00, CHIPThermostatControlSequenceCoolingWithReheat = 0x01, CHIPThermostatControlSequenceHeatingOnly = 0x02, @@ -15796,13 +15802,13 @@ typedef NS_ENUM(NSInteger, CHIPThermostatControlSequence) { CHIPThermostatControlSequenceCoolingAndHeatingWithReheat = 0x05, }; -typedef NS_ENUM(NSInteger, CHIPThermostatRunningMode) { +typedef NS_ENUM(uint8_t, CHIPThermostatRunningMode) { CHIPThermostatRunningModeOff = 0x00, CHIPThermostatRunningModeCool = 0x03, CHIPThermostatRunningModeHeat = 0x04, }; -typedef NS_ENUM(NSInteger, CHIPThermostatSystemMode) { +typedef NS_ENUM(uint8_t, CHIPThermostatSystemMode) { CHIPThermostatSystemModeOff = 0x00, CHIPThermostatSystemModeAuto = 0x01, CHIPThermostatSystemModeCool = 0x03, @@ -15812,7 +15818,7 @@ typedef NS_ENUM(NSInteger, CHIPThermostatSystemMode) { CHIPThermostatSystemModeFanOnly = 0x07, }; -typedef NS_OPTIONS(NSUInteger, CHIPThermostatDayOfWeek) { +typedef NS_OPTIONS(uint8_t, CHIPThermostatDayOfWeek) { CHIPThermostatDayOfWeekSunday = 0x1, CHIPThermostatDayOfWeekMonday = 0x2, CHIPThermostatDayOfWeekTuesday = 0x4, @@ -15823,12 +15829,12 @@ typedef NS_OPTIONS(NSUInteger, CHIPThermostatDayOfWeek) { CHIPThermostatDayOfWeekAwayOrVacation = 0x80, }; -typedef NS_OPTIONS(NSUInteger, CHIPThermostatModeForSequence) { +typedef NS_OPTIONS(uint8_t, CHIPThermostatModeForSequence) { CHIPThermostatModeForSequenceHeatSetpointFieldPresent = 0x1, CHIPThermostatModeForSequenceCoolSetpointFieldPresent = 0x2, }; -typedef NS_OPTIONS(NSUInteger, CHIPThermostatFeature) { +typedef NS_OPTIONS(uint32_t, CHIPThermostatFeature) { CHIPThermostatFeatureHeating = 0x1, CHIPThermostatFeatureCooling = 0x2, CHIPThermostatFeatureOccupancy = 0x4, @@ -15837,53 +15843,53 @@ typedef NS_OPTIONS(NSUInteger, CHIPThermostatFeature) { CHIPThermostatFeatureAutomode = 0x20, }; -typedef NS_ENUM(NSInteger, CHIPColorControlColorLoopAction) { +typedef NS_ENUM(uint8_t, CHIPColorControlColorLoopAction) { CHIPColorControlColorLoopActionDeactivate = 0x00, CHIPColorControlColorLoopActionActivateFromColorLoopStartEnhancedHue = 0x01, CHIPColorControlColorLoopActionActivateFromEnhancedCurrentHue = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPColorControlColorLoopDirection) { +typedef NS_ENUM(uint8_t, CHIPColorControlColorLoopDirection) { CHIPColorControlColorLoopDirectionDecrementHue = 0x00, CHIPColorControlColorLoopDirectionIncrementHue = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPColorControlColorMode) { +typedef NS_ENUM(uint8_t, CHIPColorControlColorMode) { CHIPColorControlColorModeCurrentHueAndCurrentSaturation = 0x00, CHIPColorControlColorModeCurrentXAndCurrentY = 0x01, CHIPColorControlColorModeColorTemperature = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPColorControlHueDirection) { +typedef NS_ENUM(uint8_t, CHIPColorControlHueDirection) { CHIPColorControlHueDirectionShortestDistance = 0x00, CHIPColorControlHueDirectionLongestDistance = 0x01, CHIPColorControlHueDirectionUp = 0x02, CHIPColorControlHueDirectionDown = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPColorControlHueMoveMode) { +typedef NS_ENUM(uint8_t, CHIPColorControlHueMoveMode) { CHIPColorControlHueMoveModeStop = 0x00, CHIPColorControlHueMoveModeUp = 0x01, CHIPColorControlHueMoveModeDown = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPColorControlHueStepMode) { +typedef NS_ENUM(uint8_t, CHIPColorControlHueStepMode) { CHIPColorControlHueStepModeUp = 0x01, CHIPColorControlHueStepModeDown = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPColorControlSaturationMoveMode) { +typedef NS_ENUM(uint8_t, CHIPColorControlSaturationMoveMode) { CHIPColorControlSaturationMoveModeStop = 0x00, CHIPColorControlSaturationMoveModeUp = 0x01, CHIPColorControlSaturationMoveModeDown = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPColorControlSaturationStepMode) { +typedef NS_ENUM(uint8_t, CHIPColorControlSaturationStepMode) { CHIPColorControlSaturationStepModeUp = 0x01, CHIPColorControlSaturationStepModeDown = 0x03, }; -typedef NS_OPTIONS(NSUInteger, CHIPColorControlColorCapabilities) { +typedef NS_OPTIONS(uint16_t, CHIPColorControlColorCapabilities) { CHIPColorControlColorCapabilitiesHueSaturationSupported = 0x1, CHIPColorControlColorCapabilitiesEnhancedHueSupported = 0x2, CHIPColorControlColorCapabilitiesColorLoopSupported = 0x4, @@ -15891,30 +15897,30 @@ typedef NS_OPTIONS(NSUInteger, CHIPColorControlColorCapabilities) { CHIPColorControlColorCapabilitiesColorTemperatureSupported = 0x10, }; -typedef NS_OPTIONS(NSUInteger, CHIPColorControlColorLoopUpdateFlags) { +typedef NS_OPTIONS(uint8_t, CHIPColorControlColorLoopUpdateFlags) { CHIPColorControlColorLoopUpdateFlagsUpdateAction = 0x1, CHIPColorControlColorLoopUpdateFlagsUpdateDirection = 0x2, CHIPColorControlColorLoopUpdateFlagsUpdateTime = 0x4, CHIPColorControlColorLoopUpdateFlagsUpdateStartHue = 0x8, }; -typedef NS_ENUM(NSInteger, CHIPIlluminanceMeasurementLightSensorType) { +typedef NS_ENUM(uint8_t, CHIPIlluminanceMeasurementLightSensorType) { CHIPIlluminanceMeasurementLightSensorTypePhotodiode = 0x00, CHIPIlluminanceMeasurementLightSensorTypeCMOS = 0x01, }; -typedef NS_OPTIONS(NSUInteger, CHIPPressureMeasurementPressureFeature) { +typedef NS_OPTIONS(uint32_t, CHIPPressureMeasurementPressureFeature) { CHIPPressureMeasurementPressureFeatureEXT = 0x1, }; -typedef NS_ENUM(NSInteger, CHIPIasZoneIasEnrollResponseCode) { +typedef NS_ENUM(uint8_t, CHIPIasZoneIasEnrollResponseCode) { CHIPIasZoneIasEnrollResponseCodeSuccess = 0x00, CHIPIasZoneIasEnrollResponseCodeNotSupported = 0x01, CHIPIasZoneIasEnrollResponseCodeNoEnrollPermit = 0x02, CHIPIasZoneIasEnrollResponseCodeTooManyZones = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPIasZoneType) { +typedef NS_ENUM(uint16_t, CHIPIasZoneType) { CHIPIasZoneTypeStandardCie = 0x00, CHIPIasZoneTypeMotionSensor = 0x0D, CHIPIasZoneTypeContactSwitch = 0x15, @@ -15933,7 +15939,7 @@ typedef NS_ENUM(NSInteger, CHIPIasZoneType) { CHIPIasZoneTypeInvalidZoneType = 0xFFFF, }; -typedef NS_OPTIONS(NSUInteger, CHIPIasZoneStatus) { +typedef NS_OPTIONS(uint16_t, CHIPIasZoneStatus) { CHIPIasZoneStatusAlarm1 = 0x1, CHIPIasZoneStatusAlarm2 = 0x2, CHIPIasZoneStatusTamper = 0x4, @@ -15946,7 +15952,7 @@ typedef NS_OPTIONS(NSUInteger, CHIPIasZoneStatus) { CHIPIasZoneStatusBatteryDefect = 0x200, }; -typedef NS_ENUM(NSInteger, CHIPIasAceAlarmStatus) { +typedef NS_ENUM(uint8_t, CHIPIasAceAlarmStatus) { CHIPIasAceAlarmStatusNoAlarm = 0x00, CHIPIasAceAlarmStatusBurglar = 0x01, CHIPIasAceAlarmStatusFire = 0x02, @@ -15956,14 +15962,14 @@ typedef NS_ENUM(NSInteger, CHIPIasAceAlarmStatus) { CHIPIasAceAlarmStatusEmergencyPanic = 0x06, }; -typedef NS_ENUM(NSInteger, CHIPIasAceArmMode) { +typedef NS_ENUM(uint8_t, CHIPIasAceArmMode) { CHIPIasAceArmModeDisarm = 0x00, CHIPIasAceArmModeArmDayHomeZonesOnly = 0x01, CHIPIasAceArmModeArmNightSleepZonesOnly = 0x02, CHIPIasAceArmModeArmAllZones = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPIasAceArmNotification) { +typedef NS_ENUM(uint8_t, CHIPIasAceArmNotification) { CHIPIasAceArmNotificationAllZonesDisarmed = 0x00, CHIPIasAceArmNotificationOnlyDayHomeZonesArmed = 0x01, CHIPIasAceArmNotificationOnlyNightSleepZonesArmed = 0x02, @@ -15973,12 +15979,12 @@ typedef NS_ENUM(NSInteger, CHIPIasAceArmNotification) { CHIPIasAceArmNotificationAlreadyDisarmed = 0x06, }; -typedef NS_ENUM(NSInteger, CHIPIasAceAudibleNotification) { +typedef NS_ENUM(uint8_t, CHIPIasAceAudibleNotification) { CHIPIasAceAudibleNotificationMute = 0x00, CHIPIasAceAudibleNotificationDefaultSound = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPIasAceBypassResult) { +typedef NS_ENUM(uint8_t, CHIPIasAceBypassResult) { CHIPIasAceBypassResultZoneBypassed = 0x00, CHIPIasAceBypassResultZoneNotBypassed = 0x01, CHIPIasAceBypassResultNotAllowed = 0x02, @@ -15987,7 +15993,7 @@ typedef NS_ENUM(NSInteger, CHIPIasAceBypassResult) { CHIPIasAceBypassResultInvalidArmDisarmCode = 0x05, }; -typedef NS_ENUM(NSInteger, CHIPIasAcePanelStatus) { +typedef NS_ENUM(uint8_t, CHIPIasAcePanelStatus) { CHIPIasAcePanelStatusPanelDisarmed = 0x00, CHIPIasAcePanelStatusArmedStay = 0x01, CHIPIasAcePanelStatusArmedNight = 0x02, @@ -16001,7 +16007,7 @@ typedef NS_ENUM(NSInteger, CHIPIasAcePanelStatus) { CHIPIasAcePanelStatusArmingAway = 0x0A, }; -typedef NS_ENUM(NSInteger, CHIPIasAceIasZoneType) { +typedef NS_ENUM(uint16_t, CHIPIasAceIasZoneType) { CHIPIasAceIasZoneTypeStandardCie = 0x00, CHIPIasAceIasZoneTypeMotionSensor = 0x0D, CHIPIasAceIasZoneTypeContactSwitch = 0x15, @@ -16020,7 +16026,7 @@ typedef NS_ENUM(NSInteger, CHIPIasAceIasZoneType) { CHIPIasAceIasZoneTypeInvalidZoneType = 0xFFFF, }; -typedef NS_OPTIONS(NSUInteger, CHIPIasAceIasZoneStatus) { +typedef NS_OPTIONS(uint16_t, CHIPIasAceIasZoneStatus) { CHIPIasAceIasZoneStatusAlarm1 = 0x1, CHIPIasAceIasZoneStatusAlarm2 = 0x2, CHIPIasAceIasZoneStatusTamper = 0x4, @@ -16033,47 +16039,47 @@ typedef NS_OPTIONS(NSUInteger, CHIPIasAceIasZoneStatus) { CHIPIasAceIasZoneStatusBatteryDefect = 0x200, }; -typedef NS_OPTIONS(NSUInteger, CHIPIasWdSquawkInfo) { +typedef NS_OPTIONS(uint8_t, CHIPIasWdSquawkInfo) { CHIPIasWdSquawkInfoMode = 0xF0, CHIPIasWdSquawkInfoStrobe = 0x8, CHIPIasWdSquawkInfoLevel = 0x3, }; -typedef NS_OPTIONS(NSUInteger, CHIPIasWdWarningInfo) { +typedef NS_OPTIONS(uint8_t, CHIPIasWdWarningInfo) { CHIPIasWdWarningInfoMode = 0xF0, CHIPIasWdWarningInfoStrobe = 0xC, CHIPIasWdWarningInfoSirenLevel = 0x3, }; -typedef NS_ENUM(NSInteger, CHIPChannelLineupInfoType) { +typedef NS_ENUM(uint8_t, CHIPChannelLineupInfoType) { CHIPChannelLineupInfoTypeMso = 0x00, }; -typedef NS_ENUM(NSInteger, CHIPChannelStatus) { +typedef NS_ENUM(uint8_t, CHIPChannelStatus) { CHIPChannelStatusSuccess = 0x00, CHIPChannelStatusMultipleMatches = 0x01, CHIPChannelStatusNoMatches = 0x02, }; -typedef NS_OPTIONS(NSUInteger, CHIPChannelFeature) { +typedef NS_OPTIONS(uint32_t, CHIPChannelFeature) { CHIPChannelFeatureChannelList = 0x1, CHIPChannelFeatureLineupInfo = 0x2, }; -typedef NS_ENUM(NSInteger, CHIPTargetNavigatorStatus) { +typedef NS_ENUM(uint8_t, CHIPTargetNavigatorStatus) { CHIPTargetNavigatorStatusSuccess = 0x00, CHIPTargetNavigatorStatusTargetNotFound = 0x01, CHIPTargetNavigatorStatusNotAllowed = 0x02, }; -typedef NS_ENUM(NSInteger, CHIPMediaPlaybackPlaybackState) { +typedef NS_ENUM(uint8_t, CHIPMediaPlaybackPlaybackState) { CHIPMediaPlaybackPlaybackStatePlaying = 0x00, CHIPMediaPlaybackPlaybackStatePaused = 0x01, CHIPMediaPlaybackPlaybackStateNotPlaying = 0x02, CHIPMediaPlaybackPlaybackStateBuffering = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPMediaPlaybackStatus) { +typedef NS_ENUM(uint8_t, CHIPMediaPlaybackStatus) { CHIPMediaPlaybackStatusSuccess = 0x00, CHIPMediaPlaybackStatusInvalidStateForCommand = 0x01, CHIPMediaPlaybackStatusNotAllowed = 0x02, @@ -16082,7 +16088,7 @@ typedef NS_ENUM(NSInteger, CHIPMediaPlaybackStatus) { CHIPMediaPlaybackStatusSeekOutOfRange = 0x05, }; -typedef NS_ENUM(NSInteger, CHIPMediaInputInputType) { +typedef NS_ENUM(uint8_t, CHIPMediaInputInputType) { CHIPMediaInputInputTypeInternal = 0x00, CHIPMediaInputInputTypeAux = 0x01, CHIPMediaInputInputTypeCoax = 0x02, @@ -16097,11 +16103,11 @@ typedef NS_ENUM(NSInteger, CHIPMediaInputInputType) { CHIPMediaInputInputTypeOther = 0x0B, }; -typedef NS_OPTIONS(NSUInteger, CHIPMediaInputFeature) { +typedef NS_OPTIONS(uint32_t, CHIPMediaInputFeature) { CHIPMediaInputFeatureNameUpdates = 0x1, }; -typedef NS_ENUM(NSInteger, CHIPKeypadInputCecKeyCode) { +typedef NS_ENUM(uint8_t, CHIPKeypadInputCecKeyCode) { CHIPKeypadInputCecKeyCodeSelect = 0x00, CHIPKeypadInputCecKeyCodeUp = 0x01, CHIPKeypadInputCecKeyCodeDown = 0x02, @@ -16190,24 +16196,24 @@ typedef NS_ENUM(NSInteger, CHIPKeypadInputCecKeyCode) { CHIPKeypadInputCecKeyCodeData = 0x76, }; -typedef NS_ENUM(NSInteger, CHIPKeypadInputStatus) { +typedef NS_ENUM(uint8_t, CHIPKeypadInputStatus) { CHIPKeypadInputStatusSuccess = 0x00, CHIPKeypadInputStatusUnsupportedKey = 0x01, CHIPKeypadInputStatusInvalidKeyInCurrentState = 0x02, }; -typedef NS_OPTIONS(NSUInteger, CHIPKeypadInputFeature) { +typedef NS_OPTIONS(uint32_t, CHIPKeypadInputFeature) { CHIPKeypadInputFeatureNavigationKeyCodes = 0x1, CHIPKeypadInputFeatureLocationKeys = 0x2, CHIPKeypadInputFeatureNumberKeys = 0x4, }; -typedef NS_ENUM(NSInteger, CHIPContentLauncherMetricType) { +typedef NS_ENUM(uint8_t, CHIPContentLauncherMetricType) { CHIPContentLauncherMetricTypePIXELS = 0x00, CHIPContentLauncherMetricTypePERCENTAGE = 0x01, }; -typedef NS_ENUM(NSInteger, CHIPContentLauncherParameter) { +typedef NS_ENUM(uint8_t, CHIPContentLauncherParameter) { CHIPContentLauncherParameterActor = 0x00, CHIPContentLauncherParameterChannel = 0x01, CHIPContentLauncherParameterCharacter = 0x02, @@ -16223,23 +16229,23 @@ typedef NS_ENUM(NSInteger, CHIPContentLauncherParameter) { CHIPContentLauncherParameterType = 0x0C, }; -typedef NS_ENUM(NSInteger, CHIPContentLauncherStatus) { +typedef NS_ENUM(uint8_t, CHIPContentLauncherStatus) { CHIPContentLauncherStatusSuccess = 0x00, CHIPContentLauncherStatusUrlNotAvailable = 0x01, CHIPContentLauncherStatusAuthFailed = 0x02, }; -typedef NS_OPTIONS(NSUInteger, CHIPContentLauncherFeature) { +typedef NS_OPTIONS(uint32_t, CHIPContentLauncherFeature) { CHIPContentLauncherFeatureContentSearch = 0x1, CHIPContentLauncherFeatureURLPlayback = 0x2, }; -typedef NS_OPTIONS(NSUInteger, CHIPContentLauncherSupportedStreamingProtocol) { +typedef NS_OPTIONS(uint32_t, CHIPContentLauncherSupportedStreamingProtocol) { CHIPContentLauncherSupportedStreamingProtocolDASH = 0x1, CHIPContentLauncherSupportedStreamingProtocolHLS = 0x2, }; -typedef NS_ENUM(NSInteger, CHIPAudioOutputOutputType) { +typedef NS_ENUM(uint8_t, CHIPAudioOutputOutputType) { CHIPAudioOutputOutputTypeHdmi = 0x00, CHIPAudioOutputOutputTypeBt = 0x01, CHIPAudioOutputOutputTypeOptical = 0x02, @@ -16248,69 +16254,69 @@ typedef NS_ENUM(NSInteger, CHIPAudioOutputOutputType) { CHIPAudioOutputOutputTypeOther = 0x05, }; -typedef NS_OPTIONS(NSUInteger, CHIPAudioOutputAudiouOutputFeature) { +typedef NS_OPTIONS(uint32_t, CHIPAudioOutputAudiouOutputFeature) { CHIPAudioOutputAudiouOutputFeatureNameUpdates = 0x1, }; -typedef NS_ENUM(NSInteger, CHIPApplicationLauncherStatus) { +typedef NS_ENUM(uint8_t, CHIPApplicationLauncherStatus) { CHIPApplicationLauncherStatusSuccess = 0x00, CHIPApplicationLauncherStatusAppNotAvailable = 0x01, CHIPApplicationLauncherStatusSystemBusy = 0x02, }; -typedef NS_OPTIONS(NSUInteger, CHIPApplicationLauncherFeature) { +typedef NS_OPTIONS(uint32_t, CHIPApplicationLauncherFeature) { CHIPApplicationLauncherFeatureApplicationPlatform = 0x1, }; -typedef NS_ENUM(NSInteger, CHIPApplicationBasicApplicationStatus) { +typedef NS_ENUM(uint8_t, CHIPApplicationBasicApplicationStatus) { CHIPApplicationBasicApplicationStatusStopped = 0x00, CHIPApplicationBasicApplicationStatusActiveVisibleFocus = 0x01, CHIPApplicationBasicApplicationStatusActiveHidden = 0x02, CHIPApplicationBasicApplicationStatusActiveVisibleNotFocus = 0x03, }; -typedef NS_ENUM(NSInteger, CHIPTestClusterSimple) { +typedef NS_ENUM(uint8_t, CHIPTestClusterSimple) { CHIPTestClusterSimpleUnspecified = 0x00, CHIPTestClusterSimpleValueA = 0x01, CHIPTestClusterSimpleValueB = 0x02, CHIPTestClusterSimpleValueC = 0x03, }; -typedef NS_OPTIONS(NSUInteger, CHIPTestClusterBitmap16MaskMap) { +typedef NS_OPTIONS(uint16_t, CHIPTestClusterBitmap16MaskMap) { CHIPTestClusterBitmap16MaskMapMaskVal1 = 0x1, CHIPTestClusterBitmap16MaskMapMaskVal2 = 0x2, CHIPTestClusterBitmap16MaskMapMaskVal3 = 0x4, CHIPTestClusterBitmap16MaskMapMaskVal4 = 0x4000, }; -typedef NS_OPTIONS(NSUInteger, CHIPTestClusterBitmap32MaskMap) { +typedef NS_OPTIONS(uint32_t, CHIPTestClusterBitmap32MaskMap) { CHIPTestClusterBitmap32MaskMapMaskVal1 = 0x1, CHIPTestClusterBitmap32MaskMapMaskVal2 = 0x2, CHIPTestClusterBitmap32MaskMapMaskVal3 = 0x4, CHIPTestClusterBitmap32MaskMapMaskVal4 = 0x40000000, }; -typedef NS_OPTIONS(NSUInteger, CHIPTestClusterBitmap64MaskMap) { +typedef NS_OPTIONS(uint64_t, CHIPTestClusterBitmap64MaskMap) { CHIPTestClusterBitmap64MaskMapMaskVal1 = 0x1, CHIPTestClusterBitmap64MaskMapMaskVal2 = 0x2, CHIPTestClusterBitmap64MaskMapMaskVal3 = 0x4, CHIPTestClusterBitmap64MaskMapMaskVal4 = 0x4000000000000000, }; -typedef NS_OPTIONS(NSUInteger, CHIPTestClusterBitmap8MaskMap) { +typedef NS_OPTIONS(uint8_t, CHIPTestClusterBitmap8MaskMap) { CHIPTestClusterBitmap8MaskMapMaskVal1 = 0x1, CHIPTestClusterBitmap8MaskMapMaskVal2 = 0x2, CHIPTestClusterBitmap8MaskMapMaskVal3 = 0x4, CHIPTestClusterBitmap8MaskMapMaskVal4 = 0x40, }; -typedef NS_OPTIONS(NSUInteger, CHIPTestClusterSimpleBitmap) { +typedef NS_OPTIONS(uint8_t, CHIPTestClusterSimpleBitmap) { CHIPTestClusterSimpleBitmapValueA = 0x1, CHIPTestClusterSimpleBitmapValueB = 0x2, CHIPTestClusterSimpleBitmapValueC = 0x4, }; -typedef NS_ENUM(NSInteger, CHIPMessagingEventId) { +typedef NS_ENUM(uint8_t, CHIPMessagingEventId) { CHIPMessagingEventIdMeterCoverRemoved = 0x00, CHIPMessagingEventIdMeterCoverClosed = 0x01, CHIPMessagingEventIdStrongMagneticField = 0x02, @@ -16394,47 +16400,47 @@ typedef NS_ENUM(NSInteger, CHIPMessagingEventId) { CHIPMessagingEventIdManufacturerSpecificI = 0xE8, }; -typedef NS_ENUM(NSInteger, CHIPMessagingControlConfirmation) { +typedef NS_ENUM(uint8_t, CHIPMessagingControlConfirmation) { CHIPMessagingControlConfirmationNotRequired = 0x00, CHIPMessagingControlConfirmationRequired = 0x80, }; -typedef NS_ENUM(NSInteger, CHIPMessagingControlEnhancedConfirmation) { +typedef NS_ENUM(uint8_t, CHIPMessagingControlEnhancedConfirmation) { CHIPMessagingControlEnhancedConfirmationNotRequired = 0x00, CHIPMessagingControlEnhancedConfirmationRequired = 0x20, }; -typedef NS_ENUM(NSInteger, CHIPMessagingControlImportance) { +typedef NS_ENUM(uint8_t, CHIPMessagingControlImportance) { CHIPMessagingControlImportanceLow = 0x00, CHIPMessagingControlImportanceMedium = 0x04, CHIPMessagingControlImportanceHigh = 0x08, CHIPMessagingControlImportanceCritical = 0x0C, }; -typedef NS_ENUM(NSInteger, CHIPMessagingControlTransmission) { +typedef NS_ENUM(uint8_t, CHIPMessagingControlTransmission) { CHIPMessagingControlTransmissionNormal = 0x00, CHIPMessagingControlTransmissionNormalAndAnonymous = 0x01, CHIPMessagingControlTransmissionAnonymous = 0x02, CHIPMessagingControlTransmissionReserved = 0x03, }; -typedef NS_OPTIONS(NSUInteger, CHIPMessagingConfirmationControl) { +typedef NS_OPTIONS(uint8_t, CHIPMessagingConfirmationControl) { CHIPMessagingConfirmationControlNoReturned = 0x1, CHIPMessagingConfirmationControlYesReturned = 0x2, }; -typedef NS_OPTIONS(NSUInteger, CHIPMessagingControlMask) { +typedef NS_OPTIONS(uint8_t, CHIPMessagingControlMask) { CHIPMessagingControlMaskTransMechanism = 0x3, CHIPMessagingControlMaskMessageUrgency = 0xC, CHIPMessagingControlMaskEnhancedConfirmationRequest = 0x20, CHIPMessagingControlMaskMessageConfirmation = 0x80, }; -typedef NS_OPTIONS(NSUInteger, CHIPMessagingExtendedControlMask) { +typedef NS_OPTIONS(uint8_t, CHIPMessagingExtendedControlMask) { CHIPMessagingExtendedControlMaskMessageConfirmationStatus = 0x1, }; -typedef NS_ENUM(NSInteger, CHIPApplianceEventsAndAlertEventIdentification) { +typedef NS_ENUM(uint8_t, CHIPApplianceEventsAndAlertEventIdentification) { CHIPApplianceEventsAndAlertEventIdentificationEndOfCycle = 0x01, CHIPApplianceEventsAndAlertEventIdentificationTemperatureReached = 0x04, CHIPApplianceEventsAndAlertEventIdentificationEndOfCooking = 0x05, @@ -16442,12 +16448,12 @@ typedef NS_ENUM(NSInteger, CHIPApplianceEventsAndAlertEventIdentification) { CHIPApplianceEventsAndAlertEventIdentificationWrongData = 0x07, }; -typedef NS_OPTIONS(NSUInteger, CHIPApplianceEventsAndAlertAlertCount) { +typedef NS_OPTIONS(uint8_t, CHIPApplianceEventsAndAlertAlertCount) { CHIPApplianceEventsAndAlertAlertCountNumberOfAlerts = 0xF, CHIPApplianceEventsAndAlertAlertCountTypeOfAlert = 0xF0, }; -typedef NS_OPTIONS(NSUInteger, CHIPApplianceEventsAndAlertAlertStructure) { +typedef NS_OPTIONS(uint32_t, CHIPApplianceEventsAndAlertAlertStructure) { CHIPApplianceEventsAndAlertAlertStructureAlertId = 0xFF, CHIPApplianceEventsAndAlertAlertStructureCategory = 0xF00, CHIPApplianceEventsAndAlertAlertStructurePresenceRecovery = 0x3000, diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 508267c609f8c8..a28f9f0cdefd66 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -81,7 +81,6 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPAccessControlClusterAccessControlEntry *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].privilege = static_castmList[i_0].privilege)>>( element_0.privilege.unsignedCharValue); @@ -159,6 +158,7 @@ new CHIPDefaultSuccessCallbackBridge( } } } + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -259,8 +259,8 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPAccessControlClusterExtensionEntry *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].data = [self asByteSpan:element_0.data]; + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -5630,7 +5630,6 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPBindingClusterTargetStruct *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; if (element_0.node != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].node.Emplace(); definedValue_2 = element_0.node.unsignedLongLongValue; @@ -5647,6 +5646,7 @@ new CHIPDefaultSuccessCallbackBridge( auto & definedValue_2 = listHolder_0->mList[i_0].cluster.Emplace(); definedValue_2 = element_0.cluster.unsignedIntValue; } + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -15672,12 +15672,13 @@ new CHIPDoorLockClusterDlOperatingModeAttributeCallbackBridge( - (void)readAttributeSupportedOperatingModesWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); - }); + new CHIPDoorLockSupportedOperatingModesAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); } - (void)subscribeAttributeSupportedOperatingModesWithMinInterval:(NSNumber * _Nonnull)minInterval @@ -15688,7 +15689,7 @@ - (void)subscribeAttributeSupportedOperatingModesWithMinInterval:(NSNumber * _No reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPInt16uAttributeCallbackSubscriptionBridge( + new CHIPDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -15696,11 +15697,11 @@ new CHIPInt16uAttributeCallbackSubscriptionBridge( return CHIP_ERROR_INVALID_ARGUMENT; } using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - CHIPInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + CHIPDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -15713,23 +15714,24 @@ + (void)readAttributeSupportedOperatingModesWithAttributeCache:(CHIPAttributeCac completionHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - if (attributeCacheContainer.cppAttributeCache) { - chip::app::ConcreteAttributePath path; - using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; - path.mEndpointId = static_cast([endpoint unsignedShortValue]); - path.mClusterId = TypeInfo::GetClusterId(); - path.mAttributeId = TypeInfo::GetAttributeId(); - TypeInfo::DecodableType value; - CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); - if (err == CHIP_NO_ERROR) { - successFn->mCall(successFn->mContext, value); + new CHIPDoorLockSupportedOperatingModesAttributeCallbackBridge( + queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; } - return err; - } - return CHIP_ERROR_NOT_FOUND; - }); + return CHIP_ERROR_NOT_FOUND; + }); } - (void)readAttributeEnableOneTouchLockingWithCompletionHandler:(void (^)(NSNumber * _Nullable value, @@ -20952,9 +20954,9 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPGroupKeyManagementClusterGroupKeyMapStruct *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].groupId = element_0.groupId.unsignedShortValue; listHolder_0->mList[i_0].groupKeySetID = element_0.groupKeySetID.unsignedShortValue; + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -42244,7 +42246,6 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPTestClusterClusterTestFabricScoped *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].fabricSensitiveInt8u = element_0.fabricSensitiveInt8u.unsignedCharValue; if (element_0.optionalFabricSensitiveInt8u != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].optionalFabricSensitiveInt8u.Emplace(); @@ -42301,6 +42302,7 @@ new CHIPDefaultSuccessCallbackBridge( listHolder_0->mList[i_0].fabricSensitiveInt8uList = ListType_2(); } } + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h index 566e9d43fa369d..d3a758250b858d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h @@ -62,11 +62,11 @@ NS_ASSUME_NONNULL_BEGIN @end @interface CHIPBindingClusterTargetStruct : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSNumber * _Nullable node; @property (strong, nonatomic) NSNumber * _Nullable group; @property (strong, nonatomic) NSNumber * _Nullable endpoint; @property (strong, nonatomic) NSNumber * _Nullable cluster; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; - (instancetype)init; @end @@ -78,17 +78,17 @@ NS_ASSUME_NONNULL_BEGIN @end @interface CHIPAccessControlClusterAccessControlEntry : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSNumber * _Nonnull privilege; @property (strong, nonatomic) NSNumber * _Nonnull authMode; @property (strong, nonatomic) NSArray * _Nullable subjects; @property (strong, nonatomic) NSArray * _Nullable targets; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; - (instancetype)init; @end @interface CHIPAccessControlClusterExtensionEntry : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSData * _Nonnull data; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; - (instancetype)init; @end @@ -251,34 +251,34 @@ NS_ASSUME_NONNULL_BEGIN @end @interface CHIPOperationalCredentialsClusterFabricDescriptor : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSData * _Nonnull rootPublicKey; @property (strong, nonatomic) NSNumber * _Nonnull vendorId; @property (strong, nonatomic) NSNumber * _Nonnull fabricId; @property (strong, nonatomic) NSNumber * _Nonnull nodeId; @property (strong, nonatomic) NSString * _Nonnull label; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; - (instancetype)init; @end @interface CHIPOperationalCredentialsClusterNOCStruct : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSData * _Nonnull noc; @property (strong, nonatomic) NSData * _Nullable icac; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; - (instancetype)init; @end @interface CHIPGroupKeyManagementClusterGroupInfoMapStruct : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSNumber * _Nonnull groupId; @property (strong, nonatomic) NSArray * _Nonnull endpoints; @property (strong, nonatomic) NSString * _Nullable groupName; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; - (instancetype)init; @end @interface CHIPGroupKeyManagementClusterGroupKeyMapStruct : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSNumber * _Nonnull groupId; @property (strong, nonatomic) NSNumber * _Nonnull groupKeySetID; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; - (instancetype)init; @end @@ -448,7 +448,6 @@ NS_ASSUME_NONNULL_BEGIN @end @interface CHIPTestClusterClusterTestFabricScoped : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSNumber * _Nonnull fabricSensitiveInt8u; @property (strong, nonatomic) NSNumber * _Nullable optionalFabricSensitiveInt8u; @property (strong, nonatomic) NSNumber * _Nullable nullableFabricSensitiveInt8u; @@ -456,6 +455,7 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic) NSString * _Nonnull fabricSensitiveCharString; @property (strong, nonatomic) CHIPTestClusterClusterSimpleStruct * _Nonnull fabricSensitiveStruct; @property (strong, nonatomic) NSArray * _Nonnull fabricSensitiveInt8uList; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; - (instancetype)init; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm index 54ade50b9ccdb5..28257d240eb56e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm @@ -105,8 +105,6 @@ - (instancetype)init { if (self = [super init]) { - _fabricIndex = @(0); - _node = nil; _group = nil; @@ -114,6 +112,8 @@ - (instancetype)init _endpoint = nil; _cluster = nil; + + _fabricIndex = @(0); } return self; } @@ -139,8 +139,6 @@ - (instancetype)init { if (self = [super init]) { - _fabricIndex = @(0); - _privilege = @(0); _authMode = @(0); @@ -148,6 +146,8 @@ - (instancetype)init _subjects = nil; _targets = nil; + + _fabricIndex = @(0); } return self; } @@ -158,9 +158,9 @@ - (instancetype)init { if (self = [super init]) { - _fabricIndex = @(0); - _data = [NSData data]; + + _fabricIndex = @(0); } return self; } @@ -504,8 +504,6 @@ - (instancetype)init { if (self = [super init]) { - _fabricIndex = @(0); - _rootPublicKey = [NSData data]; _vendorId = @(0); @@ -515,6 +513,8 @@ - (instancetype)init _nodeId = @(0); _label = @""; + + _fabricIndex = @(0); } return self; } @@ -525,11 +525,11 @@ - (instancetype)init { if (self = [super init]) { - _fabricIndex = @(0); - _noc = [NSData data]; _icac = nil; + + _fabricIndex = @(0); } return self; } @@ -540,13 +540,13 @@ - (instancetype)init { if (self = [super init]) { - _fabricIndex = @(0); - _groupId = @(0); _endpoints = [NSArray array]; _groupName = nil; + + _fabricIndex = @(0); } return self; } @@ -557,11 +557,11 @@ - (instancetype)init { if (self = [super init]) { - _fabricIndex = @(0); - _groupId = @(0); _groupKeySetID = @(0); + + _fabricIndex = @(0); } return self; } @@ -925,8 +925,6 @@ - (instancetype)init { if (self = [super init]) { - _fabricIndex = @(0); - _fabricSensitiveInt8u = @(0); _optionalFabricSensitiveInt8u = nil; @@ -940,6 +938,8 @@ - (instancetype)init _fabricSensitiveStruct = [CHIPTestClusterClusterSimpleStruct new]; _fabricSensitiveInt8uList = [NSArray array]; + + _fabricIndex = @(0); } return self; } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index 73e16e163c828f..e4e9e6aa700f76 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -5117,7 +5117,7 @@ new CHIPDefaultSuccessCallbackBridge( ListFreer listFreer; using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; + cppValue = static_cast>(value.unsignedShortValue); auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); @@ -7235,7 +7235,6 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPGroupKeyManagementClusterGroupInfoMapStruct *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].groupId = element_0.groupId.unsignedShortValue; { using ListType_2 = std::remove_reference_tmList[i_0].endpoints)>; @@ -7263,6 +7262,7 @@ new CHIPDefaultSuccessCallbackBridge( auto & definedValue_2 = listHolder_0->mList[i_0].groupName.Emplace(); definedValue_2 = [self asCharSpan:element_0.groupName]; } + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -10664,7 +10664,6 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPOperationalCredentialsClusterNOCStruct *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].noc = [self asByteSpan:element_0.noc]; if (element_0.icac == nil) { listHolder_0->mList[i_0].icac.SetNull(); @@ -10672,6 +10671,7 @@ new CHIPDefaultSuccessCallbackBridge( auto & nonNullValue_2 = listHolder_0->mList[i_0].icac.SetNonNull(); nonNullValue_2 = [self asByteSpan:element_0.icac]; } + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -10710,12 +10710,12 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPOperationalCredentialsClusterFabricDescriptor *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].rootPublicKey = [self asByteSpan:element_0.rootPublicKey]; listHolder_0->mList[i_0].vendorId = element_0.vendorId.unsignedShortValue; listHolder_0->mList[i_0].fabricId = element_0.fabricId.unsignedLongLongValue; listHolder_0->mList[i_0].nodeId = element_0.nodeId.unsignedLongLongValue; listHolder_0->mList[i_0].label = [self asCharSpan:element_0.label]; + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 2461419f977f32..a17599d79f222d 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -244,7 +244,6 @@ - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; @@ -267,9 +266,9 @@ - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { @@ -299,9 +298,9 @@ - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[2] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).privilege = [NSNumber numberWithUnsignedChar:3]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).authMode = [NSNumber numberWithUnsignedChar:3]; { @@ -331,6 +330,7 @@ - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -366,8 +366,6 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 3); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( @@ -437,7 +435,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute .deviceType == nil); XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex unsignedCharValue], 1); + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).privilege unsignedCharValue], 1); XCTAssertEqual( @@ -520,7 +518,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute .deviceType == nil); XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).fabricIndex unsignedCharValue], 1); + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).privilege unsignedCharValue], 3); XCTAssertEqual( @@ -602,6 +600,8 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute .targets[2]) .deviceType == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -622,14 +622,13 @@ - (void)testSendClusterTestAccessControlCluster_000003_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { @@ -640,6 +639,7 @@ - (void)testSendClusterTestAccessControlCluster_000003_WriteAttribute NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -675,8 +675,6 @@ - (void)testSendClusterTestAccessControlCluster_000004_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 2); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( @@ -684,13 +682,15 @@ - (void)testSendClusterTestAccessControlCluster_000004_ReadAttribute XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex unsignedCharValue], 1); + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).privilege unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -711,18 +711,18 @@ - (void)testSendClusterTestAccessControlCluster_000005_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:3]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -757,14 +757,14 @@ - (void)testSendClusterTestAccessControlCluster_000006_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -785,18 +785,18 @@ - (void)testSendClusterTestAccessControlCluster_000007_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -831,14 +831,14 @@ - (void)testSendClusterTestAccessControlCluster_000008_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -859,14 +859,13 @@ - (void)testSendClusterTestAccessControlCluster_000009_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { @@ -875,6 +874,7 @@ - (void)testSendClusterTestAccessControlCluster_000009_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; } ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -909,14 +909,14 @@ - (void)testSendClusterTestAccessControlCluster_000010_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -937,14 +937,13 @@ - (void)testSendClusterTestAccessControlCluster_000011_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; @@ -957,6 +956,7 @@ - (void)testSendClusterTestAccessControlCluster_000011_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -991,14 +991,14 @@ - (void)testSendClusterTestAccessControlCluster_000012_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -1019,14 +1019,13 @@ - (void)testSendClusterTestAccessControlCluster_000013_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { @@ -1054,6 +1053,7 @@ - (void)testSendClusterTestAccessControlCluster_000013_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; } ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -1088,14 +1088,14 @@ - (void)testSendClusterTestAccessControlCluster_000014_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -1116,14 +1116,13 @@ - (void)testSendClusterTestAccessControlCluster_000015_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; @@ -1231,6 +1230,7 @@ - (void)testSendClusterTestAccessControlCluster_000015_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -1265,14 +1265,14 @@ - (void)testSendClusterTestAccessControlCluster_000016_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -1293,11 +1293,11 @@ - (void)testSendClusterTestAccessControlCluster_000017_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -1333,14 +1333,14 @@ - (void)testSendClusterTestAccessControlCluster_000018_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -33908,7 +33908,7 @@ - (void)testSendClusterTestCluster_000108_WriteAttribute XCTAssertNotNil(cluster); id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"Tes\x00ti\x00ng" length:9]; + octetStringArgument = [[NSData alloc] initWithBytes:"Tes\000ti\000ng" length:9]; [cluster writeAttributeOctetStringWithValue:octetStringArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute OCTET_STRING with embedded null Error: %@", err); @@ -33936,7 +33936,7 @@ - (void)testSendClusterTestCluster_000109_ReadAttribute { id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"Tes\x00ti\x00ng" length:9]]); + XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"Tes\000ti\000ng" length:9]]); } [expectation fulfill]; @@ -33954,7 +33954,7 @@ - (void)testSendClusterTestCluster_000110_WriteAttribute XCTAssertNotNil(cluster); id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"\x0d\x0a\xff\x22\xa0" length:5]; + octetStringArgument = [[NSData alloc] initWithBytes:"\015\012\377\042\240" length:5]; [cluster writeAttributeOctetStringWithValue:octetStringArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute OCTET_STRING with weird chars Error: %@", err); @@ -33982,7 +33982,7 @@ - (void)testSendClusterTestCluster_000111_ReadAttribute { id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"\x0d\x0a\xff\x22\xa0" length:5]]); + XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"\015\012\377\042\240" length:5]]); } [expectation fulfill]; @@ -48057,15 +48057,15 @@ - (void)testSendClusterTestGroupKeyManagementCluster_000005_KeySetWrite ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = [NSNumber numberWithUnsignedChar:0]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = - [[NSData alloc] initWithBytes:"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" length:16]; + [[NSData alloc] initWithBytes:"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = [NSNumber numberWithUnsignedLongLong:1110000ULL]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = - [[NSData alloc] initWithBytes:"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" length:16]; + [[NSData alloc] initWithBytes:"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = [NSNumber numberWithUnsignedLongLong:1110001ULL]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = - [[NSData alloc] initWithBytes:"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" length:16]; + [[NSData alloc] initWithBytes:"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = [NSNumber numberWithUnsignedLongLong:1110002ULL]; @@ -48095,15 +48095,15 @@ - (void)testSendClusterTestGroupKeyManagementCluster_000006_KeySetWrite ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = [NSNumber numberWithUnsignedChar:1]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = - [[NSData alloc] initWithBytes:"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" length:16]; + [[NSData alloc] initWithBytes:"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = [NSNumber numberWithUnsignedLongLong:2110000ULL]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = - [[NSData alloc] initWithBytes:"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" length:16]; + [[NSData alloc] initWithBytes:"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = [NSNumber numberWithUnsignedLongLong:2110001ULL]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = - [[NSData alloc] initWithBytes:"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" length:16]; + [[NSData alloc] initWithBytes:"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = [NSNumber numberWithUnsignedLongLong:2110002ULL]; @@ -48178,14 +48178,14 @@ - (void)testSendClusterTestGroupKeyManagementCluster_000008_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupId = [NSNumber numberWithUnsignedShort:257U]; ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; + ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; temp_0[1] = [[CHIPGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).groupId = [NSNumber numberWithUnsignedShort:258U]; ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).groupKeySetID = [NSNumber numberWithUnsignedShort:418U]; + ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; groupKeyMapArgument = temp_0; } @@ -48220,9 +48220,6 @@ - (void)testSendClusterTestGroupKeyManagementCluster_000009_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 2); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) - actualValue[0]).fabricIndex unsignedCharValue], - 1); XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[0]).groupId unsignedShortValue], 257U); @@ -48230,7 +48227,7 @@ - (void)testSendClusterTestGroupKeyManagementCluster_000009_ReadAttribute actualValue[0]).groupKeySetID unsignedShortValue], 417U); XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) - actualValue[1]).fabricIndex unsignedCharValue], + actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[1]).groupId unsignedShortValue], @@ -48238,6 +48235,9 @@ - (void)testSendClusterTestGroupKeyManagementCluster_000009_ReadAttribute XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[1]).groupKeySetID unsignedShortValue], 418U); + XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) + actualValue[1]).fabricIndex unsignedCharValue], + 1); } [expectation fulfill]; @@ -48265,22 +48265,22 @@ - (void)testSendClusterTestGroupKeyManagementCluster_000010_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 2); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) - actualValue[0]).fabricIndex unsignedCharValue], - 1); XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[0]).groupId unsignedShortValue], 257U); XCTAssertTrue([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[0]).groupName isEqualToString:@"Group #1"]); XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) - actualValue[1]).fabricIndex unsignedCharValue], + actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).groupId unsignedShortValue], 258U); XCTAssertTrue([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).groupName isEqualToString:@"Group #2"]); + XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) + actualValue[1]).fabricIndex unsignedCharValue], + 1); } [expectation fulfill]; @@ -48648,11 +48648,11 @@ - (void)testSendClusterTestOperationalCredentialsCluster_000005_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); + XCTAssertTrue([((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label + isEqualToString:@""]); XCTAssertEqualObjects( ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).fabricIndex, ourFabricIndex); - XCTAssertTrue([((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label - isEqualToString:@""]); } [expectation fulfill]; @@ -48716,11 +48716,11 @@ - (void)testSendClusterTestOperationalCredentialsCluster_000007_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); + XCTAssertTrue([((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label + isEqualToString:@"Batcave"]); XCTAssertEqualObjects( ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).fabricIndex, ourFabricIndex); - XCTAssertTrue([((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label - isEqualToString:@"Batcave"]); } [expectation fulfill]; @@ -49010,11 +49010,11 @@ - (void)testSendClusterTestBinding_000003_WriteAttribute ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).node = [NSNumber numberWithUnsignedLongLong:1ULL]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).group = [NSNumber numberWithUnsignedShort:1U]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).endpoint = [NSNumber numberWithUnsignedShort:1U]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).cluster = [NSNumber numberWithUnsignedInt:6UL]; + ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; bindingArgument = temp_0; } @@ -49041,19 +49041,19 @@ - (void)testSendClusterTestBinding_000004_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[0]).group = [NSNumber numberWithUnsignedShort:1U]; + ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).node = [NSNumber numberWithUnsignedLongLong:1ULL]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).endpoint = [NSNumber numberWithUnsignedShort:1U]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).cluster = [NSNumber numberWithUnsignedInt:6UL]; + ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[2] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[2]).node = [NSNumber numberWithUnsignedLongLong:2ULL]; ((CHIPBindingClusterTargetStruct *) temp_0[2]).endpoint = [NSNumber numberWithUnsignedShort:1U]; + ((CHIPBindingClusterTargetStruct *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; bindingArgument = temp_0; } @@ -49089,15 +49089,15 @@ - (void)testSendClusterTestBinding_000005_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 3); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).group unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).node unsignedLongLongValue], 1ULL); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).endpoint unsignedShortValue], 1U); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).cluster unsignedIntValue], 6UL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).node unsignedLongLongValue], 2ULL); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).endpoint unsignedShortValue], 1U); + XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -49118,9 +49118,9 @@ - (void)testSendClusterTestBinding_000006_WriteAttribute { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[0]).node = [NSNumber numberWithUnsignedLongLong:3ULL]; ((CHIPBindingClusterTargetStruct *) temp_0[0]).endpoint = [NSNumber numberWithUnsignedShort:1U]; + ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; bindingArgument = temp_0; } @@ -49156,9 +49156,9 @@ - (void)testSendClusterTestBinding_000007_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 1); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).node unsignedLongLongValue], 3ULL); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).endpoint unsignedShortValue], 1U); + XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; @@ -49187,15 +49187,15 @@ - (void)testSendClusterTestBinding_000008_ReadAttribute { id actualValue = value; XCTAssertEqual([actualValue count], 3); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).group unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).node unsignedLongLongValue], 1ULL); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).endpoint unsignedShortValue], 1U); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).cluster unsignedIntValue], 6UL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex unsignedCharValue], 1); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).node unsignedLongLongValue], 2ULL); XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).endpoint unsignedShortValue], 1U); + XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex unsignedCharValue], 1); } [expectation fulfill]; diff --git a/src/darwin/Framework/CHIPTests/CHIPDeviceTests.m b/src/darwin/Framework/CHIPTests/CHIPDeviceTests.m index 4f47df6da4913c..0ddb2c8b99989d 100644 --- a/src/darwin/Framework/CHIPTests/CHIPDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPDeviceTests.m @@ -70,6 +70,12 @@ static void WaitForCommissionee(XCTestExpectation * expectation, dispatch_queue_ return mConnectedDevice; } +#ifdef DEBUG +@interface CHIPDevice (Test) +- (void)failSubscribers:(dispatch_queue_t)clientQueue completion:(void (^)(void))completion; +@end +#endif + @interface CHIPDeviceTestPairingDelegate : NSObject @property (nonatomic, strong) XCTestExpectation * expectation; @end @@ -214,9 +220,9 @@ - (void)test001_ReadAttribute XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 29); - XCTAssertEqual([result[@"attributeId"] unsignedIntegerValue], 0); - XCTAssertTrue([result[@"endpointId"] isKindOfClass:[NSNumber class]]); + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.cluster unsignedIntegerValue], 29); + XCTAssertEqual([path.attribute unsignedIntegerValue], 0); XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Array"]); } @@ -256,10 +262,11 @@ - (void)test002_WriteAttribute XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 8); - XCTAssertEqual([result[@"attributeId"] unsignedIntegerValue], 17); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 8); + XCTAssertEqual([path.attribute unsignedIntegerValue], 17); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -281,18 +288,13 @@ - (void)test003_InvokeCommand CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - NSDictionary * fields = [NSDictionary - dictionaryWithObjectsAndKeys:@"Structure", @"type", - [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:0], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", - [NSNumber numberWithUnsignedInteger:0], @"value", nil], - @"value", nil], - [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:1], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", - [NSNumber numberWithUnsignedInteger:10], @"value", nil], - @"value", nil], - nil], - @"value", nil]; + NSDictionary * fields = @{ + @"type" : @"Structure", + @"value" : @[ + @{ @"contextTag" : @0, @"data" : @ { @"type" : @"UnsignedInteger", @"value" : @0 } }, + @{ @"contextTag" : @1, @"data" : @ { @"type" : @"UnsignedInteger", @"value" : @10 } } + ] + }; [device invokeCommandWithEndpointId:1 clusterId:8 commandId:4 @@ -307,10 +309,11 @@ - (void)test003_InvokeCommand XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 8); - XCTAssertEqual([result[@"commandId"] unsignedIntegerValue], 4); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 8); + XCTAssertEqual([path.command unsignedIntegerValue], 4); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -397,14 +400,15 @@ - (void)test005_Subscribe XCTestExpectation * reportExpectation = [self expectationWithDescription:@"report received"]; globalReportHandler = ^(id _Nullable value, NSError * _Nullable error) { XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); - XCTAssertTrue([value isKindOfClass:[NSDictionary class]]); - NSDictionary * result = value; - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"attributeId"] unsignedIntegerValue], 0); - XCTAssertTrue([result[@"value"] isKindOfClass:[NSDictionary class]]); - XCTAssertTrue([result[@"value"][@"type"] isEqualToString:@"Boolean"]); - if ([result[@"value"][@"value"] boolValue] == YES) { + XCTAssertTrue([value isKindOfClass:[NSArray class]]); + NSDictionary * result = value[0]; + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.attribute unsignedIntegerValue], 0); + XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Boolean"]); + if ([result[@"data"][@"value"] boolValue] == YES) { [reportExpectation fulfill]; globalReportHandler = nil; } @@ -412,7 +416,7 @@ - (void)test005_Subscribe // Send commands to trigger attribute change XCTestExpectation * commandExpectation = [self expectationWithDescription:@"command responded"]; - NSDictionary * fields = [NSDictionary dictionaryWithObjectsAndKeys:@"Structure", @"type", [NSArray array], @"value", nil]; + NSDictionary * fields = @{ @"type" : @"Structure", @"value" : [NSArray array] }; [device invokeCommandWithEndpointId:1 clusterId:6 commandId:1 @@ -427,10 +431,11 @@ - (void)test005_Subscribe XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"commandId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.command unsignedIntegerValue], 1); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -445,14 +450,15 @@ - (void)test005_Subscribe reportExpectation = [self expectationWithDescription:@"receive OnOff attribute report"]; globalReportHandler = ^(id _Nullable value, NSError * _Nullable error) { XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); - XCTAssertTrue([value isKindOfClass:[NSDictionary class]]); - NSDictionary * result = value; - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"attributeId"] unsignedIntegerValue], 0); - XCTAssertTrue([result[@"value"] isKindOfClass:[NSDictionary class]]); - XCTAssertTrue([result[@"value"][@"type"] isEqualToString:@"Boolean"]); - if ([result[@"value"][@"value"] boolValue] == NO) { + XCTAssertTrue([value isKindOfClass:[NSArray class]]); + NSDictionary * result = value[0]; + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.attribute unsignedIntegerValue], 0); + XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Boolean"]); + if ([result[@"data"][@"value"] boolValue] == NO) { [reportExpectation fulfill]; globalReportHandler = nil; } @@ -474,10 +480,11 @@ - (void)test005_Subscribe XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"commandId"] unsignedIntegerValue], 0); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.command unsignedIntegerValue], 0); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -485,6 +492,13 @@ - (void)test005_Subscribe // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; + + expectation = [self expectationWithDescription:@"Report handler deregistered"]; + [device deregisterReportHandlersWithClientQueue:queue + completion:^{ + [expectation fulfill]; + }]; + [self waitForExpectations:@[ expectation ] timeout:kTimeoutInSeconds]; } #endif @@ -664,8 +678,9 @@ - (void)test010_ReadAllAttribute XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 29); - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.cluster unsignedIntegerValue], 29); + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); } XCTAssertTrue([resultArray count] > 0); @@ -807,10 +822,11 @@ - (void)test011_ReadCachedAttribute NSLog(@"Read attribute cache value: %@, error %@", values, error); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); XCTAssertEqual([values count], 1); - XCTAssertEqual([values[0][@"endpointId"] unsignedShortValue], 1); - XCTAssertEqual([values[0][@"clusterId"] unsignedLongValue], 6); - XCTAssertEqual([values[0][@"attributeId"] unsignedLongValue], 0); - XCTAssertEqual([values[0][@"status"] intValue], 0); + CHIPAttributePath * path = values[0][@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedShortValue], 1); + XCTAssertEqual([path.cluster unsignedLongValue], 6); + XCTAssertEqual([path.attribute unsignedLongValue], 0); + XCTAssertNil(values[0][@"error"]); XCTAssertTrue([values[0][@"data"][@"type"] isEqualToString:@"Boolean"]); XCTAssertEqual([values[0][@"data"][@"value"] boolValue], NO); [cacheExpectation fulfill]; @@ -830,9 +846,10 @@ - (void)test011_ReadCachedAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); XCTAssertTrue([values count] > 0); for (NSDictionary * value in values) { - XCTAssertEqual([value[@"clusterId"] unsignedLongValue], 6); - XCTAssertEqual([value[@"attributeId"] unsignedLongValue], 0); - XCTAssertEqual([value[@"status"] intValue], 0); + CHIPAttributePath * path = value[@"attributePath"]; + XCTAssertEqual([path.cluster unsignedLongValue], 6); + XCTAssertEqual([path.attribute unsignedLongValue], 0); + XCTAssertNil(value[@"error"]); } [cacheExpectation fulfill]; }]; @@ -851,8 +868,9 @@ - (void)test011_ReadCachedAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); XCTAssertTrue([values count] > 0); for (NSDictionary * value in values) { - XCTAssertEqual([value[@"endpointId"] unsignedShortValue], 1); - XCTAssertEqual([value[@"attributeId"] unsignedLongValue], 0); + CHIPAttributePath * path = value[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedShortValue], 1); + XCTAssertEqual([path.attribute unsignedLongValue], 0); } [cacheExpectation fulfill]; }]; @@ -871,9 +889,10 @@ - (void)test011_ReadCachedAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); XCTAssertTrue([values count] > 0); for (NSDictionary * value in values) { - XCTAssertEqual([value[@"endpointId"] unsignedShortValue], 1); - XCTAssertEqual([value[@"clusterId"] unsignedLongValue], 6); - XCTAssertEqual([value[@"status"] intValue], 0); + CHIPAttributePath * path = value[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedShortValue], 1); + XCTAssertEqual([path.cluster unsignedLongValue], 6); + XCTAssertNil(value[@"error"]); } [cacheExpectation fulfill]; }]; @@ -895,9 +914,114 @@ - (void)test011_ReadCachedAttribute [self waitForExpectations:@[ cacheExpectation ] timeout:kTimeoutInSeconds]; } -// Report behavior is erratic on the accessory side at the moment. -// Hence this test is enabled only for individual manual test. +#ifdef DEBUG +// Test an error to subscription +- (void)test012_SubscriptionError +{ #if MANUAL_INDIVIDUAL_TEST + [self initStack]; + [self waitForCommissionee]; +#endif + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + XCTestExpectation * deregisterExpectation = [self expectationWithDescription:@"Report handler deregistered"]; + [device deregisterReportHandlersWithClientQueue:queue + completion:^{ + [deregisterExpectation fulfill]; + }]; + [self waitForExpectations:@[ deregisterExpectation ] timeout:kTimeoutInSeconds]; + + // Subscribe + XCTestExpectation * expectation = [self expectationWithDescription:@"subscribe OnOff attribute"]; + [device subscribeAttributeWithEndpointId:1 + clusterId:6 + attributeId:0 + minInterval:1 + maxInterval:10 + clientQueue:queue + reportHandler:^(id _Nullable values, NSError * _Nullable error) { + NSLog(@"report attribute: OnOff values: %@, error: %@", values, error); + + if (globalReportHandler) { + __auto_type callback = globalReportHandler; + callback(values, error); + } + } + subscriptionEstablished:^{ + NSLog(@"subscribe attribute: OnOff established"); + [expectation fulfill]; + }]; + + // Wait till establishment + [self waitForExpectations:[NSArray arrayWithObject:expectation] timeout:kTimeoutInSeconds]; + + // Set up expectation for report + XCTestExpectation * reportExpectation = [self expectationWithDescription:@"report received"]; + globalReportHandler = ^(id _Nullable value, NSError * _Nullable error) { + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); + XCTAssertTrue([value isKindOfClass:[NSArray class]]); + NSDictionary * result = value[0]; + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.attribute unsignedIntegerValue], 0); + XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Boolean"]); + if ([result[@"data"][@"value"] boolValue] == YES) { + [reportExpectation fulfill]; + globalReportHandler = nil; + } + }; + + // Send commands to trigger attribute change + XCTestExpectation * commandExpectation = [self expectationWithDescription:@"command responded"]; + NSDictionary * fields = @{ @"type" : @"Structure", @"value" : [NSArray array] }; + [device invokeCommandWithEndpointId:1 + clusterId:6 + commandId:1 + commandFields:fields + clientQueue:queue + completion:^(id _Nullable values, NSError * _Nullable error) { + NSLog(@"invoke command: On values: %@, error: %@", values, error); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); + + { + XCTAssertTrue([values isKindOfClass:[NSArray class]]); + NSArray * resultArray = values; + for (NSDictionary * result in resultArray) { + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.command unsignedIntegerValue], 1); + XCTAssertNil(result[@"error"]); + } + XCTAssertEqual([resultArray count], 1); + } + [commandExpectation fulfill]; + }]; + [self waitForExpectations:[NSArray arrayWithObject:commandExpectation] timeout:kTimeoutInSeconds]; + + // Wait for report + [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; + + // Trigger reader failure + XCTestExpectation * failureExpectation = [self expectationWithDescription:@"failed on purpose"]; + [device failSubscribers:queue + completion:^{ + [failureExpectation fulfill]; + }]; + [self waitForExpectations:@[ failureExpectation ] timeout:kTimeoutInSeconds]; + + deregisterExpectation = [self expectationWithDescription:@"Report handler deregistered"]; + [device deregisterReportHandlersWithClientQueue:queue + completion:^{ + [deregisterExpectation fulfill]; + }]; + [self waitForExpectations:@[ deregisterExpectation ] timeout:kTimeoutInSeconds]; +} +#endif + - (void)test900_SubscribeAllAttributes { #if MANUAL_INDIVIDUAL_TEST @@ -906,6 +1030,14 @@ - (void)test900_SubscribeAllAttributes #endif CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); + XCTestExpectation * cleanSubscriptionExpectation = [self expectationWithDescription:@"Previous subscriptions cleaned"]; + NSLog(@"Deregistering report handlers..."); + [device deregisterReportHandlersWithClientQueue:queue + completion:^{ + NSLog(@"Report handlers deregistered"); + [cleanSubscriptionExpectation fulfill]; + }]; + [self waitForExpectations:@[ cleanSubscriptionExpectation ] timeout:kTimeoutInSeconds]; XCTestExpectation * expectation = [self expectationWithDescription:@"subscribe OnOff attribute"]; __block void (^reportHandler)(id _Nullable values, NSError * _Nullable error) = nil; @@ -935,23 +1067,53 @@ - (void)test900_SubscribeAllAttributes // Set up expectation for report __auto_type reportExpectation = [self expectationWithDescription:@"receive OnOff attribute report"]; - reportHandler = ^(id _Nullable value, NSError * _Nullable error) { + reportHandler = ^(id _Nullable values, NSError * _Nullable error) { XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); - XCTAssertTrue([value isKindOfClass:[NSDictionary class]]); - NSDictionary * result = value; - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertTrue([result[@"value"] isKindOfClass:[NSDictionary class]]); - - if ([result[@"attributeId"] unsignedIntegerValue] == 0 && [result[@"value"][@"value"] boolValue] == YES) { + XCTAssertTrue([values isKindOfClass:[NSArray class]]); + NSDictionary * result = values[0]; + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); + + if ([path.attribute unsignedIntegerValue] == 0 && [result[@"data"][@"value"] boolValue] == YES) { [reportExpectation fulfill]; reportHandler = nil; } }; - // Send commands to trigger attribute change + // Send commands to set attribute state to a known state XCTestExpectation * commandExpectation = [self expectationWithDescription:@"command responded"]; - NSDictionary * fields = [NSDictionary dictionaryWithObjectsAndKeys:@"Structure", @"type", [NSArray array], @"value", nil]; + NSDictionary * fields = @{ @"type" : @"Structure", @"value" : @[] }; + [device invokeCommandWithEndpointId:1 + clusterId:6 + commandId:0 + commandFields:fields + clientQueue:queue + completion:^(id _Nullable values, NSError * _Nullable error) { + NSLog(@"invoke command: On values: %@, error: %@", values, error); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); + + { + XCTAssertTrue([values isKindOfClass:[NSArray class]]); + NSArray * resultArray = values; + for (NSDictionary * result in resultArray) { + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.command unsignedIntegerValue], 0); + XCTAssertNil(result[@"error"]); + } + XCTAssertEqual([resultArray count], 1); + } + [commandExpectation fulfill]; + }]; + [self waitForExpectations:[NSArray arrayWithObject:commandExpectation] timeout:kTimeoutInSeconds]; + + // Send commands to trigger attribute change + commandExpectation = [self expectationWithDescription:@"command responded"]; + fields = @{ @"type" : @"Structure", @"value" : @[] }; [device invokeCommandWithEndpointId:1 clusterId:6 commandId:1 @@ -966,10 +1128,11 @@ - (void)test900_SubscribeAllAttributes XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"commandId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.command unsignedIntegerValue], 1); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -982,14 +1145,15 @@ - (void)test900_SubscribeAllAttributes // Set up expectation for 2nd report reportExpectation = [self expectationWithDescription:@"receive OnOff attribute report"]; - reportHandler = ^(id _Nullable value, NSError * _Nullable error) { + reportHandler = ^(id _Nullable values, NSError * _Nullable error) { XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); - XCTAssertTrue([value isKindOfClass:[NSDictionary class]]); - NSDictionary * result = value; - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertTrue([result[@"value"] isKindOfClass:[NSDictionary class]]); - if ([result[@"attributeId"] unsignedIntegerValue] == 0 && [result[@"value"][@"value"] boolValue] == NO) { + XCTAssertTrue([values isKindOfClass:[NSArray class]]); + NSDictionary * result = values[0]; + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); + if ([path.attribute unsignedIntegerValue] == 0 && [result[@"data"][@"value"] boolValue] == NO) { [reportExpectation fulfill]; reportHandler = nil; } @@ -997,7 +1161,7 @@ - (void)test900_SubscribeAllAttributes // Send command to trigger attribute change commandExpectation = [self expectationWithDescription:@"command responded"]; - fields = [NSDictionary dictionaryWithObjectsAndKeys:@"Structure", @"type", [NSArray array], @"value", nil]; + fields = @{ @"type" : @"Structure", @"value" : @[] }; [device invokeCommandWithEndpointId:1 clusterId:6 commandId:0 @@ -1012,10 +1176,11 @@ - (void)test900_SubscribeAllAttributes XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"commandId"] unsignedIntegerValue], 0); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.command unsignedIntegerValue], 0); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -1026,7 +1191,6 @@ - (void)test900_SubscribeAllAttributes // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; } -#endif #if !MANUAL_INDIVIDUAL_TEST - (void)test999_TearDown @@ -1058,6 +1222,17 @@ - (void)testSignedInteger XCTAssertTrue([output isEqualTo:input]); } +- (void)testSignedInteger64Bits +{ + NSDictionary * input = [NSDictionary + dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:-0x7000111122223333ll], @"value", nil]; + id output = [CHIPDevice CHIPEncodeAndDecodeNSObject:input]; + NSLog(@"Conversion input: %@\nOutput: %@", input, output); + XCTAssertNotNil(output); + XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([output isEqualTo:input]); +} + - (void)testUnsignedInteger { NSDictionary * input = @@ -1069,6 +1244,17 @@ - (void)testUnsignedInteger XCTAssertTrue([output isEqualTo:input]); } +- (void)testUnsignedInteger64Bits +{ + NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", + [NSNumber numberWithUnsignedLongLong:0xCCCCDDDDEEEEFFFFull], @"value", nil]; + id output = [CHIPDevice CHIPEncodeAndDecodeNSObject:input]; + NSLog(@"Conversion input: %@\nOutput: %@", input, output); + XCTAssertNotNil(output); + XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([output isEqualTo:input]); +} + - (void)testBoolean { NSDictionary * input = @@ -1110,9 +1296,8 @@ - (void)testFloat NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); - // Note that conversion doesn't guarantee back to Float. - XCTAssertTrue([output[@"type"] isEqualToString:@"Float"] || [output[@"type"] isEqualToString:@"Double"]); - XCTAssertTrue(([output[@"value"] doubleValue] - [input[@"value"] doubleValue]) < 0.0001); + XCTAssertTrue([output[@"type"] isEqualToString:@"Float"]); + XCTAssertTrue(([output[@"value"] floatValue] - [input[@"value"] floatValue]) < 0.0001); } - (void)testDouble @@ -1123,8 +1308,7 @@ - (void)testDouble NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); - // Note that conversion doesn't guarantee back to Double. - XCTAssertTrue([output[@"type"] isEqualToString:@"Float"] || [output[@"type"] isEqualToString:@"Double"]); + XCTAssertTrue([output[@"type"] isEqualToString:@"Double"]); XCTAssertTrue(([output[@"value"] doubleValue] - [input[@"value"] doubleValue]) < 0.0001); } @@ -1140,98 +1324,38 @@ - (void)testNull - (void)testStructure { - NSArray * inputFields = [NSArray - arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:1], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys:@"Boolean", @"type", [NSNumber numberWithBool:NO], - @"value", nil], - @"value", nil], - [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:2], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:5], @"value", nil], - @"value", nil], - nil]; - NSDictionary * inputValue = [NSDictionary dictionaryWithObjectsAndKeys:@"Structure", @"type", inputFields, @"value", nil]; - - // Output will have context tags and hence build object with context tags for comparison - NSMutableArray * contextTaggedInputFields = [NSMutableArray arrayWithCapacity:[inputFields count]]; - for (NSDictionary * field in inputFields) { - [contextTaggedInputFields - addObject:[NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:([field[@"tag"] unsignedIntegerValue] - | 0xffffffff00000000ull)], - @"tag", field[@"value"], @"value", nil]]; - } + NSArray * inputFields = @[ + @{ + @"contextTag" : @1, + @"data" : @ { @"type" : @"Boolean", @"value" : @NO }, + }, + @{ + @"contextTag" : @2, + @"data" : @ { @"type" : @"SignedInteger", @"value" : @5 }, + } + ]; + NSDictionary * inputValue = @{ @"type" : @"Structure", @"value" : inputFields }; id output = [CHIPDevice CHIPEncodeAndDecodeNSObject:inputValue]; NSLog(@"Conversion input: %@\nOutput: %@", inputValue, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); - NSDictionary * compare = - [NSDictionary dictionaryWithObjectsAndKeys:@"Structure", @"type", contextTaggedInputFields, @"value", nil]; - XCTAssertTrue([output isEqualTo:compare]); + XCTAssertTrue([output isEqualTo:inputValue]); } - (void)testArray { - NSArray * inputFields = [NSArray - arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:@"Boolean", @"type", - [NSNumber numberWithBool:NO], @"value", nil], - @"value", nil], - [NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:5], @"value", nil], - @"value", nil], - nil]; - NSDictionary * inputValue = [NSDictionary dictionaryWithObjectsAndKeys:@"Array", @"type", inputFields, @"value", nil]; - - // Output will have anonymous tags and hence build object with context tags for comparison - NSMutableArray * contextTaggedInputFields = [NSMutableArray arrayWithCapacity:[inputFields count]]; - for (NSDictionary * field in inputFields) { - [contextTaggedInputFields - addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:0xffffffffffffffffull], @"tag", - field[@"value"], @"value", nil]]; - } + NSArray * inputFields = @[ + @{ @"data" : @ { @"type" : @"Boolean", @"value" : @NO } }, @{ @"data" : @ { @"type" : @"SignedInteger", @"value" : @5 } } + ]; + NSDictionary * inputValue = @{ @"type" : @"Array", @"value" : inputFields }; id output = [CHIPDevice CHIPEncodeAndDecodeNSObject:inputValue]; NSLog(@"Conversion input: %@\nOutput: %@", inputValue, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); - - NSDictionary * compare = [NSDictionary dictionaryWithObjectsAndKeys:@"Array", @"type", contextTaggedInputFields, @"value", nil]; - XCTAssertTrue([output isEqualTo:compare]); -} - -- (void)testList -{ - NSArray * inputFields = [NSArray - arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:1], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys:@"Boolean", @"type", [NSNumber numberWithBool:NO], - @"value", nil], - @"value", nil], - [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:2], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:5], @"value", nil], - @"value", nil], - nil]; - NSDictionary * inputValue = [NSDictionary dictionaryWithObjectsAndKeys:@"List", @"type", inputFields, @"value", nil]; - - // Output will have context tags and hence build object with context tags for comparison - NSMutableArray * contextTaggedInputFields = [NSMutableArray arrayWithCapacity:[inputFields count]]; - for (NSDictionary * field in inputFields) { - [contextTaggedInputFields - addObject:[NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:([field[@"tag"] unsignedIntegerValue] - | 0xffffffff00000000ull)], - @"tag", field[@"value"], @"value", nil]]; - } - - id output = [CHIPDevice CHIPEncodeAndDecodeNSObject:inputValue]; - NSLog(@"Conversion input: %@\nOutput: %@", inputValue, output); - XCTAssertNotNil(output); - XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); - - NSDictionary * compare = [NSDictionary dictionaryWithObjectsAndKeys:@"List", @"type", contextTaggedInputFields, @"value", nil]; - XCTAssertTrue([output isEqualTo:compare]); + XCTAssertTrue([output isEqualTo:inputValue]); } @end diff --git a/src/darwin/Framework/CHIPTests/CHIPXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/CHIPXPCListenerSampleTests.m index d62a4eee562962..c4fbd2a5b99b4d 100644 --- a/src/darwin/Framework/CHIPTests/CHIPXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPXPCListenerSampleTests.m @@ -162,20 +162,24 @@ - (void)readAttributeWithController:(id)controller (void) controller; __auto_type sharedController = [CHIPDeviceController sharedController]; if (sharedController) { - [sharedController getConnectedDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - completion(nil, error); - } else { - [device readAttributeWithEndpointId:endpointId - clusterId:clusterId - attributeId:attributeId - clientQueue:dispatch_get_main_queue() - completion:completion]; - } - }]; + [sharedController + getConnectedDevice:nodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + completion(nil, error); + } else { + [device readAttributeWithEndpointId:endpointId + clusterId:clusterId + attributeId:attributeId + clientQueue:dispatch_get_main_queue() + completion:^(NSArray *> * _Nullable values, + NSError * _Nullable error) { + completion([CHIPDeviceController encodeXPCResponseValues:values], error); + }]; + } + }]; } else { NSLog(@"Failed to get shared controller"); completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); @@ -193,21 +197,25 @@ - (void)writeAttributeWithController:(id)controller (void) controller; __auto_type sharedController = [CHIPDeviceController sharedController]; if (sharedController) { - [sharedController getConnectedDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - completion(nil, error); - } else { - [device writeAttributeWithEndpointId:endpointId - clusterId:clusterId - attributeId:attributeId - value:value - clientQueue:dispatch_get_main_queue() - completion:completion]; - } - }]; + [sharedController + getConnectedDevice:nodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + completion(nil, error); + } else { + [device writeAttributeWithEndpointId:endpointId + clusterId:clusterId + attributeId:attributeId + value:value + clientQueue:dispatch_get_main_queue() + completion:^(NSArray *> * _Nullable values, + NSError * _Nullable error) { + completion([CHIPDeviceController encodeXPCResponseValues:values], error); + }]; + } + }]; } else { NSLog(@"Failed to get shared controller"); completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); @@ -225,21 +233,25 @@ - (void)invokeCommandWithController:(id)controller (void) controller; __auto_type sharedController = [CHIPDeviceController sharedController]; if (sharedController) { - [sharedController getConnectedDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - completion(nil, error); - } else { - [device invokeCommandWithEndpointId:endpointId - clusterId:clusterId - commandId:commandId - commandFields:fields - clientQueue:dispatch_get_main_queue() - completion:completion]; - } - }]; + [sharedController + getConnectedDevice:nodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + completion(nil, error); + } else { + [device invokeCommandWithEndpointId:endpointId + clusterId:clusterId + commandId:commandId + commandFields:fields + clientQueue:dispatch_get_main_queue() + completion:^(NSArray *> * _Nullable values, + NSError * _Nullable error) { + completion([CHIPDeviceController encodeXPCResponseValues:values], error); + }]; + } + }]; } else { NSLog(@"Failed to get shared controller"); completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); @@ -257,43 +269,45 @@ - (void)subscribeAttributeWithController:(id)controller { __auto_type sharedController = [CHIPDeviceController sharedController]; if (sharedController) { - [sharedController getConnectedDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - establishedHandler(); - // Send an error report so that the client knows of the failure - [self.clientProxy handleReportWithController:controller - nodeId:nodeId - value:nil - error:[NSError errorWithDomain:CHIPErrorDomain - code:CHIPErrorCodeGeneralError - userInfo:nil]]; - } else { - [device subscribeAttributeWithEndpointId:endpointId - clusterId:clusterId - attributeId:attributeId - minInterval:minInterval - maxInterval:maxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, - NSError * _Nullable error) { - [self.clientProxy handleReportWithController:controller - nodeId:nodeId - value:value - error:error]; - } - subscriptionEstablished:establishedHandler]; - } - }]; + [sharedController + getConnectedDevice:nodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + establishedHandler(); + // Send an error report so that the client knows of the failure + [self.clientProxy handleReportWithController:controller + nodeId:nodeId + values:nil + error:[NSError errorWithDomain:CHIPErrorDomain + code:CHIPErrorCodeGeneralError + userInfo:nil]]; + } else { + [device subscribeAttributeWithEndpointId:endpointId + clusterId:clusterId + attributeId:attributeId + minInterval:minInterval + maxInterval:maxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, + NSError * _Nullable error) { + [self.clientProxy handleReportWithController:controller + nodeId:nodeId + values:[CHIPDeviceController + encodeXPCResponseValues:values] + error:error]; + } + subscriptionEstablished:establishedHandler]; + } + }]; } else { NSLog(@"Failed to get shared controller"); establishedHandler(); // Send an error report so that the client knows of the failure [self.clientProxy handleReportWithController:controller nodeId:nodeId - value:nil + values:nil error:[NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]]; @@ -337,11 +351,14 @@ - (void)readAttributeCacheWithController:(id _Nullable)controller { CHIPAttributeCacheContainer * attributeCacheContainer = _attributeCacheDictionary[[NSNumber numberWithUnsignedLongLong:nodeId]]; if (attributeCacheContainer) { - [attributeCacheContainer readAttributeWithEndpointId:endpointId - clusterId:clusterId - attributeId:attributeId - clientQueue:dispatch_get_main_queue() - completion:completion]; + [attributeCacheContainer + readAttributeWithEndpointId:endpointId + clusterId:clusterId + attributeId:attributeId + clientQueue:dispatch_get_main_queue() + completion:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + completion([CHIPDeviceController encodeXPCResponseValues:values], error); + }]; } else { NSLog(@"Attribute cache for node ID %llu was not setup", nodeId); completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); @@ -547,9 +564,9 @@ - (void)test001_ReadAttribute XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 29); - XCTAssertEqual([result[@"attributeId"] unsignedIntegerValue], 0); - XCTAssertTrue([result[@"endpointId"] isKindOfClass:[NSNumber class]]); + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.cluster unsignedIntegerValue], 29); + XCTAssertEqual([path.attribute unsignedIntegerValue], 0); XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Array"]); } @@ -589,10 +606,11 @@ - (void)test002_WriteAttribute XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 8); - XCTAssertEqual([result[@"attributeId"] unsignedIntegerValue], 17); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 8); + XCTAssertEqual([path.attribute unsignedIntegerValue], 17); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -614,18 +632,13 @@ - (void)test003_InvokeCommand CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - NSDictionary * fields = [NSDictionary - dictionaryWithObjectsAndKeys:@"Structure", @"type", - [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:0], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", - [NSNumber numberWithUnsignedInteger:0], @"value", nil], - @"value", nil], - [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:1], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", - [NSNumber numberWithUnsignedInteger:10], @"value", nil], - @"value", nil], - nil], - @"value", nil]; + NSDictionary * fields = @{ + @"type" : @"Structure", + @"value" : @[ + @{ @"contextTag" : @0, @"data" : @ { @"type" : @"UnsignedInteger", @"value" : @0 } }, + @{ @"contextTag" : @1, @"data" : @ { @"type" : @"UnsignedInteger", @"value" : @10 } } + ] + }; [device invokeCommandWithEndpointId:1 clusterId:8 commandId:4 @@ -640,10 +653,11 @@ - (void)test003_InvokeCommand XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 8); - XCTAssertEqual([result[@"commandId"] unsignedIntegerValue], 4); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 8); + XCTAssertEqual([path.command unsignedIntegerValue], 4); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -692,18 +706,18 @@ - (void)test004_Subscribe // Set up expectation for report expectation = [self expectationWithDescription:@"receive OnOff attribute report"]; - globalReportHandler = ^(id _Nullable value, NSError * _Nullable error) { + globalReportHandler = ^(id _Nullable values, NSError * _Nullable error) { XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:error], 0); - - { - XCTAssertTrue([value isKindOfClass:[NSDictionary class]]); - NSDictionary * result = value; - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"attributeId"] unsignedIntegerValue], 0); - XCTAssertTrue([result[@"value"] isKindOfClass:[NSDictionary class]]); - XCTAssertTrue([result[@"value"][@"type"] isEqualToString:@"Boolean"]); - XCTAssertEqual([result[@"value"][@"value"] boolValue], YES); + XCTAssertTrue([values isKindOfClass:[NSArray class]]); + + for (NSDictionary * result in values) { + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.attribute unsignedIntegerValue], 0); + XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Boolean"]); + XCTAssertEqual([result[@"data"][@"value"] boolValue], YES); } [expectation fulfill]; }; @@ -724,10 +738,11 @@ - (void)test004_Subscribe XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"commandId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.command unsignedIntegerValue], 1); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -851,8 +866,8 @@ - (void)test008_SubscribeFailure // Set up expectation for report XCTestExpectation * errorReportExpectation = [self expectationWithDescription:@"receive OnOff attribute report"]; - globalReportHandler = ^(id _Nullable value, NSError * _Nullable error) { - XCTAssertNil(value); + globalReportHandler = ^(id _Nullable values, NSError * _Nullable error) { + XCTAssertNil(values); // Error is copied over XPC and hence cannot use CHIPErrorTestUtils utility which checks against a local domain string // object. XCTAssertTrue([error.domain isEqualToString:MatterInteractionErrorDomain]); @@ -934,10 +949,11 @@ - (void)test009_SubscribeAttributeCache XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSArray * resultArray = values; for (NSDictionary * result in resultArray) { - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"commandId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"status"] unsignedIntegerValue], 0); + CHIPCommandPath * path = result[@"commandPath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.command unsignedIntegerValue], 1); + XCTAssertNil(result[@"error"]); } XCTAssertEqual([resultArray count], 1); } @@ -960,9 +976,10 @@ - (void)test009_SubscribeAttributeCache for (NSDictionary * value in values) { XCTAssertTrue([value isKindOfClass:[NSDictionary class]]); NSDictionary * result = value; - XCTAssertEqual([result[@"endpointId"] unsignedIntegerValue], 1); - XCTAssertEqual([result[@"clusterId"] unsignedIntegerValue], 6); - XCTAssertEqual([result[@"attributeId"] unsignedIntegerValue], 0); + CHIPAttributePath * path = result[@"attributePath"]; + XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); + XCTAssertEqual([path.cluster unsignedIntegerValue], 6); + XCTAssertEqual([path.attribute unsignedIntegerValue], 0); XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Boolean"]); XCTAssertEqual([result[@"data"][@"value"] boolValue], YES); diff --git a/src/darwin/Framework/CHIPTests/CHIPXPCProtocolTests.m b/src/darwin/Framework/CHIPTests/CHIPXPCProtocolTests.m index fea62527b4eecd..85356cb9e68a3c 100644 --- a/src/darwin/Framework/CHIPTests/CHIPXPCProtocolTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPXPCProtocolTests.m @@ -34,6 +34,48 @@ // Inverted expectation timeout static const uint16_t kNegativeTimeoutInSeconds = 1; +@interface CHIPAttributePath (Test) +- (BOOL)isEqual:(id)object; +@end + +@implementation CHIPAttributePath (Test) +- (BOOL)isEqual:(id)object +{ + if ([object isKindOfClass:[CHIPAttributePath class]]) { + CHIPAttributePath * other = object; + return [self.endpoint isEqualToNumber:other.endpoint] && [self.cluster isEqualToNumber:other.cluster] && + [self.attribute isEqualToNumber:other.attribute]; + } + return NO; +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"CHIPAttributePath(%@,%@,%@)", self.endpoint, self.cluster, self.attribute]; +} +@end + +@interface CHIPCommandPath (Test) +- (BOOL)isEqual:(id)object; +@end + +@implementation CHIPCommandPath (Test) +- (BOOL)isEqual:(id)object +{ + if ([object isKindOfClass:[CHIPCommandPath class]]) { + CHIPCommandPath * other = object; + return [self.endpoint isEqualToNumber:other.endpoint] && [self.cluster isEqualToNumber:other.cluster] && + [self.command isEqualToNumber:other.command]; + } + return NO; +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"CHIPCommandPath(%@,%@,%@)", self.endpoint, self.cluster, self.command]; +} +@end + @interface CHIPXPCProtocolTests : XCTestCase @property (nonatomic, readwrite, strong) NSXPCListener * xpcListener; @@ -185,6 +227,8 @@ - (void)readAttributeCacheWithController:(id _Nullable)controller - (void)setUp { + [self setContinueAfterFailure:NO]; + _xpcListener = [NSXPCListener anonymousListener]; [_xpcListener setDelegate:(id) self]; _serviceInterface = [NSXPCInterface interfaceWithProtocol:@protocol(CHIPDeviceControllerServerProtocol)]; @@ -212,13 +256,13 @@ - (void)testReadAttributeSuccess NSUInteger myEndpointId = 100; NSUInteger myClusterId = 200; NSUInteger myAttributeId = 300; - NSArray * myValues = - [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], - @"endpointId", [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", - [NSNumber numberWithUnsignedInteger:myAttributeId], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]]; + NSArray * myValues = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; + XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * responseExpectation = [self expectationWithDescription:@"XPC response received"]; @@ -231,7 +275,7 @@ - (void)testReadAttributeSuccess XCTAssertEqual(clusterId, myClusterId); XCTAssertEqual(attributeId, myAttributeId); [callExpectation fulfill]; - completion(myValues, nil); + completion([CHIPDeviceController encodeXPCResponseValues:myValues], nil); }; [_remoteDeviceController getConnectedDevice:myNodeId @@ -319,11 +363,12 @@ - (void)testWriteAttributeSuccess NSUInteger myAttributeId = 300; NSDictionary * myValue = [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", [NSNumber numberWithInteger:654321], @"value", nil]; - NSArray * myResults = - [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], - @"endpointId", [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", - [NSNumber numberWithUnsignedInteger:myAttributeId], @"attributeId", - [NSNumber numberWithInteger:0], @"status", nil]]; + NSArray * myResults = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]] + } ]; + XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * responseExpectation = [self expectationWithDescription:@"XPC response received"]; @@ -337,7 +382,7 @@ - (void)testWriteAttributeSuccess XCTAssertEqual(attributeId, myAttributeId); XCTAssertTrue([value isEqualTo:myValue]); [callExpectation fulfill]; - completion(myResults, nil); + completion([CHIPDeviceController encodeXPCResponseValues:myResults], nil); }; [_remoteDeviceController getConnectedDevice:myNodeId @@ -432,11 +477,11 @@ - (void)testInvokeCommandSuccess [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Float", @"Type", [NSNumber numberWithFloat:1.0], @"value", nil]], @"value", nil]; - NSArray * myResults = - [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], - @"endpointId", [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", - [NSNumber numberWithUnsignedInteger:myCommandId], @"commandId", - [NSNumber numberWithInteger:0], @"status", nil]]; + NSArray * myResults = @[ @{ + @"commandPath" : [CHIPCommandPath commandPathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + commandId:[NSNumber numberWithUnsignedInteger:myCommandId]] + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * responseExpectation = [self expectationWithDescription:@"XPC response received"]; @@ -450,7 +495,7 @@ - (void)testInvokeCommandSuccess XCTAssertEqual(commandId, myCommandId); XCTAssertTrue([commandFields isEqualTo:myFields]); [callExpectation fulfill]; - completion(myResults, nil); + completion([CHIPDeviceController encodeXPCResponseValues:myResults], nil); }; [_remoteDeviceController getConnectedDevice:myNodeId @@ -545,12 +590,12 @@ - (void)testSubscribeAttributeSuccess NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - __block NSDictionary * myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]; + __block NSArray * myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Report sent"]; @@ -571,48 +616,55 @@ - (void)testSubscribeAttributeSuccess _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"2nd report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -641,14 +693,14 @@ - (void)testBadlyFormattedReport NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - // Incorrect report value. Report must be a single NSDictionary - __block id myReport = - [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], - @"endpointId", [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", - [NSNumber numberWithUnsignedInteger:myAttributeId], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]]; + // Incorrect serialized report value. Report should have ben a single NSDictionary + __block id myReport = @{ + @"attributePath" : @[ + [NSNumber numberWithUnsignedInteger:myEndpointId], [NSNumber numberWithUnsignedInteger:myClusterId], + [NSNumber numberWithUnsignedInteger:myAttributeId] + ], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + }; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Unexpected report sent"]; @@ -670,48 +722,52 @@ - (void)testBadlyFormattedReport _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject badly formatted report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + [clientObject handleReportWithController:uuid nodeId:myNodeId values:myReport error:nil]; // Wait for report, which isn't expected. [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kNegativeTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"Report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -741,12 +797,12 @@ - (void)testReportWithUnrelatedEndpointId NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - __block NSDictionary * myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId + 1], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]; + __block NSArray * myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId + 1] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Unexpected report sent"]; @@ -768,48 +824,55 @@ - (void)testReportWithUnrelatedEndpointId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report which isn't expected [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kNegativeTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"2nd report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -838,12 +901,12 @@ - (void)testReportWithUnrelatedClusterId NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - __block NSDictionary * myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId + 1], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]; + __block NSArray * myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId + 1] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Unexpected report sent"]; @@ -865,48 +928,55 @@ - (void)testReportWithUnrelatedClusterId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report not to come [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kNegativeTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"2nd report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -935,12 +1005,12 @@ - (void)testReportWithUnrelatedAttributeId NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - __block NSDictionary * myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId + 1], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]; + __block NSArray * myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId + 1]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Unexpected report sent"]; @@ -962,48 +1032,55 @@ - (void)testReportWithUnrelatedAttributeId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report not to come [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kNegativeTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"2nd report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -1032,12 +1109,12 @@ - (void)testReportWithUnrelatedNode NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - __block NSDictionary * myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]; + __block NSArray * myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Unexpected report sent"]; @@ -1059,48 +1136,55 @@ - (void)testReportWithUnrelatedNode _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId + 1 value:myReport error:nil]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + 1 + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report not to come [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kNegativeTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"2nd report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -1129,12 +1213,12 @@ - (void)testSubscribeMultiEndpoints NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - __block NSDictionary * myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]; + __block NSArray * myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Report sent"]; @@ -1155,48 +1239,55 @@ - (void)testSubscribeMultiEndpoints _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:0xffff - clusterId:myClusterId - attributeId:myAttributeId - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:0xffff + clusterId:myClusterId + attributeId:myAttributeId + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kNegativeTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"2nd report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -1225,12 +1316,12 @@ - (void)testSubscribeMultiClusters NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - __block NSDictionary * myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]; + __block NSArray * myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Report sent"]; @@ -1251,48 +1342,55 @@ - (void)testSubscribeMultiClusters _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:myEndpointId - clusterId:0xffffffff - attributeId:myAttributeId - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:myEndpointId + clusterId:0xffffffff + attributeId:myAttributeId + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kNegativeTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"2nd report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -1321,12 +1419,12 @@ - (void)testSubscribeMultiAttributes NSUInteger myAttributeId = 300; NSUInteger myMinInterval = 5; NSUInteger myMaxInterval = 60; - __block NSDictionary * myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]; + __block NSArray * myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * establishExpectation = [self expectationWithDescription:@"Established called"]; __block XCTestExpectation * reportExpectation = [self expectationWithDescription:@"Report sent"]; @@ -1347,48 +1445,55 @@ - (void)testSubscribeMultiAttributes _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; - [_remoteDeviceController getConnectedDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Subscribing..."); - [device subscribeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:0xffffffff - minInterval:myMinInterval - maxInterval:myMaxInterval - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Report value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myReport isEqualTo:value]); - [reportExpectation fulfill]; - } - subscriptionEstablished:^{ - [establishExpectation fulfill]; - }]; - }]; + [_remoteDeviceController + getConnectedDevice:myNodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Subscribing..."); + [device subscribeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:0xffffffff + minInterval:myMinInterval + maxInterval:myMaxInterval + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Report value: %@", values); + XCTAssertNotNil(values); + XCTAssertNil(error); + XCTAssertTrue([myReport isEqualTo:values]); + [reportExpectation fulfill]; + } + subscriptionEstablished:^{ + [establishExpectation fulfill]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, establishExpectation, nil] timeout:kTimeoutInSeconds]; // Inject report id clientObject = _xpcConnection.remoteObjectProxy; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; // Inject another report reportExpectation = [self expectationWithDescription:@"2nd report sent"]; - myReport = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], @"endpointId", - [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", [NSNumber numberWithUnsignedInteger:myAttributeId], - @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:771234], @"value", nil], - @"data", nil]; - [clientObject handleReportWithController:uuid nodeId:myNodeId value:myReport error:nil]; + myReport = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @771234 } + } ]; + [clientObject handleReportWithController:uuid + nodeId:myNodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReport] + error:nil]; // Wait for report [self waitForExpectations:[NSArray arrayWithObject:reportExpectation] timeout:kTimeoutInSeconds]; @@ -1423,7 +1528,7 @@ - (void)testMutiSubscriptions __block NSUInteger myAttributeId = attributeIds[0]; __block NSUInteger myMinInterval = minIntervals[0]; __block NSUInteger myMaxInterval = maxIntervals[0]; - __block NSArray * myReports; + __block NSArray * myReports; __block XCTestExpectation * callExpectation; __block XCTestExpectation * establishExpectation; __block NSArray * reportExpectations; @@ -1467,11 +1572,11 @@ - (void)testMutiSubscriptions minInterval:myMinInterval maxInterval:myMaxInterval clientQueue:dispatch_get_main_queue() - reportHandler:^(NSDictionary * _Nullable value, NSError * _Nullable error) { - NSLog(@"Subscriber [%d] report value: %@", i, value); - XCTAssertNotNil(value); + reportHandler:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + NSLog(@"Subscriber [%d] report value: %@", i, values); + XCTAssertNotNil(values); XCTAssertNil(error); - XCTAssertTrue([myReports[i] isEqualTo:value]); + XCTAssertTrue([myReports[i] isEqualTo:values]); [reportExpectations[i] fulfill]; } subscriptionEstablished:^{ @@ -1490,24 +1595,29 @@ - (void)testMutiSubscriptions arrayWithObjects:[self expectationWithDescription:[NSString stringWithFormat:@"Report(%d) for first subscriber sent", count]], [self expectationWithDescription:[NSString stringWithFormat:@"Report(%d) for second subscriber sent", count]], nil]; - myReports = [NSArray - arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:endpointIds[0]], - @"endpointId", [NSNumber numberWithUnsignedInteger:clusterIds[0]], @"clusterId", - [NSNumber numberWithUnsignedInteger:attributeIds[0]], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:123456 + count * 100], @"value", nil], - @"data", nil], - [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:endpointIds[1]], @"endpointId", - [NSNumber numberWithUnsignedInteger:clusterIds[1]], @"clusterId", - [NSNumber numberWithUnsignedInteger:attributeIds[1]], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:123457 + count * 100], @"value", nil], - @"data", nil], - nil]; + myReports = @[ + @[ @{ + @"attributePath" : + [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:endpointIds[0]] + clusterId:[NSNumber numberWithUnsignedInteger:clusterIds[0]] + attributeId:[NSNumber numberWithUnsignedInteger:attributeIds[0]]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : [NSNumber numberWithInteger:123456 + count * 100] } + } ], + @[ @{ + @"attributePath" : + [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:endpointIds[1]] + clusterId:[NSNumber numberWithUnsignedInteger:clusterIds[1]] + attributeId:[NSNumber numberWithUnsignedInteger:attributeIds[1]]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : [NSNumber numberWithInteger:123457 + count * 100] } + } ] + ]; for (int i = 0; i < 2; i++) { NSUInteger nodeId = nodeIds[i]; dispatch_async(dispatch_get_main_queue(), ^{ - [clientObject handleReportWithController:uuid nodeId:nodeId value:myReports[i] error:nil]; + [clientObject handleReportWithController:uuid + nodeId:nodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReports[i]] + error:nil]; }); } [self waitForExpectations:reportExpectations timeout:kTimeoutInSeconds]; @@ -1535,24 +1645,29 @@ - (void)testMutiSubscriptions stringWithFormat:@"Report(%d) for first subscriber sent", count]], [self expectationWithDescription:[NSString stringWithFormat:@"Report(%d) for second subscriber sent", count]], nil]; reportExpectations[0].inverted = YES; - myReports = [NSArray - arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:endpointIds[0]], - @"endpointId", [NSNumber numberWithUnsignedInteger:clusterIds[0]], @"clusterId", - [NSNumber numberWithUnsignedInteger:attributeIds[0]], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:223456 + count * 100], @"value", nil], - @"data", nil], - [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:endpointIds[1]], @"endpointId", - [NSNumber numberWithUnsignedInteger:clusterIds[1]], @"clusterId", - [NSNumber numberWithUnsignedInteger:attributeIds[1]], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:223457 + count * 100], @"value", nil], - @"data", nil], - nil]; + myReports = @[ + @[ @{ + @"attributePath" : + [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:endpointIds[0]] + clusterId:[NSNumber numberWithUnsignedInteger:clusterIds[0]] + attributeId:[NSNumber numberWithUnsignedInteger:attributeIds[0]]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : [NSNumber numberWithInteger:223456 + count * 100] } + } ], + @[ @{ + @"attributePath" : + [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:endpointIds[1]] + clusterId:[NSNumber numberWithUnsignedInteger:clusterIds[1]] + attributeId:[NSNumber numberWithUnsignedInteger:attributeIds[1]]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : [NSNumber numberWithInteger:223457 + count * 100] } + } ] + ]; for (int i = 0; i < 2; i++) { NSUInteger nodeId = nodeIds[i]; dispatch_async(dispatch_get_main_queue(), ^{ - [clientObject handleReportWithController:uuid nodeId:nodeId value:myReports[i] error:nil]; + [clientObject handleReportWithController:uuid + nodeId:nodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReports[i]] + error:nil]; }); } [self waitForExpectations:reportExpectations timeout:kTimeoutInSeconds]; @@ -1584,24 +1699,29 @@ - (void)testMutiSubscriptions [self expectationWithDescription:[NSString stringWithFormat:@"Report(%d) for second subscriber sent", count]], nil]; reportExpectations[0].inverted = YES; reportExpectations[1].inverted = YES; - myReports = [NSArray - arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:endpointIds[0]], - @"endpointId", [NSNumber numberWithUnsignedInteger:clusterIds[0]], @"clusterId", - [NSNumber numberWithUnsignedInteger:attributeIds[0]], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:223456 + count * 100], @"value", nil], - @"data", nil], - [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:endpointIds[1]], @"endpointId", - [NSNumber numberWithUnsignedInteger:clusterIds[1]], @"clusterId", - [NSNumber numberWithUnsignedInteger:attributeIds[1]], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:223457 + count * 100], @"value", nil], - @"data", nil], - nil]; + myReports = @[ + @[ @{ + @"attributePath" : + [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:endpointIds[0]] + clusterId:[NSNumber numberWithUnsignedInteger:clusterIds[0]] + attributeId:[NSNumber numberWithUnsignedInteger:attributeIds[0]]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : [NSNumber numberWithInteger:223456 + count * 100] } + } ], + @[ @{ + @"attributePath" : + [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:endpointIds[1]] + clusterId:[NSNumber numberWithUnsignedInteger:clusterIds[1]] + attributeId:[NSNumber numberWithUnsignedInteger:attributeIds[1]]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : [NSNumber numberWithInteger:223457 + count * 100] } + } ] + ]; for (int i = 0; i < 2; i++) { NSUInteger nodeId = nodeIds[i]; dispatch_async(dispatch_get_main_queue(), ^{ - [clientObject handleReportWithController:uuid nodeId:nodeId value:myReports[i] error:nil]; + [clientObject handleReportWithController:uuid + nodeId:nodeId + values:[CHIPDeviceController encodeXPCResponseValues:myReports[i]] + error:nil]; }); } [self waitForExpectations:reportExpectations timeout:kNegativeTimeoutInSeconds]; @@ -1706,13 +1826,13 @@ - (void)testReadAttributeCacheSuccess NSUInteger myEndpointId = 100; NSUInteger myClusterId = 200; NSUInteger myAttributeId = 300; - NSArray * myValues = - [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:myEndpointId], - @"endpointId", [NSNumber numberWithUnsignedInteger:myClusterId], @"clusterId", - [NSNumber numberWithUnsignedInteger:myAttributeId], @"attributeId", - [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", - [NSNumber numberWithInteger:123456], @"value", nil], - @"data", nil]]; + NSArray * myValues = @[ @{ + @"attributePath" : [CHIPAttributePath attributePathWithEndpointId:[NSNumber numberWithUnsignedInteger:myEndpointId] + clusterId:[NSNumber numberWithUnsignedInteger:myClusterId] + attributeId:[NSNumber numberWithUnsignedInteger:myAttributeId]], + @"data" : @ { @"type" : @"SignedInteger", @"value" : @123456 } + } ]; + XCTestExpectation * subscribeExpectation = [self expectationWithDescription:@"Cache subscription complete"]; XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"]; XCTestExpectation * responseExpectation = [self expectationWithDescription:@"XPC response received"]; @@ -1735,7 +1855,7 @@ - (void)testReadAttributeCacheSuccess XCTAssertEqual(clusterId, myClusterId); XCTAssertEqual(attributeId, myAttributeId); [callExpectation fulfill]; - completion(myValues, nil); + completion([CHIPDeviceController encodeXPCResponseValues:myValues], nil); }; [attributeCacheContainer subscribeWithDeviceController:_remoteDeviceController diff --git a/src/include/platform/CHIPDeviceEvent.h b/src/include/platform/CHIPDeviceEvent.h index b6431bc8b22e33..3a043d12ba61cc 100644 --- a/src/include/platform/CHIPDeviceEvent.h +++ b/src/include/platform/CHIPDeviceEvent.h @@ -444,6 +444,8 @@ struct ChipDeviceEvent final CHIP_ERROR Status; uint64_t PeerNodeId; FabricIndex PeerFabricIndex; + bool AddNocCommandHasBeenInvoked; + bool UpdateNocCommandHasBeenInvoked; } CommissioningComplete; struct diff --git a/src/include/platform/ConfigurationManager.h b/src/include/platform/ConfigurationManager.h index c4f253e1dfccda..c95adb824c39f2 100644 --- a/src/include/platform/ConfigurationManager.h +++ b/src/include/platform/ConfigurationManager.h @@ -152,7 +152,7 @@ class ConfigurationManager virtual void LogDeviceConfig() = 0; virtual bool IsCommissionableDeviceTypeEnabled() = 0; - virtual CHIP_ERROR GetDeviceTypeId(uint16_t & deviceType) = 0; + virtual CHIP_ERROR GetDeviceTypeId(uint32_t & deviceType) = 0; virtual bool IsCommissionableDeviceNameEnabled() = 0; virtual CHIP_ERROR GetCommissionableDeviceName(char * buf, size_t bufSize) = 0; virtual CHIP_ERROR GetInitialPairingHint(uint16_t & pairingHint) = 0; diff --git a/src/include/platform/FailSafeContext.h b/src/include/platform/FailSafeContext.h index b575494574fe48..e31af9bf43e9e2 100644 --- a/src/include/platform/FailSafeContext.h +++ b/src/include/platform/FailSafeContext.h @@ -47,23 +47,31 @@ class FailSafeContext return mFailSafeArmed && MatchesFabricIndex(accessingFabricIndex); } - inline bool IsFailSafeArmed() { return mFailSafeArmed; } + inline bool IsFailSafeArmed() const { return mFailSafeArmed; } - inline bool MatchesFabricIndex(FabricIndex accessingFabricIndex) + inline bool MatchesFabricIndex(FabricIndex accessingFabricIndex) const { VerifyOrDie(mFailSafeArmed); return (accessingFabricIndex == mFabricIndex); } - inline bool NocCommandHasBeenInvoked() { return mNocCommandHasBeenInvoked; } + inline bool NocCommandHasBeenInvoked() const { return mAddNocCommandHasBeenInvoked || mUpdateNocCommandHasBeenInvoked; } + inline bool AddNocCommandHasBeenInvoked() { return mAddNocCommandHasBeenInvoked; } + inline bool UpdateNocCommandHasBeenInvoked() { return mUpdateNocCommandHasBeenInvoked; } - inline void SetNocCommandInvoked(FabricIndex nocFabricIndex) + inline void SetAddNocCommandInvoked(FabricIndex nocFabricIndex) { - mNocCommandHasBeenInvoked = true; - mFabricIndex = nocFabricIndex; + mAddNocCommandHasBeenInvoked = true; + mFabricIndex = nocFabricIndex; } - inline FabricIndex GetFabricIndex() + inline void SetUpdateNocCommandInvoked(FabricIndex nocFabricIndex) + { + mUpdateNocCommandHasBeenInvoked = true; + mFabricIndex = nocFabricIndex; + } + + inline FabricIndex GetFabricIndex() const { VerifyOrDie(mFailSafeArmed); return mFabricIndex; @@ -72,9 +80,10 @@ class FailSafeContext private: // ===== Private members reserved for use by this class only. - bool mFailSafeArmed = false; - bool mNocCommandHasBeenInvoked = false; - FabricIndex mFabricIndex = kUndefinedFabricIndex; + bool mFailSafeArmed = false; + bool mAddNocCommandHasBeenInvoked = false; + bool mUpdateNocCommandHasBeenInvoked = false; + FabricIndex mFabricIndex = kUndefinedFabricIndex; // TODO:: Track the state of what was mutated during fail-safe. diff --git a/src/include/platform/NetworkCommissioning.h b/src/include/platform/NetworkCommissioning.h index 713c2935838f50..7661216e0612c6 100644 --- a/src/include/platform/NetworkCommissioning.h +++ b/src/include/platform/NetworkCommissioning.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -154,10 +155,26 @@ namespace Internal { class BaseDriver { public: + class NetworkStatusChangeCallback + { + public: + /** + * @brief Callback for the network driver pushing the event of network status change to the network commissioning cluster. + * The platforms is explected to push the status from operations such as autonomous connection after loss of connectivity or + * during initial establishment. + * + * This function must be called in a thread-safe manner with CHIP stack. + */ + virtual void OnNetworkingStatusChange(Status commissioningError, Optional networkId, + Optional connectStatus) = 0; + + virtual ~NetworkStatusChangeCallback() = default; + }; + /** * @brief Initializes the driver, this function will be called when initializing the network commissioning cluster. */ - virtual CHIP_ERROR Init() { return CHIP_NO_ERROR; } + virtual CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) { return CHIP_NO_ERROR; } /** * @brief Shuts down the driver, this function will be called when shutting down the network commissioning cluster. @@ -255,7 +272,7 @@ class WiFiDriver : public Internal::WirelessDriver */ virtual void ScanNetworks(ByteSpan ssid, ScanCallback * callback) = 0; - virtual ~WiFiDriver() = default; + ~WiFiDriver() override = default; }; class ThreadDriver : public Internal::WirelessDriver @@ -285,7 +302,7 @@ class ThreadDriver : public Internal::WirelessDriver */ virtual void ScanNetworks(ScanCallback * callback) = 0; - virtual ~ThreadDriver() = default; + ~ThreadDriver() override = default; }; class EthernetDriver : public Internal::BaseDriver diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.cpp b/src/include/platform/internal/GenericConfigurationManagerImpl.cpp index b30fd932c19d84..969a1b484b9c14 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.cpp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.cpp @@ -281,9 +281,9 @@ inline CHIP_ERROR GenericConfigurationManagerImpl::StoreSoftwareVer } template -CHIP_ERROR GenericConfigurationManagerImpl::GetDeviceTypeId(uint16_t & deviceType) +CHIP_ERROR GenericConfigurationManagerImpl::GetDeviceTypeId(uint32_t & deviceType) { - deviceType = static_cast(CHIP_DEVICE_CONFIG_DEVICE_TYPE); + deviceType = static_cast(CHIP_DEVICE_CONFIG_DEVICE_TYPE); return CHIP_NO_ERROR; } @@ -864,12 +864,12 @@ void GenericConfigurationManagerImpl::LogDeviceConfig() } { - uint16_t deviceType; + uint32_t deviceType; if (GetDeviceTypeId(deviceType) != CHIP_NO_ERROR) { deviceType = 0; } - ChipLogProgress(DeviceLayer, " Device Type: %" PRIu16 " (0x%" PRIX16 ")", deviceType, deviceType); + ChipLogProgress(DeviceLayer, " Device Type: %" PRIu32 " (0x%" PRIX32 ")", deviceType, deviceType); } } diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.h b/src/include/platform/internal/GenericConfigurationManagerImpl.h index 41f4dd856ae324..9cc4f523049483 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.h +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.h @@ -87,7 +87,7 @@ class GenericConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR SetFailSafeArmed(bool val) override; CHIP_ERROR GetBLEDeviceIdentificationInfo(Ble::ChipBLEDeviceIdentificationInfo & deviceIdInfo) override; bool IsCommissionableDeviceTypeEnabled() override; - CHIP_ERROR GetDeviceTypeId(uint16_t & deviceType) override; + CHIP_ERROR GetDeviceTypeId(uint32_t & deviceType) override; bool IsCommissionableDeviceNameEnabled() override; CHIP_ERROR GetCommissionableDeviceName(char * buf, size_t bufSize) override; CHIP_ERROR GetInitialPairingHint(uint16_t & pairingHint) override; @@ -126,7 +126,7 @@ class GenericConfigurationManagerImpl : public ConfigurationManager #endif void LogDeviceConfig() override; - virtual ~GenericConfigurationManagerImpl() = default; + ~GenericConfigurationManagerImpl() override = default; protected: #if CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) diff --git a/src/inet/InetInterface.cpp b/src/inet/InetInterface.cpp index be344cbe43b983..9f5356eef52c23 100644 --- a/src/inet/InetInterface.cpp +++ b/src/inet/InetInterface.cpp @@ -283,7 +283,7 @@ bool InterfaceAddressIterator::HasBroadcastAddress() return HasCurrent() && mIntfIter.HasBroadcastAddress(); } -CHIP_ERROR InterfaceId::GetLinkLocalAddr(IPAddress * llAddr) +CHIP_ERROR InterfaceId::GetLinkLocalAddr(IPAddress * llAddr) const { VerifyOrReturnError(llAddr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -754,7 +754,7 @@ bool InterfaceAddressIterator::HasBroadcastAddress() return HasCurrent() && (mCurAddr->ifa_flags & IFF_BROADCAST) != 0; } -CHIP_ERROR InterfaceId::GetLinkLocalAddr(IPAddress * llAddr) +CHIP_ERROR InterfaceId::GetLinkLocalAddr(IPAddress * llAddr) const { VerifyOrReturnError(llAddr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -995,7 +995,7 @@ bool InterfaceAddressIterator::HasBroadcastAddress() return HasCurrent() && mIntfIter.HasBroadcastAddress(); } -CHIP_ERROR InterfaceId::GetLinkLocalAddr(IPAddress * llAddr) +CHIP_ERROR InterfaceId::GetLinkLocalAddr(IPAddress * llAddr) const { VerifyOrReturnError(llAddr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); diff --git a/src/inet/InetInterface.h b/src/inet/InetInterface.h index 1189b0a9024e45..aa303b57a2627f 100644 --- a/src/inet/InetInterface.h +++ b/src/inet/InetInterface.h @@ -180,7 +180,7 @@ class InterfaceId * any address configured. * @retval #CHIP_NO_ERROR On success. */ - CHIP_ERROR GetLinkLocalAddr(IPAddress * llAddr); + CHIP_ERROR GetLinkLocalAddr(IPAddress * llAddr) const; private: #if CHIP_SYSTEM_CONFIG_USE_LWIP diff --git a/src/inet/InetLayer.h b/src/inet/InetLayer.h index 9cd28eb3f2d052..8a075e3bcbd3dd 100644 --- a/src/inet/InetLayer.h +++ b/src/inet/InetLayer.h @@ -117,8 +117,8 @@ class EndPointManagerImplPool : public EndPointManager; using EndPoint = typename EndPointImpl::EndPoint; - EndPointManagerImplPool() = default; - ~EndPointManagerImplPool() = default; + EndPointManagerImplPool() = default; + ~EndPointManagerImplPool() override = default; EndPoint * CreateEndPoint() override { return sEndPointPool.CreateObject(*this); } void ReleaseEndPoint(EndPoint * endPoint) override { sEndPointPool.ReleaseObject(static_cast(endPoint)); } diff --git a/src/inet/TCPEndPointImplSockets.cpp b/src/inet/TCPEndPointImplSockets.cpp index f542d6d46fd3fd..c34603e2099a46 100644 --- a/src/inet/TCPEndPointImplSockets.cpp +++ b/src/inet/TCPEndPointImplSockets.cpp @@ -1030,10 +1030,8 @@ void TCPEndPointImplSockets::HandleIncomingConnection() { return; } - else - { - err = CHIP_ERROR_POSIX(errno); - } + + err = CHIP_ERROR_POSIX(errno); } // If there's no callback available, fail with an error. diff --git a/src/lib/address_resolve/AddressResolve.h b/src/lib/address_resolve/AddressResolve.h index 4a30b8876ecf91..4b2eef1301b1a3 100644 --- a/src/lib/address_resolve/AddressResolve.h +++ b/src/lib/address_resolve/AddressResolve.h @@ -81,6 +81,9 @@ class NodeLookupHandleBase : public IntrusiveListNodeBase void SetListener(NodeListener * listener) { mListener = listener; } NodeListener * GetListener() { return mListener; } + /// Convenience method that is more readable than 'IsInList' + inline bool IsActive() const { return IntrusiveListNodeBase::IsInList(); } + protected: NodeListener * mListener = nullptr; }; @@ -168,6 +171,14 @@ class NodeLookupHandle; class Resolver { public: + /// Enumeration defining how to handle cancel callbacks during operation + /// cancellation. + enum class FailureCallback + { + Call, // Call the failure callback + Skip // do not call the failure callback (generally silent operation) + }; + virtual ~Resolver(); /// Expected to be called at least once before the resolver is ever @@ -193,6 +204,21 @@ class Resolver /// in progress) virtual CHIP_ERROR LookupNode(const NodeLookupRequest & request, Impl::NodeLookupHandle & handle) = 0; + /// Stops an active lookup request. + /// + /// Caller controlls weather the `fail` callback of the handle is invoked or not by using + /// the `cancel_method` argument. + /// + /// Note that there is no default cancel_method on purpose, so that the caller has to make + /// a clear decision if the callback should or should not be invoked. + virtual CHIP_ERROR CancelLookup(Impl::NodeLookupHandle & handle, FailureCallback cancel_method) = 0; + + /// Shut down any active resolves + /// + /// Will immediately fail any scheduled resolve calls and will refuse to register + /// any new lookups until re-initialized. + virtual void Shutdown() = 0; + /// Expected to be provided by the implementation. static Resolver & Instance(); }; diff --git a/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp b/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp index f98d1439e97d5b..848b31b61b792b 100644 --- a/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp +++ b/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp @@ -63,7 +63,7 @@ IpScore ScoreIpAddress(const Inet::IPAddress & ip, Inet::InterfaceId interfaceId { return IpScore::kGlobalUnicastWithSharedPrefix; } - else if (ip.IsIPv6ULA()) + if (ip.IsIPv6ULA()) { return IpScore::kUniqueLocalWithSharedPrefix; } @@ -85,10 +85,8 @@ IpScore ScoreIpAddress(const Inet::IPAddress & ip, Inet::InterfaceId interfaceId return IpScore::kOtherIpv6; } - else - { - return IpScore::kIpv4; - } + + return IpScore::kIpv4; } } // namespace @@ -142,7 +140,7 @@ System::Clock::Timeout NodeLookupHandle::NextEventTimeout(System::Clock::Timesta { return mRequest.GetMinLookupTime() - elapsed; } - else if (elapsed < mRequest.GetMaxLookupTime()) + if (elapsed < mRequest.GetMaxLookupTime()) { return mRequest.GetMaxLookupTime() - elapsed; } @@ -183,6 +181,8 @@ NodeLookupAction NodeLookupHandle::NextAction(System::Clock::Timestamp now) CHIP_ERROR Resolver::LookupNode(const NodeLookupRequest & request, Impl::NodeLookupHandle & handle) { + VerifyOrReturnError(mSystemLayer != nullptr, CHIP_ERROR_INCORRECT_STATE); + handle.ResetForLookup(mTimeSource.GetMonotonicTimestamp(), request); ReturnErrorOnFailure(Dnssd::Resolver::Instance().ResolveNodeId(request.GetPeerId(), Inet::IPAddressType::kAny)); mActiveLookups.PushBack(&handle); @@ -190,6 +190,29 @@ CHIP_ERROR Resolver::LookupNode(const NodeLookupRequest & request, Impl::NodeLoo return CHIP_NO_ERROR; } +CHIP_ERROR Resolver::CancelLookup(Impl::NodeLookupHandle & handle, FailureCallback cancel_method) +{ + VerifyOrReturnError(handle.IsActive(), CHIP_ERROR_INVALID_ARGUMENT); + mActiveLookups.Remove(&handle); + + // Adjust any timing updates. + ReArmTimer(); + + if (cancel_method == FailureCallback::Call) + { + handle.GetListener()->OnNodeAddressResolutionFailed(handle.GetRequest().GetPeerId(), CHIP_ERROR_CANCELLED); + } + + // TODO: There should be some form of cancel into Dnssd::Resolver::Instance() + // to stop any resolution mechanism if applicable. + // + // Current code just removes the internal list and any callbacks of resolution will + // be ignored. This works from the perspective of the caller of this method, + // but may be wasteful by letting dnssd still work in the background. + + return CHIP_NO_ERROR; +} + CHIP_ERROR Resolver::Init(System::Layer * systemLayer) { mSystemLayer = systemLayer; @@ -197,6 +220,31 @@ CHIP_ERROR Resolver::Init(System::Layer * systemLayer) return CHIP_NO_ERROR; } +void Resolver::Shutdown() +{ + while (mActiveLookups.begin() != mActiveLookups.end()) + { + auto current = mActiveLookups.begin(); + + const PeerId peerId = current->GetRequest().GetPeerId(); + NodeListener * listener = current->GetListener(); + + mActiveLookups.Erase(current); + + // Failure callback only called after iterator was cleared: + // This allows failure handlers to deallocate structures that may + // contain the active lookup data as a member (intrusive lists members) + listener->OnNodeAddressResolutionFailed(peerId, CHIP_ERROR_SHUT_DOWN); + } + + // Re-arm of timer is expected to cancel any active timer as the + // internal list of active lookups is empty at this point. + ReArmTimer(); + + mSystemLayer = nullptr; + Dnssd::Resolver::Instance().SetOperationalDelegate(nullptr); +} + void Resolver::OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeData) { auto it = mActiveLookups.begin(); diff --git a/src/lib/address_resolve/AddressResolve_DefaultImpl.h b/src/lib/address_resolve/AddressResolve_DefaultImpl.h index 57d6e14c812d67..c05bdfc7f93f62 100644 --- a/src/lib/address_resolve/AddressResolve_DefaultImpl.h +++ b/src/lib/address_resolve/AddressResolve_DefaultImpl.h @@ -129,12 +129,14 @@ class NodeLookupHandle : public NodeLookupHandleBase class Resolver : public ::chip::AddressResolve::Resolver, public Dnssd::OperationalResolveDelegate { public: - virtual ~Resolver() = default; + ~Resolver() override = default; // AddressResolve::Resolver CHIP_ERROR Init(System::Layer * systemLayer) override; CHIP_ERROR LookupNode(const NodeLookupRequest & request, Impl::NodeLookupHandle & handle) override; + CHIP_ERROR CancelLookup(Impl::NodeLookupHandle & handle, FailureCallback cancel_method) override; + void Shutdown() override; // Dnssd::OperationalResolveDelegate diff --git a/src/lib/address_resolve/tool.cpp b/src/lib/address_resolve/tool.cpp index 1d852d280e7d46..9a87d1f2c63ec6 100644 --- a/src/lib/address_resolve/tool.cpp +++ b/src/lib/address_resolve/tool.cpp @@ -141,7 +141,7 @@ extern "C" int main(int argc, const char ** argv) ChipLogError(NotSpecified, "Please specify a command, or 'help' for help."); return -1; } - else if (strcasecmp(argv[1], "help") == 0 || strcasecmp(argv[1], "--help") == 0 || strcasecmp(argv[1], "-h") == 0) + if (strcasecmp(argv[1], "help") == 0 || strcasecmp(argv[1], "--help") == 0 || strcasecmp(argv[1], "-h") == 0) { fputs(sHelp, stdout); return 0; @@ -158,9 +158,7 @@ extern "C" int main(int argc, const char ** argv) { return Cmd_Node(argc - 2, argv + 2) ? 0 : 1; } - else - { - ChipLogError(NotSpecified, "Unrecognized command: %s", argv[1]); - return 1; - } + + ChipLogError(NotSpecified, "Unrecognized command: %s", argv[1]); + return 1; } diff --git a/src/lib/asn1/ASN1Reader.cpp b/src/lib/asn1/ASN1Reader.cpp index 309af285b55e1e..a6aaec2548b3a8 100644 --- a/src/lib/asn1/ASN1Reader.cpp +++ b/src/lib/asn1/ASN1Reader.cpp @@ -342,8 +342,7 @@ CHIP_ERROR DumpASN1(ASN1Reader & asn1Parser, const char * prefix, const char * i nestLevel--; continue; } - else - break; + break; } printf("ASN1Reader::Next() failed: %" CHIP_ERROR_FORMAT "\n", err.Format()); return err; diff --git a/src/lib/asn1/ASN1Writer.cpp b/src/lib/asn1/ASN1Writer.cpp index d899805a004f17..6b3d313e825456 100644 --- a/src/lib/asn1/ASN1Writer.cpp +++ b/src/lib/asn1/ASN1Writer.cpp @@ -282,8 +282,7 @@ CHIP_ERROR ASN1Writer::PutTime(const ASN1UniversalTime & val) // if (val.Year >= 2050) return PutValue(kASN1TagClass_Universal, kASN1UniversalTag_GeneralizedTime, false, buf, 15); - else - return PutValue(kASN1TagClass_Universal, kASN1UniversalTag_UTCTime, false, buf + 2, 13); + return PutValue(kASN1TagClass_Universal, kASN1UniversalTag_UTCTime, false, buf + 2, 13); } CHIP_ERROR ASN1Writer::PutNull() diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index f8c3458caade7b..d1f7c440c7312d 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -1466,8 +1466,21 @@ using CHIP_ERROR = ::chip::ChipError; */ #define CHIP_ERROR_TOO_MANY_CONNECTIONS CHIP_CORE_ERROR(0x72) -// unused CHIP_CORE_ERROR(0x73) -// unused CHIP_CORE_ERROR(0x74) +/** + * @def CHIP_ERROR_SHUT_DOWN + * + * @brief + * The operation cancelled because a shut down was initiated + */ +#define CHIP_ERROR_SHUT_DOWN CHIP_CORE_ERROR(0x73) + +/** + * @def CHIP_ERROR_SHUT_DOWN + * + * @brief + * The operation has been cancelled, generally by calling a cancel/abort request. + */ +#define CHIP_ERROR_CANCELLED CHIP_CORE_ERROR(0x74) /** * @def CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED @@ -2408,7 +2421,6 @@ using CHIP_ERROR = ::chip::ChipError; */ #define CHIP_ERROR_BUSY CHIP_CORE_ERROR(0xdb) - /** * @} */ diff --git a/src/lib/core/CHIPTLV.h b/src/lib/core/CHIPTLV.h index 9f3947c1df98bc..9dff35af5e476a 100644 --- a/src/lib/core/CHIPTLV.h +++ b/src/lib/core/CHIPTLV.h @@ -938,7 +938,7 @@ class DLL_EXPORT TLVReader CHIP_ERROR SkipData(); CHIP_ERROR SkipToEndOfContainer(); CHIP_ERROR VerifyElement(); - Tag ReadTag(TLVTagControl tagControl, const uint8_t *& p); + Tag ReadTag(TLVTagControl tagControl, const uint8_t *& p) const; CHIP_ERROR EnsureData(CHIP_ERROR noDataErr); CHIP_ERROR ReadData(uint8_t * buf, uint32_t len); CHIP_ERROR GetElementHeadLength(uint8_t & elemHeadBytes) const; @@ -2370,7 +2370,7 @@ class DLL_EXPORT TLVUpdater * implicit form. */ void SetImplicitProfileId(uint32_t profileId); - uint32_t GetImplicitProfileId() { return mUpdaterReader.ImplicitProfileId; } + uint32_t GetImplicitProfileId() const { return mUpdaterReader.ImplicitProfileId; } /** * Copies the current element from input TLV to output TLV. @@ -2610,7 +2610,7 @@ class DLL_EXPORT TLVUpdater } CHIP_ERROR EndContainer(TLVType outerContainerType) { return mUpdaterWriter.EndContainer(outerContainerType); } uint32_t GetLengthWritten() { return mUpdaterWriter.GetLengthWritten(); } - uint32_t GetRemainingFreeLength() { return mUpdaterWriter.mRemainingLen; } + uint32_t GetRemainingFreeLength() const { return mUpdaterWriter.mRemainingLen; } private: void AdjustInternalWriterFreeSpace(); diff --git a/src/lib/core/CHIPTLVReader.cpp b/src/lib/core/CHIPTLVReader.cpp index 18950d7111e863..9c5f23c5d60389 100644 --- a/src/lib/core/CHIPTLVReader.cpp +++ b/src/lib/core/CHIPTLVReader.cpp @@ -784,7 +784,7 @@ CHIP_ERROR TLVReader::VerifyElement() return CHIP_NO_ERROR; } -Tag TLVReader::ReadTag(TLVTagControl tagControl, const uint8_t *& p) +Tag TLVReader::ReadTag(TLVTagControl tagControl, const uint8_t *& p) const { uint16_t vendorId; uint16_t profileNum; diff --git a/src/lib/core/CHIPTLVUpdater.cpp b/src/lib/core/CHIPTLVUpdater.cpp index c9d489072cb5d5..a41abc1532843e 100644 --- a/src/lib/core/CHIPTLVUpdater.cpp +++ b/src/lib/core/CHIPTLVUpdater.cpp @@ -63,7 +63,7 @@ CHIP_ERROR TLVUpdater::Init(TLVReader & aReader, uint32_t freeLen) uint32_t readDataLen = aReader.GetLengthRead(); // TLVUpdater does not support backing stores yet - VerifyOrReturnError(aReader.mBackingStore == 0, CHIP_ERROR_NOT_IMPLEMENTED); + VerifyOrReturnError(aReader.mBackingStore == nullptr, CHIP_ERROR_NOT_IMPLEMENTED); // TLVReader should point to a non-NULL buffer VerifyOrReturnError(buf != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -84,7 +84,7 @@ CHIP_ERROR TLVUpdater::Init(TLVReader & aReader, uint32_t freeLen) memmove(buf + freeLen, buf, remainingDataLen); // Initialize the internal reader object - mUpdaterReader.mBackingStore = 0; + mUpdaterReader.mBackingStore = nullptr; mUpdaterReader.mReadPoint = buf + freeLen; mUpdaterReader.mBufEnd = buf + freeLen + remainingDataLen; mUpdaterReader.mLenRead = readDataLen; @@ -99,7 +99,7 @@ CHIP_ERROR TLVUpdater::Init(TLVReader & aReader, uint32_t freeLen) mUpdaterReader.AppData = aReader.AppData; // Initialize the internal writer object - mUpdaterWriter.mBackingStore = 0; + mUpdaterWriter.mBackingStore = nullptr; mUpdaterWriter.mBufStart = buf - readDataLen; mUpdaterWriter.mWritePoint = buf; mUpdaterWriter.mRemainingLen = freeLen; diff --git a/src/lib/dnssd/ActiveResolveAttempts.cpp b/src/lib/dnssd/ActiveResolveAttempts.cpp index 9137b1bdb169b4..c645c0ed98fc22 100644 --- a/src/lib/dnssd/ActiveResolveAttempts.cpp +++ b/src/lib/dnssd/ActiveResolveAttempts.cpp @@ -110,7 +110,7 @@ void ActiveResolveAttempts::MarkPending(const ScheduledAttempt & attempt) entryToUse = entry; continue; } - else if (entryToUse->attempt.IsEmpty()) + if (entryToUse->attempt.IsEmpty()) { continue; } diff --git a/src/lib/dnssd/Advertiser.h b/src/lib/dnssd/Advertiser.h index c7f003242bdfc8..bf6900acdda5b2 100644 --- a/src/lib/dnssd/Advertiser.h +++ b/src/lib/dnssd/Advertiser.h @@ -180,12 +180,12 @@ class CommissionAdvertisingParameters : public BaseAdvertisingParams deviceType) + CommissionAdvertisingParameters & SetDeviceType(Optional deviceType) { mDeviceType = deviceType; return *this; } - Optional GetDeviceType() const { return mDeviceType; } + Optional GetDeviceType() const { return mDeviceType; } CommissionAdvertisingParameters & SetDeviceName(Optional deviceName) { @@ -262,7 +262,7 @@ class CommissionAdvertisingParameters : public BaseAdvertisingParams mVendorId; chip::Optional mProductId; - chip::Optional mDeviceType; + chip::Optional mDeviceType; chip::Optional mPairingHint; char mDeviceName[kKeyDeviceNameMaxLength + 1]; diff --git a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp index 7ef2e5affae4a0..3f9d5a433a08e6 100644 --- a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include // Enable detailed mDNS logging for received queries @@ -98,6 +99,54 @@ void LogQuery(const QueryData & data) void LogQuery(const QueryData & data) {} #endif +// Max number of records for operational = PTR, SRV, TXT, A, AAAA, I subtype. +constexpr size_t kMaxOperationalRecords = 6; + +/// Represents an allocated operational responder. +/// +/// Wraps a QueryResponderAllocator. +class OperationalQueryAllocator : public chip::IntrusiveListNodeBase +{ +public: + using Allocator = QueryResponderAllocator; + + /// Prefer to use `::New` for allocations instead of this direct call + explicit OperationalQueryAllocator(Allocator * allocator) : mAllocator(allocator) {} + ~OperationalQueryAllocator() + { + chip::Platform::Delete(mAllocator); + mAllocator = nullptr; + } + + Allocator * GetAllocator() { return mAllocator; } + const Allocator * GetAllocator() const { return mAllocator; } + + /// Allocate a new entry for this type. + /// + /// May return null on allocation failures. + static OperationalQueryAllocator * New() + { + Allocator * allocator = chip::Platform::New(); + + if (allocator == nullptr) + { + return nullptr; + } + + OperationalQueryAllocator * result = chip::Platform::New(allocator); + if (result == nullptr) + { + chip::Platform::Delete(allocator); + return nullptr; + } + + return result; + } + +private: + Allocator * mAllocator = nullptr; +}; + class AdvertiserMinMdns : public ServiceAdvertiser, public MdnsPacketDelegate, // receive query packets public ParserDelegate // parses queries @@ -106,14 +155,21 @@ class AdvertiserMinMdns : public ServiceAdvertiser, AdvertiserMinMdns() : mResponseSender(&GlobalMinimalMdnsServer::Server()) { GlobalMinimalMdnsServer::Instance().SetQueryDelegate(this); - for (auto & allocator : mQueryResponderAllocatorOperational) + + CHIP_ERROR err = mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissionable.GetQueryResponder()); + + if (err != CHIP_NO_ERROR) { - mResponseSender.AddQueryResponder(allocator.GetQueryResponder()); + ChipLogError(Discovery, "Failed to set up commissionable responder: %" CHIP_ERROR_FORMAT, err.Format()); + } + + err = mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissioner.GetQueryResponder()); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Discovery, "Failed to set up commissioner responder: %" CHIP_ERROR_FORMAT, err.Format()); } - mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissionable.GetQueryResponder()); - mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissioner.GetQueryResponder()); } - ~AdvertiserMinMdns() {} + ~AdvertiserMinMdns() override { RemoveServices(); } // Service advertiser CHIP_ERROR Init(chip::Inet::EndPointManager * udpEndPointManager) override; @@ -143,7 +199,8 @@ class AdvertiserMinMdns : public ServiceAdvertiser, bool ShouldAdvertiseOn(const chip::Inet::InterfaceId id, const chip::Inet::IPAddress & addr); FullQName GetCommissioningTxtEntries(const CommissionAdvertisingParameters & params); - FullQName GetOperationalTxtEntries(const OperationalAdvertisingParameters & params); + FullQName GetOperationalTxtEntries(OperationalQueryAllocator::Allocator * allocator, + const OperationalAdvertisingParameters & params); struct CommonTxtEntryStorage { @@ -205,17 +262,15 @@ class AdvertiserMinMdns : public ServiceAdvertiser, return CHIP_NO_ERROR; } - // Max number of records for operational = PTR, SRV, TXT, A, AAAA, I subtype. - static constexpr size_t kMaxOperationalRecords = 6; - static constexpr size_t kMaxOperationalNetworks = 5; - QueryResponderAllocator mQueryResponderAllocatorOperational[kMaxOperationalNetworks]; + IntrusiveList mOperationalResponders; + // Max number of records for commissionable = 7 x PTR (base + 6 sub types - _S, _L, _D, _T, _C, _A), SRV, TXT, A, AAAA static constexpr size_t kMaxCommissionRecords = 11; QueryResponderAllocator mQueryResponderAllocatorCommissionable; QueryResponderAllocator mQueryResponderAllocatorCommissioner; - QueryResponderAllocator * FindOperationalAllocator(const FullQName & qname); - QueryResponderAllocator * FindEmptyOperationalAllocator(); + OperationalQueryAllocator::Allocator * FindOperationalAllocator(const FullQName & qname); + OperationalQueryAllocator::Allocator * FindEmptyOperationalAllocator(); ResponseSender mResponseSender; uint8_t mCommissionableInstanceName[sizeof(uint64_t)]; @@ -289,38 +344,66 @@ void AdvertiserMinMdns::Shutdown() CHIP_ERROR AdvertiserMinMdns::RemoveServices() { - for (auto & allocator : mQueryResponderAllocatorOperational) + while (mOperationalResponders.begin() != mOperationalResponders.end()) { - allocator.Clear(); + auto it = mOperationalResponders.begin(); + + // Need to free the memory once it is out of the list + OperationalQueryAllocator * ptr = &*it; + + // Mark as unused + ptr->GetAllocator()->Clear(); + + CHIP_ERROR err = mResponseSender.RemoveQueryResponder(ptr->GetAllocator()->GetQueryResponder()); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Discovery, "Failed to remove query responder: %" CHIP_ERROR_FORMAT, err.Format()); + } + + mOperationalResponders.Remove(ptr); + + // Finally release the memory + chip::Platform::Delete(ptr); } + mQueryResponderAllocatorCommissionable.Clear(); mQueryResponderAllocatorCommissioner.Clear(); return CHIP_NO_ERROR; } -QueryResponderAllocator * -AdvertiserMinMdns::FindOperationalAllocator(const FullQName & qname) +OperationalQueryAllocator::Allocator * AdvertiserMinMdns::FindOperationalAllocator(const FullQName & qname) { - for (auto & allocator : mQueryResponderAllocatorOperational) + for (auto & it : mOperationalResponders) { - if (allocator.GetResponder(QType::SRV, qname) != nullptr) + if (it.GetAllocator()->GetResponder(QType::SRV, qname) != nullptr) { - return &allocator; + return it.GetAllocator(); } } + return nullptr; } -QueryResponderAllocator * AdvertiserMinMdns::FindEmptyOperationalAllocator() +OperationalQueryAllocator::Allocator * AdvertiserMinMdns::FindEmptyOperationalAllocator() { - for (auto & allocator : mQueryResponderAllocatorOperational) + OperationalQueryAllocator * result = OperationalQueryAllocator::New(); + + if (result == nullptr) { - if (allocator.IsEmpty()) - { - return &allocator; - } + return nullptr; } - return nullptr; + + CHIP_ERROR err = mResponseSender.AddQueryResponder(result->GetAllocator()->GetQueryResponder()); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Discovery, "Failed to register query responder: %" CHIP_ERROR_FORMAT, err.Format()); + Platform::Delete(result); + return nullptr; + } + + mOperationalResponders.PushBack(result); + return result->GetAllocator(); } CHIP_ERROR AdvertiserMinMdns::Advertise(const OperationalAdvertisingParameters & params) @@ -377,7 +460,8 @@ CHIP_ERROR AdvertiserMinMdns::Advertise(const OperationalAdvertisingParameters & return CHIP_ERROR_NO_MEMORY; } - if (!operationalAllocator->AddResponder(TxtResourceRecord(instanceName, GetOperationalTxtEntries(params))) + if (!operationalAllocator + ->AddResponder(TxtResourceRecord(instanceName, GetOperationalTxtEntries(operationalAllocator, params))) .SetReportAdditional(hostName) .IsValid()) { @@ -616,21 +700,20 @@ CHIP_ERROR AdvertiserMinMdns::Advertise(const CommissionAdvertisingParameters & return CHIP_NO_ERROR; } -FullQName AdvertiserMinMdns::GetOperationalTxtEntries(const OperationalAdvertisingParameters & params) +FullQName AdvertiserMinMdns::GetOperationalTxtEntries(OperationalQueryAllocator::Allocator * allocator, + const OperationalAdvertisingParameters & params) { char * txtFields[OperationalAdvertisingParameters::kTxtMaxNumber]; size_t numTxtFields = 0; - auto * allocator = mQueryResponderAllocatorOperational; + struct CommonTxtEntryStorage commonStorage; AddCommonTxtEntries(params, commonStorage, txtFields, numTxtFields); if (numTxtFields == 0) { return allocator->AllocateQNameFromArray(mEmptyTextEntries, 1); } - else - { - return allocator->AllocateQNameFromArray(txtFields, numTxtFields); - } + + return allocator->AllocateQNameFromArray(txtFields, numTxtFields); } FullQName AdvertiserMinMdns::GetCommissioningTxtEntries(const CommissionAdvertisingParameters & params) @@ -657,7 +740,7 @@ FullQName AdvertiserMinMdns::GetCommissioningTxtEntries(const CommissionAdvertis char txtDeviceType[chip::Dnssd::kKeyDeviceTypeMaxLength + 4]; if (params.GetDeviceType().HasValue()) { - snprintf(txtDeviceType, sizeof(txtDeviceType), "DT=%d", params.GetDeviceType().Value()); + snprintf(txtDeviceType, sizeof(txtDeviceType), "DT=%" PRIu32, params.GetDeviceType().Value()); txtFields[numTxtFields++] = txtDeviceType; } @@ -707,10 +790,8 @@ FullQName AdvertiserMinMdns::GetCommissioningTxtEntries(const CommissionAdvertis { return allocator->AllocateQNameFromArray(mEmptyTextEntries, 1); } - else - { - return allocator->AllocateQNameFromArray(txtFields, numTxtFields); - } + + return allocator->AllocateQNameFromArray(txtFields, numTxtFields); } bool AdvertiserMinMdns::ShouldAdvertiseOn(const chip::Inet::InterfaceId id, const chip::Inet::IPAddress & addr) @@ -787,9 +868,9 @@ void AdvertiserMinMdns::AdvertiseRecords() QueryData queryData(QType::PTR, QClass::IN, false /* unicast */); queryData.SetIsBootAdvertising(true); - for (auto & allocator : mQueryResponderAllocatorOperational) + for (auto & it : mOperationalResponders) { - allocator.GetQueryResponder()->ClearBroadcastThrottle(); + it.GetAllocator()->GetQueryResponder()->ClearBroadcastThrottle(); } mQueryResponderAllocatorCommissionable.GetQueryResponder()->ClearBroadcastThrottle(); mQueryResponderAllocatorCommissioner.GetQueryResponder()->ClearBroadcastThrottle(); @@ -802,9 +883,9 @@ void AdvertiserMinMdns::AdvertiseRecords() } // Once all automatic broadcasts are done, allow immediate replies once. - for (auto & allocator : mQueryResponderAllocatorOperational) + for (auto & it : mOperationalResponders) { - allocator.GetQueryResponder()->ClearBroadcastThrottle(); + it.GetAllocator()->GetQueryResponder()->ClearBroadcastThrottle(); } mQueryResponderAllocatorCommissionable.GetQueryResponder()->ClearBroadcastThrottle(); mQueryResponderAllocatorCommissioner.GetQueryResponder()->ClearBroadcastThrottle(); diff --git a/src/lib/dnssd/AllInterfacesListenIterator.h b/src/lib/dnssd/AllInterfacesListenIterator.h index 7366a3ca037605..2134ea6f9d90a8 100644 --- a/src/lib/dnssd/AllInterfacesListenIterator.h +++ b/src/lib/dnssd/AllInterfacesListenIterator.h @@ -29,7 +29,7 @@ namespace Dnssd { template bool IsCurrentInterfaceUsable(T & iterator) { - if (!iterator.IsUp() || !iterator.SupportsMulticast()) + if (!iterator.IsUp()) { return false; // not a usable interface } diff --git a/src/lib/dnssd/Constants.h b/src/lib/dnssd/Constants.h index b3aeaae7379e4e..992ab9cba4bb63 100644 --- a/src/lib/dnssd/Constants.h +++ b/src/lib/dnssd/Constants.h @@ -38,7 +38,7 @@ constexpr size_t kHostNameMaxLength = 16; // MAC or 802.15.4 Extended Address in constexpr size_t kSubTypeShortDiscriminatorMaxLength = 4; // _S
constexpr size_t kSubTypeLongDiscriminatorMaxLength = 6; // _L constexpr size_t kSubTypeVendorIdMaxLength = 7; // _V -constexpr size_t kSubTypeDeviceTypeMaxLength = 5; // _T +constexpr size_t kSubTypeDeviceTypeMaxLength = 12; // _T constexpr size_t kSubTypeCommissioningModeMaxLength = 3; // _C constexpr size_t kSubTypeAdditionalCommissioningMaxLength = 3; // _A constexpr size_t kSubTypeCompressedFabricIdMaxLength = 18; // _I<16-hex-digits> diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index a6d5e1273f995b..d68b07ac436671 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -157,7 +157,6 @@ static void HandleNodeIdResolve(void * context, DnssdService * result, const Spa } nodeData.LogNodeIdResolved(); - nodeData.PrioritizeAddresses(); proxy->OnOperationalNodeResolved(nodeData); proxy->Release(); } @@ -627,6 +626,10 @@ Resolver & chip::Dnssd::Resolver::Instance() CHIP_ERROR ResolverProxy::ResolveNodeId(const PeerId & peerId, Inet::IPAddressType type) { VerifyOrReturnError(mDelegate != nullptr, CHIP_ERROR_INCORRECT_STATE); + + ChipLogProgress(Discovery, "Resolving " ChipLogFormatX64 ":" ChipLogFormatX64 " ...", + ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId())); + mDelegate->Retain(); DnssdService service; diff --git a/src/lib/dnssd/DnssdCache.h b/src/lib/dnssd/DnssdCache.h index bdc3d1a69bdaa8..bdbb23433ef36a 100644 --- a/src/lib/dnssd/DnssdCache.h +++ b/src/lib/dnssd/DnssdCache.h @@ -160,8 +160,7 @@ class DnssdCache MarkEntryUnused(entry); break; // return nullptr } - else - return &entry; + return &entry; } if (entry.mPeerId != nullPeerId && entry.mExpiryTime < current_time) { diff --git a/src/lib/dnssd/MinimalMdnsServer.h b/src/lib/dnssd/MinimalMdnsServer.h index e956fa017d9cf7..b6aa48f456a435 100644 --- a/src/lib/dnssd/MinimalMdnsServer.h +++ b/src/lib/dnssd/MinimalMdnsServer.h @@ -23,12 +23,13 @@ namespace chip { namespace Dnssd { namespace Internal { + /// Checks if the current interface is powered on /// and not local loopback. template bool IsCurrentInterfaceUsable(T & iterator) { - if (!iterator.IsUp() || !iterator.SupportsMulticast()) + if (!iterator.IsUp()) { return false; // not a usable interface } @@ -84,10 +85,8 @@ class GlobalMinimalMdnsServer : public mdns::Minimal::ServerDelegate { return *Instance().mReplacementServer; } - else - { - return Instance().mServer; - } + + return Instance().mServer; } /// Calls Server().Listen() on all available interfaces diff --git a/src/lib/dnssd/Resolver.h b/src/lib/dnssd/Resolver.h index aeb8f01d04277a..8984790d9f9326 100644 --- a/src/lib/dnssd/Resolver.h +++ b/src/lib/dnssd/Resolver.h @@ -40,32 +40,6 @@ struct ResolvedNodeData // TODO: use pool to allow dynamic static constexpr unsigned kMaxIPAddresses = 5; - static bool IsIpLess(const Inet::IPAddress & a, const Inet::IPAddress & b) - { - // Link-local last - if (a.IsIPv6LinkLocal() && !b.IsIPv6LinkLocal()) - { - return false; - } - if (!a.IsIPv6LinkLocal() && b.IsIPv6LinkLocal()) - { - return true; - } - - // IPv6 before IPv4 - if (a.IsIPv6() && !b.IsIPv6()) - { - return false; - } - if (!a.IsIPv6() && b.IsIPv6()) - { - return true; - } - - // no ordering, do not care - return false; - } - void LogNodeIdResolved() const { #if CHIP_PROGRESS_LOGGING @@ -73,7 +47,8 @@ struct ResolvedNodeData // Would be nice to log the interface id, but sorting out how to do so // across our differnet InterfaceId implementations is a pain. - ChipLogProgress(Discovery, "Node ID resolved for 0x" ChipLogFormatX64, ChipLogValueX64(mPeerId.GetNodeId())); + ChipLogProgress(Discovery, "Node ID resolved for " ChipLogFormatX64 ":" ChipLogFormatX64, + ChipLogValueX64(mPeerId.GetCompressedFabricId()), ChipLogValueX64(mPeerId.GetNodeId())); for (unsigned i = 0; i < mNumIPs; ++i) { mAddress[i].ToString(addrBuffer); @@ -82,25 +57,6 @@ struct ResolvedNodeData #endif // CHIP_PROGRESS_LOGGING } - /// Sorts IP addresses in a consistent order. Specifically places - /// Link-local IPv6 addresses at the end (e.g. mDNS reflector services in Unify will - /// return link-local addresses that will not work) and prioritizes global IPv6 addresses - /// before IPv4 ones. - void PrioritizeAddresses() - { - // Slow sort, however we have maximum kMaxIPAddreses, so this is good enough for now - for (unsigned i = 0; i + 1 < mNumIPs; i++) - { - for (unsigned j = i + 1; i < mNumIPs; i++) - { - if (IsIpLess(mAddress[j], mAddress[i])) - { - std::swap(mAddress[i], mAddress[j]); - } - } - } - } - ReliableMessageProtocolConfig GetMRPConfig() const { const ReliableMessageProtocolConfig defaultConfig = GetLocalMRPConfig(); @@ -318,10 +274,8 @@ struct DiscoveryFilter { return (instanceName != nullptr) && (other.instanceName != nullptr) && (strcmp(instanceName, other.instanceName) == 0); } - else - { - return code == other.code; - } + + return code == other.code; } }; enum class DiscoveryType diff --git a/src/lib/dnssd/ResolverProxy.h b/src/lib/dnssd/ResolverProxy.h index 00bb397a9cd4f0..57690c2dbb7920 100644 --- a/src/lib/dnssd/ResolverProxy.h +++ b/src/lib/dnssd/ResolverProxy.h @@ -86,6 +86,24 @@ class ResolverProxy : public Resolver ReturnErrorOnFailure(chip::Dnssd::Resolver::Instance().Init(udpEndPoint)); VerifyOrReturnError(mDelegate == nullptr, CHIP_ERROR_INCORRECT_STATE); mDelegate = chip::Platform::New(); + + if (mDelegate != nullptr) + { + if (mPreInitOperationalDelegate != nullptr) + { + ChipLogProgress(Discovery, "Setting operational delegate post init"); + mDelegate->SetOperationalDelegate(mPreInitOperationalDelegate); + mPreInitOperationalDelegate = nullptr; + } + + if (mPreInitCommissioningDelegate != nullptr) + { + ChipLogProgress(Discovery, "Setting commissioning delegate post init"); + mDelegate->SetCommissioningDelegate(mPreInitCommissioningDelegate); + mPreInitCommissioningDelegate = nullptr; + } + } + return mDelegate != nullptr ? CHIP_NO_ERROR : CHIP_ERROR_NO_MEMORY; } @@ -97,7 +115,8 @@ class ResolverProxy : public Resolver } else { - ChipLogError(Discovery, "Failed to proxy operational discovery: missing delegate"); + ChipLogProgress(Discovery, "Delaying proxy of operational discovery: missing delegate"); + mPreInitOperationalDelegate = delegate; } } @@ -109,7 +128,8 @@ class ResolverProxy : public Resolver } else { - ChipLogError(Discovery, "Failed to proxy commissioning discovery: missing delegate"); + ChipLogError(Discovery, "Delaying proxy of commissioning discovery: missing delegate"); + mPreInitCommissioningDelegate = delegate; } } @@ -127,7 +147,9 @@ class ResolverProxy : public Resolver CHIP_ERROR FindCommissioners(DiscoveryFilter filter = DiscoveryFilter()) override; private: - ResolverDelegateProxy * mDelegate = nullptr; + ResolverDelegateProxy * mDelegate = nullptr; + OperationalResolveDelegate * mPreInitOperationalDelegate = nullptr; + CommissioningResolveDelegate * mPreInitCommissioningDelegate = nullptr; }; } // namespace Dnssd diff --git a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp index 40e8037c527dfc..92130e2e21772a 100644 --- a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp @@ -338,7 +338,6 @@ void PacketDataReporter::OnComplete(ActiveResolveAttempts & activeAttempts) { activeAttempts.Complete(mNodeData.mPeerId); mNodeData.LogNodeIdResolved(); - mNodeData.PrioritizeAddresses(); // // This is a quick fix to address some failing tests. Issue #15489 tracks the correct fix here. @@ -684,6 +683,9 @@ Resolver & chip::Dnssd::Resolver::Instance() CHIP_ERROR ResolverProxy::ResolveNodeId(const PeerId & peerId, Inet::IPAddressType type) { VerifyOrReturnError(mDelegate != nullptr, CHIP_ERROR_INCORRECT_STATE); + + ChipLogProgress(Discovery, "Resolving " ChipLogFormatX64 ":" ChipLogFormatX64 " ...", + ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId())); chip::Dnssd::Resolver::Instance().SetOperationalDelegate(mDelegate); return chip::Dnssd::Resolver::Instance().ResolveNodeId(peerId, type); } diff --git a/src/lib/dnssd/ServiceNaming.cpp b/src/lib/dnssd/ServiceNaming.cpp index e1a2c8c6d9df95..8afd9199dba87b 100644 --- a/src/lib/dnssd/ServiceNaming.cpp +++ b/src/lib/dnssd/ServiceNaming.cpp @@ -121,8 +121,7 @@ CHIP_ERROR MakeServiceSubtype(char * buffer, size_t bufferLen, DiscoveryFilter s requiredSize = snprintf(buffer, bufferLen, "_V%" PRIu16, static_cast(subtype.code)); break; case DiscoveryFilterType::kDeviceType: - // TODO: Not totally clear the size required here: see spec issue #3226 - requiredSize = snprintf(buffer, bufferLen, "_T%" PRIu16, static_cast(subtype.code)); + requiredSize = snprintf(buffer, bufferLen, "_T%" PRIu32, static_cast(subtype.code)); break; case DiscoveryFilterType::kCommissioningMode: requiredSize = snprintf(buffer, bufferLen, "_CM"); diff --git a/src/lib/dnssd/TxtFields.cpp b/src/lib/dnssd/TxtFields.cpp index 6c8087c4361899..b681e41cd41fc3 100644 --- a/src/lib/dnssd/TxtFields.cpp +++ b/src/lib/dnssd/TxtFields.cpp @@ -145,10 +145,9 @@ uint8_t GetCommissioningMode(const ByteSpan & value) return MakeU8FromAsciiDecimal(value); } -// TODO: possibly 32-bit? see spec issue #3226 -uint16_t GetDeviceType(const ByteSpan & value) +uint32_t GetDeviceType(const ByteSpan & value) { - return MakeU16FromAsciiDecimal(value); + return MakeU32FromAsciiDecimal(value); } void GetDeviceName(const ByteSpan & value, char * name) diff --git a/src/lib/dnssd/TxtFields.h b/src/lib/dnssd/TxtFields.h index 14d4e41622961c..d32daea3d96982 100644 --- a/src/lib/dnssd/TxtFields.h +++ b/src/lib/dnssd/TxtFields.h @@ -41,7 +41,7 @@ static constexpr size_t kKeyLongDiscriminatorMaxLength = 5; static constexpr size_t kKeyVendorProductMaxLength = 11; static constexpr size_t kKeyAdditionalCommissioningMaxLength = 1; static constexpr size_t kKeyCommissioningModeMaxLength = 1; -static constexpr size_t kKeyDeviceTypeMaxLength = 5; +static constexpr size_t kKeyDeviceTypeMaxLength = 10; static constexpr size_t kKeyDeviceNameMaxLength = 32; static constexpr size_t kKeyRotatingDeviceIdMaxLength = 100; static constexpr size_t kKeyPairingInstructionMaxLength = 128; @@ -104,8 +104,7 @@ uint16_t GetProduct(const ByteSpan & value); uint16_t GetVendor(const ByteSpan & value); uint16_t GetLongDiscriminator(const ByteSpan & value); uint8_t GetCommissioningMode(const ByteSpan & value); -// TODO: possibly 32-bit? see spec issue #3226 -uint16_t GetDeviceType(const ByteSpan & value); +uint32_t GetDeviceType(const ByteSpan & value); void GetDeviceName(const ByteSpan & value, char * name); void GetRotatingDeviceId(const ByteSpan & value, uint8_t * rotatingId, size_t * len); uint16_t GetPairingHint(const ByteSpan & value); diff --git a/src/lib/dnssd/minimal_mdns/ResponseSender.cpp b/src/lib/dnssd/minimal_mdns/ResponseSender.cpp index 0209ff8ca926c1..5d84e851ce3cd3 100644 --- a/src/lib/dnssd/minimal_mdns/ResponseSender.cpp +++ b/src/lib/dnssd/minimal_mdns/ResponseSender.cpp @@ -72,6 +72,19 @@ CHIP_ERROR ResponseSender::AddQueryResponder(QueryResponderBase * queryResponder return CHIP_ERROR_NO_MEMORY; } +CHIP_ERROR ResponseSender::RemoveQueryResponder(QueryResponderBase * queryResponder) +{ + for (size_t i = 0; i < kMaxQueryResponders; ++i) + { + if (mResponder[i] == queryResponder) + { + mResponder[i] = nullptr; + return CHIP_NO_ERROR; + } + } + return CHIP_ERROR_NOT_FOUND; +} + CHIP_ERROR ResponseSender::Respond(uint32_t messageId, const QueryData & query, const chip::Inet::IPPacketInfo * querySource) { mSendState.Reset(messageId, query, querySource); diff --git a/src/lib/dnssd/minimal_mdns/ResponseSender.h b/src/lib/dnssd/minimal_mdns/ResponseSender.h index 1a40bfaa5f8138..8e5a2abb063e33 100644 --- a/src/lib/dnssd/minimal_mdns/ResponseSender.h +++ b/src/lib/dnssd/minimal_mdns/ResponseSender.h @@ -93,6 +93,7 @@ class ResponseSender : public ResponderDelegate ResponseSender(ServerBase * server) : mServer(server) {} CHIP_ERROR AddQueryResponder(QueryResponderBase * queryResponder); + CHIP_ERROR RemoveQueryResponder(QueryResponderBase * queryResponder); /// Send back the response to a particular query CHIP_ERROR Respond(uint32_t messageId, const QueryData & query, const chip::Inet::IPPacketInfo * querySource); diff --git a/src/lib/dnssd/minimal_mdns/Server.cpp b/src/lib/dnssd/minimal_mdns/Server.cpp index f868f34527f910..c2d97ad1324603 100644 --- a/src/lib/dnssd/minimal_mdns/Server.cpp +++ b/src/lib/dnssd/minimal_mdns/Server.cpp @@ -386,8 +386,14 @@ CHIP_ERROR ServerBase::BroadcastImpl(chip::System::PacketBufferHandle && data, u } else { - ChipLogError(Discovery, "Attempt to mDNS broadcast failed: %s", chip::ErrorStr(err)); lastError = err; +#if CHIP_DETAIL_LOGGING + char ifaceName[chip::Inet::InterfaceId::kMaxIfNameLength]; + err = info->mInterfaceId.GetInterfaceName(ifaceName, sizeof(ifaceName)); + if (err != CHIP_NO_ERROR) + strcpy(ifaceName, "???"); + ChipLogDetail(Discovery, "Warning: Attempt to mDNS broadcast failed on %s: %s", ifaceName, lastError.AsString()); +#endif } return chip::Loop::Continue; })) diff --git a/src/lib/dnssd/minimal_mdns/Server.h b/src/lib/dnssd/minimal_mdns/Server.h index 46c1ae8c5c606c..0266b4625ebfb3 100644 --- a/src/lib/dnssd/minimal_mdns/Server.h +++ b/src/lib/dnssd/minimal_mdns/Server.h @@ -234,7 +234,7 @@ class Server : private chip::PoolImpl(this)) {} - ~Server() {} + ~Server() override {} }; } // namespace Minimal diff --git a/src/lib/dnssd/minimal_mdns/responders/QueryResponder.h b/src/lib/dnssd/minimal_mdns/responders/QueryResponder.h index 4ff359490ee19e..c2f55096606f95 100644 --- a/src/lib/dnssd/minimal_mdns/responders/QueryResponder.h +++ b/src/lib/dnssd/minimal_mdns/responders/QueryResponder.h @@ -239,7 +239,7 @@ class QueryResponderBase : public Responder // "_services._dns-sd._udp.local" public: /// Builds a new responder with the given storage for the response infos QueryResponderBase(Internal::QueryResponderInfo * infos, size_t infoSizes); - virtual ~QueryResponderBase() {} + ~QueryResponderBase() override {} /// Setup initial settings (clears all infos and sets up dns-sd query replies) void Init(); diff --git a/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp b/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp index 65ad23b7e505e4..8de65b7aba222c 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp @@ -106,7 +106,7 @@ const QNamePart kCmSubParts[] = { "_CM", "_sub", "_matt const QNamePart kLongSubParts[] = { "_L22", "_sub", "_matterc", "_udp", "local" }; const QNamePart kShortSubParts[] = { "_S2", "_sub", "_matterc", "_udp", "local" }; const QNamePart kVendorSubParts[] = { "_V555", "_sub", "_matterc", "_udp", "local" }; -const QNamePart kDeviceTypeSubParts[] = { "_T25", "_sub", "_matterc", "_udp", "local" }; +const QNamePart kDeviceTypeSubParts[] = { "_T70000", "_sub", "_matterc", "_udp", "local" }; const FullQName kMatterCommissionableNodeQueryName = FullQName(kMatterCommissionableNodeQueryParts); FullQName kLongSubFullLenName = FullQName(kLongSubPartsFullLen); FullQName kShortSubFullLenName = FullQName(kShortSubPartsFullLen); @@ -150,14 +150,14 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeBasic = .SetLongDiscriminator(22) .SetShortDiscriminator(2) .SetVendorId(chip::Optional(555)) - .SetDeviceType(chip::Optional(25)) + .SetDeviceType(chip::Optional(70000)) .SetCommissioningMode(CommissioningMode::kEnabledBasic) .SetDeviceName(chip::Optional("testy-test")) .SetPairingHint(chip::Optional(3)) .SetPairingInstruction(chip::Optional("Pair me")) .SetProductId(chip::Optional(897)) .SetRotatingDeviceId(chip::Optional("id_that_spins")); -QNamePart txtCommissionableNodeParamsLargeBasicParts[] = { "D=22", "VP=555+897", "CM=1", "DT=25", +QNamePart txtCommissionableNodeParamsLargeBasicParts[] = { "D=22", "VP=555+897", "CM=1", "DT=70000", "DN=testy-test", "RI=id_that_spins", "PI=Pair me", "PH=3" }; FullQName txtCommissionableNodeParamsLargeBasicName = FullQName(txtCommissionableNodeParamsLargeBasicParts); TxtResourceRecord txtCommissionableNodeParamsLargeBasic = @@ -170,7 +170,7 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeEnhanced = .SetLongDiscriminator(22) .SetShortDiscriminator(2) .SetVendorId(chip::Optional(555)) - .SetDeviceType(chip::Optional(25)) + .SetDeviceType(chip::Optional(70000)) .SetCommissioningMode(CommissioningMode::kEnabledEnhanced) .SetDeviceName(chip::Optional("testy-test")) .SetPairingHint(chip::Optional(3)) @@ -180,7 +180,7 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeEnhanced = .SetTcpSupported(chip::Optional(true)) // 3600005 is more than the max so should be adjusted down .SetMRPConfig(ReliableMessageProtocolConfig(3600000_ms32, 3600005_ms32)); -QNamePart txtCommissionableNodeParamsLargeEnhancedParts[] = { "D=22", "VP=555+897", "CM=2", "DT=25", +QNamePart txtCommissionableNodeParamsLargeEnhancedParts[] = { "D=22", "VP=555+897", "CM=2", "DT=70000", "DN=testy-test", "RI=id_that_spins", "PI=Pair me", "PH=3", "CRA=3600000", "CRI=3600000", "T=1" }; FullQName txtCommissionableNodeParamsLargeEnhancedName = FullQName(txtCommissionableNodeParamsLargeEnhancedParts); @@ -328,7 +328,12 @@ void OperationalAdverts(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, server.GetSendCalled()); NL_TEST_ASSERT(inSuite, server.GetHeaderFound()); - // We should be able to add up to 5 operational networks total + // We should be able to add several operational networks + // As these are platform::new allocated, there is no upper limit + // TODO: Responder still has an upper limit of responders, which gets checked + // here but should be removed as part of #8000 as we want to not have an + // upper bound on number of operational networks (or at least not memory + // enforced but rather policy enforced) NL_TEST_ASSERT(inSuite, mdnsAdvertiser.Advertise(operationalParams3) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, mdnsAdvertiser.Advertise(operationalParams4) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, mdnsAdvertiser.Advertise(operationalParams5) == CHIP_NO_ERROR); diff --git a/src/lib/dnssd/minimal_mdns/tests/TestResponseSender.cpp b/src/lib/dnssd/minimal_mdns/tests/TestResponseSender.cpp index b97b2e4b269853..4a42cd2dcd96ea 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestResponseSender.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestResponseSender.cpp @@ -271,6 +271,16 @@ void AddManyQueryResponders(nlTestSuite * inSuite, void * inContext) // Last one should return a no memory error (no space) NL_TEST_ASSERT(inSuite, responseSender.AddQueryResponder(&q8) == CHIP_ERROR_NO_MEMORY); + + // can make space + NL_TEST_ASSERT(inSuite, responseSender.RemoveQueryResponder(&q3) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, responseSender.AddQueryResponder(&q8) == CHIP_NO_ERROR); + + // adding back does not fail + NL_TEST_ASSERT(inSuite, responseSender.AddQueryResponder(&q8) == CHIP_NO_ERROR); + + // still full and cannot add more + NL_TEST_ASSERT(inSuite, responseSender.AddQueryResponder(&q3) == CHIP_ERROR_NO_MEMORY); } void PtrSrvTxtMultipleRespondersToInstance(nlTestSuite * inSuite, void * inContext) diff --git a/src/lib/dnssd/platform/tests/TestPlatform.cpp b/src/lib/dnssd/platform/tests/TestPlatform.cpp index 3823e1b474c754..137060a598a563 100644 --- a/src/lib/dnssd/platform/tests/TestPlatform.cpp +++ b/src/lib/dnssd/platform/tests/TestPlatform.cpp @@ -86,7 +86,7 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeBasic = .SetLongDiscriminator(22) .SetShortDiscriminator(2) .SetVendorId(chip::Optional(555)) - .SetDeviceType(chip::Optional(25)) + .SetDeviceType(chip::Optional(70000)) .SetCommissioningMode(CommissioningMode::kEnabledBasic) .SetDeviceName(chip::Optional("testy-test")) .SetPairingHint(chip::Optional(3)) @@ -104,7 +104,7 @@ test::ExpectedCall commissionableLargeBasic = test::ExpectedCall() .AddTxt("D", "22") .AddTxt("VP", "555+897") .AddTxt("CM", "1") - .AddTxt("DT", "25") + .AddTxt("DT", "70000") .AddTxt("DN", "testy-test") .AddTxt("RI", "id_that_spins") .AddTxt("PI", "Pair me") @@ -115,7 +115,7 @@ test::ExpectedCall commissionableLargeBasic = test::ExpectedCall() .AddSubtype("_S2") .AddSubtype("_L22") .AddSubtype("_V555") - .AddSubtype("_T25") + .AddSubtype("_T70000") .AddSubtype("_CM"); CommissionAdvertisingParameters commissionableNodeParamsLargeEnhanced = CommissionAdvertisingParameters() @@ -124,7 +124,7 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeEnhanced = .SetLongDiscriminator(22) .SetShortDiscriminator(2) .SetVendorId(chip::Optional(555)) - .SetDeviceType(chip::Optional(25)) + .SetDeviceType(chip::Optional(70000)) .SetCommissioningMode(CommissioningMode::kEnabledEnhanced) .SetDeviceName(chip::Optional("testy-test")) .SetPairingHint(chip::Optional(3)) @@ -139,7 +139,7 @@ test::ExpectedCall commissionableLargeEnhanced = test::ExpectedCall() .AddTxt("D", "22") .AddTxt("VP", "555+897") .AddTxt("CM", "2") - .AddTxt("DT", "25") + .AddTxt("DT", "70000") .AddTxt("DN", "testy-test") .AddTxt("RI", "id_that_spins") .AddTxt("PI", "Pair me") @@ -147,7 +147,7 @@ test::ExpectedCall commissionableLargeEnhanced = test::ExpectedCall() .AddSubtype("_S2") .AddSubtype("_L22") .AddSubtype("_V555") - .AddSubtype("_T25") + .AddSubtype("_T70000") .AddSubtype("_CM"); void TestStub(nlTestSuite * inSuite, void * inContext) { diff --git a/src/lib/dnssd/tests/TestTxtFields.cpp b/src/lib/dnssd/tests/TestTxtFields.cpp index 91949c9f81d194..ef6d58931a80ab 100644 --- a/src/lib/dnssd/tests/TestTxtFields.cpp +++ b/src/lib/dnssd/tests/TestTxtFields.cpp @@ -174,8 +174,8 @@ void TestGetDeviceType(nlTestSuite * inSuite, void * inContext) strcpy(dt, "1234"); NL_TEST_ASSERT(inSuite, GetDeviceType(GetSpan(dt)) == 1234); - // overflow a uint16 - sprintf(dt, "%" PRIu32, static_cast(std::numeric_limits::max()) + 1); + // overflow a uint32 + sprintf(dt, "%" PRIu64, static_cast(std::numeric_limits::max()) + 1); NL_TEST_ASSERT(inSuite, GetDeviceType(GetSpan(dt)) == 0); } diff --git a/src/lib/shell/MainLoopDefault.cpp b/src/lib/shell/MainLoopDefault.cpp index 52127ec086f6eb..9b1f8434fa30f2 100644 --- a/src/lib/shell/MainLoopDefault.cpp +++ b/src/lib/shell/MainLoopDefault.cpp @@ -31,71 +31,64 @@ using chip::Shell::streamer_get; namespace { -ssize_t ReadLine(char * buffer, size_t max) +// max > 1 +size_t ReadLine(char * buffer, size_t max) { - ssize_t read = 0; - bool done = false; - char * inptr = buffer; + size_t line_sz = 0; - // Read in characters until we get a new line or we hit our max size. - while (((inptr - buffer) < static_cast(max)) && !done) + // Read in characters until we get a line ending or EOT. + for (bool done = false; !done;) { - if (read == 0) + // Stop reading if we've run out of space in the buffer (still need to null-terminate). + if (line_sz >= max - 1u) { - read = streamer_read(streamer_get(), inptr, 1); + buffer[max - 1] = '\0'; + break; + } + + if (streamer_read(streamer_get(), buffer + line_sz, 1) != 1) + { + continue; } - // Process any characters we just read in. - while (read > 0) + // Process character we just read. + switch (buffer[line_sz]) { - switch (*inptr) + case '\r': + case '\n': + streamer_printf(streamer_get(), "\r\n"); + buffer[line_sz] = '\0'; + line_sz++; + done = true; + break; + case 0x04: + // Do not accept EOT character (i.e. don't increment line_sz). + // Stop the read loop if the input is still empty. + if (line_sz == 0u) { - case '\r': - case '\n': - streamer_printf(streamer_get(), "\r\n"); - *inptr = 0; // null terminate - done = true; - break; - case 0x04: - // Delete EOT character. - inptr -= 1; - // Stop the read loop if the input is still empty. - if (inptr == buffer - 1) - { - done = true; - } - break; - case 0x7F: - // delete backspace character + 1 more - inptr -= 2; - if (inptr >= buffer - 1) - { - streamer_printf(streamer_get(), "\b \b"); - } - else - { - inptr = buffer - 1; - } - break; - default: - if (isprint(static_cast(*inptr)) || *inptr == '\t') - { - streamer_printf(streamer_get(), "%c", *inptr); - } - else - { - inptr--; - } - break; + done = true; } - - inptr++; - read--; + break; + case 0x7F: + // Do not accept backspace character (i.e. don't increment line_sz) and remove 1 additional character if it exists. + if (line_sz >= 1u) + { + streamer_printf(streamer_get(), "\b \b"); + line_sz--; + } + break; + default: + if (isprint(static_cast(buffer[line_sz])) || buffer[line_sz] == '\t') + { + streamer_printf(streamer_get(), "%c", buffer[line_sz]); + line_sz++; + } + break; } } // Return the length of the buffer including the terminating null byte. - return inptr - buffer; + return line_sz; } bool IsSeparator(char ch) @@ -198,7 +191,7 @@ void Engine::RunMainLoop() while (true) { char * line = static_cast(Platform::MemoryAlloc(CHIP_SHELL_MAX_LINE_SIZE)); - if (ReadLine(line, CHIP_SHELL_MAX_LINE_SIZE) == 0) + if (ReadLine(line, CHIP_SHELL_MAX_LINE_SIZE) == 0u) { // Stop loop in case of empty read (Ctrl-D). break; diff --git a/src/lib/shell/MainLoopEFR32.cpp b/src/lib/shell/MainLoopEFR32.cpp index 6b32d04bdd5ab1..7d993ccbad9966 100644 --- a/src/lib/shell/MainLoopEFR32.cpp +++ b/src/lib/shell/MainLoopEFR32.cpp @@ -34,58 +34,52 @@ namespace { constexpr const char kShellPrompt[] = "matterCli > "; +// max > 1 void ReadLine(char * buffer, size_t max) { - ssize_t read = 0; - bool done = false; - char * inptr = buffer; + size_t line_sz = 0; - // Read in characters until we get a new line or we hit our max size. - while (((inptr - buffer) < static_cast(max)) && !done) + // Read in characters until we get a line ending or EOT. + for (bool done = false; !done;) { + // Stop reading if we've run out of space in the buffer (still need to null-terminate). + if (line_sz >= max - 1u) + { + buffer[max - 1] = '\0'; + break; + } + chip::WaitForShellActivity(); - if (read == 0) + if (streamer_read(streamer_get(), buffer + line_sz, 1) != 1) { - read = streamer_read(streamer_get(), inptr, 1); + continue; } - // Process any characters we just read in. - while (read > 0) + // Process character we just read. + switch (buffer[line_sz]) { - switch (*inptr) + case '\r': + case '\n': + streamer_printf(streamer_get(), "\r\n"); + buffer[line_sz] = '\0'; + line_sz++; + done = true; + break; + case 0x7F: + // Do not accept backspace character (i.e. don't increment line_sz) and remove 1 additional character if it exists. + if (line_sz >= 1u) { - case '\r': - case '\n': - streamer_printf(streamer_get(), "\r\n"); - *inptr = 0; // null terminate - done = true; - break; - case 0x7F: - // delete backspace character + 1 more - inptr -= 2; - if (inptr >= buffer - 1) - { - streamer_printf(streamer_get(), "\b \b"); - } - else - { - inptr = buffer - 1; - } - break; - default: - if (isprint(static_cast(*inptr)) || *inptr == '\t') - { - streamer_printf(streamer_get(), "%c", *inptr); - } - else - { - inptr--; - } - break; + streamer_printf(streamer_get(), "\b \b"); + line_sz--; } - - inptr++; - read--; + break; + default: + if (isprint(static_cast(buffer[line_sz])) || buffer[line_sz] == '\t') + { + streamer_printf(streamer_get(), "%c", buffer[line_sz]); + line_sz++; + } + break; } } } diff --git a/src/lib/support/BytesCircularBuffer.cpp b/src/lib/support/BytesCircularBuffer.cpp index e25d6b640891ad..b0eba364308dfb 100644 --- a/src/lib/support/BytesCircularBuffer.cpp +++ b/src/lib/support/BytesCircularBuffer.cpp @@ -80,10 +80,8 @@ size_t BytesCircularBuffer::StorageUsed() const { return mDataEnd - mDataStart; } - else - { - return mCapacity + mDataEnd - mDataStart; - } + + return mCapacity + mDataEnd - mDataStart; } CHIP_ERROR BytesCircularBuffer::Push(const ByteSpan & payload) diff --git a/src/lib/support/BytesToHex.cpp b/src/lib/support/BytesToHex.cpp index 21b8b9a123bc8a..bb9681532d6f8f 100644 --- a/src/lib/support/BytesToHex.cpp +++ b/src/lib/support/BytesToHex.cpp @@ -34,10 +34,8 @@ char NibbleToHex(uint8_t nibble, bool uppercase) { return static_cast((x - 10) + (uppercase ? 'A' : 'a')); } - else - { - return static_cast(x + '0'); - } + + return static_cast(x + '0'); } CHIP_ERROR MakeU8FromAsciiHex(const char * src, const size_t srcLen, uint8_t * val, BitFlags flags) @@ -104,7 +102,7 @@ CHIP_ERROR BytesToHex(const uint8_t * src_bytes, size_t src_size, char * dest_he { return CHIP_ERROR_INVALID_ARGUMENT; } - else if (src_size > ((SIZE_MAX - 1) / 2u)) + if (src_size > ((SIZE_MAX - 1) / 2u)) { // Output would overflow a size_t, let's bail out to avoid computation wraparounds below. // This condition will hit with slightly less than the very max, but is unlikely to diff --git a/src/lib/support/CHIPArgParser.cpp b/src/lib/support/CHIPArgParser.cpp index 6fd0858d855e25..e3102d4c09eee1 100644 --- a/src/lib/support/CHIPArgParser.cpp +++ b/src/lib/support/CHIPArgParser.cpp @@ -1141,7 +1141,7 @@ HelpOptions::HelpOptions(const char * appName, const char * appUsage, const char /** * Print a short description of the command's usage followed by instructions on how to get more help. */ -void HelpOptions::PrintBriefUsage(FILE * s) +void HelpOptions::PrintBriefUsage(FILE * s) const { PutStringWithNewLine(s, AppUsage); fprintf(s, "Try `%s --help' for more information.\n", AppName); @@ -1150,7 +1150,7 @@ void HelpOptions::PrintBriefUsage(FILE * s) /** * Print the full usage information, including information on all available options. */ -void HelpOptions::PrintLongUsage(OptionSet ** optSets, FILE * s) +void HelpOptions::PrintLongUsage(OptionSet ** optSets, FILE * s) const { PutStringWithBlankLine(s, AppUsage); if (AppDesc != nullptr) @@ -1160,7 +1160,7 @@ void HelpOptions::PrintLongUsage(OptionSet ** optSets, FILE * s) PrintOptionHelp(optSets, s); } -void HelpOptions::PrintVersion(FILE * s) +void HelpOptions::PrintVersion(FILE * s) const { fprintf(s, "%s ", AppName); PutStringWithNewLine(s, (AppVersion != nullptr) ? AppVersion : "(unknown version)"); diff --git a/src/lib/support/CHIPArgParser.hpp b/src/lib/support/CHIPArgParser.hpp index daeab0be9e6729..f22484fcf6089f 100644 --- a/src/lib/support/CHIPArgParser.hpp +++ b/src/lib/support/CHIPArgParser.hpp @@ -149,9 +149,9 @@ class HelpOptions : public OptionSetBase HelpOptions(const char * appName, const char * appUsage, const char * appVersion); HelpOptions(const char * appName, const char * appUsage, const char * appVersion, const char * appDesc); - void PrintBriefUsage(FILE * s); - void PrintLongUsage(OptionSet * optSets[], FILE * s); - void PrintVersion(FILE * s); + void PrintBriefUsage(FILE * s) const; + void PrintLongUsage(OptionSet * optSets[], FILE * s) const; + void PrintVersion(FILE * s) const; bool HandleOption(const char * progName, OptionSet * optSet, int id, const char * name, const char * arg) override; }; diff --git a/src/lib/support/Pool.cpp b/src/lib/support/Pool.cpp index 77454ef052bff7..fe0a01143ed06c 100644 --- a/src/lib/support/Pool.cpp +++ b/src/lib/support/Pool.cpp @@ -50,10 +50,8 @@ void * StaticAllocatorBitmap::Allocate() IncreaseUsage(); return At(word * kBitChunkSize + offset); } - else - { - value = usage.load(std::memory_order_relaxed); // if there is a race, update new usage - } + + value = usage.load(std::memory_order_relaxed); // if there is a race, update new usage } } } diff --git a/src/lib/support/Pool.h b/src/lib/support/Pool.h index a3750b7d4f960d..b311d4de73efd8 100644 --- a/src/lib/support/Pool.h +++ b/src/lib/support/Pool.h @@ -222,8 +222,7 @@ class BitMapObjectPool : public internal::StaticAllocatorBitmap, public internal T * element = static_cast(Allocate()); if (element != nullptr) return new (element) T(std::forward(args)...); - else - return nullptr; + return nullptr; } void ReleaseObject(T * element) diff --git a/src/lib/support/PoolWrapper.h b/src/lib/support/PoolWrapper.h index e5025640179cf6..78b6d838245633 100644 --- a/src/lib/support/PoolWrapper.h +++ b/src/lib/support/PoolWrapper.h @@ -74,27 +74,26 @@ class PoolProxy> : public PoolIn static_assert(std::is_base_of::value, "Interface type is not derived from Pool type"); PoolProxy() {} - virtual ~PoolProxy() override {} + ~PoolProxy() override {} - virtual U * CreateObject(ConstructorArguments... args) override { return Impl().CreateObject(std::move(args)...); } + U * CreateObject(ConstructorArguments... args) override { return Impl().CreateObject(std::move(args)...); } - virtual void ReleaseObject(U * element) override { Impl().ReleaseObject(static_cast(element)); } + void ReleaseObject(U * element) override { Impl().ReleaseObject(static_cast(element)); } - virtual void ReleaseAll() override { Impl().ReleaseAll(); } + void ReleaseAll() override { Impl().ReleaseAll(); } - virtual void ResetObject(U * element, ConstructorArguments... args) override + void ResetObject(U * element, ConstructorArguments... args) override { return Impl().ResetObject(static_cast(element), std::move(args)...); } protected: - virtual Loop ForEachActiveObjectInner(void * context, - typename PoolInterface::Lambda lambda) override + Loop ForEachActiveObjectInner(void * context, typename PoolInterface::Lambda lambda) override { return Impl().ForEachActiveObject([&](T * target) { return lambda(context, static_cast(target)); }); } - virtual Loop ForEachActiveObjectInner(void * context, - typename PoolInterface::LambdaConst lambda) const override + Loop ForEachActiveObjectInner(void * context, + typename PoolInterface::LambdaConst lambda) const override { return Impl().ForEachActiveObject([&](const T * target) { return lambda(context, static_cast(target)); }); } @@ -120,11 +119,11 @@ class PoolImpl : public PoolProxy... { public: PoolImpl() {} - virtual ~PoolImpl() override {} + ~PoolImpl() override {} protected: - virtual ObjectPool & Impl() override { return mImpl; } - virtual const ObjectPool & Impl() const override { return mImpl; } + ObjectPool & Impl() override { return mImpl; } + const ObjectPool & Impl() const override { return mImpl; } private: ObjectPool mImpl; diff --git a/src/lib/support/SerializableIntegerSet.h b/src/lib/support/SerializableIntegerSet.h index b61b640ef39a61..45d7604d43ccbb 100644 --- a/src/lib/support/SerializableIntegerSet.h +++ b/src/lib/support/SerializableIntegerSet.h @@ -88,13 +88,13 @@ class SerializableU64SetBase * @brief * Get the length of the byte data if the array is serialized. */ - size_t SerializedSize() { return sizeof(uint64_t) * mNextAvailable; } + size_t SerializedSize() const { return sizeof(uint64_t) * mNextAvailable; } /** * @brief * Get the maximum length of the byte data if the array were full and serialized. */ - size_t MaxSerializedSize() { return sizeof(uint64_t) * mCapacity; } + size_t MaxSerializedSize() const { return sizeof(uint64_t) * mCapacity; } /** * @brief diff --git a/src/lib/support/TestGroupData.h b/src/lib/support/TestGroupData.h index bc80bac9ee84a8..dc611b4697609b 100644 --- a/src/lib/support/TestGroupData.h +++ b/src/lib/support/TestGroupData.h @@ -48,6 +48,14 @@ CHIP_ERROR InitProvider() return CHIP_NO_ERROR; } +CHIP_ERROR InitProvider(chip::PersistentStorageDelegate & storageDelegate) +{ + sGroupsProvider.SetStorageDelegate(&storageDelegate); + ReturnErrorOnFailure(sGroupsProvider.Init()); + chip::Credentials::SetGroupDataProvider(&sGroupsProvider); + return CHIP_NO_ERROR; +} + CHIP_ERROR InitData(chip::FabricIndex fabric_index, const ByteSpan & compressed_fabric_id) { // Groups diff --git a/src/lib/support/ThreadOperationalDataset.cpp b/src/lib/support/ThreadOperationalDataset.cpp index a30c6a82cd489f..59eaae1db0d4dd 100644 --- a/src/lib/support/ThreadOperationalDataset.cpp +++ b/src/lib/support/ThreadOperationalDataset.cpp @@ -498,8 +498,7 @@ const ThreadTLV * OperationalDataset::Locate(uint8_t aType) const { if (tlv->GetType() == aType) break; - else - tlv = tlv->GetNext(); + tlv = tlv->GetNext(); } assert(tlv < reinterpret_cast(&mData[sizeof(mData)])); diff --git a/src/lib/support/UnitTestUtils.cpp b/src/lib/support/UnitTestUtils.cpp index a5435fe425cd7d..c63bd5be015596 100644 --- a/src/lib/support/UnitTestUtils.cpp +++ b/src/lib/support/UnitTestUtils.cpp @@ -75,7 +75,7 @@ void SleepMillis(uint64_t millisecs) uint64_t TimeMonotonicMillis() { - return static_cast(time(NULL) * 1000); + return static_cast(time(nullptr) * 1000); } #endif diff --git a/src/lib/support/Variant.h b/src/lib/support/Variant.h index 1eb2c574038608..1752c21780fbaa 100644 --- a/src/lib/support/Variant.h +++ b/src/lib/support/Variant.h @@ -73,10 +73,8 @@ struct VariantCurry { return *reinterpret_cast(this_v) == *reinterpret_cast(that_v); } - else - { - return VariantCurry::Equal(type_t, that_v, this_v); - } + + return VariantCurry::Equal(type_t, that_v, this_v); } }; diff --git a/src/lib/support/logging/CHIPLogging.cpp b/src/lib/support/logging/CHIPLogging.cpp index 19c24e81eb6f66..3cbd9e7acdf946 100644 --- a/src/lib/support/logging/CHIPLogging.cpp +++ b/src/lib/support/logging/CHIPLogging.cpp @@ -116,6 +116,7 @@ const char ModuleNames[] = "-\0\0" // None "TST" // Test "ODP" // OperationalDeviceProxy "ATM" // Automation + "CSM" // CASESessionManager ; #define ModuleNamesCount ((sizeof(ModuleNames) - 1) / chip::Logging::kMaxModuleNameLen) diff --git a/src/lib/support/logging/Constants.h b/src/lib/support/logging/Constants.h index 0214fcaa2dbab8..ec2c47aba9cff3 100644 --- a/src/lib/support/logging/Constants.h +++ b/src/lib/support/logging/Constants.h @@ -58,6 +58,7 @@ enum LogModule kLogModule_Test, kLogModule_OperationalDeviceProxy, kLogModule_Automation, + kLogModule_CASESessionManager, kLogModule_Max }; diff --git a/src/messaging/ApplicationExchangeDispatch.h b/src/messaging/ApplicationExchangeDispatch.h index d1fb76aa019ec6..6316df05f1b44f 100644 --- a/src/messaging/ApplicationExchangeDispatch.h +++ b/src/messaging/ApplicationExchangeDispatch.h @@ -40,7 +40,7 @@ class ApplicationExchangeDispatch : public ExchangeMessageDispatch } ApplicationExchangeDispatch() {} - virtual ~ApplicationExchangeDispatch() {} + ~ApplicationExchangeDispatch() override {} protected: bool MessagePermitted(uint16_t protocol, uint8_t type) override; diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index 303dcbafcc3193..2da44602fe1aef 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -490,12 +490,10 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload { return mDelegate->OnMessageReceived(this, payloadHeader, std::move(msgBuf)); } - else - { - DefaultOnMessageReceived(this, payloadHeader.GetProtocolID(), payloadHeader.GetMessageType(), messageCounter, - std::move(msgBuf)); - return CHIP_NO_ERROR; - } + + DefaultOnMessageReceived(this, payloadHeader.GetProtocolID(), payloadHeader.GetMessageType(), messageCounter, + std::move(msgBuf)); + return CHIP_NO_ERROR; } void ExchangeContext::MessageHandled() diff --git a/src/messaging/ExchangeContext.h b/src/messaging/ExchangeContext.h index 1798ce2a8638b5..4e616194584037 100644 --- a/src/messaging/ExchangeContext.h +++ b/src/messaging/ExchangeContext.h @@ -68,7 +68,7 @@ class DLL_EXPORT ExchangeContext : public ReliableMessageContext, ExchangeContext(ExchangeManager * em, uint16_t ExchangeId, const SessionHandle & session, bool Initiator, ExchangeDelegate * delegate); - ~ExchangeContext(); + ~ExchangeContext() override; /** * Determine whether the context is the initiator of the exchange. diff --git a/src/messaging/ExchangeMgr.h b/src/messaging/ExchangeMgr.h index e4e5d0f723f77a..673140f949d712 100644 --- a/src/messaging/ExchangeMgr.h +++ b/src/messaging/ExchangeMgr.h @@ -187,7 +187,7 @@ class DLL_EXPORT ExchangeManager : public SessionMessageDelegate ReliableMessageMgr * GetReliableMessageMgr() { return &mReliableMessageMgr; }; - FabricIndex GetFabricIndex() { return mFabricIndex; } + FabricIndex GetFabricIndex() const { return mFabricIndex; } uint16_t GetNextKeyId() { return ++mNextKeyId; } diff --git a/src/messaging/ReliableMessageContext.cpp b/src/messaging/ReliableMessageContext.cpp index 6ee0a9882cd07f..ec4264d3742331 100644 --- a/src/messaging/ReliableMessageContext.cpp +++ b/src/messaging/ReliableMessageContext.cpp @@ -156,24 +156,22 @@ CHIP_ERROR ReliableMessageContext::HandleNeedsAckInner(uint32_t messageCounter, return err; } // Otherwise, the message IS NOT a duplicate. - else - { - if (IsAckPending()) - { - ChipLogDetail(ExchangeManager, - "Pending ack queue full; forcing tx of solitary ack for MessageCounter:" ChipLogFormatMessageCounter - " on exchange " ChipLogFormatExchange, - mPendingPeerAckMessageCounter, ChipLogValueExchange(GetExchangeContext())); - // Send the Ack for the currently pending Ack in a SecureChannel::StandaloneAck message. - ReturnErrorOnFailure(SendStandaloneAckMessage()); - } - // Replace the Pending ack message counter. - SetPendingPeerAckMessageCounter(messageCounter); - using namespace System::Clock::Literals; - mNextAckTime = System::SystemClock().GetMonotonicTimestamp() + CHIP_CONFIG_RMP_DEFAULT_ACK_TIMEOUT; - return CHIP_NO_ERROR; + if (IsAckPending()) + { + ChipLogDetail(ExchangeManager, + "Pending ack queue full; forcing tx of solitary ack for MessageCounter:" ChipLogFormatMessageCounter + " on exchange " ChipLogFormatExchange, + mPendingPeerAckMessageCounter, ChipLogValueExchange(GetExchangeContext())); + // Send the Ack for the currently pending Ack in a SecureChannel::StandaloneAck message. + ReturnErrorOnFailure(SendStandaloneAckMessage()); } + + // Replace the Pending ack message counter. + SetPendingPeerAckMessageCounter(messageCounter); + using namespace System::Clock::Literals; + mNextAckTime = System::SystemClock().GetMonotonicTimestamp() + CHIP_CONFIG_RMP_DEFAULT_ACK_TIMEOUT; + return CHIP_NO_ERROR; } CHIP_ERROR ReliableMessageContext::SendStandaloneAckMessage() diff --git a/src/messaging/tests/BUILD.gn b/src/messaging/tests/BUILD.gn index 68b2e2aa11bf44..5caa64a50579ea 100644 --- a/src/messaging/tests/BUILD.gn +++ b/src/messaging/tests/BUILD.gn @@ -31,6 +31,7 @@ static_library("helpers") { cflags = [ "-Wconversion" ] deps = [ + "${chip_root}/src/credentials/tests:cert_test_vectors", "${chip_root}/src/messaging", "${chip_root}/src/protocols", "${chip_root}/src/transport", diff --git a/src/messaging/tests/MessagingContext.cpp b/src/messaging/tests/MessagingContext.cpp index ea280ed400d063..273a98d18cc828 100644 --- a/src/messaging/tests/MessagingContext.cpp +++ b/src/messaging/tests/MessagingContext.cpp @@ -17,6 +17,7 @@ #include "MessagingContext.h" +#include #include #include @@ -38,9 +39,31 @@ CHIP_ERROR MessagingContext::Init(TransportMgrBase * transport, IOContext * ioCo ReturnErrorOnFailure(mExchangeManager.Init(&mSessionManager)); ReturnErrorOnFailure(mMessageCounterManager.Init(&mExchangeManager)); - ReturnErrorOnFailure(CreateSessionBobToAlice()); - ReturnErrorOnFailure(CreateSessionAliceToBob()); - ReturnErrorOnFailure(CreateSessionBobToFriends()); + if (mInitializeNodes) + { + FabricInfo aliceFabric; + FabricInfo bobFabric; + + aliceFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA01_Chip, TestCerts::sTestCert_ICA01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_Chip, TestCerts::sTestCert_Node01_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PublicKey, TestCerts::sTestCert_Node01_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PrivateKey, TestCerts::sTestCert_Node01_01_PrivateKey_Len)); + ReturnErrorOnFailure(mFabricTable.AddNewFabric(aliceFabric, &mAliceFabricIndex)); + + bobFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root02_Chip, TestCerts::sTestCert_Root02_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA02_Chip, TestCerts::sTestCert_ICA02_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_Chip, TestCerts::sTestCert_Node02_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PublicKey, TestCerts::sTestCert_Node02_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PrivateKey, TestCerts::sTestCert_Node02_01_PrivateKey_Len)); + ReturnErrorOnFailure(mFabricTable.AddNewFabric(bobFabric, &mBobFabricIndex)); + + ReturnErrorOnFailure(CreateSessionBobToAlice()); + ReturnErrorOnFailure(CreateSessionAliceToBob()); + ReturnErrorOnFailure(CreateSessionBobToFriends()); + } return CHIP_NO_ERROR; } @@ -72,19 +95,21 @@ CHIP_ERROR MessagingContext::ShutdownAndRestoreExisting(MessagingContext & exist CHIP_ERROR MessagingContext::CreateSessionBobToAlice() { - return mSessionManager.NewPairing(mSessionBobToAlice, Optional::Value(mAliceAddress), GetAliceNodeId(), - &mPairingBobToAlice, CryptoContext::SessionRole::kInitiator, mSrcFabricIndex); + return mSessionManager.NewPairing(mSessionBobToAlice, Optional::Value(mAliceAddress), + GetAliceFabric()->GetNodeId(), &mPairingBobToAlice, CryptoContext::SessionRole::kInitiator, + mBobFabricIndex); } CHIP_ERROR MessagingContext::CreateSessionAliceToBob() { - return mSessionManager.NewPairing(mSessionAliceToBob, Optional::Value(mBobAddress), GetBobNodeId(), - &mPairingAliceToBob, CryptoContext::SessionRole::kResponder, mDestFabricIndex); + return mSessionManager.NewPairing(mSessionAliceToBob, Optional::Value(mBobAddress), + GetBobFabric()->GetNodeId(), &mPairingAliceToBob, CryptoContext::SessionRole::kResponder, + mAliceFabricIndex); } CHIP_ERROR MessagingContext::CreateSessionBobToFriends() { - mSessionBobToFriends.Emplace(GetFriendsGroupId(), mSrcFabricIndex, GetBobNodeId()); + mSessionBobToFriends.Emplace(GetFriendsGroupId(), mBobFabricIndex, GetBobFabric()->GetNodeId()); return CHIP_NO_ERROR; } diff --git a/src/messaging/tests/MessagingContext.h b/src/messaging/tests/MessagingContext.h index 3d289de7bdb3d7..bff1a6e9606f72 100644 --- a/src/messaging/tests/MessagingContext.h +++ b/src/messaging/tests/MessagingContext.h @@ -71,11 +71,14 @@ class MessagingContext : public PlatformMemoryUser public: MessagingContext() : mInitialized(false), mAliceAddress(Transport::PeerAddress::UDP(GetAddress(), CHIP_PORT + 1)), - mBobAddress(Transport::PeerAddress::UDP(GetAddress(), CHIP_PORT)), mPairingAliceToBob(GetBobKeyId(), GetAliceKeyId()), - mPairingBobToAlice(GetAliceKeyId(), GetBobKeyId()) + mBobAddress(Transport::PeerAddress::UDP(GetAddress(), CHIP_PORT)), mPairingAliceToBob(kBobKeyId, kAliceKeyId), + mPairingBobToAlice(kAliceKeyId, kBobKeyId) {} ~MessagingContext() { VerifyOrDie(mInitialized == false); } + // Whether Alice and Bob are initialized, must be called before Init + void ConfigInitializeNodes(bool initializeNodes) { mInitializeNodes = initializeNodes; } + /// Initialize the underlying layers and test suite pointer CHIP_ERROR Init(TransportMgrBase * transport, IOContext * io); @@ -96,30 +99,22 @@ class MessagingContext : public PlatformMemoryUser Inet::IPAddress::FromString("::1", addr); return addr; } - NodeId GetBobNodeId() const { return mBobNodeId; } - NodeId GetAliceNodeId() const { return mAliceNodeId; } - - void SetBobNodeId(NodeId nodeId) { mBobNodeId = nodeId; } - void SetAliceNodeId(NodeId nodeId) { mAliceNodeId = nodeId; } - uint16_t GetBobKeyId() const { return mBobKeyId; } - uint16_t GetAliceKeyId() const { return mAliceKeyId; } + static const uint16_t kBobKeyId = 1; + static const uint16_t kAliceKeyId = 2; + NodeId GetBobNodeId() const; + NodeId GetAliceNodeId() const; GroupId GetFriendsGroupId() const { return mFriendsGroupId; } - void SetBobKeyId(uint16_t id) { mBobKeyId = id; } - void SetAliceKeyId(uint16_t id) { mAliceKeyId = id; } - - FabricIndex GetFabricIndex() const { return mSrcFabricIndex; } - void SetFabricIndex(FabricIndex id) - { - mSrcFabricIndex = id; - mDestFabricIndex = id; - } - SessionManager & GetSecureSessionManager() { return mSessionManager; } Messaging::ExchangeManager & GetExchangeManager() { return mExchangeManager; } secure_channel::MessageCounterManager & GetMessageCounterManager() { return mMessageCounterManager; } + FabricIndex GetAliceFabricIndex() { return mAliceFabricIndex; } + FabricIndex GetBobFabricIndex() { return mBobFabricIndex; } + FabricInfo * GetAliceFabric() { return mFabricTable.FindFabricWithIndex(mAliceFabricIndex); } + FabricInfo * GetBobFabric() { return mFabricTable.FindFabricWithIndex(mBobFabricIndex); } + CHIP_ERROR CreateSessionBobToAlice(); CHIP_ERROR CreateSessionAliceToBob(); CHIP_ERROR CreateSessionBobToFriends(); @@ -141,6 +136,7 @@ class MessagingContext : public PlatformMemoryUser System::Layer & GetSystemLayer() { return mIOContext->GetSystemLayer(); } private: + bool mInitializeNodes = true; bool mInitialized; FabricTable mFabricTable; SessionManager mSessionManager; @@ -150,11 +146,9 @@ class MessagingContext : public PlatformMemoryUser TransportMgrBase * mTransport; // Only needed for InitFromExisting. chip::TestPersistentStorageDelegate mStorage; // for SessionManagerInit - NodeId mBobNodeId = 123654; - NodeId mAliceNodeId = 111222333; - uint16_t mBobKeyId = 1; - uint16_t mAliceKeyId = 2; - GroupId mFriendsGroupId = 0x0101; + FabricIndex mAliceFabricIndex = kUndefinedFabricIndex; + FabricIndex mBobFabricIndex = kUndefinedFabricIndex; + GroupId mFriendsGroupId = 0x0101; Transport::PeerAddress mAliceAddress; Transport::PeerAddress mBobAddress; SecurePairingUsingTestSecret mPairingAliceToBob; @@ -162,8 +156,6 @@ class MessagingContext : public PlatformMemoryUser SessionHolder mSessionAliceToBob; SessionHolder mSessionBobToAlice; Optional mSessionBobToFriends; - FabricIndex mSrcFabricIndex = 1; - FabricIndex mDestFabricIndex = 1; }; template diff --git a/src/messaging/tests/TestExchangeMgr.cpp b/src/messaging/tests/TestExchangeMgr.cpp index 9ee9be6954db8d..9d0eec265cf8ee 100644 --- a/src/messaging/tests/TestExchangeMgr.cpp +++ b/src/messaging/tests/TestExchangeMgr.cpp @@ -97,17 +97,13 @@ void CheckNewContextTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, ec1 != nullptr); NL_TEST_ASSERT(inSuite, ec1->IsInitiator() == true); NL_TEST_ASSERT(inSuite, ec1->GetExchangeId() != 0); - auto sessionPeerToLocal = ec1->GetSessionHandle()->AsSecureSession(); - NL_TEST_ASSERT(inSuite, sessionPeerToLocal->GetPeerNodeId() == ctx.GetBobNodeId()); - NL_TEST_ASSERT(inSuite, sessionPeerToLocal->GetPeerSessionId() == ctx.GetBobKeyId()); + NL_TEST_ASSERT(inSuite, ec1->GetSessionHandle() == ctx.GetSessionAliceToBob()); NL_TEST_ASSERT(inSuite, ec1->GetDelegate() == &mockAppDelegate); ExchangeContext * ec2 = ctx.NewExchangeToAlice(&mockAppDelegate); NL_TEST_ASSERT(inSuite, ec2 != nullptr); NL_TEST_ASSERT(inSuite, ec2->GetExchangeId() > ec1->GetExchangeId()); - auto sessionLocalToPeer = ec2->GetSessionHandle()->AsSecureSession(); - NL_TEST_ASSERT(inSuite, sessionLocalToPeer->GetPeerNodeId() == ctx.GetAliceNodeId()); - NL_TEST_ASSERT(inSuite, sessionLocalToPeer->GetPeerSessionId() == ctx.GetAliceKeyId()); + NL_TEST_ASSERT(inSuite, ec2->GetSessionHandle() == ctx.GetSessionBobToAlice()); ec1->Close(); ec2->Close(); diff --git a/src/platform/Ameba/NetworkCommissioningDriver.h b/src/platform/Ameba/NetworkCommissioningDriver.h index a1430ada013201..0d8c4cb431eae1 100644 --- a/src/platform/Ameba/NetworkCommissioningDriver.h +++ b/src/platform/Ameba/NetworkCommissioningDriver.h @@ -89,7 +89,7 @@ class AmebaWiFiDriver final : public WiFiDriver // BaseDriver NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); } - CHIP_ERROR Init() override; + CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override; CHIP_ERROR Shutdown() override; // WirelessDriver diff --git a/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp b/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp index 25dd5a02eb0e63..30f07d2564f3fb 100644 --- a/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp @@ -35,7 +35,7 @@ constexpr char kWiFiSSIDKeyName[] = "wifi-ssid"; constexpr char kWiFiCredentialsKeyName[] = "wifi-pass"; } // namespace -CHIP_ERROR AmebaWiFiDriver::Init() +CHIP_ERROR AmebaWiFiDriver::Init(NetworkStatusChangeCallback *) { CHIP_ERROR err; size_t ssidLen = 0; diff --git a/src/platform/Darwin/DnssdImpl.h b/src/platform/Darwin/DnssdImpl.h index 0c002ba9de9dd6..a23470c232c638 100644 --- a/src/platform/Darwin/DnssdImpl.h +++ b/src/platform/Darwin/DnssdImpl.h @@ -19,6 +19,9 @@ #include #include +#include + +#include #include #include @@ -47,10 +50,11 @@ struct RegisterContext : public GenericContext RegisterContext(const char * sType, DnssdPublishCallback cb, void * cbContext) { - type = ContextType::Register; - strncpy(mType, sType, sizeof(mType)); + type = ContextType::Register; context = cbContext; callback = cb; + + Platform::CopyString(mType, sType); } bool matches(const char * sType) { return (strcmp(mType, sType) == 0); } @@ -80,11 +84,12 @@ struct ResolveContext : public GenericContext ResolveContext(void * cbContext, DnssdResolveCallback cb, const char * cbContextName, chip::Inet::IPAddressType cbAddressType) { - type = ContextType::Resolve; - context = cbContext; - callback = cb; - strncpy(name, cbContextName, sizeof(name)); + type = ContextType::Resolve; + context = cbContext; + callback = cb; addressType = cbAddressType; + + Platform::CopyString(name, cbContextName); } }; @@ -105,7 +110,8 @@ struct GetAddrInfoContext : public GenericContext callback = cb; interfaceId = cbInterfaceId; port = cbContextPort; - strncpy(name, cbContextName, sizeof(name)); + + Platform::CopyString(name, cbContextName); } }; diff --git a/src/platform/DeviceControlServer.cpp b/src/platform/DeviceControlServer.cpp index eb9bc6731c2c9d..1582f9e4f47ddf 100644 --- a/src/platform/DeviceControlServer.cpp +++ b/src/platform/DeviceControlServer.cpp @@ -37,11 +37,16 @@ DeviceControlServer & DeviceControlServer::DeviceControlSvr() CHIP_ERROR DeviceControlServer::CommissioningComplete(NodeId peerNodeId, FabricIndex accessingFabricIndex) { VerifyOrReturnError(CHIP_NO_ERROR == mFailSafeContext.DisarmFailSafe(), CHIP_ERROR_INTERNAL); + ChipDeviceEvent event; - event.Type = DeviceEventType::kCommissioningComplete; - event.CommissioningComplete.PeerNodeId = peerNodeId; - event.CommissioningComplete.PeerFabricIndex = accessingFabricIndex; - event.CommissioningComplete.Status = CHIP_NO_ERROR; + + event.Type = DeviceEventType::kCommissioningComplete; + event.CommissioningComplete.PeerNodeId = peerNodeId; + event.CommissioningComplete.PeerFabricIndex = accessingFabricIndex; + event.CommissioningComplete.AddNocCommandHasBeenInvoked = mFailSafeContext.AddNocCommandHasBeenInvoked(); + event.CommissioningComplete.UpdateNocCommandHasBeenInvoked = mFailSafeContext.UpdateNocCommandHasBeenInvoked(); + event.CommissioningComplete.Status = CHIP_NO_ERROR; + return PlatformMgr().PostEvent(&event); } diff --git a/src/platform/EFR32/NetworkCommissioningWiFiDriver.cpp b/src/platform/EFR32/NetworkCommissioningWiFiDriver.cpp index d4c3948a7549d5..1401b418318499 100644 --- a/src/platform/EFR32/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/EFR32/NetworkCommissioningWiFiDriver.cpp @@ -35,7 +35,7 @@ NetworkCommissioning::WiFiScanResponse * sScanResult; SlScanResponseIterator mScanResponseIter(sScanResult); } // namespace -CHIP_ERROR SlWiFiDriver::Init() +CHIP_ERROR SlWiFiDriver::Init(NetworkStatusChangeCallback * networkStatusChangeCallback) { CHIP_ERROR err; size_t ssidLen = 0; diff --git a/src/platform/EFR32/NetworkCommissioningWiFiDriver.h b/src/platform/EFR32/NetworkCommissioningWiFiDriver.h index 6f411818b7e214..9a98a1057f11a1 100644 --- a/src/platform/EFR32/NetworkCommissioningWiFiDriver.h +++ b/src/platform/EFR32/NetworkCommissioningWiFiDriver.h @@ -132,7 +132,7 @@ class SlWiFiDriver final : public WiFiDriver // BaseDriver NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); } - CHIP_ERROR Init() override; + CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override; // WirelessDriver uint8_t GetMaxNetworks() override { return kMaxWiFiNetworks; } diff --git a/src/platform/EFR32/ThreadStackManagerImpl.cpp b/src/platform/EFR32/ThreadStackManagerImpl.cpp index fbd89807260177..c8858467bcff77 100644 --- a/src/platform/EFR32/ThreadStackManagerImpl.cpp +++ b/src/platform/EFR32/ThreadStackManagerImpl.cpp @@ -125,6 +125,8 @@ extern "C" otError otPlatUartEnable(void) #endif } +#if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI + extern "C" otError otPlatUartSend(const uint8_t * aBuf, uint16_t aBufLength) { #ifdef PW_RPC_ENABLED @@ -162,3 +164,5 @@ extern "C" __WEAK otError otPlatUartDisable(void) { return OT_ERROR_NOT_IMPLEMENTED; } + +#endif // CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI diff --git a/src/platform/ESP32/NetworkCommissioningDriver.h b/src/platform/ESP32/NetworkCommissioningDriver.h index f998eb9dd59560..decc8e21771466 100644 --- a/src/platform/ESP32/NetworkCommissioningDriver.h +++ b/src/platform/ESP32/NetworkCommissioningDriver.h @@ -88,7 +88,7 @@ class ESPWiFiDriver final : public WiFiDriver // BaseDriver NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); } - CHIP_ERROR Init() override; + CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override; CHIP_ERROR Shutdown() override; // WirelessDriver diff --git a/src/platform/ESP32/NetworkCommissioningWiFiDriver.cpp b/src/platform/ESP32/NetworkCommissioningWiFiDriver.cpp index 8f09ee5f595865..1e4fc0fb9c42d6 100644 --- a/src/platform/ESP32/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/ESP32/NetworkCommissioningWiFiDriver.cpp @@ -38,7 +38,7 @@ constexpr char kWiFiCredentialsKeyName[] = "wifi-pass"; static uint8_t WiFiSSIDStr[DeviceLayer::Internal::kMaxWiFiSSIDLength]; } // namespace -CHIP_ERROR ESPWiFiDriver::Init() +CHIP_ERROR ESPWiFiDriver::Init(NetworkStatusChangeCallback * networkStatusChangeCallback) { CHIP_ERROR err; size_t ssidLen = 0; @@ -92,6 +92,24 @@ bool ESPWiFiDriver::NetworkMatch(const WiFiNetwork & network, ByteSpan networkId Status ESPWiFiDriver::AddOrUpdateNetwork(ByteSpan ssid, ByteSpan credentials) { + // If device is already connected to WiFi, then disconnect the WiFi, + // clear the WiFi configurations and add the newly provided WiFi configurations. + if (chip::DeviceLayer::Internal::ESP32Utils::IsStationProvisioned()) + { + ChipLogProgress(DeviceLayer, "Disconnecting WiFi station interface"); + esp_err_t err = esp_wifi_disconnect(); + if (err != ESP_OK) + { + ChipLogError(DeviceLayer, "esp_wifi_disconnect() failed: %s", esp_err_to_name(err)); + return Status::kOtherConnectionFailure; + } + CHIP_ERROR error = chip::DeviceLayer::Internal::ESP32Utils::ClearWiFiStationProvision(); + if (error != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "ClearWiFiStationProvision failed: %s", chip::ErrorStr(error)); + return Status::kUnknownError; + } + } VerifyOrReturnError(mStagingNetwork.ssidLen == 0 || NetworkMatch(mStagingNetwork, ssid), Status::kBoundsExceeded); VerifyOrReturnError(credentials.size() <= sizeof(mStagingNetwork.credentials), Status::kOutOfRange); VerifyOrReturnError(ssid.size() <= sizeof(mStagingNetwork.ssid), Status::kOutOfRange); diff --git a/src/platform/FailSafeContext.cpp b/src/platform/FailSafeContext.cpp index 0a732fd8b194d4..14e0bb417db72f 100644 --- a/src/platform/FailSafeContext.cpp +++ b/src/platform/FailSafeContext.cpp @@ -35,16 +35,17 @@ void FailSafeContext::HandleArmFailSafe(System::Layer * layer, void * aAppState) void FailSafeContext::CommissioningFailedTimerComplete() { - // TODO: If the fail-safe timer expires before the CommissioningComplete command is - // successfully invoked, conduct clean-up steps. - ChipDeviceEvent event; - event.Type = DeviceEventType::kCommissioningComplete; - event.CommissioningComplete.Status = CHIP_ERROR_TIMEOUT; - CHIP_ERROR status = PlatformMgr().PostEvent(&event); + event.Type = DeviceEventType::kCommissioningComplete; + event.CommissioningComplete.PeerFabricIndex = mFabricIndex; + event.CommissioningComplete.AddNocCommandHasBeenInvoked = mAddNocCommandHasBeenInvoked; + event.CommissioningComplete.UpdateNocCommandHasBeenInvoked = mUpdateNocCommandHasBeenInvoked; + event.CommissioningComplete.Status = CHIP_ERROR_TIMEOUT; + CHIP_ERROR status = PlatformMgr().PostEvent(&event); - mFailSafeArmed = false; - mNocCommandHasBeenInvoked = false; + mFailSafeArmed = false; + mAddNocCommandHasBeenInvoked = false; + mUpdateNocCommandHasBeenInvoked = false; if (status != CHIP_NO_ERROR) { @@ -62,8 +63,9 @@ CHIP_ERROR FailSafeContext::ArmFailSafe(FabricIndex accessingFabricIndex, System CHIP_ERROR FailSafeContext::DisarmFailSafe() { - mFailSafeArmed = false; - mNocCommandHasBeenInvoked = false; + mFailSafeArmed = false; + mAddNocCommandHasBeenInvoked = false; + mUpdateNocCommandHasBeenInvoked = false; DeviceLayer::SystemLayer().CancelTimer(HandleArmFailSafe, this); return CHIP_NO_ERROR; } diff --git a/src/platform/Linux/ConfigurationManagerImpl.cpp b/src/platform/Linux/ConfigurationManagerImpl.cpp index c0f997ef1dd7e9..fed2f6d723a56f 100644 --- a/src/platform/Linux/ConfigurationManagerImpl.cpp +++ b/src/platform/Linux/ConfigurationManagerImpl.cpp @@ -121,12 +121,12 @@ CHIP_ERROR ConfigurationManagerImpl::Init() CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { - struct ifaddrs * addresses = NULL; + struct ifaddrs * addresses = nullptr; CHIP_ERROR error = CHIP_NO_ERROR; bool found = false; VerifyOrExit(getifaddrs(&addresses) == 0, error = CHIP_ERROR_INTERNAL); - for (auto addr = addresses; addr != NULL; addr = addr->ifa_next) + for (auto addr = addresses; addr != nullptr; addr = addr->ifa_next) { if ((addr->ifa_addr) && (addr->ifa_addr->sa_family == AF_PACKET) && strncmp(addr->ifa_name, "lo", IFNAMSIZ) != 0) { diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index 8b8f3059d338c8..0d6d4de61f427b 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -283,7 +283,7 @@ CHIP_ERROR ConnectivityManagerImpl::_SetWiFiAPMode(WiFiAPMode val) ChipLogProgress(DeviceLayer, "WiFi AP mode change: %s -> %s", WiFiAPModeToStr(mWiFiAPMode), WiFiAPModeToStr(val)); mWiFiAPMode = val; - DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); + DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, nullptr); } exit: @@ -296,7 +296,7 @@ void ConnectivityManagerImpl::_DemandStartWiFiAP() { ChipLogProgress(DeviceLayer, "wpa_supplicant: Demand start WiFi AP"); mLastAPDemandTime = System::SystemClock().GetMonotonicTimestamp(); - DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); + DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, nullptr); } else { @@ -310,7 +310,7 @@ void ConnectivityManagerImpl::_StopOnDemandWiFiAP() { ChipLogProgress(DeviceLayer, "wpa_supplicant: Demand stop WiFi AP"); mLastAPDemandTime = System::Clock::kZero; - DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); + DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, nullptr); } else { @@ -332,7 +332,33 @@ void ConnectivityManagerImpl::_MaintainOnDemandWiFiAP() void ConnectivityManagerImpl::_SetWiFiAPIdleTimeout(System::Clock::Timeout val) { mWiFiAPIdleTimeout = val; - DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); + DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, nullptr); +} + +void ConnectivityManagerImpl::UpdateNetworkStatus() +{ + Network configuredNetwork; + + VerifyOrReturn(IsWiFiStationEnabled() && mpStatusChangeCallback != nullptr); + + CHIP_ERROR err = GetConfiguredNetwork(configuredNetwork); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to get configured network when updating network status: %s", err.AsString()); + return; + } + + // If we have already connected to the WiFi AP, then return null to indicate a success state. + if (IsWiFiStationConnected()) + { + mpStatusChangeCallback->OnNetworkingStatusChange( + Status::kSuccess, MakeOptional(ByteSpan(configuredNetwork.networkID, configuredNetwork.networkIDLen)), NullOptional); + return; + } + + mpStatusChangeCallback->OnNetworkingStatusChange( + Status::kUnknownError, MakeOptional(ByteSpan(configuredNetwork.networkID, configuredNetwork.networkIDLen)), + MakeOptional(GetDisconnectReason())); } void ConnectivityManagerImpl::_OnWpaPropertiesChanged(WpaFiW1Wpa_supplicant1Interface * proxy, GVariant * changed_properties, @@ -400,6 +426,8 @@ void ConnectivityManagerImpl::_OnWpaPropertiesChanged(WpaFiW1Wpa_supplicant1Inte delegate->OnAssociationFailureDetected(associationFailureCause, status); } + DeviceLayer::SystemLayer().ScheduleLambda([]() { ConnectivityMgrImpl().UpdateNetworkStatus(); }); + mAssociattionStarted = false; } else if (g_strcmp0(value_str, "\'associated\'") == 0) @@ -408,6 +436,8 @@ void ConnectivityManagerImpl::_OnWpaPropertiesChanged(WpaFiW1Wpa_supplicant1Inte { delegate->OnConnectionStatusChanged(static_cast(WiFiConnectionStatus::kNotConnected)); } + + DeviceLayer::SystemLayer().ScheduleLambda([]() { ConnectivityMgrImpl().UpdateNetworkStatus(); }); } } @@ -728,7 +758,7 @@ void ConnectivityManagerImpl::DriveAPState() // Compute the amount of idle time before the AP should be deactivated and // arm a timer to fire at that time. System::Clock::Timeout apTimeout = (mLastAPDemandTime + mWiFiAPIdleTimeout) - now; - err = DeviceLayer::SystemLayer().StartTimer(apTimeout, DriveAPState, NULL); + err = DeviceLayer::SystemLayer().StartTimer(apTimeout, DriveAPState, nullptr); SuccessOrExit(err); ChipLogProgress(DeviceLayer, "Next WiFi AP timeout in %" PRIu32 " s", std::chrono::duration_cast(apTimeout).count()); @@ -1277,13 +1307,30 @@ CHIP_ERROR ConnectivityManagerImpl::GetWiFiVersion(uint8_t & wiFiVersion) return CHIP_NO_ERROR; } -CHIP_ERROR ConnectivityManagerImpl::GetConnectedNetwork(NetworkCommissioning::Network & network) +int32_t ConnectivityManagerImpl::GetDisconnectReason() +{ + std::lock_guard lock(mWpaSupplicantMutex); + std::unique_ptr err; + + gint errorValue = wpa_fi_w1_wpa_supplicant1_interface_get_disconnect_reason(mWpaSupplicant.iface); + // wpa_supplicant DBus API: DisconnectReason: The most recent IEEE 802.11 reason code for disconnect. Negative value + // indicates locally generated disconnection. + return errorValue; +} + +CHIP_ERROR ConnectivityManagerImpl::GetConfiguredNetwork(NetworkCommissioning::Network & network) { std::lock_guard lock(mWpaSupplicantMutex); std::unique_ptr err; const gchar * networkPath = wpa_fi_w1_wpa_supplicant1_interface_get_current_network(mWpaSupplicant.iface); + // wpa_supplicant DBus API: if network path of current network is "/", means no networks is currently selected. + if (strcmp(networkPath, "/") == 0) + { + return CHIP_ERROR_KEY_NOT_FOUND; + } + std::unique_ptr networkInfo( wpa_fi_w1_wpa_supplicant1_network_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kWpaSupplicantServiceName, networkPath, nullptr, diff --git a/src/platform/Linux/ConnectivityManagerImpl.h b/src/platform/Linux/ConnectivityManagerImpl.h index 555aa2ae28802e..1a8c1dd036b47e 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.h +++ b/src/platform/Linux/ConnectivityManagerImpl.h @@ -114,6 +114,11 @@ class ConnectivityManagerImpl final : public ConnectivityManager, public: #if CHIP_DEVICE_CONFIG_ENABLE_WPA CHIP_ERROR ProvisionWiFiNetwork(const char * ssid, const char * key); + void + SetNetworkStatusChangeCallback(NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) + { + mpStatusChangeCallback = statusChangeCallback; + } CHIP_ERROR ConnectWiFiNetworkAsync(ByteSpan ssid, ByteSpan credentials, NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * connectCallback); void PostNetworkConnect(); @@ -122,10 +127,11 @@ class ConnectivityManagerImpl final : public ConnectivityManager, void StartWiFiManagement(); bool IsWiFiManagementStarted(); + int32_t GetDisconnectReason(); CHIP_ERROR GetWiFiBssId(ByteSpan & value); CHIP_ERROR GetWiFiSecurityType(uint8_t & securityType); CHIP_ERROR GetWiFiVersion(uint8_t & wiFiVersion); - CHIP_ERROR GetConnectedNetwork(NetworkCommissioning::Network & network); + CHIP_ERROR GetConfiguredNetwork(NetworkCommissioning::Network & network); CHIP_ERROR StartWiFiScan(ByteSpan ssid, NetworkCommissioning::WiFiDriver::ScanCallback * callback); #endif @@ -174,6 +180,7 @@ class ConnectivityManagerImpl final : public ConnectivityManager, void _MaintainOnDemandWiFiAP(); System::Clock::Timeout _GetWiFiAPIdleTimeout(); void _SetWiFiAPIdleTimeout(System::Clock::Timeout val); + void UpdateNetworkStatus(); static CHIP_ERROR StopAutoScan(); static void _OnWpaProxyReady(GObject * source_object, GAsyncResult * res, gpointer user_data); @@ -193,6 +200,8 @@ class ConnectivityManagerImpl final : public ConnectivityManager, static BitFlags mConnectivityFlag; static struct GDBusWpaSupplicant mWpaSupplicant; static std::mutex mWpaSupplicantMutex; + + NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback * mpStatusChangeCallback = nullptr; #endif // ==================== ConnectivityManager Private Methods ==================== diff --git a/src/platform/Linux/DiagnosticDataProviderImpl.cpp b/src/platform/Linux/DiagnosticDataProviderImpl.cpp index b2e0e0cd0948f9..12beb5a882589a 100644 --- a/src/platform/Linux/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Linux/DiagnosticDataProviderImpl.cpp @@ -281,7 +281,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetThreadMetrics(ThreadMetrics ** threadM struct dirent * entry; /* proc available, iterate through tasks... */ - while ((entry = readdir(proc_dir)) != NULL) + while ((entry = readdir(proc_dir)) != nullptr) { if (entry->d_name[0] == '.') continue; diff --git a/src/platform/Linux/DnssdImpl.cpp b/src/platform/Linux/DnssdImpl.cpp index 1d17d67ef2079a..3f5b5258c51344 100644 --- a/src/platform/Linux/DnssdImpl.cpp +++ b/src/platform/Linux/DnssdImpl.cpp @@ -569,7 +569,7 @@ DnssdServiceProtocol GetProtocolInType(const char * type) { const char * deliminator = strrchr(type, '.'); - if (deliminator == NULL) + if (deliminator == nullptr) { ChipLogError(Discovery, "Failed to find protocol in type: %s", type); return DnssdServiceProtocol::kDnssdProtocolUnknown; diff --git a/src/platform/Linux/KeyValueStoreManagerImpl.cpp b/src/platform/Linux/KeyValueStoreManagerImpl.cpp index d9a7db6fbf3f71..6e1774759bcb42 100644 --- a/src/platform/Linux/KeyValueStoreManagerImpl.cpp +++ b/src/platform/Linux/KeyValueStoreManagerImpl.cpp @@ -52,11 +52,11 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t { return CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; } - else if ((err != CHIP_NO_ERROR) && (err != CHIP_ERROR_BUFFER_TOO_SMALL)) + if ((err != CHIP_NO_ERROR) && (err != CHIP_ERROR_BUFFER_TOO_SMALL)) { return err; } - else if (offset_bytes > read_size) + if (offset_bytes > read_size) { return CHIP_ERROR_INVALID_ARGUMENT; } diff --git a/src/platform/Linux/NetworkCommissioningDriver.h b/src/platform/Linux/NetworkCommissioningDriver.h index 41daa19ef04a18..948de0e19ce64a 100644 --- a/src/platform/Linux/NetworkCommissioningDriver.h +++ b/src/platform/Linux/NetworkCommissioningDriver.h @@ -62,7 +62,7 @@ class LinuxWiFiDriver final : public WiFiDriver size_t Count() override; bool Next(Network & item) override; void Release() override { delete this; } - ~WiFiNetworkIterator() = default; + ~WiFiNetworkIterator() override = default; private: LinuxWiFiDriver * driver; @@ -79,8 +79,8 @@ class LinuxWiFiDriver final : public WiFiDriver // BaseDriver NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); } - CHIP_ERROR Init() override; - CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } // Nothing to do on linux for shutdown. + CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override; + CHIP_ERROR Shutdown() override; // WirelessDriver uint8_t GetMaxNetworks() override { return 1; } @@ -104,6 +104,7 @@ class LinuxWiFiDriver final : public WiFiDriver WiFiNetworkIterator mWiFiIterator = WiFiNetworkIterator(this); WiFiNetwork mSavedNetwork; WiFiNetwork mStagingNetwork; + Optional mScanStatus; }; #endif // CHIP_DEVICE_CONFIG_ENABLE_WPA @@ -118,7 +119,7 @@ class LinuxThreadDriver final : public ThreadDriver size_t Count() override; bool Next(Network & item) override; void Release() override { delete this; } - ~ThreadNetworkIterator() = default; + ~ThreadNetworkIterator() override = default; private: LinuxThreadDriver * driver; @@ -127,8 +128,8 @@ class LinuxThreadDriver final : public ThreadDriver // BaseDriver NetworkIterator * GetNetworks() override { return new ThreadNetworkIterator(this); } - CHIP_ERROR Init() override; - CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } // Nothing to do on linux for shutdown. + CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override; + CHIP_ERROR Shutdown() override; // WirelessDriver uint8_t GetMaxNetworks() override { return 1; } @@ -144,7 +145,7 @@ class LinuxThreadDriver final : public ThreadDriver // ThreadDriver Status AddOrUpdateNetwork(ByteSpan operationalDataset) override; - void ScanNetworks(ScanCallback * callback) override; + void ScanNetworks(ThreadDriver::ScanCallback * callback) override; private: ThreadNetworkIterator mThreadIterator = ThreadNetworkIterator(this); diff --git a/src/platform/Linux/NetworkCommissioningThreadDriver.cpp b/src/platform/Linux/NetworkCommissioningThreadDriver.cpp index abbeeaa3f0af84..e8f079e1ae0e7e 100644 --- a/src/platform/Linux/NetworkCommissioningThreadDriver.cpp +++ b/src/platform/Linux/NetworkCommissioningThreadDriver.cpp @@ -41,7 +41,7 @@ namespace NetworkCommissioning { // TODO: The otbr-posix does not actually maintains its own networking states, it will always persist the last network connected. // This should not be an issue for most cases, but we should implement the code for maintaining the states by ourselves. -CHIP_ERROR LinuxThreadDriver::Init() +CHIP_ERROR LinuxThreadDriver::Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) { ByteSpan currentProvision; VerifyOrReturnError(ConnectivityMgrImpl().IsThreadAttached(), CHIP_NO_ERROR); @@ -50,6 +50,14 @@ CHIP_ERROR LinuxThreadDriver::Init() mSavedNetwork.Init(currentProvision); mStagingNetwork.Init(currentProvision); + ThreadStackMgrImpl().SetNetworkStatusChangeCallback(networkStatusChangeCallback); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR LinuxThreadDriver::Shutdown() +{ + ThreadStackMgrImpl().SetNetworkStatusChangeCallback(nullptr); return CHIP_NO_ERROR; } @@ -90,7 +98,7 @@ Status LinuxThreadDriver::RemoveNetwork(ByteSpan networkId) { return Status::kNetworkNotFound; } - else if (mStagingNetwork.GetExtendedPanId(extpanid) != CHIP_NO_ERROR) + if (mStagingNetwork.GetExtendedPanId(extpanid) != CHIP_NO_ERROR) { return Status::kUnknownError; } @@ -108,7 +116,7 @@ Status LinuxThreadDriver::ReorderNetwork(ByteSpan networkId, uint8_t index) { return Status::kNetworkNotFound; } - else if (mStagingNetwork.GetExtendedPanId(extpanid) != CHIP_NO_ERROR) + if (mStagingNetwork.GetExtendedPanId(extpanid) != CHIP_NO_ERROR) { return Status::kUnknownError; } @@ -148,6 +156,7 @@ void LinuxThreadDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * cal void LinuxThreadDriver::ScanNetworks(ThreadDriver::ScanCallback * callback) { CHIP_ERROR err = DeviceLayer::ThreadStackMgrImpl().StartThreadScan(callback); + // The ThreadScan callback will always be invoked in CHIP mainloop, which is strictly after this function if (err != CHIP_NO_ERROR) { callback->OnFinished(Status::kUnknownError, CharSpan(), nullptr); diff --git a/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp b/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp index ae56e1a6aa90b3..47ae49833c483d 100644 --- a/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp @@ -50,7 +50,7 @@ constexpr char kWiFiCredentialsKeyName[] = "wifi-pass"; // NOTE: For now, the LinuxWiFiDriver only supports one network, this can be fixed by using the wpa_supplicant API directly (then // wpa_supplicant will manage the networks for us.) -CHIP_ERROR LinuxWiFiDriver::Init() +CHIP_ERROR LinuxWiFiDriver::Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) { CHIP_ERROR err; size_t ssidLen = 0; @@ -73,6 +73,14 @@ CHIP_ERROR LinuxWiFiDriver::Init() mSavedNetwork.ssidLen = ssidLen; mStagingNetwork = mSavedNetwork; + + ConnectivityMgrImpl().SetNetworkStatusChangeCallback(networkStatusChangeCallback); + return CHIP_NO_ERROR; +} + +CHIP_ERROR LinuxWiFiDriver::Shutdown() +{ + ConnectivityMgrImpl().SetNetworkStatusChangeCallback(nullptr); return CHIP_NO_ERROR; } @@ -166,8 +174,14 @@ void LinuxWiFiDriver::ScanNetworks(ByteSpan ssid, WiFiDriver::ScanCallback * cal CHIP_ERROR err = DeviceLayer::ConnectivityMgrImpl().StartWiFiScan(ssid, callback); if (err != CHIP_NO_ERROR) { + mScanStatus.SetValue(Status::kUnknownError); callback->OnFinished(Status::kUnknownError, CharSpan(), nullptr); } + else + { + // On linux platform, once "scan" is started, we can say the result will always be success. + mScanStatus.SetValue(Status::kSuccess); + } } size_t LinuxWiFiDriver::WiFiNetworkIterator::Count() @@ -186,12 +200,12 @@ bool LinuxWiFiDriver::WiFiNetworkIterator::Next(Network & item) item.connected = false; exhausted = true; - Network connectedNetwork; - CHIP_ERROR err = DeviceLayer::ConnectivityMgrImpl().GetConnectedNetwork(connectedNetwork); + Network configuredNetwork; + CHIP_ERROR err = DeviceLayer::ConnectivityMgrImpl().GetConfiguredNetwork(configuredNetwork); if (err == CHIP_NO_ERROR) { - if (connectedNetwork.networkIDLen == item.networkIDLen && - memcmp(connectedNetwork.networkID, item.networkID, item.networkIDLen) == 0) + if (DeviceLayer::ConnectivityMgrImpl().IsWiFiStationConnected() && configuredNetwork.networkIDLen == item.networkIDLen && + memcmp(configuredNetwork.networkID, item.networkID, item.networkIDLen) == 0) { item.connected = true; } diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp index 473653d4562c11..e6ad974847a081 100644 --- a/src/platform/Linux/PlatformManagerImpl.cpp +++ b/src/platform/Linux/PlatformManagerImpl.cpp @@ -136,7 +136,7 @@ void PlatformManagerImpl::WiFIIPChangeListener() if (routeInfo->rta_type == IFA_LOCAL) { char name[IFNAMSIZ]; - if (if_indextoname(addressMessage->ifa_index, name) == NULL) + if (if_indextoname(addressMessage->ifa_index, name) == nullptr) { ChipLogError(DeviceLayer, "Error %d when getting the interface name at index: %d", errno, addressMessage->ifa_index); @@ -178,11 +178,11 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() memset(&action, 0, sizeof(action)); action.sa_handler = SignalHandler; - sigaction(SIGHUP, &action, NULL); - sigaction(SIGTERM, &action, NULL); - sigaction(SIGUSR1, &action, NULL); - sigaction(SIGUSR2, &action, NULL); - sigaction(SIGTSTP, &action, NULL); + sigaction(SIGHUP, &action, nullptr); + sigaction(SIGTERM, &action, nullptr); + sigaction(SIGUSR1, &action, nullptr); + sigaction(SIGUSR2, &action, nullptr); + sigaction(SIGTSTP, &action, nullptr); #if CHIP_WITH_GIO GError * error = nullptr; diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index 48e0ccd052d2c2..104f90d805cb7a 100644 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -94,6 +94,8 @@ void ThreadStackManagerImpl::OnDbusPropertiesChanged(OpenthreadIoOpenthreadBorde if (key == nullptr || value == nullptr) continue; // ownership of key and value is still holding by the iter + DeviceLayer::SystemLayer().ScheduleLambda([me]() { me->_UpdateNetworkStatus(); }); + if (strcmp(key, kPropertyDeviceRole) == 0) { const gchar * value_str = g_variant_get_string(value, nullptr); @@ -301,7 +303,7 @@ bool ThreadStackManagerImpl::_IsThreadEnabled() std::unique_ptr err; - std::unique_ptr value( + std::unique_ptr response( g_dbus_proxy_call_sync(G_DBUS_PROXY(mProxy.get()), "org.freedesktop.DBus.Properties.Get", g_variant_new("(ss)", "io.openthread.BorderRouter", "DeviceRole"), G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &MakeUniquePointerReceiver(err).Get())); @@ -312,6 +314,20 @@ bool ThreadStackManagerImpl::_IsThreadEnabled() return false; } + if (response == nullptr) + { + return false; + } + + std::unique_ptr tupleContent(g_variant_get_child_value(response.get(), 0)); + + if (tupleContent == nullptr) + { + return false; + } + + std::unique_ptr value(g_variant_get_variant(tupleContent.get())); + if (value == nullptr) { return false; @@ -319,10 +335,15 @@ bool ThreadStackManagerImpl::_IsThreadEnabled() const gchar * role = g_variant_get_string(value.get(), nullptr); + if (role == nullptr) + { + return false; + } + return (strcmp(role, kOpenthreadDeviceRoleDisabled) != 0); } -bool ThreadStackManagerImpl::_IsThreadAttached() +bool ThreadStackManagerImpl::_IsThreadAttached() const { return mAttached; } @@ -405,7 +426,7 @@ ConnectivityManager::ThreadDeviceType ThreadStackManagerImpl::_GetThreadDeviceTy { return ConnectivityManager::ThreadDeviceType::kThreadDeviceType_NotSupported; } - else if (strcmp(role.get(), kOpenthreadDeviceRoleChild) == 0) + if (strcmp(role.get(), kOpenthreadDeviceRoleChild) == 0) { std::unique_ptr linkMode(openthread_io_openthread_border_router_dup_link_mode(mProxy.get())); if (!linkMode) @@ -425,15 +446,13 @@ ConnectivityManager::ThreadDeviceType ThreadStackManagerImpl::_GetThreadDeviceTy } return type; } - else if (strcmp(role.get(), kOpenthreadDeviceRoleLeader) == 0 || strcmp(role.get(), kOpenthreadDeviceRoleRouter) == 0) + if (strcmp(role.get(), kOpenthreadDeviceRoleLeader) == 0 || strcmp(role.get(), kOpenthreadDeviceRoleRouter) == 0) { return ConnectivityManager::ThreadDeviceType::kThreadDeviceType_Router; } - else - { - ChipLogError(DeviceLayer, "Unknown Thread role: %s", role.get()); - return ConnectivityManager::ThreadDeviceType::kThreadDeviceType_NotSupported; - } + + ChipLogError(DeviceLayer, "Unknown Thread role: %s", role.get()); + return ConnectivityManager::ThreadDeviceType::kThreadDeviceType_NotSupported; } CHIP_ERROR ThreadStackManagerImpl::_SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType) @@ -692,6 +711,39 @@ ThreadStackManagerImpl::_AttachToThreadNetwork(ByteSpan netInfo, return CHIP_NO_ERROR; } +void ThreadStackManagerImpl::_UpdateNetworkStatus() +{ + // Thread is not enabled, then we are not trying to connect to the network. + VerifyOrReturn(IsThreadEnabled() && mpStatusChangeCallback != nullptr); + + ByteSpan datasetTLV; + Thread::OperationalDataset dataset; + uint8_t extpanid[Thread::kSizeExtendedPanId]; + + // If we have not provisioned any Thread network, return the status from last network scan, + // If we have provisioned a network, we assume the ot-br-posix is activitely connecting to that network. + CHIP_ERROR err = ThreadStackMgrImpl().GetThreadProvision(datasetTLV); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to get configured network when updating network status: %s", err.AsString()); + return; + } + + VerifyOrReturn(dataset.Init(datasetTLV) == CHIP_NO_ERROR); + // The Thread network is not enabled, but has a different extended pan id. + VerifyOrReturn(dataset.GetExtendedPanId(extpanid) == CHIP_NO_ERROR); + + // We have already connected to the network, thus return success. + if (ThreadStackMgrImpl().IsThreadAttached()) + { + mpStatusChangeCallback->OnNetworkingStatusChange(Status::kSuccess, MakeOptional(ByteSpan(extpanid)), NullOptional); + } + else + { + mpStatusChangeCallback->OnNetworkingStatusChange(Status::kNetworkNotFound, MakeOptional(ByteSpan(extpanid)), NullOptional); + } +} + ThreadStackManager & ThreadStackMgr() { return chip::DeviceLayer::ThreadStackManagerImpl::sInstance; diff --git a/src/platform/Linux/ThreadStackManagerImpl.h b/src/platform/Linux/ThreadStackManagerImpl.h index e725bb5d72f64d..431812c8788238 100644 --- a/src/platform/Linux/ThreadStackManagerImpl.h +++ b/src/platform/Linux/ThreadStackManagerImpl.h @@ -36,6 +36,12 @@ class ThreadStackManagerImpl : public ThreadStackManager public: ThreadStackManagerImpl(); + void + SetNetworkStatusChangeCallback(NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) + { + mpStatusChangeCallback = statusChangeCallback; + } + CHIP_ERROR _InitThreadStack(); void _ProcessThreadActivity(); @@ -63,7 +69,7 @@ class ThreadStackManagerImpl : public ThreadStackManager bool _IsThreadEnabled(); - bool _IsThreadAttached(); + bool _IsThreadAttached() const; CHIP_ERROR _AttachToThreadNetwork(ByteSpan netInfo, NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * callback); @@ -71,6 +77,8 @@ class ThreadStackManagerImpl : public ThreadStackManager void _OnThreadAttachFinished(void); + void _UpdateNetworkStatus(); + static void _OnThreadBrAttachFinished(GObject * source_object, GAsyncResult * res, gpointer user_data); ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(); @@ -144,6 +152,7 @@ class ThreadStackManagerImpl : public ThreadStackManager NetworkCommissioning::ThreadDriver::ScanCallback * mpScanCallback; NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * mpConnectCallback; + NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback * mpStatusChangeCallback = nullptr; bool mAttached; }; diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp index ccb3a408e7ecc3..717bc02264bc44 100644 --- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp +++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp @@ -35,9 +35,11 @@ namespace NetworkCommissioning { // load the network config from thread persistent info, and loads it into both mSavedNetwork and mStagingNetwork. When updating the // networks, all changes are made on the staging network. When validated we can commit it and save it to the persistent info -CHIP_ERROR GenericThreadDriver::Init() +CHIP_ERROR GenericThreadDriver::Init(Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) { ByteSpan currentProvision; + ThreadStackMgrImpl().SetNetworkStatusChangeCallback(statusChangeCallback); + VerifyOrReturnError(ThreadStackMgrImpl().IsThreadAttached(), CHIP_NO_ERROR); VerifyOrReturnError(ThreadStackMgrImpl().GetThreadProvision(currentProvision) == CHIP_NO_ERROR, CHIP_NO_ERROR); @@ -47,6 +49,12 @@ CHIP_ERROR GenericThreadDriver::Init() return CHIP_NO_ERROR; } +CHIP_ERROR GenericThreadDriver::Shutdown() +{ + ThreadStackMgrImpl().SetNetworkStatusChangeCallback(nullptr); + return CHIP_NO_ERROR; +} + CHIP_ERROR GenericThreadDriver::CommitConfiguration() { // Note: on AttachToThreadNetwork OpenThread will persist the networks on its own, @@ -150,8 +158,14 @@ void GenericThreadDriver::ScanNetworks(ThreadDriver::ScanCallback * callback) CHIP_ERROR err = DeviceLayer::ThreadStackMgrImpl().StartThreadScan(callback); if (err != CHIP_NO_ERROR) { + mScanStatus.SetValue(Status::kUnknownError); callback->OnFinished(Status::kUnknownError, CharSpan(), nullptr); } + else + { + // OpenThread's "scan" will always success once started, so we can set the value of scan result here. + mScanStatus.SetValue(Status::kSuccess); + } } size_t GenericThreadDriver::ThreadNetworkIterator::Count() diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h index be5ad934d7162e..ec801c997bda43 100644 --- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h +++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h @@ -84,8 +84,8 @@ class GenericThreadDriver final : public ThreadDriver // BaseDriver NetworkIterator * GetNetworks() override { return new ThreadNetworkIterator(this); } - CHIP_ERROR Init() override; - CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } // Nothing to do on EFR32 for shutdown. + CHIP_ERROR Init(Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) override; + CHIP_ERROR Shutdown() override; // WirelessDriver uint8_t GetMaxNetworks() override { return 1; } @@ -101,12 +101,13 @@ class GenericThreadDriver final : public ThreadDriver // ThreadDriver Status AddOrUpdateNetwork(ByteSpan operationalDataset) override; - void ScanNetworks(ScanCallback * callback) override; + void ScanNetworks(ThreadDriver::ScanCallback * callback) override; private: ThreadNetworkIterator mThreadIterator = ThreadNetworkIterator(this); Thread::OperationalDataset mSavedNetwork = {}; Thread::OperationalDataset mStagingNetwork = {}; + Optional mScanStatus; }; } // namespace NetworkCommissioning diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index 039c1e759506c8..ffbfa33d1fb185 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -127,6 +127,8 @@ void GenericThreadStackManagerImpl_OpenThread::OnOpenThreadStateChang { ChipLogError(DeviceLayer, "Failed to post Thread state change: %" CHIP_ERROR_FORMAT, status.Format()); } + + DeviceLayer::SystemLayer().ScheduleLambda([]() { ThreadStackMgrImpl()._UpdateNetworkStatus(); }); } template @@ -1843,6 +1845,36 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_JoinerStart(voi return error; } +template +void GenericThreadStackManagerImpl_OpenThread::_UpdateNetworkStatus() +{ + // Thread is not enabled, then we are not trying to connect to the network. + VerifyOrReturn(ThreadStackMgrImpl().IsThreadEnabled() && mpStatusChangeCallback != nullptr); + + ByteSpan datasetTLV; + Thread::OperationalDataset dataset; + uint8_t extpanid[chip::Thread::kSizeExtendedPanId]; + + // If we have not provisioned any Thread network, return the status from last network scan, + // If we have provisioned a network, we assume the ot-br-posix is activitely connecting to that network. + ReturnOnFailure(ThreadStackMgrImpl().GetThreadProvision(datasetTLV)); + ReturnOnFailure(dataset.Init(datasetTLV)); + // The Thread network is not enabled, but has a different extended pan id. + ReturnOnFailure(dataset.GetExtendedPanId(extpanid)); + // If we don't have a valid dataset, we are not attempting to connect the network. + + // We have already connected to the network, thus return success. + if (ThreadStackMgrImpl().IsThreadAttached()) + { + mpStatusChangeCallback->OnNetworkingStatusChange(Status::kSuccess, MakeOptional(ByteSpan(extpanid)), NullOptional); + } + else + { + mpStatusChangeCallback->OnNetworkingStatusChange(Status::kNetworkNotFound, MakeOptional(ByteSpan(extpanid)), + MakeOptional(static_cast(OT_ERROR_DETACHED))); + } +} + #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT static_assert(OPENTHREAD_API_VERSION >= 156, "SRP Client requires a more recent OpenThread version"); diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h index 5b44e32b668f87..7cd8dac1a4fae9 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h @@ -70,6 +70,11 @@ class GenericThreadStackManagerImpl_OpenThread otInstance * OTInstance() const; static void OnOpenThreadStateChange(uint32_t flags, void * context); inline void OverrunErrorTally(void); + void + SetNetworkStatusChangeCallback(NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) + { + mpStatusChangeCallback = statusChangeCallback; + } protected: // ===== Methods that implement the ThreadStackManager abstract interface. @@ -92,6 +97,7 @@ class GenericThreadStackManagerImpl_OpenThread CHIP_ERROR _StartThreadScan(NetworkCommissioning::ThreadDriver::ScanCallback * callback); static void _OnNetworkScanFinished(otActiveScanResult * aResult, void * aContext); void _OnNetworkScanFinished(otActiveScanResult * aResult); + void _UpdateNetworkStatus(); #if CHIP_DEVICE_CONFIG_ENABLE_SED CHIP_ERROR _GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig); @@ -148,6 +154,7 @@ class GenericThreadStackManagerImpl_OpenThread NetworkCommissioning::ThreadDriver::ScanCallback * mpScanCallback; NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * mpConnectCallback; + NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback * mpStatusChangeCallback = nullptr; #if CHIP_DEVICE_CONFIG_ENABLE_SED ConnectivityManager::SEDPollingConfig mPollingConfig; diff --git a/src/platform/P6/NetworkCommissioningDriver.h b/src/platform/P6/NetworkCommissioningDriver.h index a1c30b4e8488e8..54302bd2410aa8 100644 --- a/src/platform/P6/NetworkCommissioningDriver.h +++ b/src/platform/P6/NetworkCommissioningDriver.h @@ -91,7 +91,7 @@ class P6WiFiDriver final : public WiFiDriver // BaseDriver NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); } - CHIP_ERROR Init() override; + CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override; CHIP_ERROR Shutdown() override; // WirelessDriver diff --git a/src/platform/P6/NetworkCommissioningWiFiDriver.cpp b/src/platform/P6/NetworkCommissioningWiFiDriver.cpp index fe911c79c687a8..c4b2a826ae4a27 100644 --- a/src/platform/P6/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/P6/NetworkCommissioningWiFiDriver.cpp @@ -39,7 +39,7 @@ constexpr char kWiFiCredentialsKeyName[] = "wifi-pass"; cy_wcm_scan_result_t scan_result_list[kWiFiMaxNetworks]; uint8_t NumAP; // no of network scanned -CHIP_ERROR P6WiFiDriver::Init() +CHIP_ERROR P6WiFiDriver::Init(NetworkStatusChangeCallback * networkStatusChangeCallback) { CHIP_ERROR err; size_t ssidLen = 0; diff --git a/src/platform/Tizen/NetworkCommissioningDriver.h b/src/platform/Tizen/NetworkCommissioningDriver.h index c7b23ca33e8020..5c00f8bc8028d1 100644 --- a/src/platform/Tizen/NetworkCommissioningDriver.h +++ b/src/platform/Tizen/NetworkCommissioningDriver.h @@ -52,7 +52,7 @@ class TizenWiFiDriver final : public WiFiDriver // BaseDriver NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); } - CHIP_ERROR Init() override; + CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override; CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } // WirelessDriver diff --git a/src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp b/src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp index 43a71c84287d44..fa444f99bef2ee 100644 --- a/src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp @@ -38,7 +38,7 @@ constexpr char kWiFiSSIDKeyName[] = "wifi-ssid"; constexpr char kWiFiCredentialsKeyName[] = "wifi-pass"; } // namespace -CHIP_ERROR TizenWiFiDriver::Init() +CHIP_ERROR TizenWiFiDriver::Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) { CHIP_ERROR err; size_t ssidLen = 0; diff --git a/src/platform/android/AndroidChipPlatform-JNI.cpp b/src/platform/android/AndroidChipPlatform-JNI.cpp index 0848201a981ad6..e655b30140c4b2 100644 --- a/src/platform/android/AndroidChipPlatform-JNI.cpp +++ b/src/platform/android/AndroidChipPlatform-JNI.cpp @@ -99,6 +99,7 @@ void AndroidChipPlatformJNI_OnUnload(JavaVM * jvm, void * reserved) JNI_METHOD(void, initChipStack)(JNIEnv * env, jobject self) { + chip::DeviceLayer::StackLock lock; CHIP_ERROR err = chip::DeviceLayer::PlatformMgr().InitChipStack(); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Error initializing CHIP stack: %s", ErrorStr(err))); } @@ -214,12 +215,7 @@ JNI_METHOD(void, setKeyValueStoreManager)(JNIEnv * env, jclass self, jobject man JNI_METHOD(void, setConfigurationManager)(JNIEnv * env, jclass self, jobject manager) { chip::DeviceLayer::StackLock lock; - chip::DeviceLayer::ConfigurationManagerImpl * configurationManagerImpl = - reinterpret_cast(&chip::DeviceLayer::ConfigurationMgr()); - if (configurationManagerImpl != nullptr) - { - configurationManagerImpl->InitializeWithObject(manager); - } + chip::DeviceLayer::ConfigurationManagerImpl::GetDefaultInstance().InitializeWithObject(manager); } // for DiagnosticDataProviderManager diff --git a/src/platform/android/ConfigurationManagerImpl.cpp b/src/platform/android/ConfigurationManagerImpl.cpp index 446db3c81b2fa8..fbcca64417888c 100644 --- a/src/platform/android/ConfigurationManagerImpl.cpp +++ b/src/platform/android/ConfigurationManagerImpl.cpp @@ -58,11 +58,6 @@ void ConfigurationManagerImpl::InitializeWithObject(jobject managerObject) AndroidConfig::InitializeWithObject(managerObject); } -CHIP_ERROR ConfigurationManagerImpl::Init() -{ - return CHIP_NO_ERROR; -} - CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { return CHIP_ERROR_NOT_IMPLEMENTED; diff --git a/src/platform/android/ConfigurationManagerImpl.h b/src/platform/android/ConfigurationManagerImpl.h index 5f674da0d50786..eca40580e1dab1 100644 --- a/src/platform/android/ConfigurationManagerImpl.h +++ b/src/platform/android/ConfigurationManagerImpl.h @@ -56,8 +56,6 @@ class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImp private: // ===== Members that implement the ConfigurationManager public interface. - - CHIP_ERROR Init() override; CHIP_ERROR GetPrimaryWiFiMACAddress(uint8_t * buf) override; bool CanFactoryReset() override; void InitiateFactoryReset() override; diff --git a/src/platform/android/DnssdImpl.cpp b/src/platform/android/DnssdImpl.cpp index 52d20525e8ca04..fa5a9d30e589f2 100644 --- a/src/platform/android/DnssdImpl.cpp +++ b/src/platform/android/DnssdImpl.cpp @@ -44,7 +44,7 @@ jmethodID sPublishMethod = nullptr; jmethodID sRemoveServicesMethod = nullptr; } // namespace -// Implemention of functions declared in lib/dnssd/platform/Dnssd.h +// Implementation of functions declared in lib/dnssd/platform/Dnssd.h CHIP_ERROR ChipDnssdInit(DnssdAsyncReturnCallback initCallback, DnssdAsyncReturnCallback errorCallback, void * context) { diff --git a/src/platform/android/KeyValueStoreManagerImpl.cpp b/src/platform/android/KeyValueStoreManagerImpl.cpp index 46ba0354f915cb..3b15d888810e56 100644 --- a/src/platform/android/KeyValueStoreManagerImpl.cpp +++ b/src/platform/android/KeyValueStoreManagerImpl.cpp @@ -120,7 +120,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t ChipLogError(DeviceLayer, "KeyValueStoreManager base64 decoding failed"); return CHIP_ERROR_INTEGRITY_CHECK_FAILED; } - ReturnErrorCodeIf(offset_bytes >= decodedLength, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorCodeIf(offset_bytes != 0 && offset_bytes >= decodedLength, CHIP_ERROR_INVALID_ARGUMENT); size_t read_size = std::min(value_size, decodedLength - offset_bytes); if (value_size + offset_bytes < decodedLength) { diff --git a/src/platform/android/java/chip/platform/AndroidChipPlatform.java b/src/platform/android/java/chip/platform/AndroidChipPlatform.java index f3f1dbbd27f461..da1ee88423872f 100644 --- a/src/platform/android/java/chip/platform/AndroidChipPlatform.java +++ b/src/platform/android/java/chip/platform/AndroidChipPlatform.java @@ -28,13 +28,13 @@ public AndroidChipPlatform( ChipMdnsCallback chipMdnsCallback, DiagnosticDataProvider dataProvider) { // Order is important here: initChipStack() initializes the BLEManagerImpl, which depends on the - // BLEManager being set. setConfigurationManager() depends on the CHIP stack being initialized. + // BLEManager being set. setBLEManager(ble); - initChipStack(); setKeyValueStoreManager(kvm); setConfigurationManager(cfg); setServiceResolver(resolver, chipMdnsCallback); setDiagnosticDataProviderManager(dataProvider); + initChipStack(); } // for BLEManager diff --git a/src/platform/fake/ConfigurationManagerImpl.h b/src/platform/fake/ConfigurationManagerImpl.h index 6348d20a98f996..01af1ac8caa0d0 100644 --- a/src/platform/fake/ConfigurationManagerImpl.h +++ b/src/platform/fake/ConfigurationManagerImpl.h @@ -69,7 +69,7 @@ class ConfigurationManagerImpl : public ConfigurationManager return CHIP_ERROR_NOT_IMPLEMENTED; } bool IsCommissionableDeviceTypeEnabled() override { return false; } - CHIP_ERROR GetDeviceTypeId(uint16_t & deviceType) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR GetDeviceTypeId(uint32_t & deviceType) override { return CHIP_ERROR_NOT_IMPLEMENTED; } bool IsCommissionableDeviceNameEnabled() override { return false; } CHIP_ERROR GetCommissionableDeviceName(char * buf, size_t bufSize) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GetInitialPairingHint(uint16_t & pairingHint) override { return CHIP_ERROR_NOT_IMPLEMENTED; } diff --git a/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp b/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp index 57aca8b67b5183..d5e0200e84c76b 100644 --- a/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp +++ b/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp @@ -56,7 +56,7 @@ CHIP_ERROR ConnectivityManagerImpl::InitWiFi() #if CHIP_DEVICE_ENABLE_DATA_MODEL err = sWiFiNetworkCommissioningInstance.Init(); #else - err = NetworkCommissioning::WiFiDriverImpl::GetInstance().Init(); + err = NetworkCommissioning::WiFiDriverImpl::GetInstance().Init(nullptr); #endif VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "WiFi driver init failed: %s", chip::ErrorStr(err))); @@ -116,7 +116,7 @@ CHIP_ERROR ConnectivityManagerImpl::_SetWiFiStationMode(WiFiStationMode val) { if (mWiFiStationMode == kWiFiStationMode_Enabled) { - NetworkCommissioning::WiFiDriverImpl::GetInstance().Init(); + NetworkCommissioning::WiFiDriverImpl::GetInstance().Init(nullptr); } else if (mWiFiStationMode == kWiFiStationMode_Disabled) { diff --git a/src/platform/mbed/NetworkCommissioningDriver.h b/src/platform/mbed/NetworkCommissioningDriver.h index 1a374f53b25f6c..c7424469460acc 100644 --- a/src/platform/mbed/NetworkCommissioningDriver.h +++ b/src/platform/mbed/NetworkCommissioningDriver.h @@ -93,7 +93,7 @@ class WiFiDriverImpl final : public WiFiDriver // BaseDriver NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); } - CHIP_ERROR Init() override; + CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override; CHIP_ERROR Shutdown() override; // WirelessDriver diff --git a/src/platform/mbed/NetworkCommissioningWiFiDriver.cpp b/src/platform/mbed/NetworkCommissioningWiFiDriver.cpp index f6918e65fc507a..50d3548bfa58e8 100644 --- a/src/platform/mbed/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/mbed/NetworkCommissioningWiFiDriver.cpp @@ -34,7 +34,7 @@ constexpr char kWiFiSSIDKeyName[] = "wifi-ssid"; constexpr char kWiFiCredentialsKeyName[] = "wifi-pass"; } // namespace -CHIP_ERROR WiFiDriverImpl::Init() +CHIP_ERROR WiFiDriverImpl::Init(NetworkStatusChangeCallback * networkStatusChangeCallback) { size_t ssidLen = 0; size_t credentialsLen = 0; @@ -265,8 +265,6 @@ void WiFiDriverImpl::ConnectNetwork(ByteSpan networkId, ConnectCallback * callba void WiFiDriverImpl::DisconnectNetwork(ByteSpan networkId) { - Status status = Status::kSuccess; - VerifyOrReturn(mWiFiInterface != nullptr, ChipLogError(DeviceLayer, "Wifi network not available")); VerifyOrReturn(NetworkMatch(mStagingNetwork, networkId), ChipLogError(DeviceLayer, "Network not found")); ChipLogProgress(NetworkProvisioning, "Mbed WiFi driver disconnect network: SSID: %.*s", static_cast(networkId.size()), diff --git a/src/protocols/bdx/BdxTransferSession.cpp b/src/protocols/bdx/BdxTransferSession.cpp index f92fb109284cd2..945381e2fefa2c 100644 --- a/src/protocols/bdx/BdxTransferSession.cpp +++ b/src/protocols/bdx/BdxTransferSession.cpp @@ -894,7 +894,7 @@ void TransferSession::PrepareStatusReport(StatusCode code) mAwaitingResponse = false; // Prevent triggering timeout } -bool TransferSession::IsTransferLengthDefinite() +bool TransferSession::IsTransferLengthDefinite() const { return (mTransferLength > 0); } diff --git a/src/protocols/bdx/BdxTransferSession.h b/src/protocols/bdx/BdxTransferSession.h index 7c37ed3019c3e3..7696d0473c9dc8 100644 --- a/src/protocols/bdx/BdxTransferSession.h +++ b/src/protocols/bdx/BdxTransferSession.h @@ -349,7 +349,7 @@ class DLL_EXPORT TransferSession CHIP_ERROR VerifyProposedMode(const BitFlags & proposed); void PrepareStatusReport(StatusCode code); - bool IsTransferLengthDefinite(); + bool IsTransferLengthDefinite() const; OutputEventType mPendingOutput = OutputEventType::kNone; TransferState mState = TransferState::kUnitialized; diff --git a/src/protocols/bdx/TransferFacilitator.h b/src/protocols/bdx/TransferFacilitator.h index 40f606d3524881..bc02e871ac1d41 100644 --- a/src/protocols/bdx/TransferFacilitator.h +++ b/src/protocols/bdx/TransferFacilitator.h @@ -45,7 +45,7 @@ class TransferFacilitator : public Messaging::ExchangeDelegate { public: TransferFacilitator() : mExchangeCtx(nullptr), mSystemLayer(nullptr), mPollFreq(kDefaultPollFreq) {} - ~TransferFacilitator() = default; + ~TransferFacilitator() override = default; private: // Inherited from ExchangeContext diff --git a/src/protocols/secure_channel/CASEServer.h b/src/protocols/secure_channel/CASEServer.h index 256c0fc04fa58c..81597fbb3e5f59 100644 --- a/src/protocols/secure_channel/CASEServer.h +++ b/src/protocols/secure_channel/CASEServer.h @@ -29,7 +29,7 @@ class CASEServer : public SessionEstablishmentDelegate, public Messaging::Exchan { public: CASEServer() {} - ~CASEServer() + ~CASEServer() override { if (mExchangeManager != nullptr) { diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index e88d7db8881ba3..bc4dd71514e201 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -229,7 +229,7 @@ CHIP_ERROR CASESession::EstablishSession(const Transport::PeerAddress peerAddres uint16_t localSessionId, ExchangeContext * exchangeCtxt, SessionEstablishmentDelegate * delegate, Optional mrpConfig) { - TRACE_EVENT_SCOPE("EstablishSession", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("EstablishSession", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; #if CHIP_PROGRESS_LOGGING @@ -313,7 +313,7 @@ CHIP_ERROR CASESession::DeriveSecureSession(CryptoContext & session, CryptoConte CHIP_ERROR CASESession::SendSigma1() { - TRACE_EVENT_SCOPE("SendSigma1", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("SendSigma1", "CASESession"); const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; size_t data_len = TLV::EstimateStructOverhead(kSigmaParamRandomNumberSize, // initiatorRandom sizeof(uint16_t), // initiatorSessionId, @@ -396,7 +396,7 @@ CHIP_ERROR CASESession::SendSigma1() CHIP_ERROR CASESession::HandleSigma1_and_SendSigma2(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandleSigma1_and_SendSigma2", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleSigma1_and_SendSigma2", "CASESession"); ReturnErrorOnFailure(HandleSigma1(std::move(msg))); return CHIP_NO_ERROR; @@ -404,7 +404,7 @@ CHIP_ERROR CASESession::HandleSigma1_and_SendSigma2(System::PacketBufferHandle & CHIP_ERROR CASESession::HandleSigma1(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandleSigma1", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleSigma1", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; @@ -482,7 +482,7 @@ CHIP_ERROR CASESession::HandleSigma1(System::PacketBufferHandle && msg) CHIP_ERROR CASESession::SendSigma2Resume(const ByteSpan & initiatorRandom) { - TRACE_EVENT_SCOPE("SendSigma2Resume", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("SendSigma2Resume", "CASESession"); const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; size_t max_sigma2_resume_data_len = TLV::EstimateStructOverhead(kCASEResumptionIDSize, CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES, sizeof(uint16_t), mrpParamsSize); @@ -533,7 +533,7 @@ CHIP_ERROR CASESession::SendSigma2Resume(const ByteSpan & initiatorRandom) CHIP_ERROR CASESession::SendSigma2() { - TRACE_EVENT_SCOPE("SendSigma2", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("SendSigma2", "CASESession"); VerifyOrReturnError(mFabricInfo != nullptr, CHIP_ERROR_INCORRECT_STATE); ByteSpan icaCert; @@ -664,7 +664,7 @@ CHIP_ERROR CASESession::SendSigma2() CHIP_ERROR CASESession::HandleSigma2Resume(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandleSigma2Resume", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleSigma2Resume", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; TLV::TLVType containerType = TLV::kTLVType_Structure; @@ -731,7 +731,7 @@ CHIP_ERROR CASESession::HandleSigma2Resume(System::PacketBufferHandle && msg) CHIP_ERROR CASESession::HandleSigma2_and_SendSigma3(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandleSigma2_and_SendSigma3", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleSigma2_and_SendSigma3", "CASESession"); ReturnErrorOnFailure(HandleSigma2(std::move(msg))); ReturnErrorOnFailure(SendSigma3()); @@ -740,7 +740,7 @@ CHIP_ERROR CASESession::HandleSigma2_and_SendSigma3(System::PacketBufferHandle & CHIP_ERROR CASESession::HandleSigma2(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandleSigma2", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleSigma2", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; TLV::TLVReader decryptedDataTlvReader; @@ -899,7 +899,7 @@ CHIP_ERROR CASESession::HandleSigma2(System::PacketBufferHandle && msg) CHIP_ERROR CASESession::SendSigma3() { - TRACE_EVENT_SCOPE("SendSigma3", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("SendSigma3", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; MutableByteSpan messageDigestSpan(mMessageDigest); @@ -1034,7 +1034,7 @@ CHIP_ERROR CASESession::SendSigma3() CHIP_ERROR CASESession::HandleSigma3(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandleSigma3", "CASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleSigma3", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; MutableByteSpan messageDigestSpan(mMessageDigest); System::PacketBufferTLVReader tlvReader; diff --git a/src/protocols/secure_channel/CASESession.h b/src/protocols/secure_channel/CASESession.h index 6c8c35e3ed8d55..d5e8aed5edfde9 100644 --- a/src/protocols/secure_channel/CASESession.h +++ b/src/protocols/secure_channel/CASESession.h @@ -76,7 +76,7 @@ class DLL_EXPORT CASESession : public Messaging::ExchangeDelegate, public Pairin CASESession(CASESession &&) = default; CASESession(const CASESession &) = default; - virtual ~CASESession(); + ~CASESession() override; /** * @brief @@ -142,7 +142,7 @@ class DLL_EXPORT CASESession : public Messaging::ExchangeDelegate, public Pairin * @param role Role of the new session (initiator or responder) * @return CHIP_ERROR The result of session derivation */ - virtual CHIP_ERROR DeriveSecureSession(CryptoContext & session, CryptoContext::SessionRole role) override; + CHIP_ERROR DeriveSecureSession(CryptoContext & session, CryptoContext::SessionRole role) override; /** * @brief Serialize the CASESession to the given cachableSession data structure for secure pairing diff --git a/src/protocols/secure_channel/MessageCounterManager.cpp b/src/protocols/secure_channel/MessageCounterManager.cpp index fe986b5c5f2a3a..cf9d9552422e72 100644 --- a/src/protocols/secure_channel/MessageCounterManager.cpp +++ b/src/protocols/secure_channel/MessageCounterManager.cpp @@ -95,7 +95,7 @@ CHIP_ERROR MessageCounterManager::OnMessageReceived(Messaging::ExchangeContext * { return HandleMsgCounterSyncReq(exchangeContext, std::move(msgBuf)); } - else if (payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::MsgCounterSyncRsp)) + if (payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::MsgCounterSyncRsp)) { return HandleMsgCounterSyncResp(exchangeContext, std::move(msgBuf)); } diff --git a/src/protocols/secure_channel/PASESession.cpp b/src/protocols/secure_channel/PASESession.cpp index 933ba327eab14a..c714f860225ae4 100644 --- a/src/protocols/secure_channel/PASESession.cpp +++ b/src/protocols/secure_channel/PASESession.cpp @@ -207,7 +207,7 @@ CHIP_ERROR PASESession::Init(uint16_t mySessionId, uint32_t setupCode, SessionEs CHIP_ERROR PASESession::GeneratePASEVerifier(Spake2pVerifier & verifier, uint32_t pbkdf2IterCount, const ByteSpan & salt, bool useRandomPIN, uint32_t & setupPINCode) { - TRACE_EVENT_SCOPE("GeneratePASEVerifier", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("GeneratePASEVerifier", "PASESession"); if (useRandomPIN) { @@ -222,7 +222,7 @@ CHIP_ERROR PASESession::GeneratePASEVerifier(Spake2pVerifier & verifier, uint32_ CHIP_ERROR PASESession::SetupSpake2p() { - TRACE_EVENT_SCOPE("SetupSpake2p", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("SetupSpake2p", "PASESession"); uint8_t context[kSHA256_Hash_Length] = { 0 }; MutableByteSpan contextSpan{ context }; @@ -283,7 +283,7 @@ CHIP_ERROR PASESession::Pair(const Transport::PeerAddress peerAddress, uint32_t Optional mrpConfig, Messaging::ExchangeContext * exchangeCtxt, SessionEstablishmentDelegate * delegate) { - TRACE_EVENT_SCOPE("Pair", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("Pair", "PASESession"); ReturnErrorCodeIf(exchangeCtxt == nullptr, CHIP_ERROR_INVALID_ARGUMENT); CHIP_ERROR err = Init(mySessionId, peerSetUpPINCode, delegate); SuccessOrExit(err); @@ -333,7 +333,7 @@ CHIP_ERROR PASESession::DeriveSecureSession(CryptoContext & session, CryptoConte CHIP_ERROR PASESession::SendPBKDFParamRequest() { - TRACE_EVENT_SCOPE("SendPBKDFParamRequest", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("SendPBKDFParamRequest", "PASESession"); ReturnErrorOnFailure(DRBG_get_bytes(mPBKDFLocalRandomData, sizeof(mPBKDFLocalRandomData))); const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; @@ -379,7 +379,7 @@ CHIP_ERROR PASESession::SendPBKDFParamRequest() CHIP_ERROR PASESession::HandlePBKDFParamRequest(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandlePBKDFParamRequest", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("HandlePBKDFParamRequest", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; @@ -441,7 +441,7 @@ CHIP_ERROR PASESession::HandlePBKDFParamRequest(System::PacketBufferHandle && ms CHIP_ERROR PASESession::SendPBKDFParamResponse(ByteSpan initiatorRandom, bool initiatorHasPBKDFParams) { - TRACE_EVENT_SCOPE("SendPBKDFParamResponse", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("SendPBKDFParamResponse", "PASESession"); ReturnErrorOnFailure(DRBG_get_bytes(mPBKDFLocalRandomData, sizeof(mPBKDFLocalRandomData))); const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; @@ -499,7 +499,7 @@ CHIP_ERROR PASESession::SendPBKDFParamResponse(ByteSpan initiatorRandom, bool in CHIP_ERROR PASESession::HandlePBKDFParamResponse(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandlePBKDFParamResponse", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("HandlePBKDFParamResponse", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; @@ -593,7 +593,7 @@ CHIP_ERROR PASESession::HandlePBKDFParamResponse(System::PacketBufferHandle && m CHIP_ERROR PASESession::SendMsg1() { - TRACE_EVENT_SCOPE("SendMsg1", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("SendMsg1", "PASESession"); const size_t max_msg_len = TLV::EstimateStructOverhead(kMAX_Point_Length); System::PacketBufferHandle msg = System::PacketBufferHandle::New(max_msg_len); VerifyOrReturnError(!msg.IsNull(), CHIP_ERROR_NO_MEMORY); @@ -609,7 +609,7 @@ CHIP_ERROR PASESession::SendMsg1() constexpr uint8_t kPake1_pA = 1; - ReturnErrorOnFailure(mSpake2p.ComputeRoundOne(NULL, 0, X, &X_len)); + ReturnErrorOnFailure(mSpake2p.ComputeRoundOne(nullptr, 0, X, &X_len)); VerifyOrReturnError(X_len == sizeof(X), CHIP_ERROR_INTERNAL); ReturnErrorOnFailure(tlvWriter.Put(TLV::ContextTag(kPake1_pA), ByteSpan(X))); ReturnErrorOnFailure(tlvWriter.EndContainer(outerContainerType)); @@ -626,7 +626,7 @@ CHIP_ERROR PASESession::SendMsg1() CHIP_ERROR PASESession::HandleMsg1_and_SendMsg2(System::PacketBufferHandle && msg1) { - TRACE_EVENT_SCOPE("HandleMsg1_and_SendMsg2", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleMsg1_and_SendMsg2", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; uint8_t Y[kMAX_Point_Length]; @@ -696,7 +696,7 @@ CHIP_ERROR PASESession::HandleMsg1_and_SendMsg2(System::PacketBufferHandle && ms CHIP_ERROR PASESession::HandleMsg2_and_SendMsg3(System::PacketBufferHandle && msg2) { - TRACE_EVENT_SCOPE("HandleMsg2_and_SendMsg3", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleMsg2_and_SendMsg3", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; uint8_t verifier[kMAX_Hash_Length]; @@ -772,7 +772,7 @@ CHIP_ERROR PASESession::HandleMsg2_and_SendMsg3(System::PacketBufferHandle && ms CHIP_ERROR PASESession::HandleMsg3(System::PacketBufferHandle && msg) { - TRACE_EVENT_SCOPE("HandleMsg3", "PASESession"); + MATTER_TRACE_EVENT_SCOPE("HandleMsg3", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; ChipLogDetail(SecureChannel, "Received spake2p msg3"); diff --git a/src/protocols/secure_channel/PASESession.h b/src/protocols/secure_channel/PASESession.h index 98bbc6c2d72914..a6f9b687c6566a 100644 --- a/src/protocols/secure_channel/PASESession.h +++ b/src/protocols/secure_channel/PASESession.h @@ -73,7 +73,7 @@ class DLL_EXPORT PASESession : public Messaging::ExchangeDelegate, public Pairin PASESession(PASESession &&) = default; PASESession(const PASESession &) = delete; - virtual ~PASESession(); + ~PASESession() override; // TODO: The SetPeerNodeId method should not be exposed; PASE sessions // should not need to be told their peer node ID diff --git a/src/protocols/secure_channel/RendezvousParameters.h b/src/protocols/secure_channel/RendezvousParameters.h index f08082d2deb725..e81162cb237c29 100644 --- a/src/protocols/secure_channel/RendezvousParameters.h +++ b/src/protocols/secure_channel/RendezvousParameters.h @@ -80,7 +80,7 @@ class RendezvousParameters return *this; } - bool HasConnectionObject() const { return mConnectionObject != 0; } + bool HasConnectionObject() const { return mConnectionObject != BLE_CONNECTION_UNINITIALIZED; } BLE_CONNECTION_OBJECT GetConnectionObject() const { return mConnectionObject; } RendezvousParameters & SetConnectionObject(BLE_CONNECTION_OBJECT connObj) { @@ -101,7 +101,7 @@ class RendezvousParameters #if CONFIG_NETWORK_LAYER_BLE Ble::BleLayer * mBleLayer = nullptr; - BLE_CONNECTION_OBJECT mConnectionObject = 0; + BLE_CONNECTION_OBJECT mConnectionObject = BLE_CONNECTION_UNINITIALIZED; #endif // CONFIG_NETWORK_LAYER_BLE }; diff --git a/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.h b/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.h index 60a3397033d716..9cb75a596ff6a4 100644 --- a/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.h +++ b/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.h @@ -38,7 +38,7 @@ class SessionEstablishmentExchangeDispatch : public Messaging::ExchangeMessageDi } SessionEstablishmentExchangeDispatch() {} - virtual ~SessionEstablishmentExchangeDispatch() {} + ~SessionEstablishmentExchangeDispatch() override {} protected: bool MessagePermitted(uint16_t protocol, uint8_t type) override; diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index a29f03332ecda6..1c75010df24062 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -656,15 +656,10 @@ CHIP_ERROR CASETestSecurePairingSetup(void * inContext) { TestContext & ctx = *reinterpret_cast(inContext); + ctx.ConfigInitializeNodes(false); ReturnErrorOnFailure(ctx.Init()); ctx.EnableAsyncDispatch(); - ctx.SetBobNodeId(kPlaceholderNodeId); - ctx.SetAliceNodeId(kPlaceholderNodeId); - ctx.SetBobKeyId(0); - ctx.SetAliceKeyId(0); - ctx.SetFabricIndex(kUndefinedFabricIndex); - gCommissionerFabrics.Init(&gCommissionerStorageDelegate); gDeviceFabrics.Init(&gDeviceStorageDelegate); diff --git a/src/protocols/secure_channel/tests/TestPASESession.cpp b/src/protocols/secure_channel/tests/TestPASESession.cpp index 2dfffa2453d0cd..13a75f8f66a083 100644 --- a/src/protocols/secure_channel/tests/TestPASESession.cpp +++ b/src/protocols/secure_channel/tests/TestPASESession.cpp @@ -496,16 +496,12 @@ static nlTestSuite sSuite = */ int TestSecurePairing_Setup(void * inContext) { + auto & ctx = *static_cast(inContext); + // Initialize System memory and resources + ctx.ConfigInitializeNodes(false); VerifyOrReturnError(TestContext::InitializeAsync(inContext) == SUCCESS, FAILURE); - auto & ctx = *static_cast(inContext); - ctx.SetBobNodeId(kPlaceholderNodeId); - ctx.SetAliceNodeId(kPlaceholderNodeId); - ctx.SetBobKeyId(0); - ctx.SetAliceKeyId(0); - ctx.SetFabricIndex(kUndefinedFabricIndex); - return SUCCESS; } diff --git a/src/system/SystemClock.h b/src/system/SystemClock.h index 6202ea8b6861af..dfc54e8a12f0e9 100644 --- a/src/system/SystemClock.h +++ b/src/system/SystemClock.h @@ -285,7 +285,7 @@ class ClockBase class ClockImpl : public ClockBase { public: - ~ClockImpl() = default; + ~ClockImpl() override = default; Microseconds64 GetMonotonicMicroseconds64() override; Milliseconds64 GetMonotonicMilliseconds64() override; CHIP_ERROR GetClock_RealTime(Microseconds64 & aCurTime) override; diff --git a/src/system/SystemLayerImplSelect.cpp b/src/system/SystemLayerImplSelect.cpp index e3b75eb81faee3..74357f9d195b57 100644 --- a/src/system/SystemLayerImplSelect.cpp +++ b/src/system/SystemLayerImplSelect.cpp @@ -219,7 +219,7 @@ CHIP_ERROR LayerImplSelect::StartWatchingSocket(int fd, SocketWatchToken * token // Duplicate registration is an error. return CHIP_ERROR_INVALID_ARGUMENT; } - else if ((w.mFD == kInvalidFd) && (watch == nullptr)) + if ((w.mFD == kInvalidFd) && (watch == nullptr)) { watch = &w; } diff --git a/src/system/SystemLayerImplSelect.h b/src/system/SystemLayerImplSelect.h index d714f7929067a5..5a631470f3e9e5 100644 --- a/src/system/SystemLayerImplSelect.h +++ b/src/system/SystemLayerImplSelect.h @@ -41,7 +41,7 @@ class LayerImplSelect : public LayerSocketsLoop { public: LayerImplSelect() = default; - ~LayerImplSelect() { VerifyOrDie(mLayerState.Destroy()); } + ~LayerImplSelect() override { VerifyOrDie(mLayerState.Destroy()); } // Layer overrides. CHIP_ERROR Init() override; diff --git a/src/system/SystemTimer.cpp b/src/system/SystemTimer.cpp index f966564e788418..cb54d075ee23e1 100644 --- a/src/system/SystemTimer.cpp +++ b/src/system/SystemTimer.cpp @@ -41,7 +41,7 @@ namespace System { TimerList::Node * TimerList::Add(TimerList::Node * add) { VerifyOrDie(add != mEarliestTimer); - if (mEarliestTimer == NULL || (add->AwakenTime() < mEarliestTimer->AwakenTime())) + if (mEarliestTimer == nullptr || (add->AwakenTime() < mEarliestTimer->AwakenTime())) { add->mNextTimer = mEarliestTimer; mEarliestTimer = add; diff --git a/src/system/TLVPacketBufferBackingStore.h b/src/system/TLVPacketBufferBackingStore.h index 512d4a20e996f4..bbdb85e89df894 100644 --- a/src/system/TLVPacketBufferBackingStore.h +++ b/src/system/TLVPacketBufferBackingStore.h @@ -42,7 +42,7 @@ class TLVPacketBufferBackingStore : public chip::TLV::TLVBackingStore { Init(std::move(buffer), useChainedBuffers); } - virtual ~TLVPacketBufferBackingStore() {} + ~TLVPacketBufferBackingStore() override {} /** * Take ownership of a backing packet buffer. diff --git a/src/system/WakeEvent.cpp b/src/system/WakeEvent.cpp index 8c6cda1aa8fa87..a670cc687cff3c 100644 --- a/src/system/WakeEvent.cpp +++ b/src/system/WakeEvent.cpp @@ -91,7 +91,7 @@ void WakeEvent::Close(LayerSockets & systemLayer) mWriteFD = -1; } -void WakeEvent::Confirm() +void WakeEvent::Confirm() const { uint8_t buffer[128]; ssize_t res; @@ -107,7 +107,7 @@ void WakeEvent::Confirm() } while (res == sizeof(buffer)); } -CHIP_ERROR WakeEvent::Notify() +CHIP_ERROR WakeEvent::Notify() const { char byte = 1; @@ -143,7 +143,7 @@ void WakeEvent::Close(LayerSockets & systemLayer) mReadFD = -1; } -void WakeEvent::Confirm() +void WakeEvent::Confirm() const { uint64_t value; @@ -153,7 +153,7 @@ void WakeEvent::Confirm() } } -CHIP_ERROR WakeEvent::Notify() +CHIP_ERROR WakeEvent::Notify() const { uint64_t value = 1; diff --git a/src/system/WakeEvent.h b/src/system/WakeEvent.h index 1c5c3d843b9ef5..b979c67ab17752 100644 --- a/src/system/WakeEvent.h +++ b/src/system/WakeEvent.h @@ -48,8 +48,8 @@ class WakeEvent CHIP_ERROR Open(LayerSockets & systemLayer); /**< Initialize the pipeline */ void Close(LayerSockets & systemLayer); /**< Close both ends of the pipeline. */ - CHIP_ERROR Notify(); /**< Set the event. */ - void Confirm(); /**< Clear the event. */ + CHIP_ERROR Notify() const; /**< Set the event. */ + void Confirm() const; /**< Clear the event. */ private: friend class WakeEventTest; diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index 67bbf521466712..14d27ad9460808 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -73,10 +73,13 @@ efr32_executable("efr32_device_tests") { "${examples_plat_dir}/PigweedLogger.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.cpp", "src/main.cpp", ] + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) { + sources += [ "${examples_plat_dir}/uart.cpp" ] + } + deps = [ ":nl_test_service.nanopb_rpc", ":sdk", diff --git a/src/test_driver/linux-cirque/MobileDeviceTest.py b/src/test_driver/linux-cirque/MobileDeviceTest.py index 20fb5022a9cb98..9af296978b760d 100755 --- a/src/test_driver/linux-cirque/MobileDeviceTest.py +++ b/src/test_driver/linux-cirque/MobileDeviceTest.py @@ -93,8 +93,7 @@ def run_controller_test(self): command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 -a {}".format( os.path.join( - CHIP_REPO, "src/controller/python/test/test_scripts/mobile-device-test.py"), - ethernet_ip) + CHIP_REPO, "src/controller/python/test/test_scripts/mobile-device-test.py"), ethernet_ip) ret = self.execute_device_cmd(req_device_id, command) self.assertEqual(ret['return_code'], '0', diff --git a/src/test_driver/linux-cirque/SplitCommissioningTest.py b/src/test_driver/linux-cirque/SplitCommissioningTest.py new file mode 100755 index 00000000000000..9527cff2293f80 --- /dev/null +++ b/src/test_driver/linux-cirque/SplitCommissioningTest.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python3 +""" +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 logging +import os +import pprint +import time +import sys + +from helper.CHIPTestBase import CHIPVirtualHome + +logger = logging.getLogger('MobileDeviceTest') +logger.setLevel(logging.INFO) + +sh = logging.StreamHandler() +sh.setFormatter( + logging.Formatter( + '%(asctime)s [%(name)s] %(levelname)s %(message)s')) +logger.addHandler(sh) + +CHIP_PORT = 5540 + +CIRQUE_URL = "http://localhost:5000" +CHIP_REPO = os.path.join(os.path.abspath( + os.path.dirname(__file__)), "..", "..", "..") +TEST_EXTPANID = "fedcba9876543210" + +DEVICE_CONFIG = { + 'device0': { + 'type': 'MobileDevice', + 'base_image': 'connectedhomeip/chip-cirque-device-base', + 'capability': ['TrafficControl', 'Mount'], + 'rcp_mode': True, + 'docker_network': 'Ipv6', + 'traffic_control': {'latencyMs': 100}, + "mount_pairs": [[CHIP_REPO, CHIP_REPO]], + }, + 'device1': { + 'type': 'CHIPEndDevice', + 'base_image': 'connectedhomeip/chip-cirque-device-base', + 'capability': ['Thread', 'TrafficControl', 'Mount'], + 'rcp_mode': True, + 'docker_network': 'Ipv6', + 'traffic_control': {'latencyMs': 100}, + "mount_pairs": [[CHIP_REPO, CHIP_REPO]], + }, + 'device2': { + 'type': 'CHIPEndDevice', + 'base_image': 'connectedhomeip/chip-cirque-device-base', + 'capability': ['Thread', 'TrafficControl', 'Mount'], + 'rcp_mode': True, + 'docker_network': 'Ipv6', + 'traffic_control': {'latencyMs': 100}, + "mount_pairs": [[CHIP_REPO, CHIP_REPO]], + } +} + + +class TestSplitCommissioning(CHIPVirtualHome): + def __init__(self, device_config): + super().__init__(CIRQUE_URL, device_config) + self.logger = logger + + def setup(self): + self.initialize_home() + + def test_routine(self): + self.run_controller_test() + + def run_controller_test(self): + ethernet_ips = [device['description']['ipv6_addr'] for device in self.non_ap_devices + if device['type'] == 'CHIPEndDevice'] + server_ids = [device['id'] for device in self.non_ap_devices + if device['type'] == 'CHIPEndDevice'] + req_ids = [device['id'] for device in self.non_ap_devices + if device['type'] == 'MobileDevice'] + + for server in server_ids: + self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread".format( + os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"))) + + self.reset_thread_devices(server_ids) + + req_device_id = req_ids[0] + + self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join( + CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip-0.0-cp37-abi3-linux_x86_64.whl"))) + + command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 --address1 {} --address2 {}".format( + os.path.join( + CHIP_REPO, "src/controller/python/test/test_scripts/split_commissioning_test.py"), + ethernet_ips[0], ethernet_ips[1]) + ret = self.execute_device_cmd(req_device_id, command) + + self.assertEqual(ret['return_code'], '0', + "Test failed: non-zero return code") + + +if __name__ == "__main__": + sys.exit(TestSplitCommissioning(DEVICE_CONFIG).run_test()) diff --git a/src/trace/README.md b/src/trace/README.md new file mode 100644 index 00000000000000..64e699d4b08db0 --- /dev/null +++ b/src/trace/README.md @@ -0,0 +1,40 @@ +# Matter tracing + +Matter tracing provides a tool for applications to trace information about the +execution of the application. It depends on +[pw_trace module](https://pigweed.dev/pw_trace/). + +## How to add trace events + +1. Include "trace/trace.h" in the source file. +2. Add "\${chip_root}/src/trace" as deps in BUILD.gn. +3. Add MATTER*TRACE_EVENT*\* in functions to be traced. + +## Example + +``` +#include "pw_trace/trace.h" + + void SendButton() { + MATTER_TRACE_EVENT_FUNCTION(); + // do something + } + + void InputLoop() { + while(1) { + auto event = WaitNewInputEvent() + MATTER_TRACE_EVENT_SCOPE("Handle Event"); // measure until loop finished + if (event == kNewButton){ + SendButton(); + MATTER_TRACE_EVENT_END("button"); // Trace event was started in ButtonIsr + } else { + MATTER_TRACE_EVENT_INSTANT("Unknown event"); + } + } + } + + void ButtonIsr() { + MATTER_TRACE_EVENT_START("button"); + SendNewInputEvent(kNewButton); + } +``` diff --git a/src/trace/trace.h b/src/trace/trace.h index f6e23134d0191a..e3eca631ab3b0a 100644 --- a/src/trace/trace.h +++ b/src/trace/trace.h @@ -21,45 +21,45 @@ #include -#define TRACE_EVENT_INSTANT(...) PW_TRACE_INSTANT(__VA_ARGS__) -#define TRACE_EVENT_INSTANT_FLAG(...) PW_TRACE_INSTANT_FLAG(__VA_ARGS__) -#define TRACE_EVENT_INSTANT_DATA(...) PW_TRACE_INSTANT_DATA(__VA_ARGS__) -#define TRACE_EVENT_INSTANT_DATA_FLAG(...) PW_TRACE_INSTANT_DATA_FLAG(__VA_ARGS__) -#define TRACE_EVENT_START(...) PW_TRACE_START(__VA_ARGS__) -#define TRACE_EVENT_START_FLAG(...) PW_TRACE_START_FLAG(__VA_ARGS__) -#define TRACE_EVENT_START_DATA(...) PW_TRACE_START_DATA(__VA_ARGS__) -#define TRACE_EVENT_START_DATA_FLAG(...) PW_TRACE_START_DATA_FLAG(__VA_ARGS__) -#define TRACE_EVENT_END(...) PW_TRACE_END(__VA_ARGS__) -#define TRACE_EVENT_END_FLAG(...) PW_TRACE_END_FLAG(__VA_ARGS__) -#define TRACE_EVENT_END_DATA(...) PW_TRACE_END_DATA(__VA_ARGS__) -#define TRACE_EVENT_END_DATA_FLAG(...) PW_TRACE_END_DATA_FLAG(__VA_ARGS__) -#define TRACE_EVENT_SCOPE(...) PW_TRACE_SCOPE(__VA_ARGS__) -#define TRACE_EVENT_SCOPE_FLAG(...) PW_TRACE_SCOPE_FLAG(__VA_ARGS__) -#define TRACE_EVENT_FUNCTION(...) PW_TRACE_FUNCTION(__VA_ARGS__) -#define TRACE_EVENT_FUNCTION_FLAG(...) PW_TRACE_FUNCTION_FLAG(__VA_ARGS__) +#define MATTER_TRACE_EVENT_INSTANT(...) PW_TRACE_INSTANT(__VA_ARGS__) +#define MATTER_TRACE_EVENT_INSTANT_FLAG(...) PW_TRACE_INSTANT_FLAG(__VA_ARGS__) +#define MATTER_TRACE_EVENT_INSTANT_DATA(...) PW_TRACE_INSTANT_DATA(__VA_ARGS__) +#define MATTER_TRACE_EVENT_INSTANT_DATA_FLAG(...) PW_TRACE_INSTANT_DATA_FLAG(__VA_ARGS__) +#define MATTER_TRACE_EVENT_START(...) PW_TRACE_START(__VA_ARGS__) +#define MATTER_TRACE_EVENT_START_FLAG(...) PW_TRACE_START_FLAG(__VA_ARGS__) +#define MATTER_TRACE_EVENT_START_DATA(...) PW_TRACE_START_DATA(__VA_ARGS__) +#define MATTER_TRACE_EVENT_START_DATA_FLAG(...) PW_TRACE_START_DATA_FLAG(__VA_ARGS__) +#define MATTER_TRACE_EVENT_END(...) PW_TRACE_END(__VA_ARGS__) +#define MATTER_TRACE_EVENT_END_FLAG(...) PW_TRACE_END_FLAG(__VA_ARGS__) +#define MATTER_TRACE_EVENT_END_DATA(...) PW_TRACE_END_DATA(__VA_ARGS__) +#define MATTER_TRACE_EVENT_END_DATA_FLAG(...) PW_TRACE_END_DATA_FLAG(__VA_ARGS__) +#define MATTER_TRACE_EVENT_SCOPE(...) PW_TRACE_SCOPE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_SCOPE_FLAG(...) PW_TRACE_SCOPE_FLAG(__VA_ARGS__) +#define MATTER_TRACE_EVENT_FUNCTION(...) PW_TRACE_FUNCTION(__VA_ARGS__) +#define MATTER_TRACE_EVENT_FUNCTION_FLAG(...) PW_TRACE_FUNCTION_FLAG(__VA_ARGS__) #else // defined(PW_TRACE_BACKEND_SET) && PW_TRACE_BACKEND_SET -#define _TRACE_EVENT_DISABLE(...) \ +#define _MATTER_TRACE_EVENT_DISABLE(...) \ do \ { \ } while (0) -#define TRACE_EVENT_INSTANT(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_INSTANT_FLAG(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_INSTANT_DATA(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_INSTANT_DATA_FLAG(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_START(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_START_FLAG(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_START_DATA(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_START_DATA_FLAG(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_END(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_END_FLAG(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_END_DATA(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_END_DATA_FLAG(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_SCOPE(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_SCOPE_FLAG(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_FUNCTION(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) -#define TRACE_EVENT_FUNCTION_FLAG(...) _TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_INSTANT(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_INSTANT_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_INSTANT_DATA(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_INSTANT_DATA_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_START(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_START_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_START_DATA(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_START_DATA_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_END(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_END_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_END_DATA(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_END_DATA_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_SCOPE(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_SCOPE_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_FUNCTION(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_EVENT_FUNCTION_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__) #endif // defined(PW_TRACE_BACKEND_SET) && PW_TRACE_BACKEND_SET diff --git a/src/transport/CryptoContext.cpp b/src/transport/CryptoContext.cpp index 3481d33de75e60..ab0ee35c1b2bec 100644 --- a/src/transport/CryptoContext.cpp +++ b/src/transport/CryptoContext.cpp @@ -37,8 +37,8 @@ namespace chip { namespace { -constexpr size_t kAESCCMIVLen = 13; -constexpr size_t kMaxAADLen = 128; +constexpr size_t kAESCCMNonceLen = 13; +constexpr size_t kMaxAADLen = 128; /* Session Establish Key Info */ constexpr uint8_t SEKeysInfo[] = { 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73 }; @@ -131,12 +131,12 @@ CHIP_ERROR CryptoContext::InitFromKeyPair(const Crypto::P256Keypair & local_keyp return InitFromSecret(ByteSpan(secret, secret.Length()), salt, infoType, role); } -CHIP_ERROR CryptoContext::GetIV(const PacketHeader & header, uint8_t * iv, size_t len) +CHIP_ERROR CryptoContext::GetNonce(const PacketHeader & header, uint8_t * nonce, size_t len) { - VerifyOrReturnError(len == kAESCCMIVLen, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(len == kAESCCMNonceLen, CHIP_ERROR_INVALID_ARGUMENT); - Encoding::LittleEndian::BufferWriter bbuf(iv, len); + Encoding::LittleEndian::BufferWriter bbuf(nonce, len); bbuf.Put8(header.GetSecurityFlags()); bbuf.Put32(header.GetMessageCounter()); @@ -174,11 +174,11 @@ CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, ui VerifyOrReturnError(output != nullptr, CHIP_ERROR_INVALID_ARGUMENT); uint8_t AAD[kMaxAADLen]; - uint8_t IV[kAESCCMIVLen]; + uint8_t nonce[kAESCCMNonceLen]; uint16_t aadLen = sizeof(AAD); uint8_t tag[kMaxTagLen]; - ReturnErrorOnFailure(GetIV(header, IV, sizeof(IV))); + ReturnErrorOnFailure(GetNonce(header, nonce, sizeof(nonce))); ReturnErrorOnFailure(GetAdditionalAuthData(header, AAD, aadLen)); if (mKeyContext) @@ -187,7 +187,7 @@ CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, ui MutableByteSpan ciphertext(output, input_length); MutableByteSpan mic(tag, taglen); - ReturnErrorOnFailure(mKeyContext->EncryptMessage(plaintext, ByteSpan(AAD, aadLen), ByteSpan(IV), mic, ciphertext)); + ReturnErrorOnFailure(mKeyContext->EncryptMessage(plaintext, ByteSpan(AAD, aadLen), ByteSpan(nonce), mic, ciphertext)); } else { @@ -202,8 +202,8 @@ CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, ui usage = kI2RKey; } - ReturnErrorOnFailure(AES_CCM_encrypt(input, input_length, AAD, aadLen, mKeys[usage], Crypto::kAES_CCM128_Key_Length, IV, - sizeof(IV), output, tag, taglen)); + ReturnErrorOnFailure(AES_CCM_encrypt(input, input_length, AAD, aadLen, mKeys[usage], Crypto::kAES_CCM128_Key_Length, nonce, + sizeof(nonce), output, tag, taglen)); } mac.SetTag(&header, tag, taglen); @@ -216,7 +216,7 @@ CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, ui { const size_t taglen = header.MICTagLength(); const uint8_t * tag = mac.GetTag(); - uint8_t IV[kAESCCMIVLen]; + uint8_t nonce[kAESCCMNonceLen]; uint8_t AAD[kMaxAADLen]; uint16_t aadLen = sizeof(AAD); @@ -224,7 +224,7 @@ CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, ui VerifyOrReturnError(input_length > 0, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(output != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure(GetIV(header, IV, sizeof(IV))); + ReturnErrorOnFailure(GetNonce(header, nonce, sizeof(nonce))); ReturnErrorOnFailure(GetAdditionalAuthData(header, AAD, aadLen)); if (nullptr != mKeyContext) @@ -233,7 +233,7 @@ CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, ui MutableByteSpan plaintext(output, input_length); ByteSpan mic(tag, taglen); - CHIP_ERROR err = mKeyContext->DecryptMessage(ciphertext, ByteSpan(AAD, aadLen), ByteSpan(IV), mic, plaintext); + CHIP_ERROR err = mKeyContext->DecryptMessage(ciphertext, ByteSpan(AAD, aadLen), ByteSpan(nonce), mic, plaintext); ReturnErrorOnFailure(err); } else @@ -250,7 +250,7 @@ CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, ui } ReturnErrorOnFailure(AES_CCM_decrypt(input, input_length, AAD, aadLen, tag, taglen, mKeys[usage], - Crypto::kAES_CCM128_Key_Length, IV, sizeof(IV), output)); + Crypto::kAES_CCM128_Key_Length, nonce, sizeof(nonce), output)); } return CHIP_NO_ERROR; } diff --git a/src/transport/CryptoContext.h b/src/transport/CryptoContext.h index 82f347e13d3376..5a462fbe45cbaf 100644 --- a/src/transport/CryptoContext.h +++ b/src/transport/CryptoContext.h @@ -143,7 +143,7 @@ class DLL_EXPORT CryptoContext CryptoKey mKeys[KeyUsage::kNumCryptoKeys]; Crypto::SymmetricKeyContext * mKeyContext = nullptr; - static CHIP_ERROR GetIV(const PacketHeader & header, uint8_t * iv, size_t len); + static CHIP_ERROR GetNonce(const PacketHeader & header, uint8_t * nonce, size_t len); // Use unencrypted header as additional authenticated data (AAD) during encryption and decryption. // The encryption operations includes AAD when message authentication tag is generated. This tag diff --git a/src/transport/GroupSession.h b/src/transport/GroupSession.h index 969050436c4899..88315d0527c97f 100644 --- a/src/transport/GroupSession.h +++ b/src/transport/GroupSession.h @@ -48,7 +48,7 @@ class IncomingGroupSession : public Session { SetFabricIndex(fabricIndex); } - ~IncomingGroupSession() + ~IncomingGroupSession() override { NotifySessionReleased(); #ifndef NDEBUG @@ -92,7 +92,7 @@ class IncomingGroupSession : public Session GroupId GetGroupId() const { return mGroupId; } - NodeId GetSourceNodeId() { return mSourceNodeId; } + NodeId GetSourceNodeId() const { return mSourceNodeId; } private: const GroupId mGroupId; @@ -113,7 +113,7 @@ class OutgoingGroupSession : public Session { SetFabricIndex(fabricIndex); } - ~OutgoingGroupSession() + ~OutgoingGroupSession() override { NotifySessionReleased(); #ifndef NDEBUG @@ -153,7 +153,7 @@ class OutgoingGroupSession : public Session GroupId GetGroupId() const { return mGroupId; } - NodeId GetSourceNodeId() { return mSourceNodeId; } + NodeId GetSourceNodeId() const { return mSourceNodeId; } private: const GroupId mGroupId; diff --git a/src/transport/PeerMessageCounter.h b/src/transport/PeerMessageCounter.h index 2be1109b68b78e..edfac7bf8ddb5a 100644 --- a/src/transport/PeerMessageCounter.h +++ b/src/transport/PeerMessageCounter.h @@ -192,7 +192,7 @@ class PeerMessageCounter mSynced.mWindow.reset(); } - uint32_t GetCounter() { return mSynced.mMaxCounter; } + uint32_t GetCounter() const { return mSynced.mMaxCounter; } private: // Counter position indicator with respect to our current diff --git a/src/transport/SecureSession.h b/src/transport/SecureSession.h index 04094961ae6c6e..e77fab01eb7fbf 100644 --- a/src/transport/SecureSession.h +++ b/src/transport/SecureSession.h @@ -71,7 +71,7 @@ class SecureSession : public Session { SetFabricIndex(fabric); } - ~SecureSession() { NotifySessionReleased(); } + ~SecureSession() override { NotifySessionReleased(); } SecureSession(SecureSession &&) = delete; SecureSession(const SecureSession &) = delete; diff --git a/src/transport/SessionHolder.h b/src/transport/SessionHolder.h index 897004f59f6dcc..ded017e210da9f 100644 --- a/src/transport/SessionHolder.h +++ b/src/transport/SessionHolder.h @@ -32,7 +32,7 @@ class SessionHolder : public SessionReleaseDelegate, public IntrusiveListNodeBas { public: SessionHolder() {} - ~SessionHolder(); + ~SessionHolder() override; SessionHolder(const SessionHolder &); SessionHolder(SessionHolder && that); diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index 7fef5e0a5d537b..6dcbbdb5275613 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -320,11 +320,9 @@ CHIP_ERROR SessionManager::SendPreparedMessage(const SessionHandle & sessionHand { return mTransportMgr->SendMessage(*destination, std::move(msgBuf)); } - else - { - ChipLogError(Inet, "The transport manager is not initialized. Unable to send the message"); - return CHIP_ERROR_INCORRECT_STATE; - } + + ChipLogError(Inet, "The transport manager is not initialized. Unable to send the message"); + return CHIP_ERROR_INCORRECT_STATE; } void SessionManager::ExpirePairing(const SessionHandle & sessionHandle) diff --git a/src/transport/SessionManager.h b/src/transport/SessionManager.h index f96a1367a3b4d1..87aef5649a4959 100644 --- a/src/transport/SessionManager.h +++ b/src/transport/SessionManager.h @@ -302,10 +302,8 @@ class DLL_EXPORT SessionManager : public TransportMgrDelegate { return mGlobalEncryptedMessageCounter; } - else - { - return state.GetSessionMessageCounter().GetLocalMessageCounter(); - } + + return state.GetSessionMessageCounter().GetLocalMessageCounter(); } }; diff --git a/src/transport/UnauthenticatedSessionTable.h b/src/transport/UnauthenticatedSessionTable.h index 213afb1661235a..68c8afc66a72eb 100644 --- a/src/transport/UnauthenticatedSessionTable.h +++ b/src/transport/UnauthenticatedSessionTable.h @@ -56,7 +56,7 @@ class UnauthenticatedSession : public Session, public ReferenceCounted(*result); } - else - { - return Optional::Missing(); - } + + return Optional::Missing(); } CHECK_RETURN_VALUE Optional FindInitiator(NodeId ephemeralInitiatorNodeID) @@ -171,10 +167,8 @@ class UnauthenticatedSessionTable { return MakeOptional(*result); } - else - { - return Optional::Missing(); - } + + return Optional::Missing(); } CHECK_RETURN_VALUE Optional AllocInitiator(NodeId ephemeralInitiatorNodeID, const PeerAddress & peerAddress, @@ -187,10 +181,8 @@ class UnauthenticatedSessionTable result->SetPeerAddress(peerAddress); return MakeOptional(*result); } - else - { - return Optional::Missing(); - } + + return Optional::Missing(); } private: diff --git a/src/transport/raw/MessageHeader.cpp b/src/transport/raw/MessageHeader.cpp index 77474cf9941c01..1b8ef89680d75f 100644 --- a/src/transport/raw/MessageHeader.cpp +++ b/src/transport/raw/MessageHeader.cpp @@ -202,8 +202,17 @@ CHIP_ERROR PacketHeader::Decode(const uint8_t * const data, uint16_t size, uint1 mDestinationGroupId.ClearValue(); } + if (mSecFlags.Has(Header::SecFlagValues::kMsgExtensionFlag)) + { + // If present, skip over Message Extension block. + // Spec 4.4.1.8. Message Extensions (variable) + uint16_t mxLength; + SuccessOrExit(err = reader.Read16(&mxLength).StatusCode()); + VerifyOrExit(mxLength <= reader.Remaining(), err = CHIP_ERROR_INTERNAL); + reader.Skip(mxLength); + } + octets_read = static_cast(reader.OctetsRead()); - VerifyOrExit(octets_read == EncodeSizeBytes(), err = CHIP_ERROR_INTERNAL); *decode_len = octets_read; exit: @@ -258,8 +267,17 @@ CHIP_ERROR PayloadHeader::Decode(const uint8_t * const data, uint16_t size, uint mAckMessageCounter.ClearValue(); } + if (mExchangeFlags.Has(Header::ExFlagValues::kExchangeFlag_SecuredExtension)) + { + // If present, skip over Secured Extension block. + // Spec 4.4.3.7. Secured Extensions (variable) + uint16_t sxLength; + SuccessOrExit(err = reader.Read16(&sxLength).StatusCode()); + VerifyOrExit(sxLength <= reader.Remaining(), err = CHIP_ERROR_INTERNAL); + reader.Skip(sxLength); + } + octets_read = static_cast(reader.OctetsRead()); - VerifyOrExit(octets_read == EncodeSizeBytes(), err = CHIP_ERROR_INTERNAL); *decode_len = octets_read; exit: diff --git a/src/transport/raw/MessageHeader.h b/src/transport/raw/MessageHeader.h index 60255f78d19629..f253aa4f928751 100644 --- a/src/transport/raw/MessageHeader.h +++ b/src/transport/raw/MessageHeader.h @@ -71,6 +71,9 @@ enum class ExFlagValues : uint8_t /// Set when current message is requesting an acknowledgment from the recipient. kExchangeFlag_NeedsAck = 0x04, + /// Secured Extension block is present. + kExchangeFlag_SecuredExtension = 0x08, + /// Set when a vendor id is prepended to the Message Protocol Id field. kExchangeFlag_VendorIdPresent = 0x10, }; diff --git a/src/transport/raw/TCP.cpp b/src/transport/raw/TCP.cpp index 70b7b8027b3ccf..b8ab3ddbed9306 100644 --- a/src/transport/raw/TCP.cpp +++ b/src/transport/raw/TCP.cpp @@ -192,10 +192,8 @@ CHIP_ERROR TCPBase::SendMessage(const Transport::PeerAddress & address, System:: { return connection->mEndPoint->Send(std::move(msgBuf)); } - else - { - return SendAfterConnect(address, std::move(msgBuf)); - } + + return SendAfterConnect(address, std::move(msgBuf)); } CHIP_ERROR TCPBase::SendAfterConnect(const PeerAddress & addr, System::PacketBufferHandle && msg) @@ -272,7 +270,7 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe // We don't have enough data to read the message size. Wait until there's more. return CHIP_NO_ERROR; } - else if (err != CHIP_NO_ERROR) + if (err != CHIP_NO_ERROR) { return err; } diff --git a/src/transport/raw/TCP.h b/src/transport/raw/TCP.h index f6a09bc93f847e..8f90a4242b187f 100644 --- a/src/transport/raw/TCP.h +++ b/src/transport/raw/TCP.h @@ -276,7 +276,7 @@ class TCP : public TCPBase mConnectionsBuffer[i].Init(nullptr); } } - ~TCP() { mPendingPackets.ReleaseAll(); } + ~TCP() override { mPendingPackets.ReleaseAll(); } private: friend class TCPTest; diff --git a/src/transport/raw/UDP.cpp b/src/transport/raw/UDP.cpp index c27190ad7b1e6f..fb21d390082c80 100644 --- a/src/transport/raw/UDP.cpp +++ b/src/transport/raw/UDP.cpp @@ -142,11 +142,9 @@ CHIP_ERROR UDP::MulticastGroupJoinLeave(const Transport::PeerAddress & address, ChipLogProgress(Inet, "Joining Multicast Group with address %s", addressStr); return mUDPEndPoint->JoinMulticastGroup(mUDPEndPoint->GetBoundInterface(), address.GetIPAddress()); } - else - { - ChipLogProgress(Inet, "Leaving Multicast Group with address %s", addressStr); - return mUDPEndPoint->LeaveMulticastGroup(mUDPEndPoint->GetBoundInterface(), address.GetIPAddress()); - } + + ChipLogProgress(Inet, "Leaving Multicast Group with address %s", addressStr); + return mUDPEndPoint->LeaveMulticastGroup(mUDPEndPoint->GetBoundInterface(), address.GetIPAddress()); } } // namespace Transport diff --git a/src/transport/raw/tests/TestMessageHeader.cpp b/src/transport/raw/tests/TestMessageHeader.cpp index f335b61e45911b..ff50e104f7579f 100644 --- a/src/transport/raw/tests/TestMessageHeader.cpp +++ b/src/transport/raw/tests/TestMessageHeader.cpp @@ -22,6 +22,8 @@ * the Message Header class within the transport layer * */ + +#include #include #include #include @@ -304,9 +306,21 @@ void TestPayloadHeaderEncodeDecodeBounds(nlTestSuite * inSuite, void * inContext } } +constexpr size_t HDR_LEN = 8; ///< Message header length +constexpr size_t SRC_LEN = 8; ///< Source Node ID length +constexpr size_t DST_LEN = 8; ///< Destination Node ID length +constexpr size_t GID_LEN = 2; ///< Group ID length +constexpr size_t MX_LEN = 6; ///< Message Exchange block length +constexpr size_t SX_LEN = 6; ///< Security Exchange block length +constexpr size_t PRO_LEN = 6; ///< Protocol header length +constexpr size_t APP_LEN = 2; ///< App payload length + +/// Size of fixed portion of message header + max source node id + max destination node id. +constexpr size_t MAX_FIXED_HEADER_SIZE = (HDR_LEN + SRC_LEN + DST_LEN); + struct SpecComplianceTestVector { - uint8_t encoded[8 + 8 + 8]; // Fixed header + max source id + max dest id + uint8_t encoded[MAX_FIXED_HEADER_SIZE]; // Fixed header + max source id + max dest id uint8_t messageFlags; uint16_t sessionId; uint8_t sessionType; @@ -363,12 +377,10 @@ struct SpecComplianceTestVector theSpecComplianceTestVector[] = { const unsigned theSpecComplianceTestVectorLength = sizeof(theSpecComplianceTestVector) / sizeof(struct SpecComplianceTestVector); -#define MAX_HEADER_SIZE (8 + 8 + 8) - void TestSpecComplianceEncode(nlTestSuite * inSuite, void * inContext) { struct SpecComplianceTestVector * testEntry; - uint8_t buffer[MAX_HEADER_SIZE]; + uint8_t buffer[MAX_FIXED_HEADER_SIZE]; uint16_t encodeSize; for (unsigned i = 0; i < theSpecComplianceTestVectorLength; i++) @@ -412,6 +424,126 @@ void TestSpecComplianceDecode(nlTestSuite * inSuite, void * inContext) } } +struct TestVectorMsgExtensions +{ + uint8_t payloadOffset; + uint8_t appPayloadOffset; + uint16_t msgLength; + const char * msg; +}; + +struct TestVectorMsgExtensions theTestVectorMsgExtensions[] = { + { + // SRC=none, DST=none, MX=0, SX=0 + .payloadOffset = HDR_LEN, + .appPayloadOffset = PRO_LEN, + .msgLength = HDR_LEN + PRO_LEN + APP_LEN, + .msg = "\x00\x00\x00\x00\xCC\xCC\xCC\xCC" + "\x01\xCC\xEE\xEE\x66\x66\xBB\xBB", + }, + // ================== Test MX ================== + { + // SRC=none, DST=none, MX=1, SX=0 + .payloadOffset = HDR_LEN + MX_LEN, + .appPayloadOffset = PRO_LEN, + .msgLength = HDR_LEN + MX_LEN + PRO_LEN + APP_LEN, + .msg = "\x00\x00\x00\x20\xCC\xCC\xCC\xCC\x04\x00\xE4\xE3\xE2\xE1" + "\x01\xCC\xEE\xEE\x66\x66\xBB\xBB", + }, + { + // SRC=1, DST=none, MX=1, SX=0 + .payloadOffset = HDR_LEN + MX_LEN + SRC_LEN, + .appPayloadOffset = PRO_LEN, + .msgLength = HDR_LEN + MX_LEN + SRC_LEN + PRO_LEN + APP_LEN, + .msg = "\x04\x00\x00\x20\xCC\xCC\xCC\xCC\x11\x11\x11\x11\x11\x11\x11\x11\x04\x00\xE4\xE3\xE2\xE1" + "\x01\xCC\xEE\xEE\x66\x66\xBB\xBB", + }, + { + // SRC=none, DST=1, MX=1, SX=0 + .payloadOffset = HDR_LEN + MX_LEN + DST_LEN, + .appPayloadOffset = PRO_LEN, + .msgLength = HDR_LEN + MX_LEN + DST_LEN + PRO_LEN + APP_LEN, + .msg = "\x01\x00\x00\x20\xCC\xCC\xCC\xCC\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\x04\x00\xE4\xE3\xE2\xE1" + "\x01\xCC\xEE\xEE\x66\x66\xBB\xBB", + }, + { + // SRC=1, DST=1, MX=1, SX=0 + .payloadOffset = HDR_LEN + MX_LEN + SRC_LEN + DST_LEN, + .appPayloadOffset = PRO_LEN, + .msgLength = HDR_LEN + MX_LEN + SRC_LEN + DST_LEN + PRO_LEN + APP_LEN, + .msg = "\x05\x00\x00\x20\xCC\xCC\xCC\xCC\x11\x11\x11\x11\x11\x11\x11\x11\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\x04\x00\xE4\xE3" + "\xE2\xE1" + "\x01\xCC\xEE\xEE\x66\x66\xBB\xBB", + }, + { + // SRC=none, DST=group, MX=1, SX=0 + .payloadOffset = HDR_LEN + MX_LEN + GID_LEN, + .appPayloadOffset = PRO_LEN, + .msgLength = HDR_LEN + MX_LEN + GID_LEN + PRO_LEN + APP_LEN, + .msg = "\x02\x00\x00\x21\xCC\xCC\xCC\xCC\xDD\xDD\x04\x00\xE4\xE3\xE2\xE1" + "\x01\xCC\xEE\xEE\x66\x66\xBB\xBB", + }, + { + // SRC=1, DST=group, MX=1, SX=0 + .payloadOffset = HDR_LEN + MX_LEN + SRC_LEN + GID_LEN, + .appPayloadOffset = PRO_LEN, + .msgLength = HDR_LEN + MX_LEN + SRC_LEN + GID_LEN + PRO_LEN + APP_LEN, + .msg = "\x06\x00\x00\x21\xCC\xCC\xCC\xCC\x11\x11\x11\x11\x11\x11\x11\x11\xDD\xDD\x04\x00\xE4\xE3\xE2\xE1" + "\x01\xCC\xEE\xEE\x66\x66\xBB\xBB", + }, + // ================== Test SX ================== + { + // SRC=none, DST=none, MX=0, SX=1 + .payloadOffset = HDR_LEN, + .appPayloadOffset = PRO_LEN + SX_LEN, + .msgLength = HDR_LEN + PRO_LEN + SX_LEN + APP_LEN, + .msg = "\x00\x00\x00\x00\xCC\xCC\xCC\xCC" + "\x08\xCC\xEE\xEE\x66\x66\x04\x00\xE4\xE3\xE2\xE1\xBB\xBB", + }, + { + // SRC=none, DST=none, MX=1, SX=1 + .payloadOffset = HDR_LEN + MX_LEN, + .appPayloadOffset = PRO_LEN + SX_LEN, + .msgLength = HDR_LEN + MX_LEN + PRO_LEN + SX_LEN + APP_LEN, + .msg = "\x00\x00\x00\x20\xCC\xCC\xCC\xCC\x04\x00\xE4\xE3\xE2\xE1" + "\x08\xCC\xEE\xEE\x66\x66\x04\x00\xE4\xE3\xE2\xE1\xBB\xBB", + }, + { + // SRC=1, DST=1, MX=1, SX=1 + .payloadOffset = HDR_LEN + MX_LEN + SRC_LEN + DST_LEN, + .appPayloadOffset = PRO_LEN + SX_LEN, + .msgLength = HDR_LEN + MX_LEN + SRC_LEN + DST_LEN + PRO_LEN + SX_LEN + APP_LEN, + .msg = "\x05\x00\x00\x20\xCC\xCC\xCC\xCC\x11\x11\x11\x11\x11\x11\x11\x11\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\x04\x00\xE4\xE3" + "\xE2\xE1" + "\x09\xCC\xEE\xEE\x66\x66\x04\x00\xE4\xE3\xE2\xE1\xBB\xBB", + }, +}; + +const unsigned theTestVectorMsgExtensionsLength = sizeof(theTestVectorMsgExtensions) / sizeof(struct TestVectorMsgExtensions); + +void TestMsgExtensionsDecode(nlTestSuite * inSuite, void * inContext) +{ + struct TestVectorMsgExtensions * testEntry; + PacketHeader packetHeader; + PayloadHeader payloadHeader; + uint16_t decodeSize; + + NL_TEST_ASSERT(inSuite, chip::Platform::MemoryInit() == CHIP_NO_ERROR); + + for (unsigned i = 0; i < theTestVectorMsgExtensionsLength; i++) + { + testEntry = &theTestVectorMsgExtensions[i]; + + System::PacketBufferHandle msg = System::PacketBufferHandle::NewWithData(testEntry->msg, testEntry->msgLength); + + NL_TEST_ASSERT(inSuite, packetHeader.Decode(msg->Start(), msg->DataLength(), &decodeSize) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, decodeSize == testEntry->payloadOffset); + + NL_TEST_ASSERT(inSuite, payloadHeader.Decode(msg->Start() + decodeSize, msg->DataLength(), &decodeSize) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, decodeSize == testEntry->appPayloadOffset); + } +} + } // namespace // clang-format off @@ -425,6 +557,7 @@ static const nlTest sTests[] = NL_TEST_DEF("PayloadEncodeDecodeBounds", TestPayloadHeaderEncodeDecodeBounds), NL_TEST_DEF("SpecComplianceEncode", TestSpecComplianceEncode), NL_TEST_DEF("SpecComplianceDecode", TestSpecComplianceDecode), + NL_TEST_DEF("TestMsgExtensionsDecode", TestMsgExtensionsDecode), NL_TEST_SENTINEL() }; // clang-format on diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 81ca2ac8034cfd..92bb1d824e7796 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -23,6 +23,7 @@ import("efr32_board.gni") declare_args() { # Location of the efr32 SDK. efr32_sdk_root = "${chip_root}/third_party/efr32_sdk/repo" + enable_openthread_cli = true } assert(efr32_sdk_root != "", "efr32_sdk_root must be specified") @@ -71,8 +72,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/driver/leddrv/inc", "${efr32_sdk_root}/platform/emdrv/common/inc", "${efr32_sdk_root}/platform/emdrv/gpiointerrupt/inc", - "${efr32_sdk_root}/platform/emdrv/uartdrv/inc", - "${efr32_sdk_root}/platform/emdrv/uartdrv/config", "${efr32_sdk_root}/platform/emdrv/dmadrv/config", "${efr32_sdk_root}/platform/emdrv/dmadrv/inc", "${efr32_sdk_root}/platform/emdrv/nvm3/inc", @@ -140,7 +139,6 @@ template("efr32_sdk") { "${efr32_board}=1", "SL_SUPRESS_DEPRECATION_WARNINGS_SDK_3_1", "CHIP_KVS_BASE_SECTOR_INDEX=((FLASH_SIZE/FLASH_PAGE_SIZE)-(CHIP_KVS_SECTOR_COUNT))", - "CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1", "__HEAP_SIZE=0", "SL_CATALOG_FREERTOS_KERNEL_PRESENT=1", "MBEDTLS_THREADING_C=1", @@ -162,17 +160,49 @@ template("efr32_sdk") { } } - if (chip_build_libshell) { + if (chip_build_libshell) { # matter shell defines += [ "ENABLE_CHIP_SHELL", "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE", + "CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1", ] + } else { + if (enable_openthread_cli) { # ot-cli only + defines += [ "CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1" ] + } + } + + # USART include files + if ((defined(invoker.chip_enable_pw_rpc) && invoker.chip_enable_pw_rpc) || + chip_build_libshell || enable_openthread_cli || + (defined(invoker.show_qr_code) && invoker.show_qr_code)) { + defines += [ "CONFIG_ENABLE_UART" ] + + _include_dirs += [ + "${efr32_sdk_root}/platform/emdrv/uartdrv/inc", + "${efr32_sdk_root}/platform/emdrv/uartdrv/config", + ] + + if (efr32_family == "efr32mg12") { + _include_dirs += [ + "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_usart", + "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/inc/sl_mx25_flash_shutdown_usart", + ] + } else if (efr32_family == "efr32mg21") { + _include_dirs += [ + "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_usart", + "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/inc/sl_mx25_flash_shutdown_usart", + ] + } else if (efr32_family == "efr32mg24") { + _include_dirs += [ + "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_eusart", + "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/inc/sl_mx25_flash_shutdown_eusart", + ] + } } if (efr32_family == "efr32mg12") { _include_dirs += [ - "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_usart", - "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/inc/sl_mx25_flash_shutdown_usart", "${efr32_sdk_root}/hardware/kit/EFR32MG12_${efr32_board}/config", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG12P/Include", "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg1x", @@ -193,8 +223,6 @@ template("efr32_sdk") { ] } else if (efr32_family == "efr32mg21") { _include_dirs += [ - "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_usart", - "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/inc/sl_mx25_flash_shutdown_usart", "${efr32_sdk_root}/hardware/kit/EFR32MG21_${efr32_board}/config", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG21/Include", "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x", @@ -217,8 +245,6 @@ template("efr32_sdk") { ] } else if (efr32_family == "efr32mg24") { _include_dirs += [ - "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_eusart", - "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/inc/sl_mx25_flash_shutdown_eusart", "${efr32_sdk_root}/hardware/kit/EFR32MG24_${efr32_board}/config", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Include", "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x", @@ -275,7 +301,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/matter/efr32/sl_event_handler.c", "${efr32_sdk_root}/matter/efr32/sl_simple_button_instances.c", "${efr32_sdk_root}/matter/efr32/sl_simple_led_instances.c", - "${efr32_sdk_root}/matter/efr32/sl_uartdrv_init.c", "${efr32_sdk_root}/platform/CMSIS/RTOS2/Source/os_systick.c", "${efr32_sdk_root}/platform/bootloader/plugin/security/sha/crypto_sha.c", "${efr32_sdk_root}/platform/common/src/sl_slist.c", @@ -288,16 +313,13 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/emdrv/nvm3/src/nvm3_default.c", "${efr32_sdk_root}/platform/emdrv/nvm3/src/nvm3_hal_flash.c", "${efr32_sdk_root}/platform/emdrv/nvm3/src/nvm3_lock.c", - "${efr32_sdk_root}/platform/emdrv/uartdrv/src/uartdrv.c", "${efr32_sdk_root}/platform/emlib/src/em_adc.c", "${efr32_sdk_root}/platform/emlib/src/em_cmu.c", "${efr32_sdk_root}/platform/emlib/src/em_core.c", "${efr32_sdk_root}/platform/emlib/src/em_crypto.c", "${efr32_sdk_root}/platform/emlib/src/em_emu.c", - "${efr32_sdk_root}/platform/emlib/src/em_eusart.c", "${efr32_sdk_root}/platform/emlib/src/em_gpio.c", "${efr32_sdk_root}/platform/emlib/src/em_ldma.c", - "${efr32_sdk_root}/platform/emlib/src/em_leuart.c", "${efr32_sdk_root}/platform/emlib/src/em_msc.c", "${efr32_sdk_root}/platform/emlib/src/em_prs.c", "${efr32_sdk_root}/platform/emlib/src/em_rmu.c", @@ -305,7 +327,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/emlib/src/em_se.c", "${efr32_sdk_root}/platform/emlib/src/em_system.c", "${efr32_sdk_root}/platform/emlib/src/em_timer.c", - "${efr32_sdk_root}/platform/emlib/src/em_usart.c", "${efr32_sdk_root}/platform/peripheral/src/peripheral_sysrtc.c", "${efr32_sdk_root}/platform/radio/rail_lib/hal/efr32/hal_efr.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/pa_conversions_efr32.c", @@ -454,6 +475,36 @@ template("efr32_sdk") { ] } + # USART sources files + if ((defined(invoker.chip_enable_pw_rpc) && invoker.chip_enable_pw_rpc) || + chip_build_libshell || enable_openthread_cli || + (defined(invoker.show_qr_code) && invoker.show_qr_code)) { + sources += [ + "${efr32_sdk_root}/matter/efr32/sl_uartdrv_init.c", + "${efr32_sdk_root}/platform/emdrv/uartdrv/src/uartdrv.c", + "${efr32_sdk_root}/platform/emlib/src/em_eusart.c", + "${efr32_sdk_root}/platform/emlib/src/em_leuart.c", + "${efr32_sdk_root}/platform/emlib/src/em_usart.c", + ] + + if (efr32_family == "efr32mg12") { + sources += [ + "${efr32_sdk_root}/hardware/driver/memlcd/src/memlcd_usart/sl_memlcd_spi.c", + "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/src/sl_mx25_flash_shutdown_usart/sl_mx25_flash_shutdown.c", + ] + } else if (efr32_family == "efr32mg21") { + sources += [ + "${efr32_sdk_root}/hardware/driver/memlcd/src/memlcd_usart/sl_memlcd_spi.c", + "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/src/sl_mx25_flash_shutdown_usart/sl_mx25_flash_shutdown.c", + ] + } else if (efr32_family == "efr32mg24") { + sources += [ + "${efr32_sdk_root}/hardware/driver/memlcd/src/memlcd_eusart/sl_memlcd_spi.c", + "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/src/sl_mx25_flash_shutdown_eusart/sl_mx25_flash_shutdown.c", + ] + } + } + if (defined(invoker.show_qr_code)) { if (invoker.show_qr_code) { sources += [ @@ -485,8 +536,6 @@ template("efr32_sdk") { if (efr32_family == "efr32mg12") { sources += [ - "${efr32_sdk_root}/hardware/driver/memlcd/src/memlcd_usart/sl_memlcd_spi.c", - "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/src/sl_mx25_flash_shutdown_usart/sl_mx25_flash_shutdown.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG12P/Source/GCC/startup_efr32mg12p.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG12P/Source/system_efr32mg12p.c", "${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_dcdc_s1.c", @@ -497,8 +546,6 @@ template("efr32_sdk") { ] } else if (efr32_family == "efr32mg21") { sources += [ - "${efr32_sdk_root}/hardware/driver/memlcd/src/memlcd_usart/sl_memlcd_spi.c", - "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/src/sl_mx25_flash_shutdown_usart/sl_mx25_flash_shutdown.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG21/Source/GCC/startup_efr32mg21.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG21/Source/system_efr32mg21.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rf_path/sl_rail_util_rf_path.c", @@ -539,8 +586,6 @@ template("efr32_sdk") { ] } else if (efr32_family == "efr32mg24") { sources += [ - "${efr32_sdk_root}/hardware/driver/memlcd/src/memlcd_eusart/sl_memlcd_spi.c", - "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/src/sl_mx25_flash_shutdown_eusart/sl_mx25_flash_shutdown.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Source/GCC/startup_efr32mg24.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Source/system_efr32mg24.c", "${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_dcdc_s2.c", diff --git a/third_party/efr32_sdk/repo b/third_party/efr32_sdk/repo index 1f6ff3d05c9400..9b527ad5d35e72 160000 --- a/third_party/efr32_sdk/repo +++ b/third_party/efr32_sdk/repo @@ -1 +1 @@ -Subproject commit 1f6ff3d05c94003899f3599b2e3ca524c5aa5495 +Subproject commit 9b527ad5d35e72f0266b54ed64d74ebe0170aa45 diff --git a/third_party/inipp/repo/inipp/inipp/inipp.h b/third_party/inipp/repo/inipp/inipp/inipp.h index 41391567378ff8..54b0892fe95dfe 100644 --- a/third_party/inipp/repo/inipp/inipp/inipp.h +++ b/third_party/inipp/repo/inipp/inipp/inipp.h @@ -79,9 +79,8 @@ inline bool extract(const std::basic_string & value, T & dst) { dst = result; return true; } - else { - return false; - } + return false; + } template @@ -135,7 +134,7 @@ class Ini if (front == char_comment) { continue; } - else if (front == char_section_start) { + if (front == char_section_start) { if (line.back() == char_section_end) section = line.substr(1, length - 2); else diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 79525f59ff502d..86698c0b9620fe 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 79525f59ff502d80346c9cc8e70570786c5fc903 +Subproject commit 86698c0b9620febe11cc274a44c9457e6127dd62 diff --git a/zzz_generated/app-common/app-common/zap-generated/af-structs.h b/zzz_generated/app-common/app-common/zap-generated/af-structs.h index 5fedd6a584ef31..fa90936d96ad5f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/af-structs.h +++ b/zzz_generated/app-common/app-common/zap-generated/af-structs.h @@ -44,7 +44,6 @@ typedef struct _SimpleStruct // Struct for TestFabricScoped typedef struct _TestFabricScoped { - chip::FabricIndex fabricIndex; uint8_t fabricSensitiveInt8u; uint8_t optionalFabricSensitiveInt8u; uint8_t nullableFabricSensitiveInt8u; @@ -52,6 +51,7 @@ typedef struct _TestFabricScoped chip::CharSpan fabricSensitiveCharString; SimpleStruct fabricSensitiveStruct; /* TYPE WARNING: array array defaults to */ uint8_t * fabricSensitiveInt8uList; + chip::FabricIndex fabricIndex; } TestFabricScoped; // Struct for Dimension @@ -170,11 +170,11 @@ typedef struct _Target // Struct for AccessControlEntry typedef struct _AccessControlEntry { - chip::FabricIndex FabricIndex; uint8_t Privilege; uint8_t AuthMode; /* TYPE WARNING: array array defaults to */ uint8_t * Subjects; /* TYPE WARNING: array array defaults to */ uint8_t * Targets; + chip::FabricIndex FabricIndex; } AccessControlEntry; // Struct for ActionStruct @@ -251,36 +251,36 @@ typedef struct _EndpointListStruct // Struct for ExtensionEntry typedef struct _ExtensionEntry { - chip::FabricIndex FabricIndex; chip::ByteSpan Data; + chip::FabricIndex FabricIndex; } ExtensionEntry; // Struct for FabricDescriptor typedef struct _FabricDescriptor { - chip::FabricIndex FabricIndex; chip::ByteSpan RootPublicKey; uint16_t VendorId; chip::FabricId FabricId; chip::NodeId NodeId; chip::CharSpan Label; + chip::FabricIndex FabricIndex; } FabricDescriptor; // Struct for GroupInfoMapStruct typedef struct _GroupInfoMapStruct { - chip::FabricIndex FabricIndex; chip::GroupId GroupId; /* TYPE WARNING: array array defaults to */ uint8_t * Endpoints; chip::CharSpan GroupName; + chip::FabricIndex FabricIndex; } GroupInfoMapStruct; // Struct for GroupKeyMapStruct typedef struct _GroupKeyMapStruct { - chip::FabricIndex FabricIndex; chip::GroupId GroupId; uint16_t GroupKeySetID; + chip::FabricIndex FabricIndex; } GroupKeyMapStruct; // Struct for GroupKeySetStruct @@ -339,9 +339,9 @@ typedef struct _ModeOptionStruct // Struct for NOCStruct typedef struct _NOCStruct { - chip::FabricIndex FabricIndex; chip::ByteSpan NOC; chip::ByteSpan ICAC; + chip::FabricIndex FabricIndex; } NOCStruct; // Struct for NeighborTable @@ -525,11 +525,11 @@ typedef struct _TargetInfo // Struct for TargetStruct typedef struct _TargetStruct { - chip::FabricIndex FabricIndex; chip::NodeId Node; chip::GroupId Group; chip::EndpointId Endpoint; chip::ClusterId Cluster; + chip::FabricIndex FabricIndex; } TargetStruct; // Struct for TestListStructOctet diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 014cec69b4c5b3..715630b90fea87 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -14271,9 +14271,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) namespace CredentialRulesSupport { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14285,9 +14285,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -14487,9 +14487,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::DoorLock::DlOp namespace SupportedOperatingModes { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14501,9 +14501,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -14518,9 +14518,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace DefaultConfigurationRegister { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14532,9 +14532,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -14673,9 +14673,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, bool value) namespace LocalProgrammingFeatures { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14687,9 +14687,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -14859,9 +14859,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace AlarmMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14873,9 +14873,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -14890,9 +14890,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace KeypadOperationEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14904,9 +14904,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -14921,9 +14921,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace RemoteOperationEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14935,9 +14935,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -14952,9 +14952,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace ManualOperationEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14966,9 +14966,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -14983,9 +14983,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace RFIDOperationEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -14997,9 +14997,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -15014,9 +15014,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace KeypadProgrammingEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -15028,9 +15028,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -15045,9 +15045,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace RemoteProgrammingEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -15059,9 +15059,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -15076,9 +15076,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace RFIDProgrammingEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -15090,9 +15090,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 7928ae7778d7b5..8c36603379e522 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2561,8 +2561,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); } // namespace MinRFIDCodeLength namespace CredentialRulesSupport { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlCredentialRuleMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace CredentialRulesSupport namespace EnableLogging { @@ -2596,13 +2597,16 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::DoorLock::DlOp } // namespace OperatingMode namespace SupportedOperatingModes { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlSupportedOperatingModes +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace SupportedOperatingModes namespace DefaultConfigurationRegister { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus +Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlDefaultConfigurationRegister +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace DefaultConfigurationRegister namespace EnableLocalProgramming { @@ -2626,8 +2630,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, bool value); } // namespace EnablePrivacyModeButton namespace LocalProgrammingFeatures { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlLocalProgrammingFeatures +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace LocalProgrammingFeatures namespace WrongCodeEntryLimit { @@ -2656,43 +2661,51 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace ExpiringUserTimeout namespace AlarmMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value); // DlAlarmMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace AlarmMask namespace KeypadOperationEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlKeypadOperationEventMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace KeypadOperationEventMask namespace RemoteOperationEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlRemoteOperationEventMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace RemoteOperationEventMask namespace ManualOperationEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlManualOperationEventMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace ManualOperationEventMask namespace RFIDOperationEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlRFIDOperationEventMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace RFIDOperationEventMask namespace KeypadProgrammingEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlKeypadOperationEventMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace KeypadProgrammingEventMask namespace RemoteProgrammingEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus +Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlRemoteProgrammingEventMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace RemoteProgrammingEventMask namespace RFIDProgrammingEventMask { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // DlRFIDProgrammingEventMask +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace RFIDProgrammingEventMask namespace FeatureMap { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 2471223302da32..d3207eef9140c3 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -1188,6 +1188,14 @@ enum class DlAlarmMask : uint16_t kForcedDoorOpenUnderDoorLockedCondition = 0x40, }; +// Bitmap for DlCredentialRuleMask +enum class DlCredentialRuleMask : uint8_t +{ + kSingle = 0x1, + kDual = 0x2, + kTri = 0x4, +}; + // Bitmap for DlCredentialRulesSupport enum class DlCredentialRulesSupport : uint8_t { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index c32353bbd1d684..3e3dc6523a7721 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -4453,14 +4453,14 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - if (accessingFabricIndex.HasValue()) - { - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); - } ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kNode)), node)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroup)), group)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEndpoint)), endpoint)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kCluster)), cluster)); + if (accessingFabricIndex.HasValue()) + { + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); + } ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -4477,9 +4477,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; case to_underlying(Fields::kNode): ReturnErrorOnFailure(DataModel::Decode(reader, node)); break; @@ -4492,6 +4489,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) case to_underlying(Fields::kCluster): ReturnErrorOnFailure(DataModel::Decode(reader, cluster)); break; + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; default: break; } @@ -4607,10 +4607,6 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< bool includeSensitive = !accessingFabricIndex.HasValue() || (accessingFabricIndex.Value() == fabricIndex); TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - if (accessingFabricIndex.HasValue()) - { - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); - } if (includeSensitive) { ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kPrivilege)), privilege)); @@ -4627,6 +4623,10 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< { ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kTargets)), targets)); } + if (accessingFabricIndex.HasValue()) + { + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); + } ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -4643,9 +4643,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; case to_underlying(Fields::kPrivilege): ReturnErrorOnFailure(DataModel::Decode(reader, privilege)); break; @@ -4658,6 +4655,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) case to_underlying(Fields::kTargets): ReturnErrorOnFailure(DataModel::Decode(reader, targets)); break; + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; default: break; } @@ -4685,11 +4685,11 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kData)), data)); if (accessingFabricIndex.HasValue()) { ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); } - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kData)), data)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -4706,12 +4706,12 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; case to_underlying(Fields::kData): ReturnErrorOnFailure(DataModel::Decode(reader, data)); break; + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; default: break; } @@ -4769,12 +4769,12 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminFabricIndex)), adminFabricIndex)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminNodeID)), adminNodeID)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminPasscodeID)), adminPasscodeID)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kChangeType)), changeType)); ReturnErrorOnFailure( DataModel::EncodeForRead(writer, TLV::ContextTag(to_underlying(Fields::kLatestValue)), GetFabricIndex(), latestValue)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminFabricIndex)), adminFabricIndex)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -4790,9 +4790,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kAdminFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, adminFabricIndex)); - break; case to_underlying(Fields::kAdminNodeID): ReturnErrorOnFailure(DataModel::Decode(reader, adminNodeID)); break; @@ -4805,6 +4802,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) case to_underlying(Fields::kLatestValue): ReturnErrorOnFailure(DataModel::Decode(reader, latestValue)); break; + case to_underlying(Fields::kAdminFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, adminFabricIndex)); + break; default: break; } @@ -4820,12 +4820,12 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminFabricIndex)), adminFabricIndex)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminNodeID)), adminNodeID)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminPasscodeID)), adminPasscodeID)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kChangeType)), changeType)); ReturnErrorOnFailure( DataModel::EncodeForRead(writer, TLV::ContextTag(to_underlying(Fields::kLatestValue)), GetFabricIndex(), latestValue)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminFabricIndex)), adminFabricIndex)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -4841,9 +4841,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kAdminFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, adminFabricIndex)); - break; case to_underlying(Fields::kAdminNodeID): ReturnErrorOnFailure(DataModel::Decode(reader, adminNodeID)); break; @@ -4856,6 +4853,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) case to_underlying(Fields::kLatestValue): ReturnErrorOnFailure(DataModel::Decode(reader, latestValue)); break; + case to_underlying(Fields::kAdminFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, adminFabricIndex)); + break; default: break; } @@ -10198,15 +10198,15 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - if (accessingFabricIndex.HasValue()) - { - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); - } ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kRootPublicKey)), rootPublicKey)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kVendorId)), vendorId)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricId)), fabricId)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kNodeId)), nodeId)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kLabel)), label)); + if (accessingFabricIndex.HasValue()) + { + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); + } ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -10223,9 +10223,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; case to_underlying(Fields::kRootPublicKey): ReturnErrorOnFailure(DataModel::Decode(reader, rootPublicKey)); break; @@ -10241,6 +10238,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) case to_underlying(Fields::kLabel): ReturnErrorOnFailure(DataModel::Decode(reader, label)); break; + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; default: break; } @@ -10269,10 +10269,6 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< bool includeSensitive = !accessingFabricIndex.HasValue() || (accessingFabricIndex.Value() == fabricIndex); TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - if (accessingFabricIndex.HasValue()) - { - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); - } if (includeSensitive) { ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kNoc)), noc)); @@ -10281,6 +10277,10 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< { ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kIcac)), icac)); } + if (accessingFabricIndex.HasValue()) + { + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); + } ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -10297,15 +10297,15 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; case to_underlying(Fields::kNoc): ReturnErrorOnFailure(DataModel::Decode(reader, noc)); break; case to_underlying(Fields::kIcac): ReturnErrorOnFailure(DataModel::Decode(reader, icac)); break; + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; default: break; } @@ -10871,13 +10871,13 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupId)), groupId)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEndpoints)), endpoints)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupName)), groupName)); if (accessingFabricIndex.HasValue()) { ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); } - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupId)), groupId)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEndpoints)), endpoints)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupName)), groupName)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -10894,9 +10894,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; case to_underlying(Fields::kGroupId): ReturnErrorOnFailure(DataModel::Decode(reader, groupId)); break; @@ -10906,6 +10903,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) case to_underlying(Fields::kGroupName): ReturnErrorOnFailure(DataModel::Decode(reader, groupName)); break; + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; default: break; } @@ -10933,12 +10933,12 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupId)), groupId)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetID)), groupKeySetID)); if (accessingFabricIndex.HasValue()) { ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); } - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupId)), groupId)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetID)), groupKeySetID)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -10955,15 +10955,15 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; case to_underlying(Fields::kGroupId): ReturnErrorOnFailure(DataModel::Decode(reader, groupId)); break; case to_underlying(Fields::kGroupKeySetID): ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); break; + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; default: break; } @@ -22715,10 +22715,6 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< bool includeSensitive = !accessingFabricIndex.HasValue() || (accessingFabricIndex.Value() == fabricIndex); TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - if (accessingFabricIndex.HasValue()) - { - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); - } if (includeSensitive) { ReturnErrorOnFailure( @@ -22755,6 +22751,10 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & writer, TLV::Tag tag, const Optional< ReturnErrorOnFailure( DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricSensitiveInt8uList)), fabricSensitiveInt8uList)); } + if (accessingFabricIndex.HasValue()) + { + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); + } ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -22771,9 +22771,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; case to_underlying(Fields::kFabricSensitiveInt8u): ReturnErrorOnFailure(DataModel::Decode(reader, fabricSensitiveInt8u)); break; @@ -22795,6 +22792,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) case to_underlying(Fields::kFabricSensitiveInt8uList): ReturnErrorOnFailure(DataModel::Decode(reader, fabricSensitiveInt8uList)); break; + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; default: break; } diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 0dd2d68e998832..2931b5cf7ff7fc 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -6484,21 +6484,21 @@ namespace Structs { namespace TargetStruct { enum class Fields { - kFabricIndex = 0, kNode = 1, kGroup = 2, kEndpoint = 3, kCluster = 4, + kFabricIndex = 254, }; struct Type { public: - chip::FabricIndex fabricIndex = static_cast(0); Optional node; Optional group; Optional endpoint; Optional cluster; + chip::FabricIndex fabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -6644,21 +6644,21 @@ using DecodableType = Type; namespace AccessControlEntry { enum class Fields { - kFabricIndex = 0, kPrivilege = 1, kAuthMode = 2, kSubjects = 3, kTargets = 4, + kFabricIndex = 254, }; struct Type { public: - chip::FabricIndex fabricIndex = static_cast(0); - Privilege privilege = static_cast(0); - AuthMode authMode = static_cast(0); + Privilege privilege = static_cast(0); + AuthMode authMode = static_cast(0); DataModel::Nullable> subjects; DataModel::Nullable> targets; + chip::FabricIndex fabricIndex = static_cast(0); static constexpr bool kIsFabricScoped = true; @@ -6676,11 +6676,11 @@ struct Type struct DecodableType { public: - chip::FabricIndex fabricIndex = static_cast(0); - Privilege privilege = static_cast(0); - AuthMode authMode = static_cast(0); + Privilege privilege = static_cast(0); + AuthMode authMode = static_cast(0); DataModel::Nullable> subjects; DataModel::Nullable> targets; + chip::FabricIndex fabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -6695,15 +6695,15 @@ struct DecodableType namespace ExtensionEntry { enum class Fields { - kFabricIndex = 0, kData = 1, + kFabricIndex = 254, }; struct Type { public: - chip::FabricIndex fabricIndex = static_cast(0); chip::ByteSpan data; + chip::FabricIndex fabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -6840,11 +6840,11 @@ static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; enum class Fields { - kAdminFabricIndex = 0, kAdminNodeID = 1, kAdminPasscodeID = 2, kChangeType = 3, kLatestValue = 4, + kAdminFabricIndex = 254, }; struct Type @@ -6855,11 +6855,11 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } static constexpr bool kIsFabricScoped = true; - chip::FabricIndex adminFabricIndex = static_cast(0); DataModel::Nullable adminNodeID; DataModel::Nullable adminPasscodeID; ChangeTypeEnum changeType = static_cast(0); DataModel::Nullable latestValue; + chip::FabricIndex adminFabricIndex = static_cast(0); auto GetFabricIndex() const { return adminFabricIndex; } @@ -6873,11 +6873,11 @@ struct DecodableType static constexpr EventId GetEventId() { return Events::AccessControlEntryChanged::Id; } static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } - chip::FabricIndex adminFabricIndex = static_cast(0); DataModel::Nullable adminNodeID; DataModel::Nullable adminPasscodeID; ChangeTypeEnum changeType = static_cast(0); DataModel::Nullable latestValue; + chip::FabricIndex adminFabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; @@ -6887,11 +6887,11 @@ static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; enum class Fields { - kAdminFabricIndex = 0, kAdminNodeID = 1, kAdminPasscodeID = 2, kChangeType = 3, kLatestValue = 4, + kAdminFabricIndex = 254, }; struct Type @@ -6902,11 +6902,11 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } static constexpr bool kIsFabricScoped = true; - chip::FabricIndex adminFabricIndex = static_cast(0); DataModel::Nullable adminNodeID; DataModel::Nullable adminPasscodeID; ChangeTypeEnum changeType = static_cast(0); DataModel::Nullable latestValue; + chip::FabricIndex adminFabricIndex = static_cast(0); auto GetFabricIndex() const { return adminFabricIndex; } @@ -6920,11 +6920,11 @@ struct DecodableType static constexpr EventId GetEventId() { return Events::AccessControlExtensionChanged::Id; } static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } - chip::FabricIndex adminFabricIndex = static_cast(0); DataModel::Nullable adminNodeID; DataModel::Nullable adminPasscodeID; ChangeTypeEnum changeType = static_cast(0); DataModel::Nullable latestValue; + chip::FabricIndex adminFabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; @@ -15050,23 +15050,23 @@ namespace Structs { namespace FabricDescriptor { enum class Fields { - kFabricIndex = 0, kRootPublicKey = 1, kVendorId = 2, kFabricId = 3, kNodeId = 4, kLabel = 5, + kFabricIndex = 254, }; struct Type { public: - chip::FabricIndex fabricIndex = static_cast(0); chip::ByteSpan rootPublicKey; uint16_t vendorId = static_cast(0); chip::FabricId fabricId = static_cast(0); chip::NodeId nodeId = static_cast(0); chip::CharSpan label; + chip::FabricIndex fabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -15089,17 +15089,17 @@ using DecodableType = Type; namespace NOCStruct { enum class Fields { - kFabricIndex = 0, kNoc = 1, kIcac = 2, + kFabricIndex = 254, }; struct Type { public: - chip::FabricIndex fabricIndex = static_cast(0); chip::ByteSpan noc; DataModel::Nullable icac; + chip::FabricIndex fabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -15804,19 +15804,19 @@ namespace Structs { namespace GroupInfoMapStruct { enum class Fields { - kFabricIndex = 0, kGroupId = 1, kEndpoints = 2, kGroupName = 3, + kFabricIndex = 254, }; struct Type { public: - chip::FabricIndex fabricIndex = static_cast(0); - chip::GroupId groupId = static_cast(0); + chip::GroupId groupId = static_cast(0); DataModel::List endpoints; Optional groupName; + chip::FabricIndex fabricIndex = static_cast(0); static constexpr bool kIsFabricScoped = true; @@ -15834,10 +15834,10 @@ struct Type struct DecodableType { public: - chip::FabricIndex fabricIndex = static_cast(0); - chip::GroupId groupId = static_cast(0); + chip::GroupId groupId = static_cast(0); DataModel::DecodableList endpoints; Optional groupName; + chip::FabricIndex fabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -15852,17 +15852,17 @@ struct DecodableType namespace GroupKeyMapStruct { enum class Fields { - kFabricIndex = 0, kGroupId = 1, kGroupKeySetID = 2, + kFabricIndex = 254, }; struct Type { public: - chip::FabricIndex fabricIndex = static_cast(0); chip::GroupId groupId = static_cast(0); uint16_t groupKeySetID = static_cast(0); + chip::FabricIndex fabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -19397,9 +19397,9 @@ struct TypeInfo namespace CredentialRulesSupport { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::CredentialRulesSupport::Id; } @@ -19482,9 +19482,9 @@ struct TypeInfo namespace SupportedOperatingModes { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SupportedOperatingModes::Id; } @@ -19494,9 +19494,9 @@ struct TypeInfo namespace DefaultConfigurationRegister { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::DefaultConfigurationRegister::Id; } @@ -19554,9 +19554,9 @@ struct TypeInfo namespace LocalProgrammingFeatures { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::LocalProgrammingFeatures::Id; } @@ -19626,9 +19626,9 @@ struct TypeInfo namespace AlarmMask { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::AlarmMask::Id; } @@ -19638,9 +19638,9 @@ struct TypeInfo namespace KeypadOperationEventMask { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::KeypadOperationEventMask::Id; } @@ -19650,9 +19650,9 @@ struct TypeInfo namespace RemoteOperationEventMask { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::RemoteOperationEventMask::Id; } @@ -19662,9 +19662,9 @@ struct TypeInfo namespace ManualOperationEventMask { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::ManualOperationEventMask::Id; } @@ -19674,9 +19674,9 @@ struct TypeInfo namespace RFIDOperationEventMask { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::RFIDOperationEventMask::Id; } @@ -19686,9 +19686,9 @@ struct TypeInfo namespace KeypadProgrammingEventMask { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::KeypadProgrammingEventMask::Id; } @@ -19698,9 +19698,9 @@ struct TypeInfo namespace RemoteProgrammingEventMask { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::RemoteProgrammingEventMask::Id; } @@ -19710,9 +19710,9 @@ struct TypeInfo namespace RFIDProgrammingEventMask { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::RFIDProgrammingEventMask::Id; } @@ -19805,38 +19805,50 @@ struct TypeInfo static_cast(0); Attributes::NumberOfHolidaySchedulesSupported::TypeInfo::DecodableType numberOfHolidaySchedulesSupported = static_cast(0); - Attributes::MaxPINCodeLength::TypeInfo::DecodableType maxPINCodeLength = static_cast(0); - Attributes::MinPINCodeLength::TypeInfo::DecodableType minPINCodeLength = static_cast(0); - Attributes::MaxRFIDCodeLength::TypeInfo::DecodableType maxRFIDCodeLength = static_cast(0); - Attributes::MinRFIDCodeLength::TypeInfo::DecodableType minRFIDCodeLength = static_cast(0); - Attributes::CredentialRulesSupport::TypeInfo::DecodableType credentialRulesSupport = static_cast(0); - Attributes::EnableLogging::TypeInfo::DecodableType enableLogging = static_cast(0); + Attributes::MaxPINCodeLength::TypeInfo::DecodableType maxPINCodeLength = static_cast(0); + Attributes::MinPINCodeLength::TypeInfo::DecodableType minPINCodeLength = static_cast(0); + Attributes::MaxRFIDCodeLength::TypeInfo::DecodableType maxRFIDCodeLength = static_cast(0); + Attributes::MinRFIDCodeLength::TypeInfo::DecodableType minRFIDCodeLength = static_cast(0); + Attributes::CredentialRulesSupport::TypeInfo::DecodableType credentialRulesSupport = + static_cast>(0); + Attributes::EnableLogging::TypeInfo::DecodableType enableLogging = static_cast(0); Attributes::Language::TypeInfo::DecodableType language; Attributes::LEDSettings::TypeInfo::DecodableType LEDSettings = static_cast(0); Attributes::AutoRelockTime::TypeInfo::DecodableType autoRelockTime = static_cast(0); Attributes::SoundVolume::TypeInfo::DecodableType soundVolume = static_cast(0); Attributes::OperatingMode::TypeInfo::DecodableType operatingMode = static_cast(0); - Attributes::SupportedOperatingModes::TypeInfo::DecodableType supportedOperatingModes = static_cast(0); - Attributes::DefaultConfigurationRegister::TypeInfo::DecodableType defaultConfigurationRegister = static_cast(0); - Attributes::EnableLocalProgramming::TypeInfo::DecodableType enableLocalProgramming = static_cast(0); - Attributes::EnableOneTouchLocking::TypeInfo::DecodableType enableOneTouchLocking = static_cast(0); - Attributes::EnableInsideStatusLED::TypeInfo::DecodableType enableInsideStatusLED = static_cast(0); - Attributes::EnablePrivacyModeButton::TypeInfo::DecodableType enablePrivacyModeButton = static_cast(0); - Attributes::LocalProgrammingFeatures::TypeInfo::DecodableType localProgrammingFeatures = static_cast(0); + Attributes::SupportedOperatingModes::TypeInfo::DecodableType supportedOperatingModes = + static_cast>(0); + Attributes::DefaultConfigurationRegister::TypeInfo::DecodableType defaultConfigurationRegister = + static_cast>(0); + Attributes::EnableLocalProgramming::TypeInfo::DecodableType enableLocalProgramming = static_cast(0); + Attributes::EnableOneTouchLocking::TypeInfo::DecodableType enableOneTouchLocking = static_cast(0); + Attributes::EnableInsideStatusLED::TypeInfo::DecodableType enableInsideStatusLED = static_cast(0); + Attributes::EnablePrivacyModeButton::TypeInfo::DecodableType enablePrivacyModeButton = static_cast(0); + Attributes::LocalProgrammingFeatures::TypeInfo::DecodableType localProgrammingFeatures = + static_cast>(0); Attributes::WrongCodeEntryLimit::TypeInfo::DecodableType wrongCodeEntryLimit = static_cast(0); Attributes::UserCodeTemporaryDisableTime::TypeInfo::DecodableType userCodeTemporaryDisableTime = static_cast(0); Attributes::SendPINOverTheAir::TypeInfo::DecodableType sendPINOverTheAir = static_cast(0); Attributes::RequirePINforRemoteOperation::TypeInfo::DecodableType requirePINforRemoteOperation = static_cast(0); Attributes::ExpiringUserTimeout::TypeInfo::DecodableType expiringUserTimeout = static_cast(0); - Attributes::AlarmMask::TypeInfo::DecodableType alarmMask = static_cast(0); - Attributes::KeypadOperationEventMask::TypeInfo::DecodableType keypadOperationEventMask = static_cast(0); - Attributes::RemoteOperationEventMask::TypeInfo::DecodableType remoteOperationEventMask = static_cast(0); - Attributes::ManualOperationEventMask::TypeInfo::DecodableType manualOperationEventMask = static_cast(0); - Attributes::RFIDOperationEventMask::TypeInfo::DecodableType RFIDOperationEventMask = static_cast(0); - Attributes::KeypadProgrammingEventMask::TypeInfo::DecodableType keypadProgrammingEventMask = static_cast(0); - Attributes::RemoteProgrammingEventMask::TypeInfo::DecodableType remoteProgrammingEventMask = static_cast(0); - Attributes::RFIDProgrammingEventMask::TypeInfo::DecodableType RFIDProgrammingEventMask = static_cast(0); + Attributes::AlarmMask::TypeInfo::DecodableType alarmMask = + static_cast>(0); + Attributes::KeypadOperationEventMask::TypeInfo::DecodableType keypadOperationEventMask = + static_cast>(0); + Attributes::RemoteOperationEventMask::TypeInfo::DecodableType remoteOperationEventMask = + static_cast>(0); + Attributes::ManualOperationEventMask::TypeInfo::DecodableType manualOperationEventMask = + static_cast>(0); + Attributes::RFIDOperationEventMask::TypeInfo::DecodableType RFIDOperationEventMask = + static_cast>(0); + Attributes::KeypadProgrammingEventMask::TypeInfo::DecodableType keypadProgrammingEventMask = + static_cast>(0); + Attributes::RemoteProgrammingEventMask::TypeInfo::DecodableType remoteProgrammingEventMask = + static_cast>(0); + Attributes::RFIDProgrammingEventMask::TypeInfo::DecodableType RFIDProgrammingEventMask = + static_cast>(0); Attributes::ServerGeneratedCommandList::TypeInfo::DecodableType serverGeneratedCommandList; Attributes::ClientGeneratedCommandList::TypeInfo::DecodableType clientGeneratedCommandList; Attributes::AttributeList::TypeInfo::DecodableType attributeList; @@ -35049,7 +35061,6 @@ using DecodableType = Type; namespace TestFabricScoped { enum class Fields { - kFabricIndex = 0, kFabricSensitiveInt8u = 1, kOptionalFabricSensitiveInt8u = 2, kNullableFabricSensitiveInt8u = 3, @@ -35057,19 +35068,20 @@ enum class Fields kFabricSensitiveCharString = 5, kFabricSensitiveStruct = 6, kFabricSensitiveInt8uList = 7, + kFabricIndex = 254, }; struct Type { public: - chip::FabricIndex fabricIndex = static_cast(0); - uint8_t fabricSensitiveInt8u = static_cast(0); + uint8_t fabricSensitiveInt8u = static_cast(0); Optional optionalFabricSensitiveInt8u; DataModel::Nullable nullableFabricSensitiveInt8u; Optional> nullableOptionalFabricSensitiveInt8u; chip::CharSpan fabricSensitiveCharString; Structs::SimpleStruct::Type fabricSensitiveStruct; DataModel::List fabricSensitiveInt8uList; + chip::FabricIndex fabricIndex = static_cast(0); static constexpr bool kIsFabricScoped = true; @@ -35087,14 +35099,14 @@ struct Type struct DecodableType { public: - chip::FabricIndex fabricIndex = static_cast(0); - uint8_t fabricSensitiveInt8u = static_cast(0); + uint8_t fabricSensitiveInt8u = static_cast(0); Optional optionalFabricSensitiveInt8u; DataModel::Nullable nullableFabricSensitiveInt8u; Optional> nullableOptionalFabricSensitiveInt8u; chip::CharSpan fabricSensitiveCharString; Structs::SimpleStruct::DecodableType fabricSensitiveStruct; DataModel::DecodableList fabricSensitiveInt8uList; + chip::FabricIndex fabricIndex = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -37909,7 +37921,7 @@ static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; enum class Fields { - kArg1 = 1, + kArg1 = 254, }; struct Type diff --git a/zzz_generated/app-common/app-common/zap-generated/enums.h b/zzz_generated/app-common/app-common/zap-generated/enums.h index 5a0bdf956c7cef..1fada60b916043 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -583,6 +583,12 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_DL_ALARM_MASK_FRONT_ESCUTCHEON_REMOVED_FROM_MAIN_OFFSET (5) #define EMBER_AF_DL_ALARM_MASK_FORCED_DOOR_OPEN_UNDER_DOOR_LOCKED_CONDITION (64) #define EMBER_AF_DL_ALARM_MASK_FORCED_DOOR_OPEN_UNDER_DOOR_LOCKED_CONDITION_OFFSET (6) +#define EMBER_AF_DL_CREDENTIAL_RULE_MASK_SINGLE (1) +#define EMBER_AF_DL_CREDENTIAL_RULE_MASK_SINGLE_OFFSET (0) +#define EMBER_AF_DL_CREDENTIAL_RULE_MASK_DUAL (2) +#define EMBER_AF_DL_CREDENTIAL_RULE_MASK_DUAL_OFFSET (1) +#define EMBER_AF_DL_CREDENTIAL_RULE_MASK_TRI (4) +#define EMBER_AF_DL_CREDENTIAL_RULE_MASK_TRI_OFFSET (2) #define EMBER_AF_DL_CREDENTIAL_RULES_SUPPORT_SINGLE (1) #define EMBER_AF_DL_CREDENTIAL_RULES_SUPPORT_SINGLE_OFFSET (0) #define EMBER_AF_DL_CREDENTIAL_RULES_SUPPORT_DUAL (2) diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm index 73e16e163c828f..e4e9e6aa700f76 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm @@ -5117,7 +5117,7 @@ new CHIPDefaultSuccessCallbackBridge( ListFreer listFreer; using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; + cppValue = static_cast>(value.unsignedShortValue); auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); @@ -7235,7 +7235,6 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPGroupKeyManagementClusterGroupInfoMapStruct *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].groupId = element_0.groupId.unsignedShortValue; { using ListType_2 = std::remove_reference_tmList[i_0].endpoints)>; @@ -7263,6 +7262,7 @@ new CHIPDefaultSuccessCallbackBridge( auto & definedValue_2 = listHolder_0->mList[i_0].groupName.Emplace(); definedValue_2 = [self asCharSpan:element_0.groupName]; } + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -10664,7 +10664,6 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPOperationalCredentialsClusterNOCStruct *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].noc = [self asByteSpan:element_0.noc]; if (element_0.icac == nil) { listHolder_0->mList[i_0].icac.SetNull(); @@ -10672,6 +10671,7 @@ new CHIPDefaultSuccessCallbackBridge( auto & nonNullValue_2 = listHolder_0->mList[i_0].icac.SetNonNull(); nonNullValue_2 = [self asByteSpan:element_0.icac]; } + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -10710,12 +10710,12 @@ new CHIPDefaultSuccessCallbackBridge( return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (CHIPOperationalCredentialsClusterFabricDescriptor *) value[i_0]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].rootPublicKey = [self asByteSpan:element_0.rootPublicKey]; listHolder_0->mList[i_0].vendorId = element_0.vendorId.unsignedShortValue; listHolder_0->mList[i_0].fabricId = element_0.fabricId.unsignedLongLongValue; listHolder_0->mList[i_0].nodeId = element_0.nodeId.unsignedLongLongValue; listHolder_0->mList[i_0].label = [self asCharSpan:element_0.label]; + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { diff --git a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index 6611ee287ae9c1..68856055668c88 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -326,7 +326,6 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; @@ -349,9 +348,9 @@ class TestAccessControlCluster : public TestCommandBridge { ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { @@ -381,9 +380,9 @@ class TestAccessControlCluster : public TestCommandBridge { ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[2] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).privilege = [NSNumber numberWithUnsignedChar:3]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).authMode = [NSNumber numberWithUnsignedChar:3]; { @@ -413,6 +412,7 @@ class TestAccessControlCluster : public TestCommandBridge { ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -446,8 +446,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(3))); - VerifyOrReturn(CheckValue( - "FabricIndex", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -516,7 +514,7 @@ class TestAccessControlCluster : public TestCommandBridge { .targets[2]) .deviceType)); VerifyOrReturn(CheckValue( - "FabricIndex", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex, 1)); + "FabricIndex", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).privilege, 1)); VerifyOrReturn(CheckValue( @@ -596,7 +594,7 @@ class TestAccessControlCluster : public TestCommandBridge { .targets[2]) .deviceType)); VerifyOrReturn(CheckValue( - "FabricIndex", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).fabricIndex, 1)); + "FabricIndex", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).privilege, 3)); VerifyOrReturn(CheckValue( @@ -675,6 +673,8 @@ class TestAccessControlCluster : public TestCommandBridge { ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[2]) .deviceType)); + VerifyOrReturn(CheckValue( + "FabricIndex", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).fabricIndex, 1)); } NextTest(); @@ -693,14 +693,13 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { @@ -711,6 +710,7 @@ class TestAccessControlCluster : public TestCommandBridge { NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -743,8 +743,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(2))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -754,7 +752,7 @@ class TestAccessControlCluster : public TestCommandBridge { VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets)); VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex, 1)); + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).privilege, 1)); VerifyOrReturn(CheckValue( @@ -763,6 +761,8 @@ class TestAccessControlCluster : public TestCommandBridge { "Subjects", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects)); VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex, 1)); } NextTest(); @@ -781,18 +781,18 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:3]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -824,8 +824,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -834,6 +832,8 @@ class TestAccessControlCluster : public TestCommandBridge { "Subjects", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects)); VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); } NextTest(); @@ -852,18 +852,18 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -895,8 +895,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -905,6 +903,8 @@ class TestAccessControlCluster : public TestCommandBridge { "Subjects", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects)); VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); } NextTest(); @@ -923,14 +923,13 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { @@ -939,6 +938,7 @@ class TestAccessControlCluster : public TestCommandBridge { ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; } ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -970,8 +970,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -980,6 +978,8 @@ class TestAccessControlCluster : public TestCommandBridge { "Subjects", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects)); VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); } NextTest(); @@ -998,14 +998,13 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; @@ -1018,6 +1017,7 @@ class TestAccessControlCluster : public TestCommandBridge { ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -1049,8 +1049,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -1059,6 +1057,8 @@ class TestAccessControlCluster : public TestCommandBridge { "Subjects", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects)); VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); } NextTest(); @@ -1077,14 +1077,13 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { @@ -1112,6 +1111,7 @@ class TestAccessControlCluster : public TestCommandBridge { ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; } ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -1143,8 +1143,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -1153,6 +1151,8 @@ class TestAccessControlCluster : public TestCommandBridge { "Subjects", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects)); VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); } NextTest(); @@ -1171,14 +1171,13 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; @@ -1286,6 +1285,7 @@ class TestAccessControlCluster : public TestCommandBridge { ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -1317,8 +1317,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -1327,6 +1325,8 @@ class TestAccessControlCluster : public TestCommandBridge { "Subjects", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects)); VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); } NextTest(); @@ -1345,11 +1345,11 @@ class TestAccessControlCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; aclArgument = temp_0; } @@ -1382,8 +1382,6 @@ class TestAccessControlCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("ACL", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue( "Privilege", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege, 5)); VerifyOrReturn(CheckValue( @@ -1392,6 +1390,8 @@ class TestAccessControlCluster : public TestCommandBridge { "Subjects", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects)); VerifyOrReturn(CheckValueNull( "Targets", ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex, 1)); } NextTest(); @@ -41047,7 +41047,7 @@ class TestCluster : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"Tes\x00ti\x00ng" length:9]; + octetStringArgument = [[NSData alloc] initWithBytes:"Tes\000ti\000ng" length:9]; [cluster writeAttributeOctetStringWithValue:octetStringArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute OCTET_STRING with embedded null Error: %@", err); @@ -41074,7 +41074,7 @@ class TestCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn( - CheckValueAsString("octet_string", actualValue, [[NSData alloc] initWithBytes:"Tes\x00ti\x00ng" length:9])); + CheckValueAsString("octet_string", actualValue, [[NSData alloc] initWithBytes:"Tes\000ti\000ng" length:9])); } NextTest(); @@ -41090,7 +41090,7 @@ class TestCluster : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"\x0d\x0a\xff\x22\xa0" length:5]; + octetStringArgument = [[NSData alloc] initWithBytes:"\015\012\377\042\240" length:5]; [cluster writeAttributeOctetStringWithValue:octetStringArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute OCTET_STRING with weird chars Error: %@", err); @@ -41117,7 +41117,7 @@ class TestCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValueAsString( - "octet_string", actualValue, [[NSData alloc] initWithBytes:"\x0d\x0a\xff\x22\xa0" length:5])); + "octet_string", actualValue, [[NSData alloc] initWithBytes:"\015\012\377\042\240" length:5])); } NextTest(); @@ -54924,15 +54924,15 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = [NSNumber numberWithUnsignedChar:0]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = - [[NSData alloc] initWithBytes:"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" length:16]; + [[NSData alloc] initWithBytes:"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = [NSNumber numberWithUnsignedLongLong:1110000ULL]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = - [[NSData alloc] initWithBytes:"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" length:16]; + [[NSData alloc] initWithBytes:"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = [NSNumber numberWithUnsignedLongLong:1110001ULL]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = - [[NSData alloc] initWithBytes:"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" length:16]; + [[NSData alloc] initWithBytes:"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = [NSNumber numberWithUnsignedLongLong:1110002ULL]; @@ -54963,15 +54963,15 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = [NSNumber numberWithUnsignedChar:1]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = - [[NSData alloc] initWithBytes:"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" length:16]; + [[NSData alloc] initWithBytes:"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = [NSNumber numberWithUnsignedLongLong:2110000ULL]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = - [[NSData alloc] initWithBytes:"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" length:16]; + [[NSData alloc] initWithBytes:"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = [NSNumber numberWithUnsignedLongLong:2110001ULL]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = - [[NSData alloc] initWithBytes:"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" length:16]; + [[NSData alloc] initWithBytes:"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" length:16]; ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = [NSNumber numberWithUnsignedLongLong:2110002ULL]; @@ -55049,14 +55049,14 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupId = [NSNumber numberWithUnsignedShort:257U]; ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; + ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; temp_0[1] = [[CHIPGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).groupId = [NSNumber numberWithUnsignedShort:258U]; ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).groupKeySetID = [NSNumber numberWithUnsignedShort:418U]; + ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; groupKeyMapArgument = temp_0; } @@ -55092,18 +55092,18 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("GroupKeyMap", [actualValue count], static_cast(2))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("GroupId", ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[0]).groupId, 257U)); VerifyOrReturn(CheckValue("GroupKeySetID", ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[0]).groupKeySetID, 417U)); VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[1]).fabricIndex, 1)); + ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("GroupId", ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[1]).groupId, 258U)); VerifyOrReturn(CheckValue("GroupKeySetID", ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[1]).groupKeySetID, 418U)); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) actualValue[1]).fabricIndex, 1)); } NextTest(); @@ -55131,20 +55131,20 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("GroupTable", [actualValue count], static_cast(2))); - VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("GroupId", ((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[0]).groupId, 257U)); VerifyOrReturn(CheckValueAsString("GroupName", ((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[0]).groupName, @"Group #1")); VerifyOrReturn(CheckValue("FabricIndex", - ((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).fabricIndex, 1)); + ((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("GroupId", ((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).groupId, 258U)); VerifyOrReturn(CheckValueAsString("GroupName", ((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).groupName, @"Group #2")); + VerifyOrReturn(CheckValue("FabricIndex", + ((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).fabricIndex, 1)); } NextTest(); @@ -55710,11 +55710,11 @@ class TestOperationalCredentialsCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("Fabrics", [actualValue count], static_cast(1))); + VerifyOrReturn(CheckValueAsString("Label", + ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label, @"")); VerifyOrReturn(CheckValue("FabricIndex", ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).fabricIndex, ourFabricIndex)); - VerifyOrReturn(CheckValueAsString("Label", - ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label, @"")); } NextTest(); @@ -55776,11 +55776,11 @@ class TestOperationalCredentialsCluster : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("Fabrics", [actualValue count], static_cast(1))); + VerifyOrReturn(CheckValueAsString("Label", + ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label, @"Batcave")); VerifyOrReturn(CheckValue("FabricIndex", ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).fabricIndex, ourFabricIndex)); - VerifyOrReturn(CheckValueAsString("Label", - ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label, @"Batcave")); } NextTest(); @@ -56238,11 +56238,11 @@ class TestBinding : public TestCommandBridge { ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).node = [NSNumber numberWithUnsignedLongLong:1ULL]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).group = [NSNumber numberWithUnsignedShort:1U]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).endpoint = [NSNumber numberWithUnsignedShort:1U]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).cluster = [NSNumber numberWithUnsignedInt:6UL]; + ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; bindingArgument = temp_0; } @@ -56267,19 +56267,19 @@ class TestBinding : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[0]).group = [NSNumber numberWithUnsignedShort:1U]; + ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[1] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).node = [NSNumber numberWithUnsignedLongLong:1ULL]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).endpoint = [NSNumber numberWithUnsignedShort:1U]; ((CHIPBindingClusterTargetStruct *) temp_0[1]).cluster = [NSNumber numberWithUnsignedInt:6UL]; + ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; temp_0[2] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[2]).node = [NSNumber numberWithUnsignedLongLong:2ULL]; ((CHIPBindingClusterTargetStruct *) temp_0[2]).endpoint = [NSNumber numberWithUnsignedShort:1U]; + ((CHIPBindingClusterTargetStruct *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; bindingArgument = temp_0; } @@ -56313,21 +56313,21 @@ class TestBinding : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("Binding", [actualValue count], static_cast(3))); - VerifyOrReturn( - CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("Group", ((CHIPBindingClusterTargetStruct *) actualValue[0]).group, 1U)); VerifyOrReturn( - CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex, 1)); + CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("Node", ((CHIPBindingClusterTargetStruct *) actualValue[1]).node, 1ULL)); VerifyOrReturn( CheckValue("Endpoint", ((CHIPBindingClusterTargetStruct *) actualValue[1]).endpoint, 1U)); VerifyOrReturn( CheckValue("Cluster", ((CHIPBindingClusterTargetStruct *) actualValue[1]).cluster, 6UL)); VerifyOrReturn( - CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex, 1)); + CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex, 1)); VerifyOrReturn(CheckValue("Node", ((CHIPBindingClusterTargetStruct *) actualValue[2]).node, 2ULL)); VerifyOrReturn( CheckValue("Endpoint", ((CHIPBindingClusterTargetStruct *) actualValue[2]).endpoint, 1U)); + VerifyOrReturn( + CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex, 1)); } NextTest(); @@ -56346,9 +56346,9 @@ class TestBinding : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; ((CHIPBindingClusterTargetStruct *) temp_0[0]).node = [NSNumber numberWithUnsignedLongLong:3ULL]; ((CHIPBindingClusterTargetStruct *) temp_0[0]).endpoint = [NSNumber numberWithUnsignedShort:1U]; + ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; bindingArgument = temp_0; } @@ -56382,11 +56382,11 @@ class TestBinding : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("Binding", [actualValue count], static_cast(1))); - VerifyOrReturn( - CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("Node", ((CHIPBindingClusterTargetStruct *) actualValue[0]).node, 3ULL)); VerifyOrReturn( CheckValue("Endpoint", ((CHIPBindingClusterTargetStruct *) actualValue[0]).endpoint, 1U)); + VerifyOrReturn( + CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex, 1)); } NextTest(); @@ -56413,21 +56413,21 @@ class TestBinding : public TestCommandBridge { { id actualValue = value; VerifyOrReturn(CheckValue("Binding", [actualValue count], static_cast(3))); - VerifyOrReturn( - CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("Group", ((CHIPBindingClusterTargetStruct *) actualValue[0]).group, 1U)); VerifyOrReturn( - CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex, 1)); + CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex, 1)); VerifyOrReturn(CheckValue("Node", ((CHIPBindingClusterTargetStruct *) actualValue[1]).node, 1ULL)); VerifyOrReturn( CheckValue("Endpoint", ((CHIPBindingClusterTargetStruct *) actualValue[1]).endpoint, 1U)); VerifyOrReturn( CheckValue("Cluster", ((CHIPBindingClusterTargetStruct *) actualValue[1]).cluster, 6UL)); VerifyOrReturn( - CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex, 1)); + CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex, 1)); VerifyOrReturn(CheckValue("Node", ((CHIPBindingClusterTargetStruct *) actualValue[2]).node, 2ULL)); VerifyOrReturn( CheckValue("Endpoint", ((CHIPBindingClusterTargetStruct *) actualValue[2]).endpoint, 1U)); + VerifyOrReturn( + CheckValue("FabricIndex", ((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex, 1)); } NextTest(); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 6aae4c8c2579f4..921be7ceddb760 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -8767,7 +8767,7 @@ class WriteDoorLockLocalProgrammingFeatures : public WriteAttribute } private: - uint8_t mValue; + chip::BitFlags mValue; }; class WriteDoorLockWrongCodeEntryLimit : public WriteAttribute @@ -8928,7 +8928,7 @@ class WriteDoorLockAlarmMask : public WriteAttribute } private: - uint16_t mValue; + chip::BitFlags mValue; }; class WriteDoorLockKeypadOperationEventMask : public WriteAttribute @@ -8955,7 +8955,7 @@ class WriteDoorLockKeypadOperationEventMask : public WriteAttribute } private: - uint16_t mValue; + chip::BitFlags mValue; }; class WriteDoorLockRemoteOperationEventMask : public WriteAttribute @@ -8982,7 +8982,7 @@ class WriteDoorLockRemoteOperationEventMask : public WriteAttribute } private: - uint16_t mValue; + chip::BitFlags mValue; }; class WriteDoorLockManualOperationEventMask : public WriteAttribute @@ -9009,7 +9009,7 @@ class WriteDoorLockManualOperationEventMask : public WriteAttribute } private: - uint16_t mValue; + chip::BitFlags mValue; }; class WriteDoorLockRFIDOperationEventMask : public WriteAttribute @@ -9036,7 +9036,7 @@ class WriteDoorLockRFIDOperationEventMask : public WriteAttribute } private: - uint16_t mValue; + chip::BitFlags mValue; }; class WriteDoorLockKeypadProgrammingEventMask : public WriteAttribute @@ -9063,7 +9063,7 @@ class WriteDoorLockKeypadProgrammingEventMask : public WriteAttribute } private: - uint16_t mValue; + chip::BitFlags mValue; }; class WriteDoorLockRemoteProgrammingEventMask : public WriteAttribute @@ -9090,7 +9090,7 @@ class WriteDoorLockRemoteProgrammingEventMask : public WriteAttribute } private: - uint16_t mValue; + chip::BitFlags mValue; }; class WriteDoorLockRFIDProgrammingEventMask : public WriteAttribute @@ -9117,7 +9117,7 @@ class WriteDoorLockRFIDProgrammingEventMask : public WriteAttribute } private: - uint16_t mValue; + chip::BitFlags mValue; }; /*----------------------------------------------------------------------------*\ diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 2b02c0cf0555b6..3236459f7962e0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -25,8 +25,6 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.privilege", "privilege", value.isMember("privilege"))); ReturnErrorOnFailure( @@ -35,11 +33,10 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.subjects", "subjects", value.isMember("subjects"))); ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.targets", "targets", value.isMember("targets"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "privilege"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.privilege, value["privilege"])); @@ -52,16 +49,19 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "targets"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.targets, value["targets"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + return CHIP_NO_ERROR; } void ComplexArgumentParser::Finalize(chip::app::Clusters::AccessControl::Structs::AccessControlEntry::Type & request) { - ComplexArgumentParser::Finalize(request.fabricIndex); ComplexArgumentParser::Finalize(request.privilege); ComplexArgumentParser::Finalize(request.authMode); ComplexArgumentParser::Finalize(request.subjects); ComplexArgumentParser::Finalize(request.targets); + ComplexArgumentParser::Finalize(request.fabricIndex); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::BridgedActions::Structs::ActionStruct::Type & request, @@ -545,24 +545,24 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ExtensionEntry.data", "data", value.isMember("data"))); ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("ExtensionEntry.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ExtensionEntry.data", "data", value.isMember("data"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "data"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.data, value["data"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + return CHIP_NO_ERROR; } void ComplexArgumentParser::Finalize(chip::app::Clusters::AccessControl::Structs::ExtensionEntry::Type & request) { - ComplexArgumentParser::Finalize(request.fabricIndex); ComplexArgumentParser::Finalize(request.data); + ComplexArgumentParser::Finalize(request.fabricIndex); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::Type & request, @@ -570,8 +570,6 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.rootPublicKey", "rootPublicKey", value.isMember("rootPublicKey"))); ReturnErrorOnFailure( @@ -580,11 +578,10 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.fabricId", "fabricId", value.isMember("fabricId"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.nodeId", "nodeId", value.isMember("nodeId"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.label", "label", value.isMember("label"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rootPublicKey"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rootPublicKey, value["rootPublicKey"])); @@ -600,17 +597,20 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "label"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.label, value["label"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + return CHIP_NO_ERROR; } void ComplexArgumentParser::Finalize(chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::Type & request) { - ComplexArgumentParser::Finalize(request.fabricIndex); ComplexArgumentParser::Finalize(request.rootPublicKey); ComplexArgumentParser::Finalize(request.vendorId); ComplexArgumentParser::Finalize(request.fabricId); ComplexArgumentParser::Finalize(request.nodeId); ComplexArgumentParser::Finalize(request.label); + ComplexArgumentParser::Finalize(request.fabricIndex); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::GroupKeyManagement::Structs::GroupInfoMapStruct::Type & request, @@ -618,17 +618,14 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("GroupInfoMapStruct.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("GroupInfoMapStruct.groupId", "groupId", value.isMember("groupId"))); ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("GroupInfoMapStruct.endpoints", "endpoints", value.isMember("endpoints"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("GroupInfoMapStruct.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "groupId"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupId, value["groupId"])); @@ -641,15 +638,18 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupName, value["groupName"])); } + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + return CHIP_NO_ERROR; } void ComplexArgumentParser::Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupInfoMapStruct::Type & request) { - ComplexArgumentParser::Finalize(request.fabricIndex); ComplexArgumentParser::Finalize(request.groupId); ComplexArgumentParser::Finalize(request.endpoints); ComplexArgumentParser::Finalize(request.groupName); + ComplexArgumentParser::Finalize(request.fabricIndex); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::GroupKeyManagement::Structs::GroupKeyMapStruct::Type & request, @@ -657,31 +657,31 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("GroupKeyMapStruct.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("GroupKeyMapStruct.groupId", "groupId", value.isMember("groupId"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKeyMapStruct.groupKeySetID", "groupKeySetID", value.isMember("groupKeySetID"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("GroupKeyMapStruct.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "groupId"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupId, value["groupId"])); snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "groupKeySetID"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupKeySetID, value["groupKeySetID"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + return CHIP_NO_ERROR; } void ComplexArgumentParser::Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupKeyMapStruct::Type & request) { - ComplexArgumentParser::Finalize(request.fabricIndex); ComplexArgumentParser::Finalize(request.groupId); ComplexArgumentParser::Finalize(request.groupKeySetID); + ComplexArgumentParser::Finalize(request.fabricIndex); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::Type & request, @@ -904,29 +904,29 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("NOCStruct.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NOCStruct.noc", "noc", value.isMember("noc"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NOCStruct.icac", "icac", value.isMember("icac"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NOCStruct.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "noc"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.noc, value["noc"])); snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "icac"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.icac, value["icac"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + return CHIP_NO_ERROR; } void ComplexArgumentParser::Finalize(chip::app::Clusters::OperationalCredentials::Structs::NOCStruct::Type & request) { - ComplexArgumentParser::Finalize(request.fabricIndex); ComplexArgumentParser::Finalize(request.noc); ComplexArgumentParser::Finalize(request.icac); + ComplexArgumentParser::Finalize(request.fabricIndex); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ThreadNetworkDiagnostics::Structs::NeighborTable::Type & request, @@ -1890,9 +1890,6 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters: ComplexArgumentParser::EnsureMemberExist("TargetStruct.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); - if (value.isMember("node")) { snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "node"); @@ -1917,16 +1914,19 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters: ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.cluster, value["cluster"])); } + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + return CHIP_NO_ERROR; } void ComplexArgumentParser::Finalize(chip::app::Clusters::Binding::Structs::TargetStruct::Type & request) { - ComplexArgumentParser::Finalize(request.fabricIndex); ComplexArgumentParser::Finalize(request.node); ComplexArgumentParser::Finalize(request.group); ComplexArgumentParser::Finalize(request.endpoint); ComplexArgumentParser::Finalize(request.cluster); + ComplexArgumentParser::Finalize(request.fabricIndex); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::TestCluster::Structs::TestFabricScoped::Type & request, @@ -1934,8 +1934,6 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("TestFabricScoped.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TestFabricScoped.fabricSensitiveInt8u", "fabricSensitiveInt8u", value.isMember("fabricSensitiveInt8u"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TestFabricScoped.nullableFabricSensitiveInt8u", @@ -1947,11 +1945,10 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, value.isMember("fabricSensitiveStruct"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist( "TestFabricScoped.fabricSensitiveInt8uList", "fabricSensitiveInt8uList", value.isMember("fabricSensitiveInt8uList"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TestFabricScoped.fabricIndex", "fabricIndex", value.isMember("fabricIndex"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricSensitiveInt8u"); ReturnErrorOnFailure( ComplexArgumentParser::Setup(labelWithMember, request.fabricSensitiveInt8u, value["fabricSensitiveInt8u"])); @@ -1986,12 +1983,14 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ReturnErrorOnFailure( ComplexArgumentParser::Setup(labelWithMember, request.fabricSensitiveInt8uList, value["fabricSensitiveInt8uList"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + return CHIP_NO_ERROR; } void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs::TestFabricScoped::Type & request) { - ComplexArgumentParser::Finalize(request.fabricIndex); ComplexArgumentParser::Finalize(request.fabricSensitiveInt8u); ComplexArgumentParser::Finalize(request.optionalFabricSensitiveInt8u); ComplexArgumentParser::Finalize(request.nullableFabricSensitiveInt8u); @@ -1999,6 +1998,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs:: ComplexArgumentParser::Finalize(request.fabricSensitiveCharString); ComplexArgumentParser::Finalize(request.fabricSensitiveStruct); ComplexArgumentParser::Finalize(request.fabricSensitiveInt8uList); + ComplexArgumentParser::Finalize(request.fabricIndex); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::TestCluster::Structs::TestListStructOctet::Type & request, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 0ecc381437c736..06ba6bbdaac648 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -25,14 +25,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::AccessControl::Structs::AccessControlEntry::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); - return err; - } - } { CHIP_ERROR err = LogValue("Privilege", indent + 1, value.privilege); if (err != CHIP_NO_ERROR) @@ -65,6 +57,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -550,18 +550,18 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + CHIP_ERROR err = LogValue("Data", indent + 1, value.data); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Data'"); return err; } } { - CHIP_ERROR err = LogValue("Data", indent + 1, value.data); + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Data'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); return err; } } @@ -574,14 +574,6 @@ DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); - return err; - } - } { CHIP_ERROR err = LogValue("RootPublicKey", indent + 1, value.rootPublicKey); if (err != CHIP_NO_ERROR) @@ -622,6 +614,14 @@ DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -631,14 +631,6 @@ DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::GroupKeyManagement::Structs::GroupInfoMapStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); - return err; - } - } { CHIP_ERROR err = LogValue("GroupId", indent + 1, value.groupId); if (err != CHIP_NO_ERROR) @@ -663,6 +655,14 @@ DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -673,26 +673,26 @@ DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + CHIP_ERROR err = LogValue("GroupId", indent + 1, value.groupId); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'GroupId'"); return err; } } { - CHIP_ERROR err = LogValue("GroupId", indent + 1, value.groupId); + CHIP_ERROR err = LogValue("GroupKeySetID", indent + 1, value.groupKeySetID); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'GroupId'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'GroupKeySetID'"); return err; } } { - CHIP_ERROR err = LogValue("GroupKeySetID", indent + 1, value.groupKeySetID); + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'GroupKeySetID'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); return err; } } @@ -938,26 +938,26 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + CHIP_ERROR err = LogValue("Noc", indent + 1, value.noc); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Noc'"); return err; } } { - CHIP_ERROR err = LogValue("Noc", indent + 1, value.noc); + CHIP_ERROR err = LogValue("Icac", indent + 1, value.icac); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Noc'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Icac'"); return err; } } { - CHIP_ERROR err = LogValue("Icac", indent + 1, value.icac); + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Icac'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); return err; } } @@ -2041,14 +2041,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Binding::Structs::TargetStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); - return err; - } - } { CHIP_ERROR err = LogValue("Node", indent + 1, value.node); if (err != CHIP_NO_ERROR) @@ -2081,14 +2073,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::TestCluster::Structs::TestFabricScoped::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); { CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); if (err != CHIP_NO_ERROR) @@ -2097,6 +2081,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::TestCluster::Structs::TestFabricScoped::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); { CHIP_ERROR err = LogValue("FabricSensitiveInt8u", indent + 1, value.fabricSensitiveInt8u); if (err != CHIP_NO_ERROR) @@ -2154,6 +2146,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -2445,14 +2445,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const AccessControl::Events::AccessControlEntryChanged::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = DataModelLogger::LogValue("AdminFabricIndex", indent + 1, value.adminFabricIndex); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'AdminFabricIndex'"); - return err; - } - } { CHIP_ERROR err = DataModelLogger::LogValue("AdminNodeID", indent + 1, value.adminNodeID); if (err != CHIP_NO_ERROR) @@ -2485,14 +2477,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const AccessControl::Events::AccessControlExtensionChanged::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); { CHIP_ERROR err = DataModelLogger::LogValue("AdminFabricIndex", indent + 1, value.adminFabricIndex); if (err != CHIP_NO_ERROR) @@ -2501,6 +2485,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const AccessControl::Events::AccessControlExtensionChanged::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); { CHIP_ERROR err = DataModelLogger::LogValue("AdminNodeID", indent + 1, value.adminNodeID); if (err != CHIP_NO_ERROR) @@ -2533,6 +2525,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = DataModelLogger::LogValue("AdminFabricIndex", indent + 1, value.adminFabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'AdminFabricIndex'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -5582,7 +5582,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("MinRFIDCodeLength", 1, value); } case DoorLock::Attributes::CredentialRulesSupport::Id: { - uint8_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("CredentialRulesSupport", 1, value); } @@ -5617,12 +5617,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("OperatingMode", 1, value); } case DoorLock::Attributes::SupportedOperatingModes::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SupportedOperatingModes", 1, value); } case DoorLock::Attributes::DefaultConfigurationRegister::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("DefaultConfigurationRegister", 1, value); } @@ -5647,7 +5647,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("EnablePrivacyModeButton", 1, value); } case DoorLock::Attributes::LocalProgrammingFeatures::Id: { - uint8_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("LocalProgrammingFeatures", 1, value); } @@ -5677,42 +5677,42 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("ExpiringUserTimeout", 1, value); } case DoorLock::Attributes::AlarmMask::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("AlarmMask", 1, value); } case DoorLock::Attributes::KeypadOperationEventMask::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("KeypadOperationEventMask", 1, value); } case DoorLock::Attributes::RemoteOperationEventMask::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("RemoteOperationEventMask", 1, value); } case DoorLock::Attributes::ManualOperationEventMask::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("ManualOperationEventMask", 1, value); } case DoorLock::Attributes::RFIDOperationEventMask::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("RFIDOperationEventMask", 1, value); } case DoorLock::Attributes::KeypadProgrammingEventMask::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("KeypadProgrammingEventMask", 1, value); } case DoorLock::Attributes::RemoteProgrammingEventMask::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("RemoteProgrammingEventMask", 1, value); } case DoorLock::Attributes::RFIDProgrammingEventMask::Id: { - uint16_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("RFIDProgrammingEventMask", 1, value); } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index a2eecf03d9d76c..507785446604c2 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -747,9 +747,8 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(3); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNonNull(); @@ -776,10 +775,10 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[0].targets.Value() = chip::app::DataModel::List(listHolder_3->mList, 3); } + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); listHolder_0->mList[1].subjects.SetNonNull(); { @@ -816,10 +815,10 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[1].targets.Value() = chip::app::DataModel::List(listHolder_3->mList, 3); } + listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[2].fabricIndex = 0; - listHolder_0->mList[2].privilege = static_cast(3); - listHolder_0->mList[2].authMode = static_cast(3); + listHolder_0->mList[2].privilege = static_cast(3); + listHolder_0->mList[2].authMode = static_cast(3); listHolder_0->mList[2].subjects.SetNonNull(); { @@ -856,6 +855,7 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[2].targets.Value() = chip::app::DataModel::List(listHolder_3->mList, 3); } + listHolder_0->mList[2].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 3); @@ -898,7 +898,6 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); @@ -927,8 +926,8 @@ class TestAccessControlClusterSuite : public TestCommand VerifyOrReturn( CheckNoMoreListItems("acl[0].targets.Value()", iter_NaN, 3)); } + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1)); VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); @@ -974,8 +973,8 @@ class TestAccessControlClusterSuite : public TestCommand VerifyOrReturn( CheckNoMoreListItems("acl[1].targets.Value()", iter_NaN, 3)); } + VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3)); VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3)); VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); @@ -1021,6 +1020,7 @@ class TestAccessControlClusterSuite : public TestCommand VerifyOrReturn( CheckNoMoreListItems("acl[2].targets.Value()", iter_NaN, 3)); } + VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); } @@ -1040,15 +1040,14 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); listHolder_0->mList[1].subjects.SetNonNull(); listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(); @@ -1056,6 +1055,7 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[1].targets.Value() = chip::app::DataModel::List(); + listHolder_0->mList[1].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -1098,17 +1098,17 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1)); VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); } @@ -1128,17 +1128,17 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(5); - listHolder_0->mList[1].authMode = static_cast(3); + listHolder_0->mList[1].privilege = static_cast(5); + listHolder_0->mList[1].authMode = static_cast(3); listHolder_0->mList[1].subjects.SetNull(); listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -1182,11 +1182,11 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); } @@ -1206,17 +1206,17 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(1); + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(1); listHolder_0->mList[1].subjects.SetNull(); listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -1260,11 +1260,11 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); } @@ -1284,15 +1284,14 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); listHolder_0->mList[1].subjects.SetNonNull(); { @@ -1302,6 +1301,7 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); } listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -1345,11 +1345,11 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); } @@ -1369,15 +1369,14 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); listHolder_0->mList[1].subjects.SetNull(); listHolder_0->mList[1].targets.SetNonNull(); @@ -1392,6 +1391,7 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[1].targets.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); } + listHolder_0->mList[1].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -1435,11 +1435,11 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); } @@ -1459,15 +1459,14 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); listHolder_0->mList[1].subjects.SetNonNull(); { @@ -1496,6 +1495,7 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 20); } listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -1539,11 +1539,11 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); } @@ -1563,15 +1563,14 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); listHolder_0->mList[1].subjects.SetNull(); listHolder_0->mList[1].targets.SetNonNull(); @@ -1682,6 +1681,7 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[1].targets.Value() = chip::app::DataModel::List(listHolder_3->mList, 20); } + listHolder_0->mList[1].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -1725,11 +1725,11 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); } @@ -1749,11 +1749,11 @@ class TestAccessControlClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(1); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 1); @@ -1796,11 +1796,11 @@ class TestAccessControlClusterSuite : public TestCommand { auto iter_0 = acl.begin(); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); } @@ -6865,8 +6865,15 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnFailureResponse_47(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + { + NextTest(); + } + else + { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } } void OnSuccessResponse_47() { ThrowSuccessResponse(); } @@ -7010,8 +7017,15 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnFailureResponse_53(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + { + NextTest(); + } + else + { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } } void OnSuccessResponse_53() { ThrowSuccessResponse(); } @@ -7082,8 +7096,15 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnFailureResponse_56(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + { + NextTest(); + } + else + { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } } void OnSuccessResponse_56() { ThrowSuccessResponse(); } @@ -7153,8 +7174,15 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnFailureResponse_59(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + { + NextTest(); + } + else + { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } } void OnSuccessResponse_59() { ThrowSuccessResponse(); } @@ -21690,8 +21718,15 @@ class Test_TC_FLW_2_1Suite : public TestCommand void OnFailureResponse_12(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + { + NextTest(); + } + else + { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } } void OnSuccessResponse_12() { ThrowSuccessResponse(); } @@ -44311,8 +44346,15 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand void OnFailureResponse_55(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + { + NextTest(); + } + else + { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } } void OnSuccessResponse_55() { ThrowSuccessResponse(); } @@ -44383,8 +44425,15 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand void OnFailureResponse_58(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + { + NextTest(); + } + else + { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } } void OnSuccessResponse_58() { ThrowSuccessResponse(); } @@ -44430,8 +44479,15 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand void OnFailureResponse_60(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + { + NextTest(); + } + else + { + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } } void OnSuccessResponse_60() { ThrowSuccessResponse(); } @@ -72263,7 +72319,7 @@ class TestClusterSuite : public TestCommand cluster.Associate(mDevices[kIdentityAlpha], endpoint); chip::ByteSpan octetStringArgument; - octetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char("Tes\x00ti\x00nggarbage: not in length on purpose"), 9); + octetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char("Tes\000ti\000nggarbage: not in length on purpose"), 9); ReturnErrorOnFailure(cluster.WriteAttribute( octetStringArgument, this, OnSuccessCallback_108, OnFailureCallback_108)); @@ -72298,7 +72354,7 @@ class TestClusterSuite : public TestCommand void OnSuccessResponse_109(chip::ByteSpan octetString) { VerifyOrReturn( - CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char("Tes\x00ti\x00ng"), 9))); + CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char("Tes\000ti\000ng"), 9))); NextTest(); } @@ -72311,7 +72367,7 @@ class TestClusterSuite : public TestCommand chip::ByteSpan octetStringArgument; octetStringArgument = - chip::ByteSpan(chip::Uint8::from_const_char("\x0d\x0a\xff\x22\xa0garbage: not in length on purpose"), 5); + chip::ByteSpan(chip::Uint8::from_const_char("\015\012\377\042\240garbage: not in length on purpose"), 5); ReturnErrorOnFailure(cluster.WriteAttribute( octetStringArgument, this, OnSuccessCallback_110, OnFailureCallback_110)); @@ -72346,7 +72402,7 @@ class TestClusterSuite : public TestCommand void OnSuccessResponse_111(chip::ByteSpan octetString) { VerifyOrReturn(CheckValueAsString("octetString", octetString, - chip::ByteSpan(chip::Uint8::from_const_char("\x0d\x0a\xff\x22\xa0"), 5))); + chip::ByteSpan(chip::Uint8::from_const_char("\015\012\377\042\240"), 5))); NextTest(); } @@ -90035,8 +90091,8 @@ class TestOperationalCredentialsClusterSuite : public TestCommand { auto iter_0 = fabrics.begin(); VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); } @@ -90105,8 +90161,8 @@ class TestOperationalCredentialsClusterSuite : public TestCommand { auto iter_0 = fabrics.begin(); VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("Batcave", 7))); + VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); } @@ -90896,7 +90952,6 @@ class TestBindingSuite : public TestCommand listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; listHolder_0->mList[1].node.Emplace(); listHolder_0->mList[1].node.Value() = 1ULL; listHolder_0->mList[1].group.Emplace(); @@ -90905,6 +90960,7 @@ class TestBindingSuite : public TestCommand listHolder_0->mList[1].endpoint.Value() = 1U; listHolder_0->mList[1].cluster.Emplace(); listHolder_0->mList[1].cluster.Value() = 6UL; + listHolder_0->mList[1].fabricIndex = 0; bindingArgument = chip::app::DataModel::List(listHolder_0->mList, 2); @@ -90937,23 +90993,23 @@ class TestBindingSuite : public TestCommand auto * listHolder_0 = new ListHolder(3); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; listHolder_0->mList[0].group.Emplace(); listHolder_0->mList[0].group.Value() = 1U; + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; listHolder_0->mList[1].node.Emplace(); listHolder_0->mList[1].node.Value() = 1ULL; listHolder_0->mList[1].endpoint.Emplace(); listHolder_0->mList[1].endpoint.Value() = 1U; listHolder_0->mList[1].cluster.Emplace(); listHolder_0->mList[1].cluster.Value() = 6UL; + listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[2].fabricIndex = 0; listHolder_0->mList[2].node.Emplace(); listHolder_0->mList[2].node.Value() = 2ULL; listHolder_0->mList[2].endpoint.Emplace(); listHolder_0->mList[2].endpoint.Value() = 1U; + listHolder_0->mList[2].fabricIndex = 0; bindingArgument = chip::app::DataModel::List(listHolder_0->mList, 3); @@ -90995,23 +91051,23 @@ class TestBindingSuite : public TestCommand { auto iter_0 = binding.begin(); VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValuePresent("binding[0].group", iter_0.GetValue().group)); VerifyOrReturn(CheckValue("binding[0].group.Value()", iter_0.GetValue().group.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 1)); - VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValuePresent("binding[1].node", iter_0.GetValue().node)); VerifyOrReturn(CheckValue("binding[1].node.Value()", iter_0.GetValue().node.Value(), 1ULL)); VerifyOrReturn(CheckValuePresent("binding[1].endpoint", iter_0.GetValue().endpoint)); VerifyOrReturn(CheckValue("binding[1].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); VerifyOrReturn(CheckValuePresent("binding[1].cluster", iter_0.GetValue().cluster)); VerifyOrReturn(CheckValue("binding[1].cluster.Value()", iter_0.GetValue().cluster.Value(), 6UL)); + VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 2)); - VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValuePresent("binding[2].node", iter_0.GetValue().node)); VerifyOrReturn(CheckValue("binding[2].node.Value()", iter_0.GetValue().node.Value(), 2ULL)); VerifyOrReturn(CheckValuePresent("binding[2].endpoint", iter_0.GetValue().endpoint)); VerifyOrReturn(CheckValue("binding[2].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 3)); } @@ -91031,11 +91087,11 @@ class TestBindingSuite : public TestCommand auto * listHolder_0 = new ListHolder(1); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; listHolder_0->mList[0].node.Emplace(); listHolder_0->mList[0].node.Value() = 3ULL; listHolder_0->mList[0].endpoint.Emplace(); listHolder_0->mList[0].endpoint.Value() = 1U; + listHolder_0->mList[0].fabricIndex = 0; bindingArgument = chip::app::DataModel::List(listHolder_0->mList, 1); @@ -91077,11 +91133,11 @@ class TestBindingSuite : public TestCommand { auto iter_0 = binding.begin(); VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValuePresent("binding[0].node", iter_0.GetValue().node)); VerifyOrReturn(CheckValue("binding[0].node.Value()", iter_0.GetValue().node.Value(), 3ULL)); VerifyOrReturn(CheckValuePresent("binding[0].endpoint", iter_0.GetValue().endpoint)); VerifyOrReturn(CheckValue("binding[0].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 1)); } @@ -91111,23 +91167,23 @@ class TestBindingSuite : public TestCommand { auto iter_0 = binding.begin(); VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValuePresent("binding[0].group", iter_0.GetValue().group)); VerifyOrReturn(CheckValue("binding[0].group.Value()", iter_0.GetValue().group.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 1)); - VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValuePresent("binding[1].node", iter_0.GetValue().node)); VerifyOrReturn(CheckValue("binding[1].node.Value()", iter_0.GetValue().node.Value(), 1ULL)); VerifyOrReturn(CheckValuePresent("binding[1].endpoint", iter_0.GetValue().endpoint)); VerifyOrReturn(CheckValue("binding[1].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); VerifyOrReturn(CheckValuePresent("binding[1].cluster", iter_0.GetValue().cluster)); VerifyOrReturn(CheckValue("binding[1].cluster.Value()", iter_0.GetValue().cluster.Value(), 6UL)); + VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 2)); - VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValuePresent("binding[2].node", iter_0.GetValue().node)); VerifyOrReturn(CheckValue("binding[2].node.Value()", iter_0.GetValue().node.Value(), 2ULL)); VerifyOrReturn(CheckValuePresent("binding[2].endpoint", iter_0.GetValue().endpoint)); VerifyOrReturn(CheckValue("binding[2].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 3)); } @@ -102127,21 +102183,21 @@ class TestGroupMessagingSuite : public TestCommand request.groupKeySet.epochKey0.SetNonNull(); request.groupKeySet.epochKey0.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xafgarbage: not in length on purpose"), + "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime0.SetNonNull(); request.groupKeySet.epochStartTime0.Value() = 1110000ULL; request.groupKeySet.epochKey1.SetNonNull(); request.groupKeySet.epochKey1.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbfgarbage: not in length on purpose"), + "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime1.SetNonNull(); request.groupKeySet.epochStartTime1.Value() = 1110001ULL; request.groupKeySet.epochKey2.SetNonNull(); request.groupKeySet.epochKey2.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcfgarbage: not in length on purpose"), + "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime2.SetNonNull(); request.groupKeySet.epochStartTime2.Value() = 1110002ULL; @@ -102179,21 +102235,21 @@ class TestGroupMessagingSuite : public TestCommand request.groupKeySet.epochKey0.SetNonNull(); request.groupKeySet.epochKey0.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), + "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime0.SetNonNull(); request.groupKeySet.epochStartTime0.Value() = 2220000ULL; request.groupKeySet.epochKey1.SetNonNull(); request.groupKeySet.epochKey1.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xefgarbage: not in length on purpose"), + "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime1.SetNonNull(); request.groupKeySet.epochStartTime1.Value() = 2220001ULL; request.groupKeySet.epochKey2.SetNonNull(); request.groupKeySet.epochKey2.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xffgarbage: not in length on purpose"), + "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime2.SetNonNull(); request.groupKeySet.epochStartTime2.Value() = 2220002ULL; @@ -102232,13 +102288,13 @@ class TestGroupMessagingSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 1; listHolder_0->mList[0].groupId = 257U; listHolder_0->mList[0].groupKeySetID = 417U; + listHolder_0->mList[0].fabricIndex = 1; - listHolder_0->mList[1].fabricIndex = 1; listHolder_0->mList[1].groupId = 258U; listHolder_0->mList[1].groupKeySetID = 418U; + listHolder_0->mList[1].fabricIndex = 1; groupKeyMapArgument = chip::app::DataModel::List( @@ -102271,17 +102327,17 @@ class TestGroupMessagingSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[1].privilege = static_cast(3); - listHolder_0->mList[1].authMode = static_cast(3); + listHolder_0->mList[1].privilege = static_cast(3); + listHolder_0->mList[1].authMode = static_cast(3); listHolder_0->mList[1].subjects.SetNull(); listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -102465,11 +102521,11 @@ class TestGroupMessagingSuite : public TestCommand auto * listHolder_0 = new ListHolder(1); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 1); @@ -103652,21 +103708,21 @@ class TestGroupKeyManagementClusterSuite : public TestCommand request.groupKeySet.epochKey0.SetNonNull(); request.groupKeySet.epochKey0.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xafgarbage: not in length on purpose"), + "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime0.SetNonNull(); request.groupKeySet.epochStartTime0.Value() = 1110000ULL; request.groupKeySet.epochKey1.SetNonNull(); request.groupKeySet.epochKey1.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbfgarbage: not in length on purpose"), + "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime1.SetNonNull(); request.groupKeySet.epochStartTime1.Value() = 1110001ULL; request.groupKeySet.epochKey2.SetNonNull(); request.groupKeySet.epochKey2.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcfgarbage: not in length on purpose"), + "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime2.SetNonNull(); request.groupKeySet.epochStartTime2.Value() = 1110002ULL; @@ -103704,21 +103760,21 @@ class TestGroupKeyManagementClusterSuite : public TestCommand request.groupKeySet.epochKey0.SetNonNull(); request.groupKeySet.epochKey0.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), + "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime0.SetNonNull(); request.groupKeySet.epochStartTime0.Value() = 2110000ULL; request.groupKeySet.epochKey1.SetNonNull(); request.groupKeySet.epochKey1.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xefgarbage: not in length on purpose"), + "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime1.SetNonNull(); request.groupKeySet.epochStartTime1.Value() = 2110001ULL; request.groupKeySet.epochKey2.SetNonNull(); request.groupKeySet.epochKey2.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xffgarbage: not in length on purpose"), + "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime2.SetNonNull(); request.groupKeySet.epochStartTime2.Value() = 2110002ULL; @@ -103800,13 +103856,13 @@ class TestGroupKeyManagementClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 1; listHolder_0->mList[0].groupId = 257U; listHolder_0->mList[0].groupKeySetID = 417U; + listHolder_0->mList[0].fabricIndex = 1; - listHolder_0->mList[1].fabricIndex = 1; listHolder_0->mList[1].groupId = 258U; listHolder_0->mList[1].groupKeySetID = 418U; + listHolder_0->mList[1].fabricIndex = 1; groupKeyMapArgument = chip::app::DataModel::List( @@ -103849,13 +103905,13 @@ class TestGroupKeyManagementClusterSuite : public TestCommand { auto iter_0 = groupKeyMap.begin(); VerifyOrReturn(CheckNextListItemDecodes("groupKeyMap", iter_0, 0)); - VerifyOrReturn(CheckValue("groupKeyMap[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("groupKeyMap[0].groupId", iter_0.GetValue().groupId, 257U)); VerifyOrReturn(CheckValue("groupKeyMap[0].groupKeySetID", iter_0.GetValue().groupKeySetID, 417U)); + VerifyOrReturn(CheckValue("groupKeyMap[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("groupKeyMap", iter_0, 1)); - VerifyOrReturn(CheckValue("groupKeyMap[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("groupKeyMap[1].groupId", iter_0.GetValue().groupId, 258U)); VerifyOrReturn(CheckValue("groupKeyMap[1].groupKeySetID", iter_0.GetValue().groupKeySetID, 418U)); + VerifyOrReturn(CheckValue("groupKeyMap[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("groupKeyMap", iter_0, 2)); } @@ -103885,17 +103941,17 @@ class TestGroupKeyManagementClusterSuite : public TestCommand { auto iter_0 = groupTable.begin(); VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 0)); - VerifyOrReturn(CheckValue("groupTable[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("groupTable[0].groupId", iter_0.GetValue().groupId, 257U)); VerifyOrReturn(CheckValuePresent("groupTable[0].groupName", iter_0.GetValue().groupName)); VerifyOrReturn(CheckValueAsString("groupTable[0].groupName.Value()", iter_0.GetValue().groupName.Value(), chip::CharSpan("Group #1", 8))); + VerifyOrReturn(CheckValue("groupTable[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 1)); - VerifyOrReturn(CheckValue("groupTable[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("groupTable[1].groupId", iter_0.GetValue().groupId, 258U)); VerifyOrReturn(CheckValuePresent("groupTable[1].groupName", iter_0.GetValue().groupName)); VerifyOrReturn(CheckValueAsString("groupTable[1].groupName.Value()", iter_0.GetValue().groupName.Value(), chip::CharSpan("Group #2", 8))); + VerifyOrReturn(CheckValue("groupTable[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckNoMoreListItems("groupTable", iter_0, 2)); } @@ -106344,21 +106400,21 @@ class TestGroupDemoConfigSuite : public TestCommand request.groupKeySet.epochKey0.SetNonNull(); request.groupKeySet.epochKey0.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xafgarbage: not in length on purpose"), + "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime0.SetNonNull(); request.groupKeySet.epochStartTime0.Value() = 1110000ULL; request.groupKeySet.epochKey1.SetNonNull(); request.groupKeySet.epochKey1.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbfgarbage: not in length on purpose"), + "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime1.SetNonNull(); request.groupKeySet.epochStartTime1.Value() = 1110001ULL; request.groupKeySet.epochKey2.SetNonNull(); request.groupKeySet.epochKey2.Value() = chip::ByteSpan(chip::Uint8::from_const_char( - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcfgarbage: not in length on purpose"), + "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), 16); request.groupKeySet.epochStartTime2.SetNonNull(); request.groupKeySet.epochStartTime2.Value() = 1110002ULL; @@ -106397,9 +106453,9 @@ class TestGroupDemoConfigSuite : public TestCommand auto * listHolder_0 = new ListHolder(1); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 1; listHolder_0->mList[0].groupId = 257U; listHolder_0->mList[0].groupKeySetID = 417U; + listHolder_0->mList[0].fabricIndex = 1; groupKeyMapArgument = chip::app::DataModel::List( @@ -106432,15 +106488,14 @@ class TestGroupDemoConfigSuite : public TestCommand auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].fabricIndex = 1; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 1; - listHolder_0->mList[1].fabricIndex = 1; - listHolder_0->mList[1].privilege = static_cast(3); - listHolder_0->mList[1].authMode = static_cast(3); + listHolder_0->mList[1].privilege = static_cast(3); + listHolder_0->mList[1].authMode = static_cast(3); listHolder_0->mList[1].subjects.SetNonNull(); { @@ -106450,6 +106505,7 @@ class TestGroupDemoConfigSuite : public TestCommand listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); } listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 1; aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2);