diff --git a/.clang-tidy b/.clang-tidy index b494558e513460..fcb62d5d505d32 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -35,6 +35,7 @@ Checks: > -clang-analyzer-cplusplus.Move, -clang-analyzer-deadcode.DeadStores, -clang-analyzer-nullability.NullablePassedToNonnull, + -clang-analyzer-optin.core.EnumCastOutOfRange, -clang-analyzer-optin.cplusplus.UninitializedObject, -clang-analyzer-optin.cplusplus.VirtualCall, -clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker, diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 94ad9314b9a56c..4d5be76434e8f8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,7 @@ "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], - "initializeCommand": ".devcontainer/build.sh --tag matter-dev-environment:local --version 22", + "initializeCommand": "bash .devcontainer/build.sh --tag matter-dev-environment:local --version 22", "image": "matter-dev-environment:local", "remoteUser": "vscode", "customizations": { diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 65b1c2a93da0e8..00000000000000 --- a/.flake8 +++ /dev/null @@ -1,6 +0,0 @@ -[flake8] -max-line-length = 132 -exclude = third_party - .* - out/* - ./examples/common/QRCode/* diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 58a06086679e06..018ed267925642 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -14,29 +14,19 @@ abfb ABI ABIs ables -AccessControl -AccessControlEntry +accesscontrol accessor Accessors -AccountLogin acdbc ack ACKed ACL ACLs actdiag -AdapterAddress -AdapterName adb AddNOC -AddOrUpdateThreadNetwork -AddOrUpdateWiFiNetwork addr -AddResponse -AddThreadNetwork -AddStatus adk -AdministratorCommissioning adoc adr AdvAutonomous @@ -48,7 +38,6 @@ AE aef AES AIDL -AlarmCode algs alloc Ameba @@ -61,15 +50,12 @@ AnnounceOTAProvider AnnounceOTAProviderRequest APIs apk -AppConfig AppImpl AppleTV appliable -ApplianceControl applianceeventsandalert ApplianceIdentification appliancestatistics -ApplicationBasic ApplicationId ApplicationIdentifier ApplicationLauncher @@ -171,7 +157,6 @@ BRD breakpoint bredr BridgedDeviceBasicInformation -bridgedLightEndpoint bringup BroadcastReceiver BromateConcentrationMeasurement @@ -259,9 +244,6 @@ CLIs cloudbuild CLRF clusterAttrs -clusterId -clusterList -clusterListName ClusterName ClusterObjectTests ClusterRevision @@ -315,7 +297,6 @@ ContentApp's ContentAppPlatform ContentLaunch ContentLauncher -continuousHinting contrib controllee conv @@ -382,7 +363,6 @@ DefaultOTARequestor DefaultOTARequestorDriver DefaultOTARequestorStorage DefaultSuccess -defaultValue definedValue DehumidificationControl DelayedActionTime @@ -415,9 +395,7 @@ DeviceLayer DeviceNetworkProvisioningDelegate DeviceNetworkProvisioningDelegateImpl DevicePairingDelegate -deviceSoftwareVersionModel DeviceTemperatureConfiguration -deviceType DevKitC DevKitM devtype @@ -487,6 +465,7 @@ EchoMessage EchoRequests EchoResponse EchoService +ECW edaf edc EDR @@ -511,8 +490,6 @@ EnableNetwork EnableWiFiNetwork endian EndpointId -endpointName -endsWith eno entrypoint enum @@ -523,6 +500,7 @@ epochStartTime eq errorValue esd +espcoredump ESPPORT Espressif esptool @@ -579,7 +557,6 @@ FlowMeasurement FluorideConcentrationMeasurement focusable forkpty -formatOnSave FOTA FreeRTOS FreeRTOSConfig @@ -613,7 +590,6 @@ GetIP getManualTests GetSafeAttributePersistenceProvider getstarted -getTests GH ghcr ghp @@ -638,8 +614,6 @@ graphviz Groupcast GroupId GroupKeyManagement -groupKeySecurityPolicy -groupKeySetID groupsettings gsdk gtk @@ -693,8 +667,6 @@ ifconfig ifdef ifdefs IGMP -ignoreApplyUpdate -ignoreQueryImage ihex IlluminanceMeasurement IM @@ -767,6 +739,7 @@ kCase Kconfig kDacPublicKey KeypadInput +keypair keyset kGroup kInvalidCommandId @@ -913,6 +886,7 @@ mlan MLD mmevk moal +Mobly ModeSelect modprobe Modustoolbox @@ -977,6 +951,7 @@ nrfdks nrfutil nrfxlib NTAG +NTP nullable nullptr NUM @@ -1042,6 +1017,7 @@ OTBR otcli outform outgoingCommands +overridable OxygenConcentrationMeasurement OzoneConcentrationMeasurement PAA @@ -1080,6 +1056,7 @@ perfetto periodicQueryTimeout pexpect pickString +PICSCODE PID Pigweed PinCode @@ -1395,6 +1372,7 @@ TestGenExample TestGroupDemoConfig TestMultiRead TestName +TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke TESTPASSWD TestPICS TESTSSID @@ -1462,6 +1440,7 @@ ttymxc ttyUSB TurbidityConcentrationMeasurement TvCasting +TVOC tvOS TXD txt @@ -1621,4 +1600,4 @@ zephyrproject zhengyaohan Zigbee zigbeealliance -zigbeethread \ No newline at end of file +zigbeethread diff --git a/.github/actions/bootstrap-cache/action.yaml b/.github/actions/bootstrap-cache/action.yaml index af0d09819a5e26..9a883ecf22da79 100644 --- a/.github/actions/bootstrap-cache/action.yaml +++ b/.github/actions/bootstrap-cache/action.yaml @@ -1,9 +1,9 @@ name: Bootstrap cache -description: Bootstrap cache +description: Bootstrap cache (deprecated) runs: using: "composite" steps: - - uses: Wandalen/wretry.action@v1.3.0 + - uses: Wandalen/wretry.action@v1.4.10 name: Bootstrap cache continue-on-error: true with: diff --git a/.github/actions/bootstrap/action.yaml b/.github/actions/bootstrap/action.yaml index 8f94830b8c0e51..749dcb739b9854 100644 --- a/.github/actions/bootstrap/action.yaml +++ b/.github/actions/bootstrap/action.yaml @@ -5,9 +5,73 @@ inputs: description: "Platform name" required: false default: none + bootstrap-log-name: + description: "Bootstrap log name" + required: false + default: bootstrap-logs-${{ github.job }} +outputs: + cache-hit: + description: "Bootstrap environment was restored from cache" + value: ${{ fromJSON(steps.restore.outputs.outputs).cache-hit }} # dynamic action returns all outputs in `outputs` + runs: using: "composite" steps: - - name: Bootstrap + - name: Determine bootstrap cache configuration + id: prepare + shell: bash + run: | + # Determine bootstrap cache configuration + # In addition to the various setup files, the work directory matters as well, + # because the bootstrapped Pigweed environment contains absolute paths. + echo "Calculating bootstrap cache key for '$PWD'" + FILES_HASH="${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }}" + FINAL_HASH="$(echo "$PWD:$FILES_HASH" | shasum -a 256 | cut -d' ' -f1)" + echo key="${RUNNER_OS}-${RUNNER_ARCH}-${{ inputs.platform }}-${FINAL_HASH}" | tee -a "$GITHUB_OUTPUT" + + # Split caches across backends + case "$RUNNER_OS" in + macOS) echo backend=actions;; + *) echo backend=buildjet;; + esac | tee -a "$GITHUB_OUTPUT" + + - name: Bootstrap from cache + id: restore + uses: ./.github/actions/dynamic + continue-on-error: true + with: + action: ${{ steps.prepare.outputs.backend }}/cache/restore@v4 + with: | + key: ${{ steps.prepare.outputs.key }} + path: | + .environment + build_overrides/pigweed_environment.gni + + - name: Run bootstrap + if: ${{ fromJSON(steps.restore.outputs.outputs).cache-hit != 'true' }} + env: + PW_NO_CIPD_CACHE_DIR: 1 + PW_ENVSETUP_NO_BANNER: 1 shell: bash - run: bash scripts/bootstrap.sh -p all,${{ inputs.platform }} + run: source scripts/bootstrap.sh -p all,${{ inputs.platform }} + + - name: Save bootstrap cache + uses: ./.github/actions/dynamic + if: ${{ fromJSON(steps.restore.outputs.outputs).cache-hit != 'true' }} + continue-on-error: true + with: + action: ${{ steps.prepare.outputs.backend }}/cache/save@v4 + with: | + key: ${{ steps.prepare.outputs.key }} + path: | + .environment + build_overrides/pigweed_environment.gni + + - name: Upload bootstrap logs + uses: actions/upload-artifact@v4 + if: ${{ always() && !env.ACT && fromJSON(steps.restore.outputs.outputs).cache-hit != 'true' }} + with: + name: ${{ inputs.bootstrap-log-name }} + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log diff --git a/.github/actions/checkout-submodules-and-bootstrap/action.yaml b/.github/actions/checkout-submodules-and-bootstrap/action.yaml index 8ddaec14e7bc47..df3fdff1e02ce4 100644 --- a/.github/actions/checkout-submodules-and-bootstrap/action.yaml +++ b/.github/actions/checkout-submodules-and-bootstrap/action.yaml @@ -11,10 +11,12 @@ inputs: bootstrap-log-name: description: "Bootstrap log name" required: false - default: bootstrap-logs + default: bootstrap-logs-${{ github.job }} runs: using: "composite" steps: + - name: Maximize runner disk + uses: ./.github/actions/maximize-runner-disk - name: Dump disk info uses: ./.github/actions/dump-disk-info - name: Set git safe directory for local act runs @@ -24,18 +26,18 @@ runs: with: platform: ${{ inputs.platform }} extra-parameters: ${{ inputs.extra-submodule-parameters }} - - name: Bootstrap Cache - uses: ./.github/actions/bootstrap-cache - name: Bootstrap uses: ./.github/actions/bootstrap - env: - PW_NO_CIPD_CACHE_DIR: Y with: platform: ${{ inputs.platform }} + bootstrap-log-name: ${{ inputs.bootstrap-log-name }} - name: Dump disk info after checkout submodule & Bootstrap shell: bash run: scripts/dump_diskspace_info.sh - - name: Upload Bootstrap Logs - uses: ./.github/actions/upload-bootstrap-logs - with: - bootstrap-log-name: ${{ inputs.bootstrap-log-name }} + - name: Work around TSAN ASLR issues + if: runner.os == 'Linux' && !env.ACT + shell: bash + run: | + # See https://stackoverflow.com/a/77856955/2365113 + if [[ "$UID" == 0 ]]; then function sudo() { "$@"; }; fi + sudo sysctl vm.mmap_rnd_bits=28 diff --git a/.github/actions/checkout-submodules/action.yaml b/.github/actions/checkout-submodules/action.yaml index 429fb1a5427011..e180a8c49458a2 100644 --- a/.github/actions/checkout-submodules/action.yaml +++ b/.github/actions/checkout-submodules/action.yaml @@ -11,7 +11,7 @@ inputs: runs: using: "composite" steps: - - uses: Wandalen/wretry.action@v1.3.0 + - uses: Wandalen/wretry.action@v1.4.10 name: Checkout submodules with: command: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform ${{ inputs.platform }} ${{ inputs.extra-parameters }} diff --git a/.github/actions/dynamic/action.yaml b/.github/actions/dynamic/action.yaml new file mode 100644 index 00000000000000..7cee233c4f4ce2 --- /dev/null +++ b/.github/actions/dynamic/action.yaml @@ -0,0 +1,38 @@ +name: Dynamic +description: Dynamically resolves another GitHub action +inputs: + action: + description: Action reference + required: true + with: + description: Action inputs as multi-line YAML string + required: false + default: "" +outputs: + outputs: + description: JSON object of outputs from the action + value: ${{ steps.run.outputs.outputs }} +runs: + using: composite + steps: + - name: Instantiate + shell: bash + run: | + # Dynamically invoke ${{ inputs.action }} + with='${{ inputs.with }}' + [[ -z "$with" ]] || with="$(echo ' with:'; sed -e 's/^/ /' <<<"$with")" + mkdir -p ./.tmp/dynamic-action-instance + cat <./.tmp/dynamic-action-instance/action.yaml + runs: + using: composite + steps: + - id: run + uses: ${{ inputs.action }} + $with + outputs: + outputs: + value: $(echo '$'){{ toJSON(steps.run.outputs) }} + END + - name: Run + id: run + uses: ./.tmp/dynamic-action-instance diff --git a/.github/actions/maximize-runner-disk/action.yaml b/.github/actions/maximize-runner-disk/action.yaml new file mode 100644 index 00000000000000..d71ba3646d3279 --- /dev/null +++ b/.github/actions/maximize-runner-disk/action.yaml @@ -0,0 +1,48 @@ +name: Maximize runner disk +description: Free up disk space on the github runner +runs: + using: "composite" + steps: + - name: Free up disk space on the github runner + if: runner.os == 'Linux' && !env.ACT + shell: bash + run: | + # maximize-runner-disk + # Directories to prune to free up space. Candidates: + # 1.6G /usr/share/dotnet + # 1.1G /usr/local/lib/android/sdk/platforms + # 1000M /usr/local/lib/android/sdk/build-tools + # 8.9G /usr/local/lib/android/sdk + # This list can be amended later to change the trade-off between the amount of + # disk space freed up, and how long it takes to do so (deleting many files is slow). + prune=(/usr/share/dotnet /usr/local/lib/android/sdk/platforms /usr/local/lib/android/sdk/build-tools) + + if [[ "$UID" -eq 0 && -d /__w ]]; then + root=/runner-root-volume + if [[ ! -d "$root" ]]; then + echo "Unable to maximize disk space, job is running inside a container and $root is not mounted" + exit 0 + fi + function sudo() { "$@"; } # we're already root (and sudo is probably unavailable) + elif [[ "$UID" -ne 0 && "$RUNNER_ENVIRONMENT" == github-hosted ]]; then + root= + else + echo "Unable to maximize disk space, unknown runner environment" + exit 0 + fi + + echo "Freeing up runner disk space on ${root:-/}" + function avail() { df -k --output=avail "${root:-/}" | grep '^[0-9]*$'; } + function now() { date '+%s'; } + before="$(avail)" start="$(now)" + for dir in "${prune[@]}"; do + if [[ -d "${root}${dir}" ]]; then + echo "- $dir" + # du -sh -- "${root}${dir}" + sudo rm -rf -- "${root}${dir}" + else + echo "- $dir (not found)" + fi + done + after="$(avail)" end="$(now)" + echo "Done, freed up $(( (after - before) / 1024 ))M of disk space in $(( end - start )) seconds." diff --git a/.github/actions/perform-codeql-analysis/action.yaml b/.github/actions/perform-codeql-analysis/action.yaml index af12a9e716ee61..f1caf10dc3df1c 100644 --- a/.github/actions/perform-codeql-analysis/action.yaml +++ b/.github/actions/perform-codeql-analysis/action.yaml @@ -27,7 +27,7 @@ runs: with: sarif_file: "sarif-results/${{ inputs.language }}.sarif" - name: Upload loc as a Build Artifact - uses: actions/upload-artifact@v2.2.0 + uses: actions/upload-artifact@v4 with: name: sarif-results path: sarif-results diff --git a/.github/actions/upload-bootstrap-logs/action.yaml b/.github/actions/upload-bootstrap-logs/action.yaml deleted file mode 100644 index 85209c7302f2a5..00000000000000 --- a/.github/actions/upload-bootstrap-logs/action.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Upload bootstrap logs -description: Upload bootstrap logs -inputs: - bootstrap-log-name: - description: "Bootstrap log name" - required: false - default: bootstrap-logs -runs: - using: "composite" - steps: - - name: Uploading bootstrap logs - uses: actions/upload-artifact@v3 - if: ${{ always() && !env.ACT }} - with: - name: ${{ inputs.bootstrap-log-name }} - path: | - .environment/gn_out/.ninja_log - .environment/pigweed-venv/*.log diff --git a/.github/actions/upload-size-reports/action.yaml b/.github/actions/upload-size-reports/action.yaml index c71312ae6578ee..41fe8c820c7cc0 100644 --- a/.github/actions/upload-size-reports/action.yaml +++ b/.github/actions/upload-size-reports/action.yaml @@ -9,7 +9,7 @@ runs: using: "composite" steps: - name: Uploading Size Reports - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !env.ACT }} with: name: Size,${{ inputs.platform-name }}-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 8f04e49f961498..148426d99ccd6b 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -14,6 +14,7 @@ name: Bloat Check on: + workflow_dispatch: schedule: - cron: "*/5 * * * *" @@ -33,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 23dd3d3eb0f309..1da7dd09665706 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -40,8 +40,9 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: + - "/:/runner-root-volume" - "/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" @@ -135,8 +136,9 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: + - "/:/runner-root-volume" - "/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" @@ -221,6 +223,7 @@ jobs: run: | ./scripts/run_in_build_env.sh "./scripts/codepregen.py ./zzz_pregenerated" mv scripts/codegen.py scripts/codegen.py.renamed + mv scripts/tools/zap/generate.py scripts/tools/zap/generate.py.renamed - name: Clean output run: rm -rf ./out - name: Build using build_examples.py (pregen) @@ -232,18 +235,11 @@ jobs: --pregen-dir ./zzz_pregenerated \ build \ " - - name: Check no code generation in output - run: | - CNT=$(find out -name "CHIPClusters.h" | wc -l) - if [ "${CNT}" != "0" ]; then - echo "ERROR: found unexpected generated files:" - find out -name "CHIPClusters.h" - exit 1 - fi - name: Undo code pre-generation changes (make compile time codegen work again) run: | rm -rf ./zzz_pregenerated mv scripts/codegen.py.renamed scripts/codegen.py + mv scripts/tools/zap/generate.py.renamed scripts/tools/zap/generate.py - name: Run fake linux tests with build_examples run: | ./scripts/run_in_build_env.sh \ @@ -283,8 +279,9 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: + - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -343,8 +340,9 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: + - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -451,8 +449,9 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: + - "/:/runner-root-volume" - "/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/chef.yaml b/.github/workflows/chef.yaml index 3432fdc9a09779..c2c4a777bde7d3 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 options: --user root steps: @@ -54,7 +54,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:35 + image: ghcr.io/project-chip/chip-build-esp32:41 options: --user root steps: @@ -75,7 +75,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:35 + image: ghcr.io/project-chip/chip-build-nrf-platform:41 options: --user root steps: @@ -96,7 +96,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:35 + image: ghcr.io/project-chip/chip-build-telink:41 options: --user root steps: diff --git a/.github/workflows/cherry-picks.yaml b/.github/workflows/cherry-picks.yaml index 6d9b5339b40b9e..a062aa5fcf9b87 100644 --- a/.github/workflows/cherry-picks.yaml +++ b/.github/workflows/cherry-picks.yaml @@ -14,7 +14,6 @@ jobs: (github.event.pull_request.merged == true) && ( (contains(github.event.pull_request.labels.*.name, 'sve')) - || (contains(github.event.pull_request.labels.*.name, 'spec')) || (contains(github.event.pull_request.labels.*.name, 'request sve')) || (contains(github.event.pull_request.labels.*.name, 'cert blocker')) ) @@ -27,11 +26,12 @@ jobs: uses: carloscastrojumo/github-cherry-pick-action@v1.0.9 with: token: ${{ secrets.MATTER_PAT }} - branch: sve-2 + branch: 1.3-sve labels: | sve cherry pick reviewers: | woody-apple andy31415 + raju-apple env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 9f1bfc207f92c8..919085ac77ee0f 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -40,7 +40,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: ghcr.io/project-chip/chip-build-cirque:35 + # image: ghcr.io/project-chip/chip-build-cirque:41 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" @@ -57,6 +57,7 @@ jobs: with: platform: linux + # TODO: Is what's being cached here actually compatible with a regular bootstrap? - name: Bootstrap Cache uses: ./.github/actions/bootstrap-cache - name: Bootstrap Cirque @@ -71,7 +72,7 @@ jobs: - name: Get Cirque Bootstrap cache key id: cirque-bootstrap-cache-key run: echo "val=$(scripts/tests/cirque_tests.sh cachekeyhash)" >> $GITHUB_OUTPUT - - uses: Wandalen/wretry.action@v1.4.4 + - uses: Wandalen/wretry.action@v1.4.10 name: Cirque Bootstrap cache if: ${{ !env.ACT }} continue-on-error: true diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 05943be5b0e155..56fd5856428e10 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -49,7 +49,7 @@ jobs: LSAN_OPTIONS: detect_leaks=1 malloc_context_size=40 suppressions=scripts/tests/chiptest/lsan-mac-suppressions.txt if: github.actor != 'restyled-io[bot]' - runs-on: macos-latest + runs-on: macos-13 steps: - name: Checkout @@ -100,6 +100,7 @@ jobs: --target darwin-x64-bridge-${BUILD_VARIANT} \ --target darwin-x64-lit-icd-${BUILD_VARIANT} \ --target darwin-x64-microwave-oven-${BUILD_VARIANT} \ + --target darwin-x64-rvc-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -120,6 +121,7 @@ jobs: --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ --bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/darwin-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Run OTA Test run: | diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index 2d7443f9e9758c..6e12f1df3e11ed 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -26,64 +26,68 @@ concurrency: env: CHIP_NO_LOG_TIMESTAMPS: true - -jobs: - darwin: - name: Build Darwin +jobs: + framework: + name: Build framework if: github.actor != 'restyled-io[bot]' - runs-on: macos-latest - + runs-on: macos-13 + strategy: + matrix: + options: # We don't need a full matrix + - flavor: macos-release-availability + arguments: -sdk macosx -configuration Release WARNING_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new' + - flavor: ios-release + arguments: -sdk iphoneos -configuration Release WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' + - flavor: ios-debug + arguments: -sdk iphoneos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' + - flavor: tvos-debug + arguments: -sdk appletvos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' + - flavor: watchos-debug + arguments: -sdk watchos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Environment - run: brew install python@3.9 - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: platform: darwin + bootstrap-log-name: bootstrap-logs-framework-${{ matrix.options.flavor }} - name: Block zap-cli from being used - # xcodebuild is NOT expected to require zap-cli - run: scripts/run_in_build_env.sh 'D=$(dirname $(which zap-cli)) && mv $D/zap-cli $D/zap-cli.moved' - - name: Validate zap-cli is NOT available - # run_in_build_env.sh is used to ensure PATH is set to something that would otherwise find zap-cli - run: scripts/run_in_build_env.sh '(zap-cli --version && exit 1) || exit 0' - - name: Run iOS Build Debug - working-directory: src/darwin/Framework - # Disable availability annotations, since we are not building a system - # Matter.framework. - run: xcodebuild -target "Matter" -sdk iphoneos -configuration Debug GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' - - name: Run iOS Build Release - working-directory: src/darwin/Framework - # Disable availability annotations, since we are not building a system - # Matter.framework. - run: xcodebuild -target "Matter" -sdk iphoneos -configuration Release GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' - - name: Clean Build - run: xcodebuild clean - working-directory: src/darwin/Framework - - name: Delete Defaults - run: defaults delete com.apple.dt.xctest.tool - continue-on-error: true - - name: Run macOS Build - # Enable -Werror by hand here, because the Xcode config can't - # enable it for various reasons. Keep whatever Xcode settings - # for OTHER_CFLAGS exist by using ${inherited}. - # - # Enable -Wconversion by hand as well, because it seems to not be - # enabled by default in the Xcode config. - # - # Disable availability annotations, since we are not building a system - # Matter.framework. - run: xcodebuild -target "Matter" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' - working-directory: src/darwin/Framework - - name: Clean Build - run: xcodebuild clean + env: + PW_ENVSETUP_NO_BANNER: 1 + run: | + # Framework builds are NOT expected to require zap-cli + scripts/run_in_build_env.sh 'rm -- "$(which zap-cli)"' + # run_in_build_env.sh is used to ensure PATH is set to something that would otherwise find zap-cli + scripts/run_in_build_env.sh '(zap-cli --version && exit 1) || exit 0' + - name: Build working-directory: src/darwin/Framework - - name: Make zap-cli work again - run: scripts/run_in_build_env.sh 'D=$(dirname $(which zap-cli.moved)) && mv $D/zap-cli.moved $D/zap-cli' - - name: Validate zap-cli is again available - run: scripts/run_in_build_env.sh 'zap-cli --version' + run: xcodebuild -target "Matter" ${{ matrix.options.arguments }} + + tests: + name: Run framework tests + if: github.actor != 'restyled-io[bot]' + needs: [ framework ] # serialize to avoid running to many parallel macos runners + runs-on: macos-13 + strategy: + matrix: + options: # We don't need a full matrix + - flavor: asan + arguments: -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES + - flavor: asan-global-storage + arguments: -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES + defines: MTR_PER_CONTROLLER_STORAGE_ENABLED=0 + - flavor: tsan + arguments: -enableThreadSanitizer YES + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: darwin + bootstrap-log-name: bootstrap-logs-framework-${{ matrix.options.flavor }} - name: Build example All Clusters Server run: | scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug chip_config_network_layer_ble=false @@ -93,47 +97,49 @@ jobs: - name: Build example OTA Requestor run: | scripts/examples/gn_build_example.sh examples/ota-requestor-app/linux out/debug/ota-requestor-app chip_config_network_layer_ble=false non_spec_compliant_ota_action_delay_floor=0 - - name: Delete Defaults - run: defaults delete com.apple.dt.xctest.tool - continue-on-error: true - name: Run Framework Tests # For now disable unguarded-availability-new warnings because we # internally use APIs that we are annotating as only available on # new enough versions. Maybe we should change out deployment # target versions instead? + working-directory: src/darwin/Framework run: | mkdir -p /tmp/darwin/framework-tests - ../../../out/debug/chip-all-clusters-app --interface-id -1 > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) & + echo "This is a simple log" > /tmp/darwin/framework-tests/end_user_support_log.txt + ../../../out/debug/chip-all-clusters-app --interface-id -1 --end_user_support_log /tmp/darwin/framework-tests/end_user_support_log.txt > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) & ../../../out/debug/chip-all-clusters-app --interface-id -1 --dac_provider ../../../credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json --product-id 32768 --discriminator 3839 --secured-device-port 5539 --KVS /tmp/chip-all-clusters-app-kvs2 > >(tee /tmp/darwin/framework-tests/all-cluster-app-origin-vid.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-origin-vid-err.log >&2) & - # Disable BLE because the app does not have the permission to use - # it and that may crash the CI. - # - # -enableUndefinedBehaviorSanitizer instruments the code in Matter.framework, - # but to instrument the code in the underlying libCHIP we need to pass CHIP_IS_UBSAN=YES - TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_UBSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'> >(tee /tmp/darwin/framework-tests/darwin-tests-asan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-err.log >&2) - # And the same thing, but with MTR_PER_CONTROLLER_STORAGE_ENABLED turned off, so we test that it does not break for now. - TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_UBSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1 MTR_PER_CONTROLLER_STORAGE_ENABLED=0' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-controller-storage.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-controller-storage-err.log >&2) - # And the same thing, but with MTR_NO_AVAILABILITY not turned on. This requires -Wno-unguarded-availability-new to avoid availability errors. - TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new' CHIP_IS_UBSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited}' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-with-availability-annotations.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-with-availability-annotations-err.log >&2) - # -enableThreadSanitizer instruments the code in Matter.framework, - # but to instrument the code in the underlying libCHIP we need to pass CHIP_IS_TSAN=YES - xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableThreadSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_TSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' > >(tee /tmp/darwin/framework-tests/darwin-tests-tsan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-tsan-err.log >&2) - working-directory: src/darwin/Framework - - name: Build Matter TV Casting Bridge + + export TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 + + # Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI. + xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx ${{ matrix.options.arguments }} \ + OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1 ${{ matrix.options.defines }}' \ + > >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2) + - name: Collect crash logs + if: failure() && !env.ACT run: | - xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos - working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge - - name: Uploading .ips files in Xcode derived data to debug the failure - uses: actions/upload-artifact@v4 - if: ${{ failure() && !env.ACT }} - with: - name: darwin-framework-derived-data - path: ~/Library/Developer/Xcode/DerivedData/**/*.ips - retention-days: 5 + mkdir -p /tmp/darwin/framework-tests + find ~/Library/Developer/Xcode/DerivedData /Library/Logs/DiagnosticReports -name '*.ips' -print0 | xargs -0 -J % cp % /tmp/darwin/framework-tests - name: Uploading log files uses: actions/upload-artifact@v4 - if: ${{ failure() && !env.ACT }} + if: failure() && !env.ACT with: - name: darwin-framework-test-logs + name: darwin-framework-test-logs-${{ matrix.options.flavor }} path: /tmp/darwin/framework-tests retention-days: 5 + + tv-casting-bridge: + name: Build TV Casting Bridge example + if: github.actor != 'restyled-io[bot]' + needs: [ framework ] # serialize to avoid running to many parallel macos runners + runs-on: macos-13 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: darwin + - name: Build + working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge + run: xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 13da9c2b4da1d6..cc93947c2c0937 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:35 + image: ghcr.io/project-chip/chip-build-doxygen:41 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index a10f4a84ac7d69..4716a44f76b1e1 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:35 + image: ghcr.io/project-chip/chip-build-ameba:41 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index 092f911a233642..52c63eda8fbbd0 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:35 + image: ghcr.io/project-chip/chip-build-asr:41 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index ec90a39b26cf17..8d12696dcd8f89 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:35 + image: ghcr.io/project-chip/chip-build-bouffalolab:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml index 3c864525707a88..e9f47467b88f7f 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:35 + image: ghcr.io/project-chip/chip-build-ti:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index 73f463b167707b..54f6025d850b85 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:35 + image: ghcr.io/project-chip/chip-build-ti:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 1dae68ced0f4a7..c4af320b990074 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:36 + image: ghcr.io/project-chip/chip-build-efr32:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -59,15 +59,14 @@ jobs: timeout-minutes: 30 run: | scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4187C --slc_generate --docker - scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4164A --slc_generate --docker rm -rf ./out/ - name: Build some BRD4187C variants (1) run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --enable-flashbundle \ - --target efr32-brd4187c-thermostat-openthread_mtd \ - --target efr32-brd4187c-switch-shell-use_ot_coap_lib \ + --target efr32-brd4187c-thermostat-openthread-mtd \ + --target efr32-brd4187c-switch-shell-use-ot-coap-lib \ --target efr32-brd4187c-unit-test \ build \ --copy-artifacts-to out/artifacts \ @@ -79,9 +78,9 @@ jobs: ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --enable-flashbundle \ - --target efr32-brd4187c-light-use_ot_lib \ + --target efr32-brd4187c-light-use-ot-lib \ --target efr32-brd4187c-pump \ - --target efr32-brd4187c-lock-shell-enable_heap_monitoring \ + --target efr32-brd4187c-lock-shell-heap-monitoring \ build \ --copy-artifacts-to out/artifacts \ " @@ -92,7 +91,7 @@ jobs: ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --enable-flashbundle \ - --target efr32-brd4187c-window-covering-additional_data_advertising \ + --target efr32-brd4187c-window-covering-additional-data-advertising \ --target efr32-brd4187c-light-rpc \ build \ --copy-artifacts-to out/artifacts \ @@ -105,33 +104,39 @@ jobs: /tmp/bloat_reports/ .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ efr32 BRD4187C window-app \ - out/efr32-brd4187c-window-covering-additional_data_advertising/matter-silabs-window-example.out \ + out/efr32-brd4187c-window-covering-additional-data-advertising/matter-silabs-window-example.out \ /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out - - name: Build BRD4338A variants + - name: Build BRD4338A WiFi Soc variants run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --enable-flashbundle \ - --target efr32-brd4338a-light-wifi-917_soc-skip_rps_generation \ + --target efr32-brd4338a-light-skip-rps-generation \ + --target efr32-brd4338a-lock-skip-rps-generation \ build \ --copy-artifacts-to out/artifacts \ " - - name: Clean out build output - run: rm -rf ./out - - name: Build example EFR32+WF200 WiFi Lock app for BRD4161A + - name: Prepare bloat report for brd4338a lock app run: | - scripts/examples/gn_silabs_example.sh examples/lock-app/silabs out/lock_app_wifi_wf200 BRD4161A is_debug=false chip_logging=false --wifi wf200 --docker - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+wf200 lock-app \ - out/lock_app_wifi_wf200/BRD4161A/matter-silabs-lock-example.out /tmp/bloat_reports/ + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + efr32 BRD4338a lock-app \ + out/efr32-brd4338a-lock-skip-rps-generation/matter-silabs-lock-example.out \ + /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out - - name: Build example EFR32+RS9116 WiFi Lighting app for BRD4161A + - name: Build EFR32 with WiFi NCP run: | - scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs out/lighting_app_wifi_rs9116 BRD4161A --wifi rs9116 --docker - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rs9116 lighting-app \ - out/lighting_app_wifi_rs9116/BRD4161A/matter-silabs-lighting-example.out /tmp/bloat_reports/ + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --enable-flashbundle \ + --target efr32-brd4187c-lock-wifi-siwx917 \ + --target efr32-brd4187c-light-wifi-rs9116 \ + --target efr32-brd4187c-lock-wifi-wf200 \ + build \ + --copy-artifacts-to out/artifacts \ + " - name: Clean out build output run: rm -rf ./out - name: Uploading Size Reports diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index e24492d94e60a7..09d2b24d04aa47 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:35 + image: ghcr.io/project-chip/chip-build-esp32:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -71,6 +71,7 @@ jobs: run: | ./scripts/run_in_build_env.sh "./scripts/codepregen.py ./zzz_pregenerated" mv scripts/codegen.py scripts/codegen.py.renamed + mv scripts/tools/zap/generate.py scripts/tools/zap/generate.py.renamed - name: Clean output run: rm -rf ./out - name: Build some M5Stack variations with pregen @@ -84,18 +85,11 @@ jobs: build \ --copy-artifacts-to out/artifacts \ " - - name: Check no code generation in output - run: | - CNT=$(find out -name "CHIPClusters.h" | wc -l) - if [ "${CNT}" != "0" ]; then - echo "ERROR: found unexpected generated files:" - find out -name "CHIPClusters.h" - exit 1 - fi - name: Undo code pregeneration changes run: | rm -rf ./zzz_pregenerated mv scripts/codegen.py.renamed scripts/codegen.py + mv scripts/tools/zap/generate.py.renamed scripts/tools/zap/generate.py - name: Build example All Clusters App C3 run: scripts/examples/esp_example.sh all-clusters-app sdkconfig_c3devkit.defaults - name: Copy aside build products @@ -130,7 +124,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:35 + image: ghcr.io/project-chip/chip-build-esp32:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index ff6f2e91a906b5..0f94ce1a2da631 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-infineon:35 + image: ghcr.io/project-chip/chip-build-infineon:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index be2d372e88c177..4121768bd4cac5 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:33 + image: ghcr.io/project-chip/chip-build-k32w:38 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -46,7 +46,7 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: k32w + platform: nxp - name: Set up environment for size reports uses: ./.github/actions/setup-size-reports @@ -59,11 +59,8 @@ jobs: scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ --target k32w-k32w0-light-crypto-platform-tokenizer \ - --target k32w-k32w0-lock-crypto-platform-tokenizer \ - --target k32w-k32w0-lock-crypto-platform-low-power-nologs \ --target k32w-k32w0-contact-crypto-platform-tokenizer \ --target k32w-k32w0-contact-crypto-platform-low-power-nologs \ - --target k32w-k32w0-shell-crypto-platform \ --target k32w-k32w1-light-crypto-platform-openthread-ftd \ --target k32w-k32w1-contact-crypto-platform-low-power-nologs \ build \ @@ -79,12 +76,6 @@ jobs: k32w k32w1+release light \ out/artifacts/k32w-k32w1-light-crypto-platform-openthread-ftd/chip-k32w1-light-example.elf \ /tmp/bloat_reports/ - - name: Get lock size stats - run: | - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - k32w k32w0+release lock \ - out/artifacts/k32w-k32w0-lock-crypto-platform-tokenizer/chip-k32w0x-lock-example.elf \ - /tmp/bloat_reports/ - name: Get contact size stats run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index a346bec097fa81..562279a0d35375 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:35 + image: ghcr.io/project-chip/chip-build-crosscompile:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index f6fee89fa966e4..843e76b9b14c41 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:35 + image: ghcr.io/project-chip/chip-build-imx:41 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index ad1dc349163c7b..ea60e6adbcb022 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: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml new file mode 100644 index 00000000000000..daba40795f8d87 --- /dev/null +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -0,0 +1,68 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Test TV Casting Example + +on: + push: + pull_request: + merge_group: + +concurrency: + group: + ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == + 'pull_request' && github.event.number) || (github.event_name == + 'workflow_dispatch' && github.run_number) || github.sha }} + cancel-in-progress: true + +jobs: + Linux-test: + name: Linux Test + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: ghcr.io/project-chip/chip-build:41 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: linux + + - name: Set Up Environment for Size Reports + uses: ./.github/actions/setup-size-reports + if: ${{ !env.ACT }} + with: + gh-context: ${{ toJson(github) }} + + - name: Build Linux tv-app + run: | + ./scripts/run_in_build_env.sh \ + "scripts/examples/gn_build_example.sh examples/tv-app/linux/ out/tv-app" + + - name: Build Linux tv-casting-app + run: | + ./scripts/run_in_build_env.sh \ + "scripts/examples/gn_build_example.sh examples/tv-casting-app/linux/ out/tv-casting-app" + + - name: Uploading Size Reports + uses: ./.github/actions/upload-size-reports + if: ${{ !env.ACT }} + with: + platform-name: Linux diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 54d33b9f91d3c2..4b5748b4d0abe7 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-mbed-os:35 + image: ghcr.io/project-chip/chip-build-mbed-os:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index d0e7ce3122c06b..a16ea66c148aca 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 64bb5a319eafa8..eb62c69299fc85 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:35 + image: ghcr.io/project-chip/chip-build-nrf-platform:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 254e5688d62435..b6f69791d2270a 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:35 + image: ghcr.io/project-chip/chip-build-openiotsdk:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index e012eb9b02d065..b0af5ab2141ef0 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-rw61x.yaml b/.github/workflows/examples-rw61x.yaml new file mode 100644 index 00000000000000..42df03382b9249 --- /dev/null +++ b/.github/workflows/examples-rw61x.yaml @@ -0,0 +1,87 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Build example - RW61X + +on: + push: + pull_request: + merge_group: + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + cancel-in-progress: true + +env: + CHIP_NO_LOG_TIMESTAMPS: true + +jobs: + rw61x: + name: RW61X + + env: + BUILD_TYPE: gn_rw61x + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: ghcr.io/project-chip/chip-build-rw61x:37 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: rw61x + + - name: Set up environment for size reports + uses: ./.github/actions/setup-size-reports + if: ${{ !env.ACT }} + with: + gh-context: ${{ toJson(github) }} + + - name: Build RW61X all clusters example app + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target rw61x-all-clusters-app-wifi \ + build \ + --copy-artifacts-to out/artifacts \ + " + + - name: Build RW61X thermostat example app + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target rw61x-thermostat-wifi \ + build \ + --copy-artifacts-to out/artifacts \ + " + + - name: Build RW61X laundry-washer example app + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target rw61x-laundry-washer-wifi \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Uploading Size Reports + uses: ./.github/actions/upload-size-reports + if: ${{ !env.ACT }} + with: + platform-name: RW61X diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 84442f85294d31..9a30af500112ce 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 9131b3969df075..285ba96aceda07 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:35 + image: ghcr.io/project-chip/chip-build-telink:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index a289e159dc6318..65c15e5ea4114d 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:35 + image: ghcr.io/project-chip/chip-build-tizen:41 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-tv-app.yaml b/.github/workflows/examples-tv-app.yaml index fff6cbb39d1acb..c59a9292a1261b 100644 --- a/.github/workflows/examples-tv-app.yaml +++ b/.github/workflows/examples-tv-app.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:35 + image: ghcr.io/project-chip/chip-build-android:41 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index f7a14d1f5d3d1b..78b2f0f7799aa8 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:35 + image: ghcr.io/project-chip/chip-build-android:41 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -73,30 +73,6 @@ jobs: "./scripts/build/build_examples.py --target android-arm-chip-tool build" - name: Clean out build output run: rm -rf ./out examples/android/CHIPTool/app/libs/jniLibs/* examples/android/CHIPTool/app/libs/*.jar - - name: Build Android arm-tv-casting-app - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target android-arm-tv-casting-app build" - - name: Clean out build output - run: rm -rf ./out examples/tv-casting-app/android/App/app/libs/jniLibs/* examples/tv-casting-app/android/App/app/libs/*.jar - - name: Build Android arm-tv-server - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target android-arm-tv-server build" - - name: Clean out build output - run: rm -rf ./out examples/tv-app/android/App/app/libs/jniLibs/* examples/tv-app/android/App/app/libs/*.jar - - name: Build Android arm64-tv-casting-app - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target android-arm64-tv-casting-app build" - - name: Clean out build output - run: rm -rf ./out examples/tv-casting-app/android/app/libs/jniLibs/* examples/android/CHIPTool/app/libs/*.jar - - name: Build Android arm64-tv-server - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target android-arm64-tv-server build" - - name: Clean out build output - run: rm -rf ./out examples/tv-app/android/App/app/libs/jniLibs/* examples/tv-app/android/App/app/libs/*.jar - name: Build Android arm64-chip-tool run: | ./scripts/run_in_build_env.sh \ @@ -107,7 +83,9 @@ jobs: "ninja -C out/android-arm64-chip-tool build/chip/java/tests:java_build_test" - name: Clean out build output run: rm -rf ./out examples/android/CHIPTool/app/libs/jniLibs/* examples/android/CHIPTool/app/libs/*.jar - # - name: Build Android Studio build (arm64 only) - # run: | - # ./scripts/run_in_build_env.sh \ - # "./scripts/build/build_examples.py --target android-androidstudio-arm64-chip-tool build" + - name: Build Android arm64-chip-test + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --target android-arm64-chip-test build" + - name: Clean out build output + run: rm -rf ./out examples/android/CHIPTest/app/libs/jniLibs/* examples/android/CHIPTest/app/libs/*.jar diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 341097915cab4f..f354ce369c27fd 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -46,12 +46,8 @@ jobs: run: | mkdir objdir-clone || true - - name: Bootstrap Cache - uses: ./.github/actions/bootstrap-cache - name: Bootstrap uses: ./.github/actions/bootstrap - - name: Upload Bootstrap Logs - uses: ./.github/actions/upload-bootstrap-logs - name: Build all-clusters-app run: | @@ -84,12 +80,8 @@ jobs: run: | mkdir objdir-clone || true - - name: Bootstrap Cache - uses: ./.github/actions/bootstrap-cache - name: Bootstrap uses: ./.github/actions/bootstrap - - name: Upload Bootstrap Logs - uses: ./.github/actions/upload-bootstrap-logs - name: Build all-clusters-app run: | diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index fadc0da4a42f3c..97617480d8f292 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: Wandalen/wretry.action@v1.4.4 + - uses: Wandalen/wretry.action@v1.4.5 name: Gradle Validation continue-on-error: true with: diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index f19d451fbc2df6..4356924024c9fe 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:35 + image: ghcr.io/project-chip/chip-build-java:41 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -132,6 +132,17 @@ jobs: --tool-cluster "im" \ --tool-args "onnetwork-long-im-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ --factoryreset \ + ' + - name: Run IM Extendable Invoke Test + run: | + scripts/run_in_python_env.sh out/venv \ + './scripts/tests/run_java_test.py \ + --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ + --app-args "--discriminator 3840 --interface-id -1" \ + --tool-path out/linux-x64-java-matter-controller \ + --tool-cluster "im" \ + --tool-args "onnetwork-long-im-extendable-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ + --factoryreset \ ' - name: Run IM Read Test run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 189f63837c841e..69e7668a700da0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,7 +29,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 steps: - name: Checkout @@ -92,65 +92,33 @@ jobs: --known-failure controller/ExamplePersistentStorage.h \ --known-failure app/AttributeAccessInterface.h \ --known-failure app/AttributeAccessToken.h \ - --known-failure app/att-storage.h \ - --known-failure app/BufferedReadCallback.h \ --known-failure app/CommandHandler.h \ --known-failure app/CommandHandlerInterface.h \ - --known-failure app/CommandPathParams.h \ - --known-failure app/CommandPathRegistry.h \ - --known-failure app/CommandResponseSender.h \ - --known-failure app/CommandSender.h \ --known-failure app/CommandSenderLegacyCallback.h \ - --known-failure app/CompatEnumNames.h \ - --known-failure app/ConcreteAttributePath.h \ - --known-failure app/ConcreteCommandPath.h \ - --known-failure app/data-model/ListLargeSystemExtensions.h \ - --known-failure app/EventHeader.h \ - --known-failure app/EventLoggingDelegate.h \ - --known-failure app/EventLogging.h \ - --known-failure app/EventLoggingTypes.h \ - --known-failure app/EventManagement.h \ - --known-failure app/InteractionModelHelper.h \ - --known-failure app/ObjectList.h \ - --known-failure app/ReadClient.h \ --known-failure app/ReadHandler.h \ - --known-failure app/ReadPrepareParams.h \ + --known-failure app/reporting/reporting.cpp \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ --known-failure app/reporting/tests/MockReportScheduler.h \ - --known-failure app/server/AppDelegate.h \ --known-failure app/TestEventTriggerDelegate.h \ --known-failure app/util/af.h \ - --known-failure app/util/af-types.h \ - --known-failure app/util/attribute-metadata.h \ --known-failure app/util/attribute-storage.cpp \ --known-failure app/util/attribute-storage.h \ - --known-failure app/util/attribute-storage-null-handling.h \ --known-failure app/util/attribute-table.cpp \ --known-failure app/util/attribute-table.h \ --known-failure app/util/binding-table.cpp \ --known-failure app/util/binding-table.h \ - --known-failure app/util/common.h \ --known-failure app/util/config.h \ --known-failure app/util/DataModelHandler.cpp \ --known-failure app/util/DataModelHandler.h \ --known-failure app/util/ember-compatibility-functions.cpp \ + --known-failure app/util/ember-compatibility-functions.h \ --known-failure app/util/endpoint-config-api.h \ - --known-failure app/util/endpoint-config-defines.h \ --known-failure app/util/generic-callbacks.h \ --known-failure app/util/generic-callback-stubs.cpp \ --known-failure app/util/im-client-callbacks.h \ - --known-failure app/util/MatterCallbacks.h \ - --known-failure app/util/message.cpp \ - --known-failure app/util/mock/Constants.h \ - --known-failure app/util/mock/Functions.h \ - --known-failure app/util/mock/MockNodeConfig.h \ - --known-failure app/util/odd-sized-integers.h \ - --known-failure app/util/types_stub.h \ --known-failure app/util/util.cpp \ --known-failure app/util/util.h \ - --known-failure app/WriteClient.h \ --known-failure app/WriteHandler.h \ - --known-failure lib/core/CHIPVendorIdentifiers.hpp \ --known-failure platform/DeviceSafeQueue.cpp \ --known-failure platform/DeviceSafeQueue.h \ --known-failure platform/GLibTypeDeleter.h \ @@ -225,7 +193,7 @@ jobs: # TODO: TLVDebug should ideally not be excluded here. # TODO: protocol_decoder.cpp should ideally not be excluded here. # TODO: PersistentStorageMacros.h should ideally not be excluded here. - git grep -I -n "PRI.64" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)examples/chip-tool' ':(exclude)examples/tv-casting-app' ':(exclude)src/app/MessageDef/MessageDefHelper.cpp' ':(exclude)src/app/tests/integration/chip_im_initiator.cpp' ':(exclude)src/lib/core/TLVDebug.cpp' ':(exclude)src/lib/dnssd/tests/TestTxtFields.cpp' ':(exclude)src/lib/format/protocol_decoder.cpp' ':(exclude)src/lib/support/PersistentStorageMacros.h' ':(exclude)src/messaging/tests/echo/echo_requester.cpp' ':(exclude)src/platform/Linux' ':(exclude)src/platform/Ameba' ':(exclude)src/platform/ESP32' ':(exclude)src/platform/webos' ':(exclude)zzz_generated/chip-tool' ':(exclude)src/tools/chip-cert/Cmd_PrintCert.cpp' && exit 1 || exit 0 + git grep -I -n "PRI.64" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)examples/chip-tool' ':(exclude)examples/tv-casting-app' ':(exclude)src/app/MessageDef/MessageDefHelper.cpp' ':(exclude)src/app/tests/integration/chip_im_initiator.cpp' ':(exclude)src/lib/core/TLVDebug.cpp' ':(exclude)src/lib/dnssd/tests/TestTxtFields.cpp' ':(exclude)src/lib/format/protocol_decoder.cpp' ':(exclude)src/lib/support/PersistentStorageMacros.h' ':(exclude)src/messaging/tests/echo/echo_requester.cpp' ':(exclude)src/platform/Linux' ':(exclude)src/platform/Ameba' ':(exclude)src/platform/ESP32' ':(exclude)src/platform/Darwin' ':(exclude)src/darwin' ':(exclude)src/platform/webos' ':(exclude)zzz_generated/chip-tool' ':(exclude)src/tools/chip-cert/Cmd_PrintCert.cpp' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -296,12 +264,11 @@ jobs: run: | git grep -I -n 'emberAfWriteAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' ':(exclude)src/app/util/attribute-table.h' ':(exclude)src/app/util/ember-compatibility-functions.cpp' && exit 1 || exit 0 - # Run python Linter (flake8) and verify python files - # ignore some style errors, restyler should do that - - name: Check for errors using flake8 Python linter + # Run ruff python linter + - name: Check for errors using ruff Python linter if: always() run: | - flake8 --extend-ignore=E501,W391 + ruff check # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -318,3 +285,18 @@ jobs: if: always() run: | git grep -I -n 'SuccessOrExit([^=)]*(' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 + + # git grep exits with 0 if it finds a match, but we want + # to fail (exit nonzero) on match. + - name: Check for use of "using namespace" outside of a class/function in headers. + if: always() + run: | + # Various platforms have `using namespace chip::Ble` in their BLEManager* headers; just exclude those for now. + # + # Exclude platform openiotsdk bits that do this in their persistent storage header. + # + # Also exclude examples (for now) and third_party, which have various instances of this. + # + # Ignore uses of `System::Clock::Literals`, because that's the only way to have things using _ms32 or whatnot + # in a header file. + git grep -I -n -e '^using namespace' --and --not -e 'System::Clock::Literals' -- './**/*.h' ':(exclude)src/platform/*/BLEManager*.h' ':(exclude)src/platform/openiotsdk/KVPsaPsStore.h' ':(exclude)./examples' ':(exclude)./third_party' && exit 1 || exit 0 diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 189c8db3159951..029f3d759771fc 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:35 + image: ghcr.io/project-chip/chip-build-minimal:41 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index c4992953780911..dc356586b4dd96 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:35 + image: ghcr.io/project-chip/chip-build-esp32-qemu:41 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -58,6 +58,8 @@ jobs: build \ " - name: Run all tests + # Disabled being tracked here: https://github.com/project-chip/connectedhomeip/issues/32587 + if: false run: | src/test_driver/esp32/run_qemu_image.py \ --verbose \ @@ -76,7 +78,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen-qemu:35 + image: ghcr.io/project-chip/chip-build-tizen-qemu:41 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 65896c73b3faca..57a1ce7b325dc3 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -32,19 +32,15 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-esp32:35 + image: ghcr.io/project-chip/chip-build-esp32:41 steps: - name: Checkout uses: actions/checkout@v4 with: ref: "${{ github.event.inputs.releaseTag }}" - - name: Bootstrap Cache - uses: ./.github/actions/bootstrap-cache - name: Bootstrap uses: ./.github/actions/bootstrap - - name: Upload Bootstrap Logs - uses: ./.github/actions/upload-bootstrap-logs - name: Build run: scripts/examples/esp_example.sh all-clusters-app @@ -68,18 +64,14 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:36 + image: ghcr.io/project-chip/chip-build-efr32:41 steps: - name: Checkout uses: actions/checkout@v4 with: ref: "${{ github.event.inputs.releaseTag }}" - - name: Bootstrap Cache - uses: ./.github/actions/bootstrap-cache - name: Bootstrap uses: ./.github/actions/bootstrap - - name: Upload Bootstrap Logs - uses: ./.github/actions/upload-bootstrap-logs - name: Build example EFR32 Lock App run: scripts/examples/gn_silabs_example.sh examples/lock-app/efr32/ diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 396fb3ae153a46..5ebd5e5d545840 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -37,8 +37,9 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:35 + image: ghcr.io/project-chip/chip-build-android:41 volumes: + - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" steps: @@ -67,15 +68,3 @@ jobs: "ninja -C out/android-arm64-chip-tool build/chip/java/tests:java_build_test" - name: Clean out build output run: rm -rf ./out examples/android/CHIPTool/app/libs/jniLibs/* examples/android/CHIPTool/app/libs/*.jar - - name: Build Android arm64-tv-casting-app - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target android-arm64-tv-casting-app build" - - name: Clean out build output - run: rm -rf ./out examples/tv-casting-app/android/App/app/libs/jniLibs/* examples/tv-casting-app/android/App/app/libs/*.jar - - name: Build Android arm64-tv-server - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target android-arm64-tv-server build" - - name: Clean out build output - run: rm -rf ./out examples/tv-app/android/App/app/libs/jniLibs/* examples/tv-app/android/App/app/libs/*.jar diff --git a/.github/workflows/spell.yml b/.github/workflows/spell.yml index 57593372543079..84877bf6f8c8bb 100644 --- a/.github/workflows/spell.yml +++ b/.github/workflows/spell.yml @@ -25,19 +25,10 @@ on: - ".github/.wordlist.txt" jobs: - check-reviewdog: - name: Check Spelling - reviewdog - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: reviewdog/action-misspell@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} check-spellcheck: name: Check Spelling - pyspelling runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - uses: igsekor/pyspelling-any@v1.0.4 + - uses: rojopolis/spellcheck-github-actions@0.36.0 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 05d2670edd665e..2907a4a89711ea 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -47,7 +47,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -213,6 +213,7 @@ jobs: --target linux-x64-bridge-${BUILD_VARIANT} \ --target linux-x64-lit-icd-${BUILD_VARIANT} \ --target linux-x64-microwave-oven-${BUILD_VARIANT} \ + --target linux-x64-rvc-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -234,6 +235,7 @@ jobs: --bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Run purposeful failure tests using the python parser sending commands to chip-tool @@ -274,6 +276,7 @@ jobs: --bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Run Tests using chip-repl (including slow) if: github.event_name == 'push' @@ -292,6 +295,7 @@ jobs: --bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Uploading core files uses: actions/upload-artifact@v4 @@ -359,6 +363,7 @@ jobs: --target darwin-x64-bridge-${BUILD_VARIANT} \ --target darwin-x64-lit-icd-${BUILD_VARIANT} \ --target darwin-x64-microwave-oven-${BUILD_VARIANT} \ + --target darwin-x64-rvc-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -381,6 +386,7 @@ jobs: --bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --lit-icd-app ./out/darwin-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/darwin-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Run purposeful failure tests using the python parser sending commands to chip-tool @@ -431,7 +437,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:32 + image: ghcr.io/project-chip/chip-build:41 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -460,6 +466,7 @@ jobs: --target linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test \ + --target linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-python-bindings \ build \ --copy-artifacts-to objdir-clone \ @@ -501,10 +508,8 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_4_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_PWRTL_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RR_1_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_SC_3_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_10.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' @@ -542,6 +547,15 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 62231116bb92c1..478d347be25ab9 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -37,8 +37,9 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 volumes: + - "/:/runner-root-volume" - "/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" @@ -49,6 +50,7 @@ jobs: uses: ./.github/actions/checkout-submodules-and-bootstrap with: platform: linux + bootstrap-log-name: bootstrap-logs-unittest-${{ matrix.type }} - name: Artifact suffix id: outsuffix uses: haya14busa/action-cond@v1 diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index a0ab3653d5ecb1..4488e23258cd65 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index cb8bff6172a119..f14b914ae7f88a 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:35 + image: ghcr.io/project-chip/chip-build:41 defaults: run: shell: sh diff --git a/.gitmodules b/.gitmodules index 06fb7f0e347951..fa3dfcfdaea9aa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -54,16 +54,16 @@ path = third_party/freertos/repo url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git branch = V10.3.1-kernel-only - platforms = ameba,cc13xx_26xx,bouffalolab,esp32,k32w,infineon,qpg,cc32xx + platforms = ameba,cc13xx_26xx,bouffalolab,esp32,infineon,qpg,cc32xx [submodule "simw-top-mini"] path = third_party/simw-top-mini/repo url = https://github.com/NXP/plug-and-trust.git branch = int/CHIPSE_Release - platforms = k32w + platforms = nxp [submodule "third_party/openthread/ot-nxp"] path = third_party/openthread/ot-nxp url = https://github.com/NXP/ot-nxp.git - platforms = k32w + platforms = nxp [submodule "third_party/openthread/ot-qorvo"] path = third_party/openthread/ot-qorvo url = https://github.com/openthread/ot-qorvo.git diff --git a/.restyled.yaml b/.restyled.yaml index 56ed3061e6e1fa..be74f5b47aa61d 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -74,6 +74,7 @@ exclude: - "examples/chef/sample_app_util/test_files/*.yaml" - "examples/chef/zzz_generated/**/*" - "examples/platform/nxp/k32w/k32w0/scripts/demo_generated_certs/**/*" + - "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/*" # zap-generated files - "integrations/cloudbuild/*.yaml" # uglier long command line content - "scripts/run_codegen_targets.sh" # shellharden breaks for loops over command outputs - "scripts/tagging/tag_new_release.sh" # shellharden breaks parameter passing @@ -230,6 +231,8 @@ restylers: command: - autopep8 - "--in-place" + - "--max-line-length" + - "132" arguments: [] include: - "**/*.py" diff --git a/.spellcheck.yml b/.spellcheck.yml index c04880827addba..7313f64ebd6976 100644 --- a/.spellcheck.yml +++ b/.spellcheck.yml @@ -65,6 +65,7 @@ matrix: # converts markdown to HTML - pyspelling.filters.markdown: sources: - - '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md' + - '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md | !docs/testing/python.md | !docs/testing/ChipDeviceCtrlAPI.md' aspell: ignore-case: true + camel-case: true diff --git a/BUILD.gn b/BUILD.gn index 838ea743f348c8..0992c61b0510c6 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -182,7 +182,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { deps += [ "${chip_root}/src/app/server/java", "${chip_root}/src/controller/java", + "${chip_root}/src/controller/java:jsontlv", "${chip_root}/src/controller/java:onboarding_payload", + "${chip_root}/src/controller/java:tlv", "${chip_root}/src/platform/android:java", ] } @@ -363,6 +365,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { enable_linux_lit_icd_app_build = enable_default_builds && (host_os == "linux" || host_os == "mac") + # Build the Linux RVC app example. + enable_linux_rvc_app_build = + enable_default_builds && (host_os == "linux" || host_os == "mac") + # Build the cc13x2x7_26x2x7 lock app example. enable_cc13x2x7_26x2x7_lock_app_build = enable_ti_simplelink_builds @@ -744,6 +750,14 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { extra_build_deps += [ ":genio_shell_app" ] } + if (enable_linux_rvc_app_build) { + group("linux_rvc_app") { + deps = [ "${chip_root}/examples/rvc-app/linux(${standalone_toolchain})" ] + } + + extra_build_deps += [ ":linux_rvc_app" ] + } + group("default") { deps = extra_build_deps + builds } diff --git a/build/chip/chip_codegen.gni b/build/chip/chip_codegen.gni index 02acd08150aae8..ee82204af22f40 100644 --- a/build/chip/chip_codegen.gni +++ b/build/chip/chip_codegen.gni @@ -31,11 +31,7 @@ template("_chip_build_time_codegen") { _name = target_name _generator = invoker.generator - config("${_name}_config") { - include_dirs = [ target_gen_dir ] - } - - pw_python_action("${_name}_codegen") { + pw_python_action("${_name}_generate") { script = "${chip_root}/scripts/codegen.py" # TODO: this seems to touch internals. Is this ok? speeds up builds! @@ -99,7 +95,7 @@ template("_chip_build_time_codegen") { if (!defined(deps)) { deps = [] } - deps += [ ":${_name}_codegen" ] + deps += [ ":${_name}_generate" ] } } @@ -124,10 +120,6 @@ template("_chip_build_time_zapgen") { _name = target_name _generator = invoker.generator - config("${_name}_config") { - include_dirs = [ "${target_gen_dir}/zapgen/" ] - } - assert(_generator == "app-templates") if (_generator == "app-templates") { @@ -152,7 +144,7 @@ template("_chip_build_time_zapgen") { _output_subdir = "zap-generated" } - pw_python_action("${_name}_zap_pregen") { + pw_python_action("${_name}_generate") { script = "${chip_root}/scripts/tools/zap/generate.py" # TODO: this seems to touch internals. Is this ok? speeds up builds! @@ -165,7 +157,7 @@ template("_chip_build_time_zapgen") { "--templates", _template_path, "--output-dir", - rebase_path(target_gen_dir) + "/zap_pregen/" + _output_subdir, + rebase_path(target_gen_dir) + "/zapgen/" + _output_subdir, # TODO: lock file support should be removed as this serializes zap # (slower), however this is currently done because on Darwin zap startup @@ -188,54 +180,10 @@ template("_chip_build_time_zapgen") { sources = [ _idl_file ] - outputs = [] - foreach(name, invoker.outputs) { - outputs += [ "${target_gen_dir}/zap_pregen/${name}" ] - } - - forward_variables_from(invoker, [ "prune_outputs" ]) - if (defined(prune_outputs)) { - foreach(name, prune_outputs) { - outputs += [ "${target_gen_dir}/zap_pregen/${name}" ] - } - } - } - - # This action ensures that any "extra" files generated by zap codegen - # are actually deleted. - # - # This is to avoid double-codegen of configurations like endpoint config - # or access credentials being generated for both "controller client" and - # application-specific - pw_python_action("${_name}_files") { - # TODO: this seems to touch internals. Is this ok? speeds up builds! - _pw_internal_run_in_venv = false - - script = "${chip_root}/scripts/tools/zap/prune_outputs.py" - - _keep_file = rebase_path("${target_gen_dir}/${_name}.keep.outputs") - write_file(_keep_file, invoker.outputs, "list lines") - - args = [ - "--keep", - _keep_file, - "--input-dir", - rebase_path("${target_gen_dir}/zap_pregen/"), - "--output-dir", - rebase_path("${target_gen_dir}/zapgen/"), - ] - - inputs = [] - foreach(name, invoker.outputs) { - inputs += [ "${target_gen_dir}/zap_pregen/${name}" ] - } - outputs = [] foreach(name, invoker.outputs) { outputs += [ "${target_gen_dir}/zapgen/${name}" ] } - - deps = [ ":${_name}_zap_pregen" ] } source_set(_name) { @@ -255,10 +203,7 @@ template("_chip_build_time_zapgen") { if (!defined(public_deps)) { public_deps = [] } - public_deps += [ - ":${_name}_files", - ":${_name}_zap_pregen", - ] + public_deps += [ ":${_name}_generate" ] } } @@ -272,6 +217,9 @@ template("_chip_build_time_zapgen") { # generator # Name of the generator to use (e.g. java-jni, java-class, cpp-app) # +# outputs MUST share the same directory prefix (e.g. 'app/' or 'tlv/meta' +# or 'jni') +# # outputs # Explicit names of the expected outputs. Enforced to validate that # expected outputs are generated when processing input files. @@ -312,7 +260,17 @@ template("_chip_build_time_zapgen") { # ] # } # +# Guarantees a target named "${target_name}_generate" exists and contains all +# generated files (this works even in the case of using a pre-generated directory +# by using a copy target to import pre-generated data) +# template("chip_codegen") { + _name = target_name + + config("${_name}_config") { + include_dirs = [ target_gen_dir ] + } + if (chip_code_pre_generated_directory == "") { _chip_build_time_codegen(target_name) { forward_variables_from(invoker, @@ -326,8 +284,6 @@ template("chip_codegen") { ]) } } else { - _name = target_name - not_needed(invoker, [ "options" ]) # This constructs a path like: @@ -339,8 +295,21 @@ template("chip_codegen") { string_replace(rebase_path(invoker.input, chip_root), ".matter", "") + "/codegen/" + invoker.generator - config("${_name}_config") { - include_dirs = [ "${_generation_dir}" ] + # Generation in this case just involves some files copying + copy("${_name}_generate") { + sources = [] + + foreach(name, invoker.outputs) { + sources += [ "${_generation_dir}/${name}" ] + } + + # NOTE: we assume ALL outputs have a common subdir. This is generally the case with + # paths like "app/callback-stub.cpp" and "app/PluginApplicationCallbacks.h" + _outputs = invoker.outputs + _dir_name = get_path_info(_outputs[0], "dir") + outputs = [ "${target_gen_dir}/${_dir_name}/{{source_file_part}}" ] + + public_configs = [ ":${_name}_config" ] } source_set(_name) { @@ -349,13 +318,13 @@ template("chip_codegen") { if (defined(invoker.public_configs)) { public_configs += invoker.public_configs } + sources = get_target_outputs(":${_name}_generate") forward_variables_from(invoker, [ "deps" ]) - - sources = [] - foreach(name, invoker.outputs) { - sources += [ "${_generation_dir}/${name}" ] + if (!defined(deps)) { + deps = [] } + deps += [ ":${_name}_generate" ] } } } @@ -374,6 +343,9 @@ template("chip_codegen") { # Explicit names of the expected outputs. Enforced to validate that # expected outputs are generated when processing input files. # +# outputs MUST share the same directory prefix (e.g. 'app/' or 'tlv/meta' +# or 'jni') +# # deps, public_configs # Forwarded to the resulting source set # @@ -399,18 +371,28 @@ template("chip_codegen") { # # Example usage: # -# chip_codegen("java-jni-generate") { -# input = "controller-clusters.matter" -# generator = "java-jni" +# chip_zapgen("controller-clusters-zap") { +# input = "controller-clusters.zap" +# generator = "app-templates" # -# outputs = [ -# "jni/IdentifyClient-ReadImpl.cpp", -# "jni/IdentifyClient-InvokeSubscribeImpl.cpp", -# # ... more to follow -# ] -# } +# outputs = [ +# "zap-generated/access.h", +# "zap-generated/gen_config.h", +# "zap-generated/endpoint_config.h", +# ] +# } +# +# Guarantees a target named "${target_name}_generate" exists and contains all +# generated files (this works even in the case of using a pre-generated directory +# by using a copy target to import pre-generated data) # template("chip_zapgen") { + _name = target_name + + config("${_name}_config") { + include_dirs = [ "${target_gen_dir}/zapgen/" ] + } + if (chip_code_pre_generated_directory == "") { _chip_build_time_zapgen(target_name) { forward_variables_from(invoker, @@ -420,12 +402,9 @@ template("chip_zapgen") { "input", "outputs", "public_configs", - "prune_outputs", ]) } } else { - _name = target_name - # This contstructs a path like: # FROM all-clusters-app.zap (inside examples/all-clusters-app/all-clusters-common/) # USING "cpp-app" for generator: @@ -435,10 +414,6 @@ template("chip_zapgen") { string_replace(rebase_path(invoker.input, chip_root), ".zap", "") + "/zap/" + invoker.generator - config("${_name}_config") { - include_dirs = [ "${_generation_dir}" ] - } - # Pick up only the headers and mark them available to use # Specifically controller seems to require header files but NOT cpp (does) # not want to include cpp compilation of IM command handler data @@ -477,22 +452,40 @@ template("chip_zapgen") { public_deps = [ ":${_name}_headers" ] } + # Generation in this case just involves some files copying + copy("${_name}_generate") { + sources = [] + + foreach(name, invoker.outputs) { + sources += [ "${_generation_dir}/${name}" ] + } + + # NOTE: we assume ALL outputs have a common subdir. This is generally the case with + # paths like "app/callback-stub.cpp" and "app/PluginApplicationCallbacks.h" + _outputs = invoker.outputs + _dir_name = get_path_info(_outputs[0], "dir") + outputs = [ "${target_gen_dir}/zapgen/${_dir_name}/{{source_file_part}}" ] + + public_configs = [ ":${_name}_config" ] + } + source_set(_name) { forward_variables_from(invoker, [ "deps", "public_configs", - "prune_outputs", ]) if (!defined(public_configs)) { public_configs = [] } public_configs += [ ":${_name}_config" ] - sources = [] - foreach(name, invoker.outputs) { - sources += [ "${_generation_dir}/${name}" ] + if (!defined(public_deps)) { + public_deps = [] } + public_deps += [ ":${_name}_generate" ] + + sources = get_target_outputs(":${_name}_generate") # Ugly, but references WILL reference back into main code. check_includes = false diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 9d2f17d1acf86e..7eb09b79c4c22d 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -76,11 +76,11 @@ if (_chip_defaults.custom_toolchain != "") { } else { _target_compiler = "gcc" } - _default_toolchain = "${_build_overrides.build_root}/toolchain/linux:linux_${target_cpu}_${_target_compiler}" -} else if (target_os == host_os && - (target_cpu == host_cpu || - (target_cpu == "arm64e" && host_cpu == "arm64"))) { +} else if (host_os == "mac" && (target_os == "mac" || target_os == "ios")) { + # On Mac the host toolchain supports building for all mac and ios targets + _default_toolchain = host_toolchain +} else if (target_os == host_os && target_cpu == host_cpu) { _default_toolchain = host_toolchain } else if (target_os == "freertos") { if (_chip_defaults.is_clang) { @@ -113,9 +113,6 @@ if (_chip_defaults.custom_toolchain != "") { } else { assert(false, "Unsupported target_cpu: ${current_cpu}") } -} else if (target_os == "ios") { - _default_toolchain = - "${_build_overrides.build_root}/toolchain/ios:ios_${target_cpu}" } else if (target_os == "tizen") { _default_toolchain = "${_build_overrides.build_root}/toolchain/tizen:tizen_${target_cpu}" @@ -127,7 +124,9 @@ if (_chip_defaults.custom_toolchain != "") { "Unsupported target_cpu: ${current_cpu}. Shall be arm for webOS") } } else { - assert(false, "No toolchain specified, please specify custom_toolchain") + assert( + false, + "No toolchain specified, please specify custom_toolchain for host_os='${host_os}', target_os='${target_os}', host_cpu='${host_cpu}', target_cpu='${target_cpu}'") } set_default_toolchain(_default_toolchain) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index b6ad67a64944fd..df85153297cad7 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -343,7 +343,7 @@ config("cosmetic_default") { } config("runtime_default") { - if (is_clang) { + if (is_clang) { # Using Pigweed clang instead of Darwin host clang configs = [ "$dir_pw_toolchain/host_clang:no_system_libcpp", "$dir_pw_toolchain/host_clang:xcode_sysroot", @@ -395,11 +395,16 @@ declare_args() { } config("sanitize_address") { + defines = [] cflags = [ "-fsanitize=address", "-fno-omit-frame-pointer", ] ldflags = cflags + + if ((target_os == "mac" || target_os == "ios") && !is_clang) { + defines += [ "_LIBCPP_HAS_NO_ASAN" ] + } } config("sanitize_thread") { diff --git a/build/config/mac/mac_sdk.gni b/build/config/mac/mac_sdk.gni index 0e7f02b5bb3399..29272d0dc9a500 100644 --- a/build/config/mac/mac_sdk.gni +++ b/build/config/mac/mac_sdk.gni @@ -34,7 +34,7 @@ if (current_os == "mac") { deployment_target = "11.0" } } else { - deployment_target = "13.4" + deployment_target = "14.0" } declare_args() { diff --git a/build/toolchain/ios/BUILD.gn b/build/toolchain/ios/BUILD.gn deleted file mode 100644 index c86dfcb83b38d5..00000000000000 --- a/build/toolchain/ios/BUILD.gn +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2020 The Pigweed Authors -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/build.gni") - -import("${build_root}/toolchain/gcc_toolchain.gni") - -gcc_toolchain("ios_arm") { - toolchain_args = { - current_os = "ios" - current_cpu = "arm" - is_clang = false - } -} - -gcc_toolchain("ios_arm64") { - toolchain_args = { - current_os = "ios" - current_cpu = "arm64" - is_clang = false - } -} - -gcc_toolchain("ios_x64") { - toolchain_args = { - current_os = "ios" - current_cpu = "x86_64" - is_clang = false - } -} diff --git a/config/esp32/.gn b/config/esp32/.gn index 9f5db65cdad79b..52535ffabaf95d 100644 --- a/config/esp32/.gn +++ b/config/esp32/.gn @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/build.gni") +import("//build_overrides/pigweed.gni") # The location of the build configuration file. buildconfig = "${build_root}/config/BUILDCONFIG.gn" @@ -24,6 +25,15 @@ default_args = { target_cpu = "esp32" target_os = "freertos" + pw_sys_io_BACKEND = dir_pw_sys_io_stdio + pw_assert_BACKEND = dir_pw_assert_log + pw_log_BACKEND = dir_pw_log_basic + + pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", + ] + pw_build_PIP_CONSTRAINTS = [ "//third_party/connectedhomeip/scripts/setup/constraints.txt" ] pw_build_PIP_REQUIREMENTS = [ diff --git a/config/esp32/BUILD.gn b/config/esp32/BUILD.gn index 1aacff5567ecf6..fe8c51af257713 100644 --- a/config/esp32/BUILD.gn +++ b/config/esp32/BUILD.gn @@ -36,6 +36,9 @@ group("esp32") { } if (chip_build_tests) { - deps += [ "${chip_root}/src:tests" ] + deps += [ + "${chip_root}/src:tests", + "${chip_root}/src/lib/support:pw_tests_wrapper", + ] } } diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index 7f62ce6cc0087a..672cf849af1244 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -131,6 +131,25 @@ endif() if(CONFIG_ENABLE_ICD_SERVER) chip_gn_arg_append("chip_enable_icd_server" "true") + if(CONFIG_ICD_ENFORCE_SIT_SLOW_POLL_LIMIT) + chip_gn_arg_append("icd_enforce_sit_slow_poll_limit" "true") + endif() + if(CONFIG_ICD_REPORT_ON_ACTIVE_MODE) + chip_gn_arg_append("chip_icd_report_on_active_mode" "true") + endif() + if(CONFIG_ENABLE_ICD_LIT) + chip_gn_arg_append("chip_enable_icd_lit" "true") + if(CONFIG_ENABLE_ICD_CIP) + chip_gn_arg_append("chip_enable_icd_checkin" "true") + else() + chip_gn_arg_append("chip_enable_icd_checkin" "false") + endif() + if(CONFIG_ENABLE_ICD_USER_ACTIVE_MODE_TRIGGER) + chip_gn_arg_append("chip_enable_icd_user_active_mode_trigger" "true") + else() + chip_gn_arg_append("chip_enable_icd_user_active_mode_trigger" "false") + endif() + endif() endif() if(CONFIG_ENABLE_PW_RPC) @@ -422,16 +441,17 @@ if(CONFIG_OPENTHREAD_ENABLED) endif() endif() -if((NOT CONFIG_USE_MINIMAL_MDNS) AND (CONFIG_ENABLE_WIFI_STATION OR CONFIG_ENABLE_WIFI_AP)) +if(NOT CONFIG_USE_MINIMAL_MDNS) idf_build_get_property(build_components BUILD_COMPONENTS) # For IDF v5.x, the mdns component was moved to idf_managed_components. # We should use 'espressif__mdns' for 'idf_component_get_property'. if("espressif__mdns" IN_LIST build_components) idf_component_get_property(mdns_lib espressif__mdns COMPONENT_LIB) + list(APPEND chip_libraries $) elseif("mdns" IN_LIST build_components) idf_component_get_property(mdns_lib mdns COMPONENT_LIB) + list(APPEND chip_libraries $) endif() - list(APPEND chip_libraries $) endif() if (CONFIG_ENABLE_ENCRYPTED_OTA) diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index 0dce48b5f720be..1c0b5afe2bcb61 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -271,6 +271,12 @@ menu "CHIP Core" Opens the commissioning window automatically at application boot time if the node is not yet commissioned. + config ENABLE_SNTP_TIME_SYNC + bool "Enable SNTP time synchronization" + default n + help + Enable this option to enable SNTP time synchronization + endmenu # "System Options" menu "Security Options" @@ -340,13 +346,27 @@ menu "CHIP Device Layer" help Enables or Disables the support for Commissionable Device Type. - config ENABLE_ICD_SERVER + menuconfig ENABLE_ICD_SERVER bool "Enable ICD server" depends on OPENTHREAD_MTD default n help Enables or Disables ICD server + config ICD_ENFORCE_SIT_SLOW_POLL_LIMIT + bool "Enforce SIT Slow Polling Max value to 15 seconds" + depends on ENABLE_ICD_SERVER + default n + help + Set to true to enforce SIT Slow Polling Max value to 15seconds + + config ICD_REPORT_ON_ACTIVE_MODE + bool "Emit a report on entering active mode" + depends on ENABLE_ICD_SERVER + default n + help + Make the ICD manager emit a report on entering active mode + config ICD_SLOW_POLL_INTERVAL_MS int "ICD Slow Polling Interval(ms)" depends on ENABLE_ICD_SERVER @@ -389,14 +409,48 @@ menu "CHIP Device Layer" This value indicates the minimum amount of time in milliseconds the server typically will stay active after network activity when in active mode. + config ENABLE_ICD_LIT + bool "Enable Long Idle Time ICD" + depends on ENABLE_ICD_SERVER + default n + help + Enables or Disables LIT ICD + + config ENABLE_ICD_CIP + bool "Enable Check-in protocol" + depends on ENABLE_ICD_LIT + default y + help + Enables or Disables ICD Check-in protocol + config ICD_CLIENTS_SUPPORTED_PER_FABRIC int "ICD Clients Number Supported Per Fabric" - depends on ENABLE_ICD_SERVER + depends on ENABLE_ICD_CIP default 1 help This value indicates the maximum number of entries that the ICD server is able to store for each fabric in the RegisteredClients attribute. + config ICD_MAX_NOTIFICATION_SUBSCRIBERS + int "Max ICD notification subscribers" + depends on ENABLE_ICD_SERVER + default 1 + help + The ICDManager implements the ICDListener functions and is always subscribed to the ICDNotifier + This allows other Matter modules to inform the ICDManager that it needs to go and may have to stay in Active Mode, + outside of its standard ActiveModeDuration and IdleModeDuration, without being tightly coupled the application + data model + + This implementation also allows other modules to implement an ICDListener and subscribe to ICDNotifier + to couple behaviours with the ICD cycles. In such cases, ICD_MAX_NOTIFICATION_SUBSCRIBERS need to be adjusted + + config ENABLE_ICD_USER_ACTIVE_MODE_TRIGGER + bool "Enable User Active Mode Trigger feature" + depends on ENABLE_ICD_LIT + default y + help + Enables or Disables ICD User Active Mode Trigger feature + config ENABLE_BG_EVENT_PROCESSING bool "Enable Background event processing" default n @@ -912,6 +966,16 @@ menu "CHIP Device Layer" default n help This option enables the system statistics to be sent to the insights cloud. + + config MAX_PERMIT_LIST_SIZE + int "Set permit list size for Insights traces" + range 5 30 + depends on ESP_INSIGHTS_ENABLED + default 20 + help + Maximum number of group entries that can be included in the permit list for reporting + the traces to insights. + endmenu diff --git a/config/nrfconnect/.nrfconnect-recommended-revision b/config/nrfconnect/.nrfconnect-recommended-revision index 21222ceed22ae6..8a965c116821a9 100644 --- a/config/nrfconnect/.nrfconnect-recommended-revision +++ b/config/nrfconnect/.nrfconnect-recommended-revision @@ -1 +1 @@ -v2.5.0 +v2.6.0 diff --git a/config/nrfconnect/chip-gn/.gn b/config/nrfconnect/chip-gn/.gn index bf81e1e8f52cef..b8e1a5a86cc803 100644 --- a/config/nrfconnect/chip-gn/.gn +++ b/config/nrfconnect/chip-gn/.gn @@ -14,6 +14,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") # The location of the build configuration file. buildconfig = "${build_root}/config/BUILDCONFIG.gn" @@ -25,5 +26,14 @@ default_args = { target_cpu = "arm" target_os = "zephyr" + pw_sys_io_BACKEND = dir_pw_sys_io_stdio + pw_assert_BACKEND = dir_pw_assert_log + pw_log_BACKEND = dir_pw_log_basic + + pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", + ] + import("${chip_root}/config/nrfconnect/chip-gn/args.gni") } diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 9b81d7cf30282e..d132d8249d76b1 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -60,13 +60,15 @@ if (CONFIG_ARM) matter_add_cflags(--specs=nosys.specs) endif() -if (CONFIG_NORDIC_SECURITY_BACKEND) +if (CONFIG_NRF_SECURITY) zephyr_include_directories($) zephyr_include_directories($) if(TARGET platform_cc3xx) zephyr_include_directories($) endif() matter_add_flags(-DMBEDTLS_CONFIG_FILE=) + matter_add_flags(-DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=) + matter_add_flags(-DMBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE=) elseif(CONFIG_MBEDTLS) zephyr_include_directories($) zephyr_compile_definitions($) diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index 3414bdd26c9687..5d03e82530c84e 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -206,6 +206,11 @@ choice CHIP_FACTORY_DATA_CERT_SOURCE endchoice +config CHIP_FACTORY_DATA_GENERATE_CD + bool "Generates Certification Declaration to the output build directory" + help + Generates the new Certification Declaration and stores it to the output build directory. + if CHIP_FACTORY_DATA_CERT_SOURCE_USER config CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT @@ -230,6 +235,7 @@ endif # CHIP_FACTORY_DATA_CERT_SOURCE_USER # Configs for SPAKE2+ generation config CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER bool "Generate SPAKE2+ verifier" + default y help Enables the generation of the SPAKE2+ verifier for the configured SPAKE2+ passcode, iteration count and salt. @@ -280,4 +286,20 @@ config CHIP_ENABLE_READ_CLIENT This config can be disabled for device types that do not require Read Client functionality. Disabling this config can save flash and RAM space. +config CHIP_MIGRATE_OPERATIONAL_KEYS_TO_ITS + bool "Operational keys migration feature" + depends on CHIP_CRYPTO_PSA + help + Enables migration of the operational keys stored in the persistent storage to the PSA ITS secure storage. + Enable this feature while updating the firmware of in-field devices that run Mbed TLS cryptography backend + to the firmware based on PSA Crypto API. + +config CHIP_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE + bool "Perform factory reset if the operational key migration failed" + default y + depends on CHIP_MIGRATE_OPERATIONAL_KEYS_TO_ITS + help + Perform factory reset of the device if the operational key for Fabric has not been migrated + properly to PSA ITS storage. + endif # CHIP diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index 8684adb2be3c52..f1c1f71e49acaf 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -20,32 +20,9 @@ if CHIP -config LOG - default y - -if LOG - -choice LOG_MODE - default LOG_MODE_MINIMAL -endchoice - -choice MATTER_LOG_LEVEL_CHOICE - default MATTER_LOG_LEVEL_DBG -endchoice - -config CHIP_APP_LOG_LEVEL - default 4 # debug - -config LOG_DEFAULT_LEVEL - default 1 # error - -config CHIP_LOG_SIZE_OPTIMIZATION - default y - -endif - -config PRINTK_SYNC - default y +# ============================================================================== +# System configuration +# ============================================================================== config ASSERT default y @@ -62,43 +39,52 @@ config HW_STACK_PROTECTION config FPU default y -config SHELL - default y - -config SHELL_MINIMAL - default y - -# Enable getting reboot reasons information -config HWINFO - bool - default y - -config HWINFO_SHELL - bool - default n - -config PTHREAD_IPC - bool - default n - config POSIX_MAX_FDS - int default 16 -# Application stack size config MAIN_STACK_SIZE default 6144 config INIT_STACKS default y +config SYSTEM_WORKQUEUE_STACK_SIZE + default 2560 if CHIP_WIFI + +config HEAP_MEM_POOL_SIZE + default 80000 if CHIP_WIFI + +config CHIP_MALLOC_SYS_HEAP_SIZE + default 30720 if CHIP_WIFI + default 8192 if NET_L2_OPENTHREAD + +# We use sys_heap based allocators, so make sure we don't reserve unused libc heap anyway +config COMMON_LIBC_MALLOC_ARENA_SIZE + default -1 + +config NVS_LOOKUP_CACHE_SIZE + default 512 + +# ============================================================================== +# Zephyr networking configuration +# ============================================================================== + config NET_IPV6_MLD default y +config NET_IPV6_NBR_CACHE + default y if CHIP_WIFI + default n if NET_L2_OPENTHREAD + +config NET_IF_UNICAST_IPV6_ADDR_COUNT + default 6 + config NET_IF_MCAST_IPV6_ADDR_COUNT default 14 -# Network buffers +config NET_IF_IPV6_PREFIX_COUNT + default NET_IF_UNICAST_IPV6_ADDR_COUNT if CHIP_WIFI + config NET_PKT_RX_COUNT default 8 @@ -111,7 +97,12 @@ config NET_BUF_RX_COUNT config NET_BUF_TX_COUNT default 16 -# Bluetooth Low Energy configs +config NET_SOCKETS_POLL_MAX + default 6 if CHIP_WIFI + +# ============================================================================== +# Bluetooth Low Energy configuration +# ============================================================================== config BT default y @@ -162,99 +153,95 @@ config BT_BUF_ACL_TX_SIZE config BT_RX_STACK_SIZE default 1200 +# Increase maximum data length of PDU supported in the Controller +config BT_CTLR_DATA_LENGTH_MAX + default 251 if SOC_SERIES_NRF52X + config BT_CTLR_ECDH - bool default n config BT_CTLR_LE_ENC - bool default n config BT_DEVICE_NAME_GATT_WRITABLE - bool default n config BT_GATT_CACHING - bool default n # Disable 2M PHY due to interoperability issues. config BT_CTLR_PHY_2M default n -# Enable NFC support +config MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL + default y if MPSL_FEM + +# ============================================================================== +# NFC configuration +# ============================================================================== config CHIP_NFC_COMMISSIONING default y # Disable not needed NFC callback to save flash config NFC_THREAD_CALLBACK - bool default n +# ============================================================================== +# DFU configuration +# ============================================================================== + config CHIP_OTA_REQUESTOR default y -# All boards besides nRF7002DK use QSPI NOR external flash -if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840 - +# All boards except nRF7002DK use QSPI NOR external flash config CHIP_QSPI_NOR - default y - -endif # BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840 + default y if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840 # nRF7002DK uses SPI NOR external flash - -if BOARD_NRF7002DK_NRF5340_CPUAPP - config CHIP_SPI_NOR - default y + default y if BOARD_NRF7002DK_NRF5340_CPUAPP -endif # BOARD_NRF7002DK_NRF5340_CPUAPP - -# Enable extended discovery -config CHIP_EXTENDED_DISCOVERY - default n +config BOOT_IMAGE_ACCESS_HOOKS + default y if SOC_SERIES_NRF53X -config NVS_LOOKUP_CACHE_SIZE - default 512 +config UPDATEABLE_IMAGE_NUMBER + default 2 if SOC_SERIES_NRF53X -# Enable OpenThread +# ============================================================================== +# OpenThread configuration +# ============================================================================== config NET_L2_OPENTHREAD default y if !WIFI_NRF700X if NET_L2_OPENTHREAD -# Disable OpenThread shell -config OPENTHREAD_SHELL - default n - -# Disable certain parts of Zephyr IPv6 stack -config NET_IPV6_NBR_CACHE - bool - default n - # Increase the default RX stack size config IEEE802154_NRF5_RX_STACK_SIZE default 1024 config OPENTHREAD_THREAD_STACK_SIZE - default 4096 + default 6144 if PSA_CRYPTO_DRIVER_CC3XX && PSA_CRYPTO_DRIVER_OBERON + default 4096 -endif +config OPENTHREAD_DEFAULT_TX_POWER + default 20 if MPSL_FEM + default 3 if SOC_SERIES_NRF53X + default 8 if SOC_SERIES_NRF52X + +endif # NET_L2_OPENTHREAD + +# ============================================================================== +# Wi-Fi configuration +# ============================================================================== if CHIP_WIFI choice WPA_SUPP_LOG_LEVEL_CHOICE - default WPA_SUPP_LOG_LEVEL_ERR + default WPA_SUPP_LOG_LEVEL_ERR endchoice -# increase the prefixes limit to match -# maximum number of IPv6 addresses per interface -config NET_IF_IPV6_PREFIX_COUNT - default 6 - # it saves us 20kB of FLASH config WPA_SUPP_NO_DEBUG default y @@ -272,74 +259,73 @@ config NRF_WIFI_LOW_POWER config NRF700X_RX_NUM_BUFS default 16 -config NRF700X_TX_MAX_DATA_SIZE - default 1280 - -config NRF700X_RX_MAX_DATA_SIZE - default 1280 - config NRF700X_MAX_TX_TOKENS default 10 config NRF700X_MAX_TX_AGGREGATION default 1 -config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG +# it saves 25kB of FLASH +config WPA_SUPP_ADVANCED_FEATURES default n -config SYSTEM_WORKQUEUE_STACK_SIZE - default 2560 +endif # CHIP_WIFI -# align these numbers to match the OpenThread config -config NET_IF_UNICAST_IPV6_ADDR_COUNT - default 6 +# ============================================================================== +# Crypto configuration +# ============================================================================== -config NET_IF_MCAST_IPV6_ADDR_COUNT - default 8 +choice OPENTHREAD_SECURITY + default OPENTHREAD_NRF_SECURITY_PSA_CHOICE if CHIP_CRYPTO_PSA + default OPENTHREAD_NRF_SECURITY_CHOICE + +endchoice -config NET_SOCKETS_POLL_MAX - default 6 +choice RNG_GENERATOR_CHOICE + default XOSHIRO_RANDOM_GENERATOR if SOC_SERIES_NRF53X +endchoice -config MBEDTLS_SSL_OUT_CONTENT_LEN - default 900 +config OBERON_BACKEND + default y -# options managed by IP4/IP6 simultaneous support -# aligned here to match OpenThread config -config NET_MAX_ROUTERS - default 1 +config MBEDTLS_ENABLE_HEAP + default y -config NET_MAX_CONN - default 4 +config MBEDTLS_HEAP_SIZE + default 8192 + +# Enable PSA Crypto dependencies for Matter -config SHELL_STACK_SIZE - default 2616 +config CHIP_CRYPTO_PSA + default y if !CHIP_WIFI -config HEAP_MEM_POOL_SIZE - default 80000 +if CHIP_CRYPTO_PSA -endif +config PSA_CRYPTO_DRIVER_CC3XX + default n -config CHIP_MALLOC_SYS_HEAP_SIZE - default 28672 if CHIP_WIFI - default 8192 if NET_L2_OPENTHREAD +config PSA_WANT_ALG_SHA_224 + default n -# Enable mbedTLS from nrf_security library +# Extend the maximum number of PSA key slots to fit Matter requirements +config MBEDTLS_PSA_KEY_SLOT_COUNT + default 64 -choice OPENTHREAD_SECURITY - default OPENTHREAD_NRF_SECURITY_CHOICE -endchoice +if PSA_CRYPTO_DRIVER_CC3XX && PSA_CRYPTO_DRIVER_OBERON -config PSA_CRYPTO_DRIVER_CC3XX - default n +# Do not use CC3XX hash driver when both Oberon and CC3xx are enabled. +config PSA_USE_CC3XX_HASH_DRIVER + default n -config OBERON_BACKEND - default y +endif -config MBEDTLS_ENABLE_HEAP +# Spake2+ support +config MBEDTLS_MD_C default y -config MBEDTLS_HEAP_SIZE - default 8192 +endif + +if !CHIP_CRYPTO_PSA config NRF_SECURITY_ADVANCED default y @@ -347,32 +333,46 @@ config NRF_SECURITY_ADVANCED config MBEDTLS_AES_C default y -config MBEDTLS_ECP_C - default y - -config MBEDTLS_ECP_DP_SECP256R1_ENABLED - default y - config MBEDTLS_CTR_DRBG_C default y config MBEDTLS_CIPHER_MODE_CTR default y +config MBEDTLS_SHA1_C + default y if CHIP_WIFI + config MBEDTLS_SHA256_C default y config MBEDTLS_PK_C default y +config MBEDTLS_PKCS5_C + default y + config MBEDTLS_PK_WRITE_C default y config MBEDTLS_X509_CREATE_C - default y if !CHIP_CRYPTO_PSA + default y config MBEDTLS_X509_CSR_WRITE_C - default y if !CHIP_CRYPTO_PSA + default y + +config MBEDTLS_ECP_C + default y + +config MBEDTLS_ECP_DP_SECP256R1_ENABLED + default y + +endif + +config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG + default n if CHIP_WIFI + +config MBEDTLS_SSL_OUT_CONTENT_LEN + default 900 if CHIP_WIFI # Disable unneeded crypto operations @@ -406,17 +406,54 @@ config MBEDTLS_SSL_SRV_C config MBEDTLS_SSL_COOKIE_C default n -# Disable not used shell modules +# ============================================================================== +# Logging configuration +# ============================================================================== -config SHELL_WILDCARD - default n +config LOG + default y -config SHELL_VT100_COLORS - default n +if LOG -config SHELL_STATS +choice LOG_MODE + default LOG_MODE_MINIMAL +endchoice + +choice MATTER_LOG_LEVEL_CHOICE + default MATTER_LOG_LEVEL_DBG +endchoice + +config CHIP_APP_LOG_LEVEL + default 4 # debug + +config LOG_DEFAULT_LEVEL + default 1 # error + +config CHIP_LOG_SIZE_OPTIMIZATION + default y + +# disable synchronous printk to avoid blocking IRQs which +# may affect time sensitive components +config PRINTK_SYNC default n +endif # LOG + +# ============================================================================== +# Shell configuration +# ============================================================================== + +config SHELL + default y + +if SHELL + +config SHELL_STACK_SIZE + default 2616 if CHIP_WIFI + +config SHELL_MINIMAL + default y + config KERNEL_SHELL default n @@ -441,42 +478,12 @@ config CLOCK_CONTROL_NRF_SHELL config FLASH_SHELL default n -if MPSL_FEM - -config MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL - default y - -endif # MPSL_FEM - -config OPENTHREAD_DEFAULT_TX_POWER - default 20 if MPSL_FEM - default 3 if SOC_SERIES_NRF53X && !MPSL_FEM - default 8 if SOC_SERIES_NRF52X && !MPSL_FEM - -# SoC series related configuration - -if SOC_SERIES_NRF52X - -# Increase maximum data length of PDU supported in the Controller -config BT_CTLR_DATA_LENGTH_MAX - default 251 - -endif # SOC_SERIES_NRF52X - -if SOC_SERIES_NRF53X - -config BOOT_IMAGE_ACCESS_HOOKS - default y - -config UPDATEABLE_IMAGE_NUMBER - default 2 +config HWINFO_SHELL + default n -# Generate random numbers using Xoroshiro algorithm instead of direct calls -# to the cryptocell library to workaround firmware hangs. -choice RNG_GENERATOR_CHOICE - default XOROSHIRO_RANDOM_GENERATOR -endchoice +config OPENTHREAD_SHELL + default n -endif # SOC_SERIES_NRF53X +endif # SHELL -endif +endif \ No newline at end of file diff --git a/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.defaults b/config/nrfconnect/chip-module/Kconfig.hci_ipc.defaults similarity index 96% rename from config/nrfconnect/chip-module/Kconfig.hci_rpmsg.defaults rename to config/nrfconnect/chip-module/Kconfig.hci_ipc.defaults index 17c7115e28b750..bede85fd2541d3 100644 --- a/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.defaults +++ b/config/nrfconnect/chip-module/Kconfig.hci_ipc.defaults @@ -14,7 +14,7 @@ # limitations under the License. # -# The purpose of this file is to define new default values of settings used when building hci_rpmsg child image for Matter samples. +# The purpose of this file is to define new default values of settings used when building hci_ipc child image for Matter samples. config LOG default n diff --git a/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root b/config/nrfconnect/chip-module/Kconfig.hci_ipc.root similarity index 84% rename from config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root rename to config/nrfconnect/chip-module/Kconfig.hci_ipc.root index 8c4f6eee49cbc2..1fe8ff85f43ee8 100644 --- a/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root +++ b/config/nrfconnect/chip-module/Kconfig.hci_ipc.root @@ -15,7 +15,7 @@ # # The purpose of this file is to create a wrapper Kconfig file that will be set as -# hci_rpmsg_KCONFIG_ROOT and processed before any other Kconfig for hci_rpmsg child image. +# hci_ipc_KCONFIG_ROOT and processed before any other Kconfig for hci_ipc child image. -rsource "Kconfig.hci_rpmsg.defaults" +rsource "Kconfig.hci_ipc.defaults" source "Kconfig.zephyr" diff --git a/config/nrfconnect/chip-module/generate_factory_data.cmake b/config/nrfconnect/chip-module/generate_factory_data.cmake index dc1794562d89cf..3c286fc21dddee 100644 --- a/config/nrfconnect/chip-module/generate_factory_data.cmake +++ b/config/nrfconnect/chip-module/generate_factory_data.cmake @@ -48,14 +48,25 @@ string(APPEND script_args "--hw_ver ${CONFIG_CHIP_DEVICE_HARDWARE_VERSION}\n") string(APPEND script_args "--hw_ver_str \"${CONFIG_CHIP_DEVICE_HARDWARE_VERSION_STRING}\"\n") # check if Rotating Device Id Unique Id should be generated -if(NOT CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID) - if(NOT DEFINED CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID) - message(FATAL_ERROR "CHIP_DEVICE_ROTATING_DEVICE_UID was not provided. To generate it use CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID=y") +if(CONFIG_CHIP_ROTATING_DEVICE_ID) + if(NOT CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID) + if(NOT DEFINED CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID) + message(FATAL_ERROR "CHIP_DEVICE_ROTATING_DEVICE_UID was not provided. To generate it use CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID=y") + else() + string(APPEND script_args "--rd_uid \"${CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID}\"\n") + endif() else() - string(APPEND script_args "--rd_uid \"${CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID}\"\n") + string(APPEND script_args "--generate_rd_uid\n") endif() -else() - string(APPEND script_args "--generate_rd_uid\n") +endif() + +if(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED OR CONFIG_CHIP_FACTORY_DATA_GENERATE_CD) + find_program(chip_cert_exe NAMES chip-cert REQUIRED) + string(APPEND script_args "--chip_cert_path ${chip_cert_exe}\n") +endif() + +if(CONFIG_CHIP_FACTORY_DATA_GENERATE_CD) + string(APPEND script_args "--gen_cd\n") endif() # for development purpose user can use default certs instead of generating or providing them @@ -77,10 +88,8 @@ elseif(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER) string(APPEND script_args "--dac_cert \"${CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT}\"\n") string(APPEND script_args "--dac_key \"${CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY}\"\n") string(APPEND script_args "--pai_cert \"${CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT}\"\n") -else() - find_program(chip_cert_exe NAMES chip-cert REQUIRED) - string(APPEND script_args "--gen_cd\n") - string(APPEND script_args "--chip_cert_path ${chip_cert_exe}\n") +elseif(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED) + string(APPEND script_args "--gen_certs\n") endif() # add Password-Authenticated Key Exchange parameters @@ -90,8 +99,14 @@ string(APPEND script_args "--discriminator ${CONFIG_CHIP_DEVICE_DISCRIMINATOR}\n string(APPEND script_args "--passcode ${CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE}\n") string(APPEND script_args "--include_passcode\n") string(APPEND script_args "--overwrite\n") -string(APPEND script_args "--product_finish ${CONFIG_CHIP_DEVICE_PRODUCT_FINISH}\n") +# check if spake2 verifier should be generated using script +if(NOT CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER) + # Spake2 verifier should be provided using kConfig + string(APPEND script_args "--spake2_verifier \"${CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER}\"\n") +endif() +# Product appearance +string(APPEND script_args "--product_finish ${CONFIG_CHIP_DEVICE_PRODUCT_FINISH}\n") if(CONFIG_CHIP_DEVICE_PRODUCT_COLOR) string(APPEND script_args "--product_color ${CONFIG_CHIP_DEVICE_PRODUCT_COLOR}\n") endif() @@ -100,12 +115,6 @@ if(CONFIG_CHIP_FACTORY_DATA_GENERATE_ONBOARDING_CODES) string(APPEND script_args "--generate_onboarding\n") endif() -# check if spake2 verifier should be generated using script -if(NOT CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER) - # Spake2 verifier should be provided using kConfig - string(APPEND script_args "--spake2_verifier \"${CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER}\"\n") -endif() - if(CONFIG_CHIP_DEVICE_ENABLE_KEY) # Add optional EnableKey that triggers user-specific action. string(APPEND script_args "--enable_key \"${CONFIG_CHIP_DEVICE_ENABLE_KEY}\"\n") diff --git a/config/nxp/chip-module/Kconfig b/config/nxp/chip-module/Kconfig index 7ee0917ebec555..ae95e1ce348f57 100644 --- a/config/nxp/chip-module/Kconfig +++ b/config/nxp/chip-module/Kconfig @@ -256,3 +256,23 @@ config CHIP_OTA_REQUESTOR_REBOOT_ON_APPLY Reboots the device automatically after downloading a new firmware update to swap the old and the new firmware images. The reboot happens only when a user consents to apply the firmware update. + +choice CHIP_OTA_REQUEST_UPGRADE_TYPE + prompt "Type of the upgrade to apply on new images" + default CHIP_OTA_REQUEST_UPGRADE_TEST + depends on CHIP_OTA_REQUESTOR + + config CHIP_OTA_REQUEST_UPGRADE_PERMANENT + bool "Mark the image as permanent" + help + The upgrade will be permanent on the next reboot. + No coming back to the old image. + + config CHIP_OTA_REQUEST_UPGRADE_TEST + bool "Mark the image as a test" + help + The upgrade will be marked as a test. + Image will be run on the next reboot, if confirmed it + becomes permanent, otherwise the new image is reverted. + +endchoice diff --git a/config/nxp/chip-module/Kconfig.defaults b/config/nxp/chip-module/Kconfig.defaults index 531a3f38245aad..178a9eddd6b057 100644 --- a/config/nxp/chip-module/Kconfig.defaults +++ b/config/nxp/chip-module/Kconfig.defaults @@ -127,7 +127,7 @@ choice NET_TC_THREAD_TYPE default NET_TC_THREAD_PREEMPTIVE endchoice -config NET_TCP_WORK_QUEUE_THREAD_PRIO +config NET_TCP_WORKER_PRIO default -16 config NET_TC_TX_THREAD_BASE_PRIO @@ -406,6 +406,3 @@ config FLASH_SHELL endif # SHELL endif - -config NXP_FW_LOADER_MONOLITHIC - default y if NXP_FW_LOADER diff --git a/config/openiotsdk/chip-gn/.gn b/config/openiotsdk/chip-gn/.gn index 4b9894b0f943ac..f2404233d6f74d 100644 --- a/config/openiotsdk/chip-gn/.gn +++ b/config/openiotsdk/chip-gn/.gn @@ -14,6 +14,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") # The location of the build configuration file. buildconfig = "//build/config/BUILDCONFIG.gn" @@ -26,4 +27,14 @@ default_args = { target_os = "cmsis-rtos" import("${chip_root}/config/openiotsdk/chip-gn/args.gni") + + pw_sys_io_BACKEND = dir_pw_sys_io_stdio + + pw_assert_BACKEND = dir_pw_assert_log + pw_log_BACKEND = dir_pw_log_basic + + pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", + ] } diff --git a/config/openiotsdk/chip-gn/BUILD.gn b/config/openiotsdk/chip-gn/BUILD.gn index 6e6fb51d404bb1..94e2f28635d114 100644 --- a/config/openiotsdk/chip-gn/BUILD.gn +++ b/config/openiotsdk/chip-gn/BUILD.gn @@ -19,7 +19,10 @@ group("openiotsdk") { deps = [ "${chip_root}/src/lib" ] if (chip_build_tests) { - deps += [ "${chip_root}/src:tests" ] + deps += [ + "${chip_root}/src:tests", + "${chip_root}/src/lib/support:pw_tests_wrapper", + ] } } diff --git a/credentials/generate-revocation-set.py b/credentials/generate-revocation-set.py new file mode 100644 index 00000000000000..534edc15b0f203 --- /dev/null +++ b/credentials/generate-revocation-set.py @@ -0,0 +1,248 @@ +#!/usr/bin/python + +# +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Generates a basic RevocationSet from TestNet +# Usage: +# python ./credentials/generate-revocation-set.py --help + +import base64 +import json +import subprocess +import sys +from enum import Enum + +import click +import requests +from click_option_group import RequiredMutuallyExclusiveOptionGroup, optgroup +from cryptography import x509 + + +class RevocationType(Enum): + CRL = 1 + + +OID_VENDOR_ID = x509.ObjectIdentifier("1.3.6.1.4.1.37244.2.1") +OID_PRODUCT_ID = x509.ObjectIdentifier("1.3.6.1.4.1.37244.2.2") + +PRODUCTION_NODE_URL = "https://on.dcl.csa-iot.org:26657" +PRODUCTION_NODE_URL_REST = "https://on.dcl.csa-iot.org" +TEST_NODE_URL_REST = "https://on.test-net.dcl.csa-iot.org" + + +def use_dcld(dcld, production, cmdlist): + return [dcld] + cmdlist + (['--node', PRODUCTION_NODE_URL] if production else []) + + +def extract_single_integer_attribute(subject, oid): + attribute_list = subject.get_attributes_for_oid(oid) + + if len(attribute_list) == 1: + if attribute_list[0].value.isdigit(): + return int(attribute_list[0].value) + + return None + + +@click.command() +@click.help_option('-h', '--help') +@optgroup.group('Input data sources', cls=RequiredMutuallyExclusiveOptionGroup) +@optgroup.option('--use-main-net-dcld', type=str, default='', metavar='PATH', help="Location of `dcld` binary, to use `dcld` for mirroring MainNet.") +@optgroup.option('--use-test-net-dcld', type=str, default='', metavar='PATH', help="Location of `dcld` binary, to use `dcld` for mirroring TestNet.") +@optgroup.option('--use-main-net-http', is_flag=True, type=str, help="Use RESTful API with HTTPS against public MainNet observer.") +@optgroup.option('--use-test-net-http', is_flag=True, type=str, help="Use RESTful API with HTTPS against public TestNet observer.") +@optgroup.group('Optional arguments') +@optgroup.option('--output', default='sample_revocation_set_list.json', type=str, metavar='FILEPATH', help="Output filename (default: sample_revocation_set_list.json)") +def main(use_main_net_dcld, use_test_net_dcld, use_main_net_http, use_test_net_http, output): + """DCL PAA mirroring tools""" + + production = False + dcld = use_test_net_dcld + + if len(use_main_net_dcld) > 0: + dcld = use_main_net_dcld + production = True + + use_rest = use_main_net_http or use_test_net_http + if use_main_net_http: + production = True + + rest_node_url = PRODUCTION_NODE_URL_REST if production else TEST_NODE_URL_REST + + # TODO: Extract this to a helper function + if use_rest: + revocation_point_list = requests.get(f"{rest_node_url}/dcl/pki/revocation-points").json()["PkiRevocationDistributionPoint"] + else: + cmdlist = ['config', 'output', 'json'] + subprocess.Popen([dcld] + cmdlist) + + cmdlist = ['query', 'pki', 'all-revocation-points'] + + cmdpipe = subprocess.Popen(use_dcld(dcld, production, cmdlist), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + revocation_point_list = json.loads(cmdpipe.stdout.read())["PkiRevocationDistributionPoint"] + + revocation_set = [] + + for revocation_point in revocation_point_list: + # 1. Validate Revocation Type + if revocation_point["revocationType"] != RevocationType.CRL: + continue + + # 2. Parse the certificate + crl_signer_certificate = x509.load_pem_x509_certificate(revocation_point["crlSignerCertificate"]) + + vid = revocation_point["vid"] + pid = revocation_point["pid"] + is_paa = revocation_point["isPAA"] + + # 3. && 4. Validate VID/PID + # TODO: Need to support alternate representation of VID/PID (see spec "6.2.2.2. Encoding of Vendor ID and Product ID in subject and issuer fields") + crl_vid = extract_single_integer_attribute(crl_signer_certificate.subject, OID_VENDOR_ID) + crl_pid = extract_single_integer_attribute(crl_signer_certificate.subject, OID_PRODUCT_ID) + + if is_paa: + if crl_vid is not None: + if vid != crl_vid: + # TODO: Need to log all situations where a continue is called + continue + else: + if crl_vid is None or vid != crl_vid: + continue + if crl_pid is not None: + if pid != crl_pid: + continue + + # 5. Validate the certification path containing CRLSignerCertificate. + crl_signer_issuer_name = base64.b64encode(crl_signer_certificate.issuer.public_bytes()).decode('utf-8') + + crl_signer_authority_key_id = crl_signer_certificate.extensions.get_extension_for_oid( + x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier + + paa_certificate = None + + # TODO: Extract this to a helper function + if use_rest: + response = requests.get( + f"{rest_node_url}/dcl/pki/certificates/{crl_signer_issuer_name}/{crl_signer_authority_key_id}").json()["approvedCertificates"]["certs"][0] + paa_certificate = response["pemCert"] + else: + cmdlist = ['query', 'pki', 'x509-cert', '-u', crl_signer_issuer_name, '-k', crl_signer_authority_key_id] + cmdpipe = subprocess.Popen(use_dcld(dcld, production, cmdlist), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + paa_certificate = json.loads(cmdpipe.stdout.read())["approvedCertificates"]["certs"][0]["pemCert"] + + if paa_certificate is None: + continue + + paa_certificate_object = x509.load_pem_x509_certificate(paa_certificate) + + try: + crl_signer_certificate.verify_directly_issued_by(paa_certificate_object) + except Exception: + continue + + # 6. Obtain the CRL + r = requests.get(revocation_point["dataURL"]) + crl_file = x509.load_der_x509_crl(r.content) + + # 7. Perform CRL File Validation + crl_authority_key_id = crl_file.extensions.get_extension_for_oid(x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier + crl_signer_subject_key_id = crl_signer_certificate.extensions.get_extension_for_oid( + x509.OID_SUBJECT_KEY_IDENTIFIER).value.key_identifier + if crl_authority_key_id != crl_signer_subject_key_id: + continue + + issuer_subject_key_id = ''.join('{:02X}'.format(x) for x in crl_authority_key_id) + + same_issuer_points = None + + # TODO: Extract this to a helper function + if use_rest: + response = requests.get( + f"{rest_node_url}/dcl/pki/revocation-points/{issuer_subject_key_id}").json()["pkiRevocationDistributionPointsByIssuerSubjectKeyID"] + same_issuer_points = response["points"] + else: + cmdlist = ['query', 'pki', 'revocation-points', '--issuer-subject-key-id', issuer_subject_key_id] + cmdpipe = subprocess.Popen(use_dcld(dcld, production, cmdlist), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + same_issuer_points = json.loads(cmdpipe.stdout.read())[ + "pkiRevocationDistributionPointsByIssuerSubjectKeyID"]["points"] + + matching_entries = False + for same_issuer_point in same_issuer_points: + if same_issuer_point["vid"] == vid: + matching_entries = True + break + + if matching_entries: + try: + issuing_distribution_point = crl_file.extensions.get_extension_for_oid( + x509.OID_ISSUING_DISTRIBUTION_POINT).value + except Exception: + continue + + uri_list = issuing_distribution_point.full_name + if len(uri_list) == 1 and isinstance(uri_list[0], x509.UniformResourceIdentifier): + if uri_list[0].value != revocation_point["dataURL"]: + continue + else: + continue + + # 9. Assign CRL File Issuer + certificate_authority_name = base64.b64encode(crl_file.issuer.public_bytes()).decode('utf-8') + + serialnumber_list = [] + # 10. Iterate through the Revoked Certificates List + for revoked_cert in crl_file: + try: + revoked_cert_issuer = revoked_cert.extensions.get_extension_for_oid( + x509.CRLEntryExtensionOID.CERTIFICATE_ISSUER).value.get_values_for_type(x509.DirectoryName).value + + if revoked_cert_issuer is not None: + if revoked_cert_issuer != certificate_authority_name: + continue + except Exception: + pass + + # b. + try: + revoked_cert_authority_key_id = revoked_cert.extensions.get_extension_for_oid( + x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier + + if revoked_cert_authority_key_id is None or revoked_cert_authority_key_id != crl_signer_subject_key_id: + continue + except Exception: + continue + + # c. and d. + serialnumber_list.append(bytes(str('{:02X}'.format(revoked_cert.serial_number)), 'utf-8').decode('utf-8')) + + issuer_name = base64.b64encode(crl_file.issuer.public_bytes()).decode('utf-8') + + revocation_set.append({"type": "revocation_set", + "issuer_subject_key_id": issuer_subject_key_id, + "issuer_name": issuer_name, + "revoked_serial_numbers": serialnumber_list}) + + with open(output, 'w+') as outfile: + json.dump(revocation_set, outfile, indent=4) + + +if __name__ == "__main__": + if len(sys.argv) == 1: + main.main(['--help']) + else: + main() diff --git a/data_model/README.md b/data_model/README.md index 36f38cae0ff1f8..a26b1c4ff65558 100644 --- a/data_model/README.md +++ b/data_model/README.md @@ -17,7 +17,7 @@ update the spec XML files, however this is not done automatically. You will require access to the following tools locally: - `scraper`. A binary copy generally available - [here](https://github.com/csa-data-model/projects/tree/main/DM-Editor/bin/1.2.0/scrape) + [here](https://github.com/csa-data-model/projects/tree/main/DM-Editor/bin/scrape) - Specification repository checkout from https://github.com/CHIP-Specifications/connectedhomeip-spec diff --git a/data_model/clusters/ACL-Cluster.xml b/data_model/clusters/ACL-Cluster.xml index 9ef2f500e96e01..b965eb84234e0d 100644 --- a/data_model/clusters/ACL-Cluster.xml +++ b/data_model/clusters/ACL-Cluster.xml @@ -55,10 +55,13 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + + + @@ -112,25 +115,27 @@ Davis, CA 95616, USA - + + - + - + + - + - + - + @@ -150,12 +155,14 @@ Davis, CA 95616, USA - + + - + + diff --git a/data_model/clusters/AccountLogin.xml b/data_model/clusters/AccountLogin.xml index 91f675eaba693b..db87d05dc74902 100644 --- a/data_model/clusters/AccountLogin.xml +++ b/data_model/clusters/AccountLogin.xml @@ -54,14 +54,20 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> - + + + + + - + @@ -70,14 +76,14 @@ Davis, CA 95616, USA - + - + @@ -86,12 +92,27 @@ Davis, CA 95616, USA - + + + + - + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/AdminCommissioningCluster.xml b/data_model/clusters/AdminCommissioningCluster.xml index b94b25ec5520c2..eea41bc65b6e2c 100644 --- a/data_model/clusters/AdminCommissioningCluster.xml +++ b/data_model/clusters/AdminCommissioningCluster.xml @@ -1,7 +1,5 @@ + + + diff --git a/data_model/clusters/AlarmBase.xml b/data_model/clusters/AlarmBase.xml index 9ba73c14ab6e63..f4ffc6344a8b90 100644 --- a/data_model/clusters/AlarmBase.xml +++ b/data_model/clusters/AlarmBase.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -91,7 +96,7 @@ Davis, CA 95616, USA - + @@ -100,7 +105,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/ApplicationBasic.xml b/data_model/clusters/ApplicationBasic.xml index 086839a2338cfc..fa197a8d1e5cca 100644 --- a/data_model/clusters/ApplicationBasic.xml +++ b/data_model/clusters/ApplicationBasic.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/ApplicationLauncher.xml b/data_model/clusters/ApplicationLauncher.xml index 5d716981a55d38..6b84436e73d42d 100644 --- a/data_model/clusters/ApplicationLauncher.xml +++ b/data_model/clusters/ApplicationLauncher.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -111,7 +116,7 @@ Davis, CA 95616, USA - + @@ -124,7 +129,7 @@ Davis, CA 95616, USA - + @@ -134,7 +139,7 @@ Davis, CA 95616, USA - + @@ -145,7 +150,6 @@ Davis, CA 95616, USA - diff --git a/data_model/clusters/AudioOutput.xml b/data_model/clusters/AudioOutput.xml index 176e75b16c19c9..468ba2750152a6 100644 --- a/data_model/clusters/AudioOutput.xml +++ b/data_model/clusters/AudioOutput.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -111,14 +116,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/clusters/BallastConfiguration.xml b/data_model/clusters/BallastConfiguration.xml index 416b8cd7014beb..f25bef22cb4b6c 100644 --- a/data_model/clusters/BallastConfiguration.xml +++ b/data_model/clusters/BallastConfiguration.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -62,6 +64,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/BasicInformationCluster.xml b/data_model/clusters/BasicInformationCluster.xml index 87fa765f65b2f5..82b9283b0d21d6 100644 --- a/data_model/clusters/BasicInformationCluster.xml +++ b/data_model/clusters/BasicInformationCluster.xml @@ -59,8 +59,11 @@ Davis, CA 95616, USA - + + + + @@ -175,50 +178,50 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + @@ -226,41 +229,41 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + @@ -271,11 +274,11 @@ Davis, CA 95616, USA - + - + @@ -293,6 +296,12 @@ Davis, CA 95616, USA + + + + + + diff --git a/data_model/clusters/Binding-Cluster.xml b/data_model/clusters/Binding-Cluster.xml index 95f68f1d6ff995..937b9164e2a4f8 100644 --- a/data_model/clusters/Binding-Cluster.xml +++ b/data_model/clusters/Binding-Cluster.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -73,6 +78,7 @@ Davis, CA 95616, USA + diff --git a/data_model/clusters/BooleanState.xml b/data_model/clusters/BooleanState.xml index 5b298075fbaefc..9205310c58f2be 100644 --- a/data_model/clusters/BooleanState.xml +++ b/data_model/clusters/BooleanState.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/BooleanStateConfiguration.xml b/data_model/clusters/BooleanStateConfiguration.xml index 160cb7fadb7a93..dc17f93a7295f0 100644 --- a/data_model/clusters/BooleanStateConfiguration.xml +++ b/data_model/clusters/BooleanStateConfiguration.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -164,7 +169,7 @@ Davis, CA 95616, USA - + @@ -173,7 +178,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/Channel.xml b/data_model/clusters/Channel.xml index 9ace62ca720a53..1809f5262e7166 100644 --- a/data_model/clusters/Channel.xml +++ b/data_model/clusters/Channel.xml @@ -54,11 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> - + + + + + @@ -67,8 +73,28 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + @@ -85,6 +111,17 @@ Davis, CA 95616, USA + + + + + + + + + + + @@ -101,6 +138,22 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + @@ -117,6 +170,132 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -142,7 +321,7 @@ Davis, CA 95616, USA - + @@ -155,7 +334,6 @@ Davis, CA 95616, USA - @@ -170,7 +348,7 @@ Davis, CA 95616, USA - + @@ -180,12 +358,108 @@ Davis, CA 95616, USA - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/ColorControl.xml b/data_model/clusters/ColorControl.xml index c0b0655261b10b..14d471b78a3043 100644 --- a/data_model/clusters/ColorControl.xml +++ b/data_model/clusters/ColorControl.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -64,6 +66,9 @@ Davis, CA 95616, USA + + + @@ -102,6 +107,7 @@ Davis, CA 95616, USA + @@ -123,19 +129,19 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -158,13 +164,13 @@ Davis, CA 95616, USA - + - + - + @@ -356,16 +362,16 @@ Davis, CA 95616, USA - + - + - + - + @@ -434,7 +440,7 @@ Davis, CA 95616, USA - + @@ -449,7 +455,7 @@ Davis, CA 95616, USA - + @@ -460,16 +466,16 @@ Davis, CA 95616, USA - + - + - + - + @@ -489,23 +495,23 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -524,23 +530,23 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -562,7 +568,7 @@ Davis, CA 95616, USA - + @@ -584,23 +590,23 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -619,23 +625,23 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -657,7 +663,7 @@ Davis, CA 95616, USA - + @@ -683,7 +689,7 @@ Davis, CA 95616, USA - + @@ -709,7 +715,7 @@ Davis, CA 95616, USA - + @@ -729,7 +735,7 @@ Davis, CA 95616, USA - + @@ -753,7 +759,7 @@ Davis, CA 95616, USA - + @@ -775,7 +781,7 @@ Davis, CA 95616, USA - + @@ -800,7 +806,7 @@ Davis, CA 95616, USA - + @@ -821,7 +827,7 @@ Davis, CA 95616, USA - + @@ -846,7 +852,7 @@ Davis, CA 95616, USA - + @@ -871,7 +877,7 @@ Davis, CA 95616, USA - + @@ -899,13 +905,13 @@ Davis, CA 95616, USA - + - + - + @@ -914,10 +920,10 @@ Davis, CA 95616, USA - + - + @@ -939,7 +945,7 @@ Davis, CA 95616, USA - + @@ -957,7 +963,7 @@ Davis, CA 95616, USA - + @@ -986,7 +992,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/ContentAppObserver.xml b/data_model/clusters/ContentAppObserver.xml index b426daa5ec3379..184cce14924cda 100644 --- a/data_model/clusters/ContentAppObserver.xml +++ b/data_model/clusters/ContentAppObserver.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -71,7 +76,7 @@ Davis, CA 95616, USA - + @@ -84,7 +89,6 @@ Davis, CA 95616, USA - diff --git a/data_model/clusters/ContentControl.xml b/data_model/clusters/ContentControl.xml index b51bdff9397448..14996a7c28011a 100644 --- a/data_model/clusters/ContentControl.xml +++ b/data_model/clusters/ContentControl.xml @@ -59,6 +59,9 @@ Davis, CA 95616, USA + + + @@ -255,7 +258,7 @@ Davis, CA 95616, USA - + @@ -269,14 +272,13 @@ Davis, CA 95616, USA - + - @@ -285,15 +287,15 @@ Davis, CA 95616, USA - + - + - + @@ -307,7 +309,7 @@ Davis, CA 95616, USA - + @@ -317,19 +319,19 @@ Davis, CA 95616, USA - + - + - + @@ -339,7 +341,7 @@ Davis, CA 95616, USA - + @@ -349,7 +351,7 @@ Davis, CA 95616, USA - + @@ -359,7 +361,7 @@ Davis, CA 95616, USA - + @@ -369,7 +371,7 @@ Davis, CA 95616, USA - + @@ -379,7 +381,7 @@ Davis, CA 95616, USA - + @@ -389,7 +391,7 @@ Davis, CA 95616, USA - + @@ -398,7 +400,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/ContentLauncher.xml b/data_model/clusters/ContentLauncher.xml index 2c310c6f2ccb3d..b8f80de2e51ea7 100644 --- a/data_model/clusters/ContentLauncher.xml +++ b/data_model/clusters/ContentLauncher.xml @@ -54,11 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> - + + + + + @@ -67,6 +73,15 @@ Davis, CA 95616, USA + + + + + + + + + @@ -119,12 +134,21 @@ Davis, CA 95616, USA - + + + + + + + + + + @@ -136,6 +160,16 @@ Davis, CA 95616, USA + + + + + + + + + + @@ -206,6 +240,27 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + @@ -220,6 +275,23 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + @@ -242,7 +314,7 @@ Davis, CA 95616, USA - + @@ -258,8 +330,15 @@ Davis, CA 95616, USA + + + + + + + - + @@ -273,9 +352,11 @@ Davis, CA 95616, USA + + + - diff --git a/data_model/clusters/DemandResponseLoadControl.xml b/data_model/clusters/DemandResponseLoadControl.xml index a5322bfb4f7206..206201b347612c 100644 --- a/data_model/clusters/DemandResponseLoadControl.xml +++ b/data_model/clusters/DemandResponseLoadControl.xml @@ -55,13 +55,16 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + + + @@ -192,6 +195,59 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -222,6 +278,41 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -361,14 +452,14 @@ Davis, CA 95616, USA - + - + @@ -376,14 +467,14 @@ Davis, CA 95616, USA - + - + @@ -394,7 +485,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/Descriptor-Cluster.xml b/data_model/clusters/Descriptor-Cluster.xml index 9944d8a3f6ea4c..1b17fb4fdfdaea 100644 --- a/data_model/clusters/Descriptor-Cluster.xml +++ b/data_model/clusters/Descriptor-Cluster.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/DeviceEnergyManagement.xml b/data_model/clusters/DeviceEnergyManagement.xml index 21f74a737d52cb..e493c5b332182e 100644 --- a/data_model/clusters/DeviceEnergyManagement.xml +++ b/data_model/clusters/DeviceEnergyManagement.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -61,6 +63,9 @@ Davis, CA 95616, USA + + + + @@ -487,13 +492,13 @@ Davis, CA 95616, USA - + - + @@ -507,7 +512,7 @@ Davis, CA 95616, USA - + @@ -521,13 +526,13 @@ Davis, CA 95616, USA - + - + @@ -545,7 +550,7 @@ Davis, CA 95616, USA - + @@ -560,7 +565,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/DiagnosticLogsCluster.xml b/data_model/clusters/DiagnosticLogsCluster.xml index 14f995ca1855a6..5b67564b18f298 100644 --- a/data_model/clusters/DiagnosticLogsCluster.xml +++ b/data_model/clusters/DiagnosticLogsCluster.xml @@ -1,7 +1,5 @@ - + + + + @@ -138,11 +139,11 @@ Davis, CA 95616, USA - + - + @@ -221,7 +222,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/DishwasherAlarm.xml b/data_model/clusters/DishwasherAlarm.xml index 7fda78ad163116..b3b67e2bffb500 100644 --- a/data_model/clusters/DishwasherAlarm.xml +++ b/data_model/clusters/DishwasherAlarm.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA + +:xrefstyle: short --> + + + diff --git a/data_model/clusters/DoorLock.xml b/data_model/clusters/DoorLock.xml index 4f84afca85ff1e..16d26420fe2009 100644 --- a/data_model/clusters/DoorLock.xml +++ b/data_model/clusters/DoorLock.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -65,6 +67,9 @@ Davis, CA 95616, USA + + + @@ -1055,7 +1060,7 @@ Davis, CA 95616, USA - + @@ -1067,7 +1072,7 @@ Davis, CA 95616, USA - + @@ -1079,11 +1084,11 @@ Davis, CA 95616, USA - + - + @@ -1098,7 +1103,7 @@ Davis, CA 95616, USA - + @@ -1109,7 +1114,6 @@ Davis, CA 95616, USA - @@ -1138,7 +1142,7 @@ Davis, CA 95616, USA - + @@ -1165,7 +1169,7 @@ Davis, CA 95616, USA - + @@ -1181,7 +1185,6 @@ Davis, CA 95616, USA - @@ -1209,7 +1212,7 @@ Davis, CA 95616, USA - + @@ -1225,7 +1228,7 @@ Davis, CA 95616, USA - + @@ -1236,7 +1239,7 @@ Davis, CA 95616, USA - + @@ -1259,7 +1262,7 @@ Davis, CA 95616, USA - + @@ -1279,7 +1282,6 @@ Davis, CA 95616, USA - @@ -1293,7 +1295,7 @@ Davis, CA 95616, USA - + @@ -1326,7 +1328,7 @@ Davis, CA 95616, USA - + @@ -1341,7 +1343,6 @@ Davis, CA 95616, USA - @@ -1377,7 +1378,7 @@ Davis, CA 95616, USA - + @@ -1392,7 +1393,7 @@ Davis, CA 95616, USA - + @@ -1412,7 +1413,7 @@ Davis, CA 95616, USA - + @@ -1427,7 +1428,6 @@ Davis, CA 95616, USA - @@ -1450,7 +1450,7 @@ Davis, CA 95616, USA - + @@ -1465,7 +1465,7 @@ Davis, CA 95616, USA - + @@ -1484,7 +1484,7 @@ Davis, CA 95616, USA - + @@ -1495,7 +1495,6 @@ Davis, CA 95616, USA - @@ -1520,7 +1519,7 @@ Davis, CA 95616, USA - + @@ -1531,7 +1530,7 @@ Davis, CA 95616, USA - + @@ -1553,7 +1552,7 @@ Davis, CA 95616, USA - + @@ -1573,7 +1572,6 @@ Davis, CA 95616, USA - @@ -1587,7 +1585,7 @@ Davis, CA 95616, USA - + @@ -1615,7 +1613,7 @@ Davis, CA 95616, USA - + @@ -1631,7 +1629,6 @@ Davis, CA 95616, USA - @@ -1659,7 +1656,7 @@ Davis, CA 95616, USA - + @@ -1675,7 +1672,7 @@ Davis, CA 95616, USA - + @@ -1686,7 +1683,7 @@ Davis, CA 95616, USA - + @@ -1731,7 +1728,7 @@ Davis, CA 95616, USA - + @@ -1742,7 +1739,6 @@ Davis, CA 95616, USA - @@ -1792,7 +1788,7 @@ Davis, CA 95616, USA - + @@ -1844,7 +1840,7 @@ Davis, CA 95616, USA - + @@ -1885,7 +1881,6 @@ Davis, CA 95616, USA - @@ -1904,7 +1899,7 @@ Davis, CA 95616, USA - + @@ -1914,7 +1909,6 @@ Davis, CA 95616, USA - @@ -1940,7 +1934,7 @@ Davis, CA 95616, USA - + @@ -1951,7 +1945,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/EVSE-Attributes.xml b/data_model/clusters/EVSE-Attributes.xml deleted file mode 100644 index 2d492a27c4c0a1..00000000000000 --- a/data_model/clusters/EVSE-Attributes.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-Classification.xml b/data_model/clusters/EVSE-Classification.xml deleted file mode 100644 index 22df357be3e9d0..00000000000000 --- a/data_model/clusters/EVSE-Classification.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-ClusterID.xml b/data_model/clusters/EVSE-ClusterID.xml deleted file mode 100644 index 6f84afeb8d04bc..00000000000000 --- a/data_model/clusters/EVSE-ClusterID.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-Commands.xml b/data_model/clusters/EVSE-Commands.xml deleted file mode 100644 index 030565e20f8f96..00000000000000 --- a/data_model/clusters/EVSE-Commands.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-DataTypes.xml b/data_model/clusters/EVSE-DataTypes.xml deleted file mode 100644 index 790d66143c7025..00000000000000 --- a/data_model/clusters/EVSE-DataTypes.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-Definitions.xml b/data_model/clusters/EVSE-Definitions.xml deleted file mode 100644 index 7ff6135a3d2976..00000000000000 --- a/data_model/clusters/EVSE-Definitions.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-Dependencies.xml b/data_model/clusters/EVSE-Dependencies.xml deleted file mode 100644 index a87cb67a4623ae..00000000000000 --- a/data_model/clusters/EVSE-Dependencies.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-Events.xml b/data_model/clusters/EVSE-Events.xml deleted file mode 100644 index 51401775a6fe59..00000000000000 --- a/data_model/clusters/EVSE-Events.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-Features.xml b/data_model/clusters/EVSE-Features.xml deleted file mode 100644 index a8b48a53b401e9..00000000000000 --- a/data_model/clusters/EVSE-Features.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/EVSE-RevisionHistory.xml b/data_model/clusters/EVSE-RevisionHistory.xml deleted file mode 100644 index 89ca30f749e5e1..00000000000000 --- a/data_model/clusters/EVSE-RevisionHistory.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/ElectricalEnergyMeasurement.xml b/data_model/clusters/ElectricalEnergyMeasurement.xml index c6bf8e73863c41..98020764397116 100644 --- a/data_model/clusters/ElectricalEnergyMeasurement.xml +++ b/data_model/clusters/ElectricalEnergyMeasurement.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -74,7 +79,59 @@ Davis, CA 95616, USA - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data_model/clusters/ElectricalPowerMeasurement.xml b/data_model/clusters/ElectricalPowerMeasurement.xml index aa5baeaf368cbb..c695e8db031790 100644 --- a/data_model/clusters/ElectricalPowerMeasurement.xml +++ b/data_model/clusters/ElectricalPowerMeasurement.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -95,6 +100,68 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data_model/clusters/EnergyCalendar.xml b/data_model/clusters/EnergyCalendar.xml index a21845d92c47c4..8d3f1b343bb4a7 100644 --- a/data_model/clusters/EnergyCalendar.xml +++ b/data_model/clusters/EnergyCalendar.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: short --> @@ -61,6 +63,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/EnergyEVSE.xml b/data_model/clusters/EnergyEVSE.xml index f59d41807d43e6..fa15692e78896d 100644 --- a/data_model/clusters/EnergyEVSE.xml +++ b/data_model/clusters/EnergyEVSE.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -395,7 +400,6 @@ Davis, CA 95616, USA - @@ -405,11 +409,11 @@ Davis, CA 95616, USA - + - + @@ -425,7 +429,7 @@ Davis, CA 95616, USA - + @@ -439,11 +443,11 @@ Davis, CA 95616, USA - + - + @@ -454,13 +458,13 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/clusters/EnergyPreference.xml b/data_model/clusters/EnergyPreference.xml index 7156be8eafe025..c3676520ed6d01 100644 --- a/data_model/clusters/EnergyPreference.xml +++ b/data_model/clusters/EnergyPreference.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/EnergyPrice.xml b/data_model/clusters/EnergyPrice.xml index 23072a6a99ead5..1683fe1bbc13cf 100644 --- a/data_model/clusters/EnergyPrice.xml +++ b/data_model/clusters/EnergyPrice.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: short --> @@ -62,6 +64,9 @@ Davis, CA 95616, USA + + + @@ -173,7 +178,7 @@ Davis, CA 95616, USA - + @@ -188,7 +193,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/FanControl.xml b/data_model/clusters/FanControl.xml index acf1d59e54d91e..756a7bd27466b3 100644 --- a/data_model/clusters/FanControl.xml +++ b/data_model/clusters/FanControl.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: short --> @@ -62,6 +64,9 @@ Davis, CA 95616, USA + + + @@ -277,7 +282,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/FlowMeasurement.xml b/data_model/clusters/FlowMeasurement.xml index 66ad022c2c64ef..29f9d9d7ae58f9 100644 --- a/data_model/clusters/FlowMeasurement.xml +++ b/data_model/clusters/FlowMeasurement.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -61,6 +63,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/GeneralCommissioningCluster.xml b/data_model/clusters/GeneralCommissioningCluster.xml index a25cdfc6ac934e..e7877635bbac68 100644 --- a/data_model/clusters/GeneralCommissioningCluster.xml +++ b/data_model/clusters/GeneralCommissioningCluster.xml @@ -1,7 +1,5 @@ - + + + + @@ -86,21 +89,22 @@ Davis, CA 95616, USA - + - + + - + - + - + - + @@ -117,35 +121,35 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + @@ -160,13 +164,15 @@ Davis, CA 95616, USA - + + - + + @@ -184,14 +190,14 @@ Davis, CA 95616, USA - + - + @@ -199,20 +205,19 @@ Davis, CA 95616, USA - - + - + @@ -220,7 +225,6 @@ Davis, CA 95616, USA - diff --git a/data_model/clusters/Groups.xml b/data_model/clusters/Groups.xml index 175c9caf26a435..72902e878cbe9f 100644 --- a/data_model/clusters/Groups.xml +++ b/data_model/clusters/Groups.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -62,6 +64,9 @@ Davis, CA 95616, USA + + + @@ -84,7 +89,7 @@ Davis, CA 95616, USA - + @@ -97,7 +102,6 @@ Davis, CA 95616, USA - @@ -108,7 +112,7 @@ Davis, CA 95616, USA - + @@ -117,7 +121,6 @@ Davis, CA 95616, USA - @@ -132,7 +135,7 @@ Davis, CA 95616, USA - + @@ -143,7 +146,6 @@ Davis, CA 95616, USA - @@ -156,7 +158,7 @@ Davis, CA 95616, USA - + @@ -165,7 +167,6 @@ Davis, CA 95616, USA - @@ -176,11 +177,11 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/clusters/ICDManagement.xml b/data_model/clusters/ICDManagement.xml index 3cc6c9bfab4416..534b8340143083 100644 --- a/data_model/clusters/ICDManagement.xml +++ b/data_model/clusters/ICDManagement.xml @@ -54,14 +54,38 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +// Update Name --> - + + + + + + + + + + + + + + + + + + + + + + + @@ -69,6 +93,7 @@ Davis, CA 95616, USA + @@ -133,9 +158,34 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -156,7 +206,6 @@ Davis, CA 95616, USA - @@ -164,7 +213,7 @@ Davis, CA 95616, USA - + @@ -177,7 +226,7 @@ Davis, CA 95616, USA - + @@ -190,7 +239,6 @@ Davis, CA 95616, USA - diff --git a/data_model/clusters/Identify.xml b/data_model/clusters/Identify.xml index 379e684e51297d..1cdc33aa0df727 100644 --- a/data_model/clusters/Identify.xml +++ b/data_model/clusters/Identify.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -62,6 +64,9 @@ Davis, CA 95616, USA + + + @@ -127,14 +132,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/clusters/IlluminanceMeasurement.xml b/data_model/clusters/IlluminanceMeasurement.xml index c9be9fa6879293..c39daa0e6bdc4d 100644 --- a/data_model/clusters/IlluminanceMeasurement.xml +++ b/data_model/clusters/IlluminanceMeasurement.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -61,6 +63,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/KeypadInput.xml b/data_model/clusters/KeypadInput.xml index f0459e6b1bff1a..4cfb509b06d0be 100644 --- a/data_model/clusters/KeypadInput.xml +++ b/data_model/clusters/KeypadInput.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -345,7 +350,7 @@ Davis, CA 95616, USA - + @@ -353,7 +358,6 @@ Davis, CA 95616, USA - diff --git a/data_model/clusters/Label-Cluster-FixedLabel.xml b/data_model/clusters/Label-Cluster-FixedLabelCluster.xml similarity index 96% rename from data_model/clusters/Label-Cluster-FixedLabel.xml rename to data_model/clusters/Label-Cluster-FixedLabelCluster.xml index 558664a5d69f72..e73bfc274a9da4 100644 --- a/data_model/clusters/Label-Cluster-FixedLabel.xml +++ b/data_model/clusters/Label-Cluster-FixedLabelCluster.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/Label-Cluster-Label.xml b/data_model/clusters/Label-Cluster-LabelCluster.xml similarity index 96% rename from data_model/clusters/Label-Cluster-Label.xml rename to data_model/clusters/Label-Cluster-LabelCluster.xml index ee64da775b05cd..f107a0a7b3f12b 100644 --- a/data_model/clusters/Label-Cluster-Label.xml +++ b/data_model/clusters/Label-Cluster-LabelCluster.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/Label-Cluster-UserLabel.xml b/data_model/clusters/Label-Cluster-UserLabelCluster.xml similarity index 96% rename from data_model/clusters/Label-Cluster-UserLabel.xml rename to data_model/clusters/Label-Cluster-UserLabelCluster.xml index bca4b1453f22de..f7e809ab785c00 100644 --- a/data_model/clusters/Label-Cluster-UserLabel.xml +++ b/data_model/clusters/Label-Cluster-UserLabelCluster.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/LaundryDryerControls.xml b/data_model/clusters/LaundryDryerControls.xml index 461f08666093b8..a3f7b911fc9e9c 100644 --- a/data_model/clusters/LaundryDryerControls.xml +++ b/data_model/clusters/LaundryDryerControls.xml @@ -59,6 +59,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/LaundryWasherControls.xml b/data_model/clusters/LaundryWasherControls.xml index 5a9d108ccc1b01..16879842721473 100644 --- a/data_model/clusters/LaundryWasherControls.xml +++ b/data_model/clusters/LaundryWasherControls.xml @@ -59,6 +59,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/LevelControl.xml b/data_model/clusters/LevelControl.xml index 8a348a2dc05cbd..13522bf0698b9e 100644 --- a/data_model/clusters/LevelControl.xml +++ b/data_model/clusters/LevelControl.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -65,6 +67,7 @@ Davis, CA 95616, USA + @@ -123,6 +126,7 @@ Davis, CA 95616, USA + @@ -210,7 +214,7 @@ Davis, CA 95616, USA - + @@ -230,7 +234,7 @@ Davis, CA 95616, USA - + @@ -250,7 +254,7 @@ Davis, CA 95616, USA - + @@ -273,7 +277,7 @@ Davis, CA 95616, USA - + @@ -285,23 +289,23 @@ Davis, CA 95616, USA - + - + - + - + - + diff --git a/data_model/clusters/LocalizationConfiguration.xml b/data_model/clusters/LocalizationConfiguration.xml index b264698b6d5393..f3c2d5b2d7662b 100644 --- a/data_model/clusters/LocalizationConfiguration.xml +++ b/data_model/clusters/LocalizationConfiguration.xml @@ -59,18 +59,25 @@ Davis, CA 95616, USA + + + - + - + - + + + + + \ No newline at end of file diff --git a/data_model/clusters/LocalizationTimeFormat.xml b/data_model/clusters/LocalizationTimeFormat.xml index 204f145f9c8b07..fb8ceea3ee17a8 100644 --- a/data_model/clusters/LocalizationTimeFormat.xml +++ b/data_model/clusters/LocalizationTimeFormat.xml @@ -59,6 +59,9 @@ Davis, CA 95616, USA + + + @@ -132,7 +135,8 @@ Davis, CA 95616, USA - + + diff --git a/data_model/clusters/LocalizationUnit.xml b/data_model/clusters/LocalizationUnit.xml index 24c54638b4ffd7..be7ea6a0aa2d78 100644 --- a/data_model/clusters/LocalizationUnit.xml +++ b/data_model/clusters/LocalizationUnit.xml @@ -59,6 +59,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/LowPower.xml b/data_model/clusters/LowPower.xml index f8ee432eef58a7..4c228d3154dfa1 100644 --- a/data_model/clusters/LowPower.xml +++ b/data_model/clusters/LowPower.xml @@ -54,14 +54,19 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + - + diff --git a/data_model/clusters/MediaInput.xml b/data_model/clusters/MediaInput.xml index 9ca0f351d1f59f..b7d9d2ef017035 100644 --- a/data_model/clusters/MediaInput.xml +++ b/data_model/clusters/MediaInput.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -132,22 +137,22 @@ Davis, CA 95616, USA - + - + - + - + diff --git a/data_model/clusters/MediaPlayback.xml b/data_model/clusters/MediaPlayback.xml index f2cdf5c4a7c851..e9194b6854c569 100644 --- a/data_model/clusters/MediaPlayback.xml +++ b/data_model/clusters/MediaPlayback.xml @@ -54,11 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> - + + + + + @@ -67,8 +73,73 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -118,6 +189,31 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + @@ -172,52 +268,96 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + + + + + + - + + + + + + - + - + @@ -225,7 +365,6 @@ Davis, CA 95616, USA - @@ -235,7 +374,7 @@ Davis, CA 95616, USA - + @@ -244,5 +383,93 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/Messages.xml b/data_model/clusters/Messages.xml index 9dd223d9a63f46..61f21bef9c95f3 100644 --- a/data_model/clusters/Messages.xml +++ b/data_model/clusters/Messages.xml @@ -55,6 +55,8 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA +:xrefstyle: short + Copyright (C) Connectivity Standards Alliance (2021). All rights reserved. This information within this document is the property of the Connectivity Standards Alliance and its use and disclosure are restricted. @@ -91,6 +93,8 @@ are made. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -98,6 +102,9 @@ Davis, CA 95616, USA + + + @@ -179,15 +186,11 @@ Davis, CA 95616, USA - - - + - - - + @@ -209,7 +212,7 @@ Davis, CA 95616, USA - + @@ -245,7 +248,7 @@ Davis, CA 95616, USA - + @@ -261,26 +264,29 @@ Davis, CA 95616, USA - + + + - + + diff --git a/data_model/clusters/MicrowaveOvenControl.xml b/data_model/clusters/MicrowaveOvenControl.xml index c95d713714854f..d7c6f72f740d3d 100644 --- a/data_model/clusters/MicrowaveOvenControl.xml +++ b/data_model/clusters/MicrowaveOvenControl.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -114,7 +119,7 @@ Davis, CA 95616, USA - + @@ -139,7 +144,7 @@ Davis, CA 95616, USA - + @@ -166,7 +171,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/ModeBase.xml b/data_model/clusters/ModeBase.xml index 5774a7fec0c5a5..2a11f85d343b39 100644 --- a/data_model/clusters/ModeBase.xml +++ b/data_model/clusters/ModeBase.xml @@ -61,6 +61,9 @@ Davis, CA 95616, USA + + + @@ -122,7 +125,7 @@ Require at least one standard mode tag. Define reserved ranges for base/derived - + diff --git a/data_model/clusters/ModeSelect.xml b/data_model/clusters/ModeSelect.xml index 19fe502c1fcfe2..a30a5b9bf8eca5 100644 --- a/data_model/clusters/ModeSelect.xml +++ b/data_model/clusters/ModeSelect.xml @@ -60,6 +60,9 @@ Davis, CA 95616, USA + + + @@ -133,7 +136,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/Mode_DeviceEnergyManagement.xml b/data_model/clusters/Mode_DeviceEnergyManagement.xml index 4181b9b60ead42..592c7d4290a342 100644 --- a/data_model/clusters/Mode_DeviceEnergyManagement.xml +++ b/data_model/clusters/Mode_DeviceEnergyManagement.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/Mode_Dishwasher.xml b/data_model/clusters/Mode_Dishwasher.xml index 22d0fab7897696..4ff6e78714f648 100644 --- a/data_model/clusters/Mode_Dishwasher.xml +++ b/data_model/clusters/Mode_Dishwasher.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/Mode_EVSE.xml b/data_model/clusters/Mode_EVSE.xml index 2a600e3e381325..de88cb3717c8bf 100644 --- a/data_model/clusters/Mode_EVSE.xml +++ b/data_model/clusters/Mode_EVSE.xml @@ -54,10 +54,15 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + \ No newline at end of file diff --git a/data_model/clusters/Mode_LaundryWasher.xml b/data_model/clusters/Mode_LaundryWasher.xml index e89778fa9ea579..c59b2c3fef9051 100644 --- a/data_model/clusters/Mode_LaundryWasher.xml +++ b/data_model/clusters/Mode_LaundryWasher.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/Mode_MicrowaveOven.xml b/data_model/clusters/Mode_MicrowaveOven.xml index cd98c189c12844..6e8a129444b9fd 100644 --- a/data_model/clusters/Mode_MicrowaveOven.xml +++ b/data_model/clusters/Mode_MicrowaveOven.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -75,12 +80,10 @@ Davis, CA 95616, USA - - + - - + diff --git a/data_model/clusters/Mode_Oven.xml b/data_model/clusters/Mode_Oven.xml index 56a369dd425572..f6c7111bb844cd 100644 --- a/data_model/clusters/Mode_Oven.xml +++ b/data_model/clusters/Mode_Oven.xml @@ -54,10 +54,15 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + \ No newline at end of file diff --git a/data_model/clusters/Mode_RVCClean.xml b/data_model/clusters/Mode_RVCClean.xml index 64118517a03c1b..d1b2272fc7e756 100644 --- a/data_model/clusters/Mode_RVCClean.xml +++ b/data_model/clusters/Mode_RVCClean.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/Mode_RVCRun.xml b/data_model/clusters/Mode_RVCRun.xml index 8f49741f7cfeb8..8e19b45a8385fc 100644 --- a/data_model/clusters/Mode_RVCRun.xml +++ b/data_model/clusters/Mode_RVCRun.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/Mode_Refrigerator.xml b/data_model/clusters/Mode_Refrigerator.xml index cf6a65721e0efd..d51e30b68d1320 100644 --- a/data_model/clusters/Mode_Refrigerator.xml +++ b/data_model/clusters/Mode_Refrigerator.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + diff --git a/data_model/clusters/Mode_WaterHeater.xml b/data_model/clusters/Mode_WaterHeater.xml index 69fba08b940293..56f1a1e9a66951 100644 --- a/data_model/clusters/Mode_WaterHeater.xml +++ b/data_model/clusters/Mode_WaterHeater.xml @@ -54,10 +54,15 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + \ No newline at end of file diff --git a/data_model/clusters/NetworkCommissioningCluster.xml b/data_model/clusters/NetworkCommissioningCluster.xml index 0153146c149d26..745a659f1b900b 100644 --- a/data_model/clusters/NetworkCommissioningCluster.xml +++ b/data_model/clusters/NetworkCommissioningCluster.xml @@ -1,7 +1,5 @@ + + + @@ -171,9 +173,9 @@ Davis, CA 95616, USA - + - + @@ -191,11 +193,11 @@ Davis, CA 95616, USA - + - + @@ -229,17 +231,17 @@ Davis, CA 95616, USA - + - + - + - + @@ -265,10 +267,11 @@ Davis, CA 95616, USA - + + - + @@ -302,24 +305,25 @@ Davis, CA 95616, USA - + - + - + + - + @@ -337,7 +341,7 @@ Davis, CA 95616, USA - + @@ -345,19 +349,18 @@ Davis, CA 95616, USA - + - + - @@ -368,54 +371,56 @@ Davis, CA 95616, USA - + - + - + + - + + - + - + - + - + - + - + - + - + - + @@ -423,16 +428,15 @@ Davis, CA 95616, USA - + - + - @@ -443,16 +447,16 @@ Davis, CA 95616, USA - + - + - + - + @@ -460,16 +464,15 @@ Davis, CA 95616, USA - + - + - @@ -479,7 +482,7 @@ Davis, CA 95616, USA - + @@ -487,7 +490,7 @@ Davis, CA 95616, USA - + @@ -495,9 +498,9 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/clusters/NetworkIdentityManagement.xml b/data_model/clusters/NetworkIdentityManagement.xml index 08bee6af5871ff..20e264277a4330 100644 --- a/data_model/clusters/NetworkIdentityManagement.xml +++ b/data_model/clusters/NetworkIdentityManagement.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> - + - + + + + @@ -119,7 +124,7 @@ Davis, CA 95616, USA - + @@ -130,7 +135,7 @@ Davis, CA 95616, USA - + @@ -141,7 +146,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/OTAProvider.xml b/data_model/clusters/OTAProvider.xml index 73157662cd6f6e..baf3996d3b911f 100644 --- a/data_model/clusters/OTAProvider.xml +++ b/data_model/clusters/OTAProvider.xml @@ -1,7 +1,5 @@ @@ -62,6 +64,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/OnOff.xml b/data_model/clusters/OnOff.xml index 0d64837ea57fbb..0b1e32af50cddb 100644 --- a/data_model/clusters/OnOff.xml +++ b/data_model/clusters/OnOff.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -64,6 +66,9 @@ Davis, CA 95616, USA + + + @@ -171,11 +176,11 @@ Davis, CA 95616, USA - + - + @@ -183,7 +188,7 @@ Davis, CA 95616, USA - + @@ -191,7 +196,7 @@ Davis, CA 95616, USA - + @@ -205,13 +210,13 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/clusters/OperationalCredentialCluster.xml b/data_model/clusters/OperationalCredentialCluster.xml index ec523ba33671d1..1a2becd5c478a2 100644 --- a/data_model/clusters/OperationalCredentialCluster.xml +++ b/data_model/clusters/OperationalCredentialCluster.xml @@ -1,7 +1,5 @@ - + + + + @@ -98,10 +99,10 @@ Davis, CA 95616, USA - + - + @@ -115,11 +116,11 @@ Davis, CA 95616, USA - + - + - + @@ -136,32 +137,34 @@ Davis, CA 95616, USA - + - + - + - + - + + - + - + + - + @@ -175,10 +178,14 @@ Davis, CA 95616, USA - + + + + + @@ -186,7 +193,7 @@ Davis, CA 95616, USA - + @@ -195,7 +202,6 @@ Davis, CA 95616, USA - @@ -206,7 +212,7 @@ Davis, CA 95616, USA - + @@ -215,14 +221,13 @@ Davis, CA 95616, USA - - + @@ -234,7 +239,6 @@ Davis, CA 95616, USA - @@ -245,29 +249,29 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + @@ -280,7 +284,6 @@ Davis, CA 95616, USA - @@ -294,7 +297,7 @@ Davis, CA 95616, USA - + @@ -302,7 +305,7 @@ Davis, CA 95616, USA - + @@ -310,12 +313,12 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/clusters/OperationalState.xml b/data_model/clusters/OperationalState.xml index dcb5753b2c1998..37dc6b6e2f8cf4 100644 --- a/data_model/clusters/OperationalState.xml +++ b/data_model/clusters/OperationalState.xml @@ -60,8 +60,22 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + @@ -74,18 +88,7 @@ Davis, CA 95616, USA - - - - - - - - - - - - + @@ -143,6 +146,53 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data_model/clusters/OperationalState_Oven.xml b/data_model/clusters/OperationalState_Oven.xml index 947e93f8ec2348..c44ac37b7ccac9 100644 --- a/data_model/clusters/OperationalState_Oven.xml +++ b/data_model/clusters/OperationalState_Oven.xml @@ -54,10 +54,15 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA + +:xrefstyle: basic --> + + + \ No newline at end of file diff --git a/data_model/clusters/OperationalState_RVC.xml b/data_model/clusters/OperationalState_RVC.xml index bc4e5505e45d6d..6426e2639a7b83 100644 --- a/data_model/clusters/OperationalState_RVC.xml +++ b/data_model/clusters/OperationalState_RVC.xml @@ -54,32 +54,29 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA + +:xrefstyle: basic --> + + + - - - - - + + - - + - - - - - - - + + + diff --git a/data_model/clusters/PowerSourceCluster.xml b/data_model/clusters/PowerSourceCluster.xml index 16d6f0ac98cad5..28a9154116ed7c 100644 --- a/data_model/clusters/PowerSourceCluster.xml +++ b/data_model/clusters/PowerSourceCluster.xml @@ -55,12 +55,14 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + + + @@ -79,16 +81,6 @@ Davis, CA 95616, USA - - - - - - - - - - @@ -226,24 +218,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - @@ -256,23 +230,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - @@ -286,12 +243,6 @@ Davis, CA 95616, USA - - - - - - @@ -538,17 +489,6 @@ Davis, CA 95616, USA - - - - - - - - - - - @@ -835,135 +775,22 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - + + - + @@ -971,13 +798,15 @@ Davis, CA 95616, USA - + + - + - + + - + @@ -985,85 +814,15 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + + + diff --git a/data_model/clusters/PowerSourceConfigurationCluster.xml b/data_model/clusters/PowerSourceConfigurationCluster.xml index 5548bf6ad8e6b5..11e3bd47dd9186 100644 --- a/data_model/clusters/PowerSourceConfigurationCluster.xml +++ b/data_model/clusters/PowerSourceConfigurationCluster.xml @@ -59,10 +59,13 @@ Davis, CA 95616, USA + + + - + diff --git a/data_model/clusters/PowerTopology.xml b/data_model/clusters/PowerTopology.xml index c8d90baeeded19..d8c8a50d22a3a6 100644 --- a/data_model/clusters/PowerTopology.xml +++ b/data_model/clusters/PowerTopology.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: short --> + + + diff --git a/data_model/clusters/PressureMeasurement.xml b/data_model/clusters/PressureMeasurement.xml index 70093485639090..d9c4a4584404fe 100644 --- a/data_model/clusters/PressureMeasurement.xml +++ b/data_model/clusters/PressureMeasurement.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -61,6 +63,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/PumpConfigurationControl.xml b/data_model/clusters/PumpConfigurationControl.xml index f3fc98a52cee9e..cfd2971a395ecb 100644 --- a/data_model/clusters/PumpConfigurationControl.xml +++ b/data_model/clusters/PumpConfigurationControl.xml @@ -62,6 +62,9 @@ Davis, CA 95616, USA + + + @@ -169,7 +172,206 @@ Davis, CA 95616, USA - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data_model/clusters/RefrigeratorAlarm.xml b/data_model/clusters/RefrigeratorAlarm.xml index c987c3860a4f52..caad94da1f6fad 100644 --- a/data_model/clusters/RefrigeratorAlarm.xml +++ b/data_model/clusters/RefrigeratorAlarm.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: short --> + + + @@ -73,8 +78,7 @@ Davis, CA 95616, USA - - + diff --git a/data_model/clusters/ResourceMonitoring.xml b/data_model/clusters/ResourceMonitoring.xml index 17fc7554ac41f0..6b0e8f3a203ded 100644 --- a/data_model/clusters/ResourceMonitoring.xml +++ b/data_model/clusters/ResourceMonitoring.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -164,7 +166,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/Scenes.xml b/data_model/clusters/Scenes.xml index 0c4347c4e8be8a..5d9be300d1abbc 100644 --- a/data_model/clusters/Scenes.xml +++ b/data_model/clusters/Scenes.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -116,17 +121,14 @@ Davis, CA 95616, USA - - - @@ -177,7 +179,7 @@ Davis, CA 95616, USA - + @@ -189,7 +191,7 @@ Davis, CA 95616, USA - + @@ -202,7 +204,6 @@ Davis, CA 95616, USA - @@ -216,7 +217,7 @@ Davis, CA 95616, USA - + @@ -228,7 +229,6 @@ Davis, CA 95616, USA - @@ -242,7 +242,7 @@ Davis, CA 95616, USA - + @@ -251,7 +251,7 @@ Davis, CA 95616, USA - + @@ -263,7 +263,6 @@ Davis, CA 95616, USA - @@ -277,7 +276,7 @@ Davis, CA 95616, USA - + @@ -285,7 +284,6 @@ Davis, CA 95616, USA - @@ -295,7 +293,7 @@ Davis, CA 95616, USA - + @@ -307,7 +305,6 @@ Davis, CA 95616, USA - @@ -321,7 +318,7 @@ Davis, CA 95616, USA - + @@ -337,7 +334,7 @@ Davis, CA 95616, USA - + @@ -345,7 +342,6 @@ Davis, CA 95616, USA - @@ -362,7 +358,7 @@ Davis, CA 95616, USA - + @@ -383,9 +379,8 @@ Davis, CA 95616, USA - - + diff --git a/data_model/clusters/SmokeCOAlarm.xml b/data_model/clusters/SmokeCOAlarm.xml index 0db5c78f4e947f..d3d35f13f15f25 100644 --- a/data_model/clusters/SmokeCOAlarm.xml +++ b/data_model/clusters/SmokeCOAlarm.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -226,7 +231,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/Switch.xml b/data_model/clusters/Switch.xml index 30602c35bf794f..e7170049ac051f 100644 --- a/data_model/clusters/Switch.xml +++ b/data_model/clusters/Switch.xml @@ -59,6 +59,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/TargetNavigator.xml b/data_model/clusters/TargetNavigator.xml index 343f1427176e41..cfb3a0c17a6f99 100644 --- a/data_model/clusters/TargetNavigator.xml +++ b/data_model/clusters/TargetNavigator.xml @@ -54,11 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> - + + + + + @@ -95,7 +101,7 @@ Davis, CA 95616, USA - + @@ -106,7 +112,6 @@ Davis, CA 95616, USA - @@ -116,4 +121,22 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/TemperatureControl.xml b/data_model/clusters/TemperatureControl.xml index f457238bab1d8a..70fc100d83bbab 100644 --- a/data_model/clusters/TemperatureControl.xml +++ b/data_model/clusters/TemperatureControl.xml @@ -59,6 +59,9 @@ Davis, CA 95616, USA + + + @@ -73,9 +76,58 @@ Davis, CA 95616, USA - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/data_model/clusters/TemperatureMeasurement.xml b/data_model/clusters/TemperatureMeasurement.xml index e1603fd3358bc3..540af82bcedd18 100644 --- a/data_model/clusters/TemperatureMeasurement.xml +++ b/data_model/clusters/TemperatureMeasurement.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -62,6 +64,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/Thermostat.xml b/data_model/clusters/Thermostat.xml index 400d55a048a116..71a0c48c6a8eb8 100644 --- a/data_model/clusters/Thermostat.xml +++ b/data_model/clusters/Thermostat.xml @@ -64,6 +64,9 @@ Davis, CA 95616, USA + + + @@ -297,7 +300,7 @@ Davis, CA 95616, USA - + @@ -825,7 +828,7 @@ Davis, CA 95616, USA - + @@ -837,7 +840,6 @@ Davis, CA 95616, USA - @@ -858,7 +860,7 @@ Davis, CA 95616, USA - + @@ -881,9 +883,8 @@ Davis, CA 95616, USA - - + @@ -909,7 +910,7 @@ Davis, CA 95616, USA - + @@ -923,13 +924,13 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/clusters/ThermostatUserInterfaceConfiguration.xml b/data_model/clusters/ThermostatUserInterfaceConfiguration.xml index 6c8d1d920e6ef7..63fdba001c67a9 100644 --- a/data_model/clusters/ThermostatUserInterfaceConfiguration.xml +++ b/data_model/clusters/ThermostatUserInterfaceConfiguration.xml @@ -60,6 +60,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/ThreadBorderRouterDiagnostics.xml b/data_model/clusters/ThreadBorderRouterDiagnostics.xml index 29b5da9b8511f0..5527c486a0cc51 100644 --- a/data_model/clusters/ThreadBorderRouterDiagnostics.xml +++ b/data_model/clusters/ThreadBorderRouterDiagnostics.xml @@ -54,19 +54,23 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + - + - @@ -75,12 +79,11 @@ Davis, CA 95616, USA - + - diff --git a/data_model/clusters/TimeSync.xml b/data_model/clusters/TimeSync.xml index 096e0ff2798261..c6c57ece628bbd 100644 --- a/data_model/clusters/TimeSync.xml +++ b/data_model/clusters/TimeSync.xml @@ -1,7 +1,5 @@ + + + @@ -96,6 +100,59 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -112,19 +169,19 @@ Davis, CA 95616, USA - + - + - + - + @@ -133,26 +190,183 @@ Davis, CA 95616, USA - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -178,9 +392,9 @@ Davis, CA 95616, USA - + - + @@ -192,10 +406,6 @@ Davis, CA 95616, USA - - - - \ No newline at end of file diff --git a/data_model/clusters/ValveConfigurationControl.xml b/data_model/clusters/ValveConfigurationControl.xml index 32620ad9cce97d..548fed7d7357c2 100644 --- a/data_model/clusters/ValveConfigurationControl.xml +++ b/data_model/clusters/ValveConfigurationControl.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -171,7 +176,7 @@ Davis, CA 95616, USA - + @@ -186,7 +191,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/WakeOnLAN.xml b/data_model/clusters/WakeOnLAN.xml index 799c92a03fd9b8..deb5af5a75ac7d 100644 --- a/data_model/clusters/WakeOnLAN.xml +++ b/data_model/clusters/WakeOnLAN.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> - + + + + diff --git a/data_model/clusters/WaterContentMeasurement.xml b/data_model/clusters/WaterContentMeasurement.xml index 8b1ff6a9a049bc..85d44793c93ae4 100644 --- a/data_model/clusters/WaterContentMeasurement.xml +++ b/data_model/clusters/WaterContentMeasurement.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -61,6 +63,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/WaterHeaterManagement.xml b/data_model/clusters/WaterHeaterManagement.xml index 073da0094b0b4b..cc641c8269fb3c 100644 --- a/data_model/clusters/WaterHeaterManagement.xml +++ b/data_model/clusters/WaterHeaterManagement.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> + + + @@ -129,7 +134,7 @@ Davis, CA 95616, USA - + @@ -151,7 +156,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/WiFiNetworkManagement.xml b/data_model/clusters/WiFiNetworkManagement.xml index 6308eca7e4b184..1a3fceec2747d3 100644 --- a/data_model/clusters/WiFiNetworkManagement.xml +++ b/data_model/clusters/WiFiNetworkManagement.xml @@ -54,12 +54,17 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> - + - + + + + @@ -69,12 +74,11 @@ Davis, CA 95616, USA - + - diff --git a/data_model/clusters/WindowCovering.xml b/data_model/clusters/WindowCovering.xml index 3ee6d43ded8bce..7b0afd461fcb96 100644 --- a/data_model/clusters/WindowCovering.xml +++ b/data_model/clusters/WindowCovering.xml @@ -54,6 +54,8 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:xrefstyle: basic --> @@ -63,6 +65,9 @@ Davis, CA 95616, USA + + + @@ -608,19 +613,19 @@ Davis, CA 95616, USA - + - + - + - + @@ -633,7 +638,7 @@ Davis, CA 95616, USA - + @@ -655,7 +660,7 @@ Davis, CA 95616, USA - + @@ -668,7 +673,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/bridge-clusters-Actions.xml b/data_model/clusters/bridge-clusters-ActionsCluster.xml similarity index 87% rename from data_model/clusters/bridge-clusters-Actions.xml rename to data_model/clusters/bridge-clusters-ActionsCluster.xml index 51f7ee79bb4bad..e02b12e43d64a4 100644 --- a/data_model/clusters/bridge-clusters-Actions.xml +++ b/data_model/clusters/bridge-clusters-ActionsCluster.xml @@ -54,11 +54,16 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:sectnums: --> + + + @@ -159,7 +164,7 @@ Davis, CA 95616, USA - + @@ -181,7 +186,7 @@ Davis, CA 95616, USA - + @@ -189,32 +194,35 @@ Davis, CA 95616, USA - + + - + - + + - + - + + - + - + - + - + @@ -223,7 +231,7 @@ Davis, CA 95616, USA - + @@ -235,7 +243,7 @@ Davis, CA 95616, USA - + @@ -244,7 +252,7 @@ Davis, CA 95616, USA - + @@ -256,7 +264,7 @@ Davis, CA 95616, USA - + @@ -265,7 +273,7 @@ Davis, CA 95616, USA - + @@ -274,7 +282,7 @@ Davis, CA 95616, USA - + @@ -286,7 +294,7 @@ Davis, CA 95616, USA - + @@ -295,7 +303,7 @@ Davis, CA 95616, USA - + @@ -304,7 +312,7 @@ Davis, CA 95616, USA - + @@ -316,7 +324,7 @@ Davis, CA 95616, USA - + @@ -325,7 +333,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformation.xml b/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml similarity index 94% rename from data_model/clusters/bridge-clusters-BridgedDeviceBasicInformation.xml rename to data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml index 5c4bd86b9ab7e4..db85cc296b8922 100644 --- a/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformation.xml +++ b/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml @@ -54,13 +54,18 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:sectnums: --> - + + + + @@ -129,6 +134,9 @@ Davis, CA 95616, USA + + + @@ -142,6 +150,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/clusters/energy_management.xml b/data_model/clusters/energy_management.xml index 792560796cdd4d..93858d1d1b3c89 100644 --- a/data_model/clusters/energy_management.xml +++ b/data_model/clusters/energy_management.xml @@ -54,5 +54,7 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA + +:toc: --> \ No newline at end of file diff --git a/data_model/clusters/network_infrastructure.xml b/data_model/clusters/network_infrastructure.xml index 181ee350003454..7e75cc0af8229f 100644 --- a/data_model/clusters/network_infrastructure.xml +++ b/data_model/clusters/network_infrastructure.xml @@ -59,4 +59,4 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - \ No newline at end of file + diff --git a/data_model/device_types/BaseDeviceType.xml b/data_model/device_types/BaseDeviceType.xml index a92816ac49d6e1..0df3ba00d26e2b 100644 --- a/data_model/device_types/BaseDeviceType.xml +++ b/data_model/device_types/BaseDeviceType.xml @@ -65,6 +65,13 @@ Davis, CA 95616, USA + + + + + + + diff --git a/data_model/device_types/BasicVideoPlayer.xml b/data_model/device_types/BasicVideoPlayer.xml index 75d54e18d1c33f..2b9b52c3b43ee6 100644 --- a/data_model/device_types/BasicVideoPlayer.xml +++ b/data_model/device_types/BasicVideoPlayer.xml @@ -55,10 +55,11 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + @@ -68,6 +69,9 @@ Davis, CA 95616, USA + + + @@ -94,5 +98,11 @@ Davis, CA 95616, USA + + + + + + \ No newline at end of file diff --git a/data_model/device_types/CastingVideoClient.xml b/data_model/device_types/CastingVideoClient.xml index 8089f57507dd18..d79506b9cf66a0 100644 --- a/data_model/device_types/CastingVideoClient.xml +++ b/data_model/device_types/CastingVideoClient.xml @@ -55,10 +55,11 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + @@ -69,6 +70,9 @@ Davis, CA 95616, USA + + + @@ -105,5 +109,14 @@ Davis, CA 95616, USA + + + + + + + + + \ No newline at end of file diff --git a/data_model/device_types/CastingVideoPlayer.xml b/data_model/device_types/CastingVideoPlayer.xml index 9997b276a6af5e..336416508660a8 100644 --- a/data_model/device_types/CastingVideoPlayer.xml +++ b/data_model/device_types/CastingVideoPlayer.xml @@ -55,10 +55,11 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + @@ -71,6 +72,9 @@ launch Content Apps and represent these apps as separate endpoints."/> + + + @@ -113,5 +117,11 @@ launch Content Apps and represent these apps as separate endpoints."/> + + + + + + \ No newline at end of file diff --git a/data_model/device_types/ColorDimmerSwitch.xml b/data_model/device_types/ColorDimmerSwitch.xml index 0adcfcedcdc92a..0da15b82a2cd08 100644 --- a/data_model/device_types/ColorDimmerSwitch.xml +++ b/data_model/device_types/ColorDimmerSwitch.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/ColorTemperatureLight.xml b/data_model/device_types/ColorTemperatureLight.xml index 5d6ac140803e23..5a54a36a7a0fbf 100644 --- a/data_model/device_types/ColorTemperatureLight.xml +++ b/data_model/device_types/ColorTemperatureLight.xml @@ -55,12 +55,13 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/ContentApp.xml b/data_model/device_types/ContentApp.xml index 0db03141e7f9a1..84bf58698f426d 100644 --- a/data_model/device_types/ContentApp.xml +++ b/data_model/device_types/ContentApp.xml @@ -55,13 +55,19 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + + + + + + @@ -91,5 +97,10 @@ Davis, CA 95616, USA + + + + + \ No newline at end of file diff --git a/data_model/device_types/ControlBridge.xml b/data_model/device_types/ControlBridge.xml index f97439b77f8c3b..f427becc14f791 100644 --- a/data_model/device_types/ControlBridge.xml +++ b/data_model/device_types/ControlBridge.xml @@ -55,12 +55,13 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/CookSurface.xml b/data_model/device_types/CookSurface.xml index a9548d3ac6e3dd..b18897b3f0f9ff 100644 --- a/data_model/device_types/CookSurface.xml +++ b/data_model/device_types/CookSurface.xml @@ -62,6 +62,14 @@ Davis, CA 95616, USA + + + + + + + + diff --git a/data_model/device_types/Cooktop.xml b/data_model/device_types/Cooktop.xml index 233c72ed37590a..ea94653008d25a 100644 --- a/data_model/device_types/Cooktop.xml +++ b/data_model/device_types/Cooktop.xml @@ -71,9 +71,6 @@ Davis, CA 95616, USA - - - diff --git a/data_model/clusters/Timer.xml b/data_model/device_types/DeviceEnergyManagement.xml similarity index 55% rename from data_model/clusters/Timer.xml rename to data_model/device_types/DeviceEnergyManagement.xml index ad0d864f016e92..cf148dabc13679 100644 --- a/data_model/clusters/Timer.xml +++ b/data_model/device_types/DeviceEnergyManagement.xml @@ -55,77 +55,23 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + - - - - - - - - - + + + + + - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/data_model/device_types/DimmableLight.xml b/data_model/device_types/DimmableLight.xml index 42c7d20fb4caad..ce0c280de6f0a6 100644 --- a/data_model/device_types/DimmableLight.xml +++ b/data_model/device_types/DimmableLight.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/DimmablePlug-InUnit.xml b/data_model/device_types/DimmablePlug-InUnit.xml index a41db3ad0ae255..98895640fe1bc5 100644 --- a/data_model/device_types/DimmablePlug-InUnit.xml +++ b/data_model/device_types/DimmablePlug-InUnit.xml @@ -55,12 +55,13 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/DimmerSwitch.xml b/data_model/device_types/DimmerSwitch.xml index 8be246f3a16056..137adfd9117cf7 100644 --- a/data_model/device_types/DimmerSwitch.xml +++ b/data_model/device_types/DimmerSwitch.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/DoorLock.xml b/data_model/device_types/DoorLock.xml index b7a0beaa3946e6..9b6c7fd145621d 100644 --- a/data_model/device_types/DoorLock.xml +++ b/data_model/device_types/DoorLock.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + @@ -70,41 +71,12 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - @@ -118,10 +90,11 @@ Davis, CA 95616, USA - - - - + + + + + @@ -130,54 +103,7 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/DoorLockController.xml b/data_model/device_types/DoorLockController.xml index 0e4529c8b5e381..0279f0100a5fc0 100644 --- a/data_model/device_types/DoorLockController.xml +++ b/data_model/device_types/DoorLockController.xml @@ -55,26 +55,28 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + + - + + + + - - - diff --git a/data_model/device_types/EVSE.xml b/data_model/device_types/EVSE.xml index f15b1db770b454..9e6ce7be28f301 100644 --- a/data_model/device_types/EVSE.xml +++ b/data_model/device_types/EVSE.xml @@ -65,28 +65,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_model/device_types/ExtendedColorLight.xml b/data_model/device_types/ExtendedColorLight.xml index 73490485fa27fa..97cb3eaf66377c 100644 --- a/data_model/device_types/ExtendedColorLight.xml +++ b/data_model/device_types/ExtendedColorLight.xml @@ -55,12 +55,13 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/GenericSwitch.xml b/data_model/device_types/GenericSwitch.xml index 24645b511ea5e7..e381914be42921 100644 --- a/data_model/device_types/GenericSwitch.xml +++ b/data_model/device_types/GenericSwitch.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/NetworkInfraManager.xml b/data_model/device_types/NetworkInfraManager.xml index cc7e22295f40be..67c3ee49f75f92 100644 --- a/data_model/device_types/NetworkInfraManager.xml +++ b/data_model/device_types/NetworkInfraManager.xml @@ -55,17 +55,17 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + - + diff --git a/data_model/device_types/OnOffLight.xml b/data_model/device_types/OnOffLight.xml index 9762c718dcc05b..59e8739cab0275 100644 --- a/data_model/device_types/OnOffLight.xml +++ b/data_model/device_types/OnOffLight.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/OnOffLightSwitch.xml b/data_model/device_types/OnOffLightSwitch.xml index eb2c3ff938060a..9b9d72ba4f0964 100644 --- a/data_model/device_types/OnOffLightSwitch.xml +++ b/data_model/device_types/OnOffLightSwitch.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/OnOffPlug-inUnit.xml b/data_model/device_types/OnOffPlug-inUnit.xml index 41d0a1398ad6f3..4b4f49725cf9fa 100644 --- a/data_model/device_types/OnOffPlug-inUnit.xml +++ b/data_model/device_types/OnOffPlug-inUnit.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/OnOffSensor.xml b/data_model/device_types/OnOffSensor.xml index 904b5f6da74c7c..e1bd3c3806c8a4 100644 --- a/data_model/device_types/OnOffSensor.xml +++ b/data_model/device_types/OnOffSensor.xml @@ -55,12 +55,13 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/Pump.xml b/data_model/device_types/Pump.xml index 4662ce0945b06d..9ab8700abb10f5 100644 --- a/data_model/device_types/Pump.xml +++ b/data_model/device_types/Pump.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/PumpController.xml b/data_model/device_types/PumpController.xml index 274eefb764de41..ca1486e4ea657e 100644 --- a/data_model/device_types/PumpController.xml +++ b/data_model/device_types/PumpController.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/RoomAirConditioner.xml b/data_model/device_types/RoomAirConditioner.xml index 888ec8a448a501..e8c557a21800b9 100644 --- a/data_model/device_types/RoomAirConditioner.xml +++ b/data_model/device_types/RoomAirConditioner.xml @@ -55,9 +55,10 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + + @@ -85,6 +86,14 @@ Davis, CA 95616, USA + + + + + + + + diff --git a/data_model/device_types/RootNodeDeviceType.xml b/data_model/device_types/RootNodeDeviceType.xml index 1696791ab8a2b3..57b204036092c7 100644 --- a/data_model/device_types/RootNodeDeviceType.xml +++ b/data_model/device_types/RootNodeDeviceType.xml @@ -153,5 +153,27 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/device_types/Thermostat.xml b/data_model/device_types/Thermostat.xml index fc154468e97c5f..9f5c8e7de5b11c 100644 --- a/data_model/device_types/Thermostat.xml +++ b/data_model/device_types/Thermostat.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + @@ -82,13 +83,13 @@ Davis, CA 95616, USA - + - + @@ -97,15 +98,18 @@ Davis, CA 95616, USA - - - - + + + + + + + diff --git a/data_model/device_types/VideoRemoteControl.xml b/data_model/device_types/VideoRemoteControl.xml index eafa4cd63780b2..33bab95b9207c1 100644 --- a/data_model/device_types/VideoRemoteControl.xml +++ b/data_model/device_types/VideoRemoteControl.xml @@ -55,10 +55,11 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + @@ -102,5 +103,11 @@ Davis, CA 95616, USA + + + + + + \ No newline at end of file diff --git a/data_model/device_types/WindowCovering.xml b/data_model/device_types/WindowCovering.xml index 1a56bbd753f63a..b9a33b47ac4d9b 100644 --- a/data_model/device_types/WindowCovering.xml +++ b/data_model/device_types/WindowCovering.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/device_types/WindowCoveringController.xml b/data_model/device_types/WindowCoveringController.xml index 5bae9d81103247..76f0cf1b1e2147 100644 --- a/data_model/device_types/WindowCoveringController.xml +++ b/data_model/device_types/WindowCoveringController.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/scraper_version b/data_model/scraper_version index 0495c4a88caed0..e8ea05db81420d 100644 --- a/data_model/scraper_version +++ b/data_model/scraper_version @@ -1 +1 @@ -1.2.3 +1.2.4 diff --git a/data_model/spec_sha b/data_model/spec_sha index ec683a1872fc3e..e9d780b94f334a 100644 --- a/data_model/spec_sha +++ b/data_model/spec_sha @@ -1 +1 @@ -72ce960f71810d6ca96125aea54e4fb0a9631e34 +c1a1e1e6bcf201334eb0b5216a464b39d9827ec4 diff --git a/docs/ERROR_CODES.md b/docs/ERROR_CODES.md index 122d188f8e0f70..ecfda40d943983 100644 --- a/docs/ERROR_CODES.md +++ b/docs/ERROR_CODES.md @@ -202,6 +202,7 @@ This file was **AUTOMATICALLY** generated by | Decimal | Hex | Name | |-----------|-------|---------------------------------------------| +| 1025 | 0x401 | `BLE_ERROR_ADAPTER_UNAVAILABLE` | | 1027 | 0x403 | `BLE_ERROR_NO_CONNECTION_RECEIVED_CALLBACK` | | 1028 | 0x404 | `BLE_ERROR_CENTRAL_UNSUBSCRIBED` | | 1029 | 0x405 | `BLE_ERROR_GATT_SUBSCRIBE_FAILED` | diff --git a/docs/ci-cd/index.md b/docs/ci-cd/index.md index 437120d61f34ca..c2bfc51db6af9e 100644 --- a/docs/ci-cd/index.md +++ b/docs/ci-cd/index.md @@ -35,5 +35,14 @@ Work In Progress ## Tools - [Daily Fail Summary](tools/daily_fail_summary.md) +- Spellcheck + - Uses + [`rojopolis`/spellcheck-github-actions](https://github.com/marketplace/actions/github-spellcheck-action#configuration), + a PySpelling-based spellchecker + - This tool utilizes the definitions in .spellcheck.yml and + .github/`.wordlist.txt` to check all documentation files. + .spellcheck.yml defines the settings while `.wordlist.txt` is a + dictionary of words to skip checking (brand names, technical jargon, + acronyms) ## General Improvement Ideas diff --git a/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md b/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md index 9e34e961ae6d87..f4c1c5eb890e71 100644 --- a/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md +++ b/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md @@ -16,14 +16,17 @@ types in the SDK. - XML - Describes the structures, enums, attributes, commands, events etc. - Direct translation of the spec into code - - src/app/zap-templates/zcl/data-model/chip/ + - [src/app/zap-templates/zcl/data-model/chip/](https://github.com/project-chip/connectedhomeip/tree/master/src/app/zap-templates/zcl/data-model/chip) - Cluster Implementation - Client side - codegen, you write the glue - Server side - cpp implementation through Ember and / or - AttributeAccessInterface & CommandHandlerInterface + [AttributeAccessInterface](https://github.com/project-chip/connectedhomeip/blob/master/src/app/AttributeAccessInterface.h) + and + [CommandHandlerInterface](https://github.com/project-chip/connectedhomeip/blob/master/src/app/CommandHandlerInterface.h) - src/app/clusters/ - - build file: src/app/chip_data_model.gni + - build file: + [src/app/chip_data_model.gni](https://github.com/project-chip/connectedhomeip/blob/master/src/app/chip_data_model.gni) - build file uses data from the codegen to auto-populate the cluster list. - Follow examples in there to get your code building into the image @@ -31,7 +34,7 @@ types in the SDK. - Device Type Definitions - XML defines conformance - - src/app/zap-templates/zcl/data-model/chip/matter-devices.xml + - [src/app/zap-templates/zcl/data-model/chip/matter-devices.xml](https://github.com/project-chip/connectedhomeip/blob/master/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml) The following wiki page has a detailed description of how and where to add cluster and device type definitions so they are picked up properly by ZAP/ember @@ -208,7 +211,7 @@ be used across examples ##### Command Handler Code -- CommandHandlerInterface +- [CommandHandlerInterface](https://github.com/project-chip/connectedhomeip/blob/master/src/app/CommandHandlerInterface.h) - Can use HandleCommand function for convenience (sets handled) - If not, need to set whether the command was handled - if no, falls through to ember by default @@ -238,7 +241,9 @@ pure CommandHandlerInterface implementations. - **MatterReportingAttributeChangeCallback** - **Events** - No direct ember support - - Call LogEvent function in EventLogging.h + - Call LogEvent function in EventLogging.h. Caller has to either lock the + Matter stack lock or queue the event to the Matter event queue when + using LogEvent. #### A note on Dynamic Endpoints diff --git a/docs/cluster_and_device_type_dev/img/cluster_commands.png b/docs/cluster_and_device_type_dev/img/cluster_commands.png index 959774e071b717..7df7a8a75412ab 100644 Binary files a/docs/cluster_and_device_type_dev/img/cluster_commands.png and b/docs/cluster_and_device_type_dev/img/cluster_commands.png differ diff --git a/docs/examples/index.md b/docs/examples/index.md index 2c9a0a4659b3bc..fc82f2a0bc9016 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -112,6 +112,15 @@ kotlin-matter-controller/README virtual-device-app/**/README ``` +## Laundry washer example + +```{toctree} +:glob: +:maxdepth: 1 + +laundry-washer-app/**/README +``` + ## Lighting example ```{toctree} diff --git a/docs/guides/nrfconnect_factory_data_configuration.md b/docs/guides/nrfconnect_factory_data_configuration.md index d30a12f1e82025..e4c3be4899df4e 100644 --- a/docs/guides/nrfconnect_factory_data_configuration.md +++ b/docs/guides/nrfconnect_factory_data_configuration.md @@ -51,6 +51,7 @@ data secure by applying hardware write protection. - [Building an example with factory data](#building-an-example-with-factory-data) - [Providing factory data parameters as a build argument list](#providing-factory-data-parameters-as-a-build-argument-list) - [Setting factory data parameters using interactive Kconfig interfaces](#setting-factory-data-parameters-using-interactive-kconfig-interfaces) + - [Default Kconfig values and developing aspects](#default-kconfig-values-and-developing-aspects) - [Programming factory data](#programming-factory-data) - [Using own factory data implementation](#using-own-factory-data-implementation) @@ -272,6 +273,7 @@ To use this script, complete the following steps: ``` --chip_cert_path + --gen_certs ``` > **Note:** To generate new certificates, you need the `chip-cert` @@ -293,7 +295,7 @@ To use this script, complete the following steps: --rd_uid ``` - - Generate a new ID and provide it (): + - (optional) Generate a new ID and provide it: ``` --generate_rd_uid @@ -328,6 +330,17 @@ To use this script, complete the following steps: --product_color ``` + j. (optional) Generate Certification Declaration for testing purposes + + ``` + --chip_cert_path + --gen_cd + ``` + + > **Note:** To generate new Certification Declaration, you need the + > `chip-cert` executable. See the note at the end of this section to learn + > how to get it. + 4. Run the script using the prepared list of arguments: ``` @@ -794,6 +807,55 @@ snippet: > interfaces, read the > [Kconfig documentation](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/kconfig/menuconfig.html). +### Default Kconfig values and developing aspects + +Each factory data parameter has its default value reflected in the Kconfig. The +list below shows some Kconfig settings that are configured in the nRF Connect +build system and have an impact on the application. You can modify them to +achieve the desired behavior of your application. + +- The device uses the test certificates located in the + `credentials/development/attestation/` directory, which are generated using + all default values. If you want to change the default `vendor_id`, + `product_id`, `vendor_name`, or `device_name` and generate new test + certificates, add the `CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED=y` + Kconfig option. Remember to build the `chip-cert` application and add it to + the system PATH. + + For developing a production-ready product, you need to write the + certificates obtained during the certification process. To do this, add the + `CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER=y` Kconfig option and set the + appropriate paths for the following Kconfig options: + + - `CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT` + - `CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY` + - `CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT` + +- By default, the SPAKE2+ verifier is generated during each example's build. + This means that this value will change automatically if you change any of + the following parameters: + + - `CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE` + - `CONFIG_CHIP_DEVICE_SPAKE2_SALT` + - `CONFIG_CHIP_DEVICE_SPAKE2_IT` + + You can disable the generation of the SPAKE2+ verifier by setting the + `CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER=n` Kconfig option. Then, + you will need to provide the externally-generated SPAKE2+ verifier using the + `CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER` Kconfig value. + +- Generating the rotating device ID unique ID is disabled by default, but you + can enable it by setting the `CONFIG_CHIP_ROTATING_DEVICE_ID=y` and + `CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID=y` Kconfig values. + Moreover, if you set the `CONFIG_CHIP_ROTATING_DEVICE_ID` Kconfig option to + `y` and disable the `CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID` + Kconfig option, you will need to provide it manually using the + `CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID` Kconfig value. + +- You can generate the test Certification Declaration by using the + `CONFIG_CHIP_FACTORY_DATA_GENERATE_CD=y` Kconfig option. Remember to build + the `chip-cert` application and add it to the system PATH. +
## Programming factory data diff --git a/docs/guides/nxp_k32w_android_commissioning.md b/docs/guides/nxp_k32w_android_commissioning.md index 3f1c6d1171df3c..b39a2f2afd2c8c 100644 --- a/docs/guides/nxp_k32w_android_commissioning.md +++ b/docs/guides/nxp_k32w_android_commissioning.md @@ -3,7 +3,7 @@ This article describes how to use [CHIPTool](../../examples/android/CHIPTool/README.md) for Android smartphones to commission an NXP K32W061 DK6 running -[NXP K32W Lock/Light Example Application](#building-and-programming-nxp-k32w-locklight-example-application) +[NXP K32W Light Example Application](#building-and-programming-nxp-k32w-light-example-application) onto a CHIP-enabled Thread network.
@@ -12,7 +12,7 @@ onto a CHIP-enabled Thread network. - [Requirements](#requirements) - [Building and programming OpenThread RCP firmware](#building-and-programming-openthread-rcp-firmware) - [Configuring PC as Thread Border Router](#configuring-pc-as-a-thread-border-router) -- [Building and programming NXP K32W Lock/Light Example Application](#building-and-programming-nxp-k32w-locklight-example-application) +- [Building and programming NXP K32W Light Example Application](#building-and-programming-nxp-k32w-light-example-application) - [Building and installing Android CHIPTool](#building-and-installing-android-chiptool) - [Forming a Thread network on the Border Router](#forming-a-thread-network-on-the-border-router) - [Preparing accessory device](#preparing-accessory-device) @@ -44,7 +44,7 @@ with a spare Wi-Fi card and an device. The following diagram shows the connectivity between network components required -to allow communication between devices running the CHIPTool and Lock/Light +to allow communication between devices running the CHIPTool and Light applications: ![nxp_hw_connectivity](../../examples/platform/nxp/k32w/k32w0/doc/images/nxp_hw_connectivity.JPG) @@ -345,11 +345,7 @@ To make your PC work as a Thread Border Router, complete the following tasks:
-## Building and programming NXP K32W Lock/Light Example Application - -See -[NXP K32W Lock Example Application README](../../examples/lock-app/nxp/k32w/k32w0/README.md) -to learn how to build and program the lock example onto an K32W061 DK6. +## Building and programming NXP K32W Light Example Application See [NXP K32W Light Example Application README](../../examples/lighting-app/nxp/k32w/k32w0/README.md) @@ -491,11 +487,10 @@ section, complete the following steps: 2. Verify that the text box on the screen is not empty and contains the IPv6 address of the accessory device. -3. Tap the following buttons to change the lock/light state: +3. Tap the following buttons to change the light state: - - _ON_ and _OFF_ buttons lock/turn on and unlock/turn off the door/light - bulb, respectively. - - _TOGGLE_ changes the lock/light state to the opposite. + - _ON_ and _OFF_ buttons turn on and turn off the light bulb, respectively. + - _TOGGLE_ changes the light state to the opposite. -The _LED D3_ on the device turns on or off based on the changes of the -lock/light state. +The _LED D3_ on the device turns on or off based on the changes of the light +state. diff --git a/docs/guides/nxp_manufacturing_flow.md b/docs/guides/nxp_manufacturing_flow.md index 64bafd53c89329..6cc3005b412289 100644 --- a/docs/guides/nxp_manufacturing_flow.md +++ b/docs/guides/nxp_manufacturing_flow.md @@ -1,8 +1,4 @@ ---- -orphan: true ---- - -# NXP manufacturing data guide +# NXP Manufacturing data By default, the example application is configured to use generic test certificates and provisioning data embedded with the application code. It is @@ -112,30 +108,30 @@ Here is the interpretation of the **required** parameters: --pai_cert -> path to the PAI (der format) location --spake2p_path -> path to the spake2p tool --out -> name of the binary that will be used for storing all the generated data - - ``` Here is the interpretation of the **optional** parameters: ```shell ---dac_key_password -> Password to decode DAC key ---dac_key_use_sss_blob -> Used when --dac_key contains a path to an encrypted blob, instead of the - actual DAC private key. The blob metadata size is 24, so the total length - of the resulting value is private key length (32) + 24 = 56. False by default. ---spake2p_verifier -> SPAKE2+ verifier (passed as base64 encoded string). If this option is set, - all SPAKE2+ inputs will be encoded in the final binary. The spake2p tool - will not be used to generate a new verifier on the fly. ---aes128_key -> 128 bits AES key used to encrypt the whole dataset. Please make sure - that the target application/board supports this feature: it has access to - the private key and implements a mechanism which can be used to decrypt - the factory data information. ---date -> Manufacturing Date (YYYY-MM-DD format) ---part_number -> Part number as string ---product_url -> Product URL as string ---product_label -> Product label as string ---serial_num -> Serial Number ---unique_id -> Unique id used for rotating device id generation +--dac_key_password -> Password to decode DAC key +--dac_key_use_sss_blob -> Used when --dac_key contains a path to an encrypted blob, instead of the + actual DAC private key. The blob metadata size is 24, so the total length + of the resulting value is private key length (32) + 24 = 56. False by default. +--spake2p_verifier -> SPAKE2+ verifier (passed as base64 encoded string). If this option is set, + all SPAKE2+ inputs will be encoded in the final binary. The spake2p tool + will not be used to generate a new verifier on the fly. +--aes128_key -> 128 bits AES key used to encrypt the whole dataset. Please make sure + that the target application/board supports this feature: it has access to + the private key and implements a mechanism which can be used to decrypt + the factory data information. +--date -> Manufacturing Date (YYYY-MM-DD format) +--part_number -> Part number as string +--product_url -> Product URL as string +--product_label -> Product label as string +--serial_num -> Serial Number +--unique_id -> Unique id used for rotating device id generation +--product_finish -> Visible finish of the product +--product_primary_color -> Representative color of the visible parts of the product ``` ## 3. Write provisioning data @@ -157,8 +153,18 @@ loadfile factory_data.bin 0xf4000 where `0xf4000` is the value of `__MATTER_FACTORY_DATA_START` in the corresponding .map file (can be different if using a custom linker script). -For the **RT1060**, **RT1170** and **RW61X** platform, the binary needs to be -written using `MCUXpresso Flash Tool GUI` at the address value corresponding to +For **RW61X** platform, the binary needs to be written in the internal flash at +location given by `__MATTER_FACTORY_DATA_START`, using `JLink`: + +``` +loadfile factory_data.bin 0xBFFF000 +``` + +where `0xBFFF000` is the value of `__FACTORY_DATA_START` in the corresponding +.map file (can be different if using a custom linker script). + +For the **RT1060** and **RT1170** platform, the binary needs to be written using +`MCUXpresso Flash Tool GUI` at the address value corresponding to `__FACTORY_DATA_START` (the map file of the application should be checked to get the exact value). @@ -198,6 +204,8 @@ Also, demo **DAC**, **PAI** and **PAA** certificates needed in case ## 6. Increased security for DAC private key +### 6.1 K32W1 + Supported platforms: - K32W1 - `src/plaftorm/nxp/k32w/k32w1/FactoryDataProviderImpl.h` @@ -242,3 +250,29 @@ python3 ./scripts/tools/nxp/factory_data_generator/generate.py -i 10000 -s UXKLz Please note that `--dac_key` now points to a binary file that contains the encrypted blob. + +### 6.2 RW61X + +Supported platforms: + +- RW61X - `src/plaftorm/nxp/rt/rw61x/FactoryDataProviderImpl.h` + +For platforms that have a secure subsystem (`SE50`), the DAC private key can be +converted to an encrypted blob. This blob will overwrite the DAC private key in +factory data and will be imported in the `SE50` before to sign, by the factory +data provider instance. + +The conversion process shall happen at manufacturing time and should be run one +time only: + +- Write factory data binary. +- Build the application with + `chip_with_factory_data=1 chip_convert_dac_private_key=1` set. +- Write the application to the board and let it run. + +After the conversion process: + +- Make sure the application is built with `chip_with_factory_data=1`, but + without `chip_convert_dac_private_key` arg, since conversion already + happened. +- Write the application to the board. diff --git a/docs/guides/nxp_rw61x_ota_software_update.md b/docs/guides/nxp_rw61x_ota_software_update.md index c3bd5227a054ed..9922909c5d1f7a 100644 --- a/docs/guides/nxp_rw61x_ota_software_update.md +++ b/docs/guides/nxp_rw61x_ota_software_update.md @@ -87,7 +87,8 @@ J-Link > erase 0x8000000, 0x88a0000 ``` - Using MCUXPresso, import the `mcuboot_opensource` demo example from the SDK - previously downloaded. + previously downloaded. The example can be found under the `ota_examples` + folder. ![mcuboot_demo](../../examples/platform/nxp/rt/rw61x/doc/images/mcuboot_demo.PNG) - Before building the demo example, it should be specified that the application to be run by the bootloader is monolithic. As a result, only one @@ -100,7 +101,20 @@ Right click on the Project -> Properties -> C/C++ Build -> Settings -> Tool Sett ![rw610_mcuboot_monolithic](../../examples/platform/nxp/rt/rw61x/doc/images/mcuboot_monolithic_app.PNG) -- Build the demo example project and program it to the target board. +- Build the demo example project. + +``` +Right click on the Project -> Build Project +``` + +- Program the demo example to the target board. + +``` +Right click on the Project -> Debug -> As->SEGGER JLink probes -> OK -> Select elf file +``` + +Note : The mcuboot binary is loaded in flash at address 0x8000000. + - To run the flashed demo, either press the reset button of the device or use the debugger IDE of MCUXpresso. If it runs successfully, the following logs will be displayed on the terminal : @@ -161,14 +175,14 @@ user@ubuntu: python3 imgtool.py sign --key ~/Desktop/SDK_RW612/boards/rdrw612bga Notes : -- If internal SDK is used instead, the key can be found in : - "`~/Desktop/SDK_RW612/middleware/mcuboot_opensource/boot/nxp_mcux_sdk/keys/sign-rsa2048-priv.pem`". -- The arguments `slot-size` and `max-sectors` should be adjusted to the size - of the partitions reserved for the primary and the secondary applications. - (By default the size considered is 4.4 MB) +- The arguments `slot-size` and `max-sectors` are aligned with the size of the + partitions reserved for the primary and the secondary applications. (By + default the size considered is 4.4 MB for each application). If the size of + these partitions are modified, the `slot-size` and `max-sectors` should be + adjusted accordingly. - In this example, the image is signed with the private key provided by the SDK as an example - (`/path_to_sdk/middleware/mcuboot_opensource/boot/nxp_mcux_sdk/keys/sign-rsa2048-priv.pem`), + (`SDK_RW612/boards/rdrw612bga/ota_examples/mcuboot_opensource/keys/sign-rsa2048-priv.pem`), MCUBoot is built with its corresponding public key which would be used to verify the integrity of the image. It is possible to generate a new pair of keys using the following commands. This procedure should be done prior to @@ -187,7 +201,7 @@ user@ubuntu: python3 imgtool.py getpub -k priv_key.pem ``` - The extracted public key can then be copied to the - `/path_to_sdk/middleware/mcuboot_opensource/boot/nxp_mcux_sdk/keys/sign-rsa2048-pub.c`, + `SDK_RW612/boards/rdrw612bga/ota_examples/mcuboot_opensource/keys/sign-rsa2048-pub.c`, given as a value to the rsa_pub_key[] array. The resulting output is the signed binary of the application version "1.0". diff --git a/docs/guides/nxp_zephyr_ota_software_update.md b/docs/guides/nxp_zephyr_ota_software_update.md index 430e0bfd81e694..a36ac3281cb116 100644 --- a/docs/guides/nxp_zephyr_ota_software_update.md +++ b/docs/guides/nxp_zephyr_ota_software_update.md @@ -114,7 +114,7 @@ and `CONFIG_MCUBOOT_SIGNATURE_KEY_FILE` needs to point to that same key. paths starts from the MCUBoot repository root. This option can be changed in: `config/nxp/app/bootloader.conf` -- `CONFIG_BOOT_SIGNATURE_KEY_FILE`: This is used for the application to be +- `CONFIG_MCUBOOT_SIGNATURE_KEY_FILE`: This is used for the application to be loaded by the bootloader. The path can be either absolute or relative. Relative paths starts from the west workspace location. This option can be changed in the application .conf files. @@ -124,6 +124,22 @@ Refer to those two files for more information: - [MCUBoot Config used for the MCUBoot Image](https://github.com/zephyrproject-rtos/mcuboot/blob/main/boot/zephyr/Kconfig) - [MCUBoot Config used for the application](https://github.com/zephyrproject-rtos/zephyr/blob/main/modules/Kconfig.mcuboot) +When an OTA image is received it can either be marked as permanent or as a test, +The Kconfig `CONFIG_CHIP_OTA_REQUEST_UPGRADE_TYPE` can choose one of those +configurations (Defined in `/config/nxp/chip-module/Kconfig`): + +- `CONFIG_CHIP_OTA_REQUEST_UPGRADE_PERMANENT`: From the next reboot, this + image will be run permanently. +- `CONFIG_CHIP_OTA_REQUEST_UPGRADE_TEST`: The image will be run on the next + reboot, but it will be reverted if it doesn't get confirmed. The image needs + to confirm itself to become permanent. + +By default, the upgrade type used is `CONFIG_CHIP_OTA_REQUEST_UPGRADE_TEST`, and +OTA image confirms itself during the initialization stage after the fundamental +parts of the application are initialized properly to make sure this new image +boots correctly. This confirmation is done by +`chip::NXP::App::OTARequestorInitiator::HandleSelfTest()`. + JLink can be used to flash the mixed binary at the base address 0x8000000, using the command : diff --git a/docs/testing/ChipDeviceCtrlAPI.md b/docs/testing/ChipDeviceCtrlAPI.md new file mode 100644 index 00000000000000..944c787d647207 --- /dev/null +++ b/docs/testing/ChipDeviceCtrlAPI.md @@ -0,0 +1,1079 @@ +# Table of Contents + +- [Table of Contents](#table-of-contents) +- [chip.ChipDeviceCtrl](#chipchipdevicectrl) + - [CommissionableNode](#commissionablenode) + - [Commission](#commission) + - [DeviceProxyWrapper](#deviceproxywrapper) + - [ChipDeviceControllerBase](#chipdevicecontrollerbase) + - [Shutdown](#shutdown) + - [ShutdownAll](#shutdownall) + - [ExpireSessions](#expiresessions) + - [DiscoverCommissionableNodes](#discovercommissionablenodes) + - [DiscoverCommissionableNodesLongDiscriminator](#discovercommissionablenodeslongdiscriminator) + - [DiscoverCommissionableNodesShortDiscriminator](#discovercommissionablenodesshortdiscriminator) + - [DiscoverCommissionableNodesVendor](#discovercommissionablenodesvendor) + - [DiscoverCommissionableNodesDeviceType](#discovercommissionablenodesdevicetype) + - [DiscoverCommissionableNodesCommissioningEnabled](#discovercommissionablenodescommissioningenabled) + - [PrintDiscoveredDevices](#printdiscovereddevices) + - [DiscoverAllCommissioning](#discoverallcommissioning) + - [OpenCommissioningWindow](#opencommissioningwindow) + - [GetFabricIdInternal](#getfabricidinternal) + - [GetNodeIdInternal](#getnodeidinternal) + - [GetConnectedDeviceSync](#getconnecteddevicesync) + - [ComputeRoundTripTimeout](#computeroundtriptimeout) + - [GetRemoteSessionParameters](#getremotesessionparameters) + - [TestOnlySendBatchCommands](#testonlysendbatchcommands) + - [TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke](#testonlysendcommandtimedrequestflagwithnotimedinvoke) + - [SendCommand](#sendcommand) + - [SendBatchCommands](#sendbatchcommands) + - [SendGroupCommand](#sendgroupcommand) + - [WriteAttribute](#writeattribute) + - [WriteGroupAttribute](#writegroupattribute) + - [Read](#read) + - [ReadAttribute](#readattribute) + - [ReadEvent](#readevent) + - [ZCLSend](#zclsend) + - [ZCLReadAttribute](#zclreadattribute) + - [ZCLWriteAttribute](#zclwriteattribute) + - [ZCLSubscribeAttribute](#zclsubscribeattribute) + - [InitGroupTestingData](#initgrouptestingdata) + - [ChipDeviceController](#chipdevicecontroller) + - [Commission](#commission-1) + - [CommissionThread](#commissionthread) + - [CommissionWiFi](#commissionwifi) + - [SetWiFiCredentials](#setwificredentials) + - [SetThreadOperationalDataset](#setthreadoperationaldataset) + - [ResetCommissioningParameters](#resetcommissioningparameters) + - [SetTimeZone](#settimezone) + - [SetDSTOffset](#setdstoffset) + - [SetDefaultNTP](#setdefaultntp) + - [SetTrustedTimeSource](#settrustedtimesource) + - [SetCheckMatchingFabric](#setcheckmatchingfabric) + - [GetFabricCheckResult](#getfabriccheckresult) + - [CommissionOnNetwork](#commissiononnetwork) + - [CommissionWithCode](#commissionwithcode) + - [CommissionIP](#commissionip) + - [IssueNOCChain](#issuenocchain) + - [BareChipDeviceController](#barechipdevicecontroller) + - [\_\_init\_\_](#__init__) + + + +# chip.ChipDeviceCtrl + +Chip Device Controller interface + + + +## CommissionableNode + +```python +class CommissionableNode(discovery.CommissionableNode) +``` + + + +#### Commission + +```python +def Commission(nodeId: int, setupPinCode: int) -> PyChipError +``` + +Commission the device using the device controller discovered this device. + +nodeId: The nodeId commissioned to the device setupPinCode: The setup pin code +of the device + + + +## DeviceProxyWrapper + +```python +class DeviceProxyWrapper() +``` + +Encapsulates a pointer to OperationalDeviceProxy on the c++ side that needs to +be freed when DeviceProxyWrapper goes out of scope. There is a potential issue +where if this is copied around that a double free will occur, but how this is +used today that is not an issue that needs to be accounted for and it will +become very apparent if that happens. + + + +## ChipDeviceControllerBase + +```python +class ChipDeviceControllerBase() +``` + + + +#### Shutdown + +```python +def Shutdown() +``` + +Shuts down this controller and reclaims any used resources, including the bound +C++ constructor instance in the SDK. + + + +#### ShutdownAll + +```python +def ShutdownAll() +``` + +Shut down all active controllers and reclaim any used resources. + + + +#### ExpireSessions + +```python +def ExpireSessions(nodeid) +``` + +Close all sessions with `nodeid` (if any existed) so that sessions get +re-established. + +This is needed to properly handle operations that invalidate a node's state, +such as UpdateNOC. + +WARNING: ONLY CALL THIS IF YOU UNDERSTAND THE SIDE-EFFECTS + + + +#### DiscoverCommissionableNodes + +```python +def DiscoverCommissionableNodes( + filterType: discovery.FilterType = discovery.FilterType.NONE, + filter: typing.Any = None, + stopOnFirst: bool = False, + timeoutSecond: int = 5 +) -> typing.Union[None, CommissionableNode, typing.List[CommissionableNode]] +``` + +Discover commissionable nodes via DNS-SD with specified filters. Supported +filters are: + + discovery.FilterType.NONE + discovery.FilterType.SHORT_DISCRIMINATOR + discovery.FilterType.LONG_DISCRIMINATOR + discovery.FilterType.VENDOR_ID + discovery.FilterType.DEVICE_TYPE + discovery.FilterType.COMMISSIONING_MODE + discovery.FilterType.INSTANCE_NAME + discovery.FilterType.COMMISSIONER + discovery.FilterType.COMPRESSED_FABRIC_ID + +This function will always return a list of CommissionableDevice. When +stopOnFirst is set, this function will return when at least one device is +discovered or on timeout. + + + +#### DiscoverCommissionableNodesLongDiscriminator + +```python +def DiscoverCommissionableNodesLongDiscriminator(long_discriminator) +``` + +Deprecated, use DiscoverCommissionableNodes + + + +#### DiscoverCommissionableNodesShortDiscriminator + +```python +def DiscoverCommissionableNodesShortDiscriminator(short_discriminator) +``` + +Deprecated, use DiscoverCommissionableNodes + + + +#### DiscoverCommissionableNodesVendor + +```python +def DiscoverCommissionableNodesVendor(vendor) +``` + +Deprecated, use DiscoverCommissionableNodes + + + +#### DiscoverCommissionableNodesDeviceType + +```python +def DiscoverCommissionableNodesDeviceType(device_type) +``` + +Deprecated, use DiscoverCommissionableNodes + + + +#### DiscoverCommissionableNodesCommissioningEnabled + +```python +def DiscoverCommissionableNodesCommissioningEnabled() +``` + +Deprecated, use DiscoverCommissionableNodes + + + +#### PrintDiscoveredDevices + +```python +def PrintDiscoveredDevices() +``` + +Deprecated, use GetCommissionableNodes + + + +#### DiscoverAllCommissioning + +```python +def DiscoverAllCommissioning() +``` + +Deprecated, use DiscoverCommissionableNodes + + + +#### OpenCommissioningWindow + +```python +def OpenCommissioningWindow( + nodeid: int, timeout: int, iteration: int, discriminator: int, + option: CommissioningWindowPasscode) -> CommissioningParameters +``` + +Opens a commissioning window on the device with the given nodeid. nodeid: Node +id of the device timeout: Command timeout iteration: The PAKE iteration count +associated with the PAKE Passcode ID and ephemeral PAKE passcode verifier to be +used for this commissioning. Valid range: 1000 - 100000 Ignored if option == 0 +discriminator: The long discriminator for the DNS-SD advertisement. Valid range: +0-4095 Ignored if option == 0 option: 0 = kOriginalSetupCode 1 = +kTokenWithRandomPIN + +Returns CommissioningParameters + + + +#### GetFabricIdInternal + +```python +def GetFabricIdInternal() +``` + +Get the fabric ID from the object. Only used to validate cached value from +property. + + + +#### GetNodeIdInternal + +```python +def GetNodeIdInternal() -> int +``` + +Get the node ID from the object. Only used to validate cached value from +property. + + + +#### GetConnectedDeviceSync + +```python +def GetConnectedDeviceSync(nodeid, allowPASE=True, timeoutMs: int = None) +``` + +Returns DeviceProxyWrapper upon success. + + + +#### ComputeRoundTripTimeout + +```python +def ComputeRoundTripTimeout(nodeid, upperLayerProcessingTimeoutMs: int = 0) +``` + +Returns a computed timeout value based on the round-trip time it takes for the +peer at the other end of the session to receive a message, process it and send +it back. This is computed based on the session type, the type of transport, +sleepy characteristics of the target and a caller-provided value for the time it +takes to process a message at the upper layer on the target For group sessions. + +This will result in a session being established if one wasn't already. + + + +#### GetRemoteSessionParameters + +```python +def GetRemoteSessionParameters(nodeid) -> typing.Optional[SessionParameters] +``` + +Returns the SessionParameters of reported by the remote node associated with +`nodeid`. If there is some error in getting SessionParameters None is returned. + +This will result in a session being established if one wasn't already +established. + + + +#### TestOnlySendBatchCommands + +```python +async def TestOnlySendBatchCommands( + nodeid: int, + commands: typing.List[ClusterCommand.InvokeRequestInfo], + timedRequestTimeoutMs: typing.Optional[int] = None, + interactionTimeoutMs: typing.Optional[int] = None, + busyWaitMs: typing.Optional[int] = None, + suppressResponse: typing.Optional[bool] = None, + remoteMaxPathsPerInvoke: typing.Optional[int] = None, + suppressTimedRequestMessage: bool = False, + commandRefsOverride: typing.Optional[typing.List[int]] = None) +``` + +Please see SendBatchCommands for description. TestOnly overridable arguments: +remoteMaxPathsPerInvoke: Overrides the number of batch commands we think can be +sent to remote node. suppressTimedRequestMessage: When set to true, we suppress +sending Timed Request Message. commandRefsOverride: List of commandRefs to use +for each command with the same index in `commands`. + +**Returns**: + +- TestOnlyBatchCommandResponse + + + +#### TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke + +```python +async def TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke( + nodeid: int, + endpoint: int, + payload: ClusterObjects.ClusterCommand, + responseType=None) +``` + +Please see SendCommand for description. + + + +#### SendCommand + +```python +async def SendCommand(nodeid: int, + endpoint: int, + payload: ClusterObjects.ClusterCommand, + responseType=None, + timedRequestTimeoutMs: typing.Union[None, int] = None, + interactionTimeoutMs: typing.Union[None, int] = None, + busyWaitMs: typing.Union[None, int] = None, + suppressResponse: typing.Union[None, bool] = None) +``` + +Send a cluster-object encapsulated command to a node and get returned a future +that can be awaited upon to receive the response. If a valid responseType is +passed in, that will be used to de-serialize the object. If not, the type will +be automatically deduced from the metadata received over the wire. + +timedWriteTimeoutMs: Timeout for a timed invoke request. Omit or set to 'None' +to indicate a non-timed request. interactionTimeoutMs: Overall timeout for the +interaction. Omit or set to 'None' to have the SDK automatically compute the +right timeout value based on transport characteristics as well as the +responsiveness of the target. + +**Returns**: + +- command response. The type of the response is defined by the command. + +**Raises**: + +- InteractionModelError on error + + + +#### SendBatchCommands + +```python +async def SendBatchCommands( + nodeid: int, + commands: typing.List[ClusterCommand.InvokeRequestInfo], + timedRequestTimeoutMs: typing.Optional[int] = None, + interactionTimeoutMs: typing.Optional[int] = None, + busyWaitMs: typing.Optional[int] = None, + suppressResponse: typing.Optional[bool] = None) +``` + +Send a batch of cluster-object encapsulated commands to a node and get returned +a future that can be awaited upon to receive the responses. If a valid +responseType is passed in, that will be used to de-serialize the object. If not, +the type will be automatically deduced from the metadata received over the wire. + +nodeId: Target's Node ID commands: A list of InvokeRequestInfo containing the +commands to invoke. timedWriteTimeoutMs: Timeout for a timed invoke request. +Omit or set to 'None' to indicate a non-timed request. interactionTimeoutMs: +Overall timeout for the interaction. Omit or set to 'None' to have the SDK +automatically compute the right timeout value based on transport characteristics +as well as the responsiveness of the target. busyWaitMs: How long to wait in ms +after sending command to device before performing any other operations. +suppressResponse: Do not send a response to this action + +**Returns**: + +- List of command responses in the same order as what was given in `commands`. + The type of the response is defined by the command. +- A value of `None` indicates success. +- If only a single command fails, for example with `UNSUPPORTED_COMMAND`, the + corresponding index associated with the command will, contain + `interaction_model.Status.UnsupportedCommand`. +- If a command is not responded to by server, command will contain + `interaction_model.Status.NoCommandResponse` + +**Raises**: + +- InteractionModelError if error with sending of InvokeRequestMessage fails as + a whole. + + + +#### SendGroupCommand + +```python +def SendGroupCommand(groupid: int, + payload: ClusterObjects.ClusterCommand, + busyWaitMs: typing.Union[None, int] = None) +``` + +Send a group cluster-object encapsulated command to a group_id and get returned +a future that can be awaited upon to get confirmation command was sent. + +**Returns**: + +- None: responses are not sent to group commands + +**Raises**: + +- InteractionModelError on error + + + +#### WriteAttribute + +```python +async def WriteAttribute(nodeid: int, + attributes: typing.List[typing.Tuple[ + int, ClusterObjects.ClusterAttributeDescriptor]], + timedRequestTimeoutMs: typing.Union[None, int] = None, + interactionTimeoutMs: typing.Union[None, int] = None, + busyWaitMs: typing.Union[None, int] = None) +``` + +Write a list of attributes on a target node. + +nodeId: Target's Node ID timedWriteTimeoutMs: Timeout for a timed write request. +Omit or set to 'None' to indicate a non-timed request. attributes: A list of +tuples of type (endpoint, cluster-object): interactionTimeoutMs: Overall timeout +for the interaction. Omit or set to 'None' to have the SDK automatically compute +the right timeout value based on transport characteristics as well as the +responsiveness of the target. + +E.g (1, Clusters.UnitTesting.Attributes.XYZAttribute('hello')) -- Write 'hello' +to the XYZ attribute on the test cluster to endpoint 1 + +**Returns**: + +- [AttributeStatus] (list - one for each path) + + + +#### WriteGroupAttribute + +```python +def WriteGroupAttribute(groupid: int, + attributes: typing.List[typing.Tuple[ + ClusterObjects.ClusterAttributeDescriptor, int]], + busyWaitMs: typing.Union[None, int] = None) +``` + +Write a list of attributes on a target group. + +groupid: Group ID to send write attribute to. attributes: A list of tuples of +type (cluster-object, data-version). The data-version can be omitted. + +E.g (Clusters.UnitTesting.Attributes.XYZAttribute('hello'), 1) -- Group Write +'hello' with data version 1 + + + +#### Read + +```python +async def Read( + nodeid: int, + attributes: typing. + List[typing.Union[ + None, # Empty tuple, all wildcard + typing.Tuple[int], # Endpoint + # Wildcard endpoint, Cluster id present + typing.Tuple[typing.Type[ClusterObjects.Cluster]], + # Wildcard endpoint, Cluster + Attribute present + typing.Tuple[typing.Type[ClusterObjects.ClusterAttributeDescriptor]], + # Wildcard attribute id + typing.Tuple[int, typing.Type[ClusterObjects.Cluster]], + # Concrete path + typing.Tuple[ + int, + typing.Type[ClusterObjects.ClusterAttributeDescriptor]]]] = None, + dataVersionFilters: typing.List[typing.Tuple[ + int, typing.Type[ClusterObjects.Cluster], int]] = None, + events: typing.List[typing.Union[ + None, # Empty tuple, all wildcard + typing.Tuple[str, int], # all wildcard with urgency set + typing.Tuple[int, int], # Endpoint, + # Wildcard endpoint, Cluster id present + typing.Tuple[typing.Type[ClusterObjects.Cluster], int], + # Wildcard endpoint, Cluster + Event present + typing.Tuple[typing.Type[ClusterObjects.ClusterEvent], int], + # Wildcard event id + typing.Tuple[int, typing.Type[ClusterObjects.Cluster], int], + # Concrete path + typing.Tuple[int, typing.Type[ClusterObjects.ClusterEvent], + int]]] = None, + eventNumberFilter: typing.Optional[int] = None, + returnClusterObject: bool = False, + reportInterval: typing.Tuple[int, int] = None, + fabricFiltered: bool = True, + keepSubscriptions: bool = False, + autoResubscribe: bool = True) +``` + +Read a list of attributes and/or events from a target node + +nodeId: Target's Node ID attributes: A list of tuples of varying types depending +on the type of read being requested: (endpoint, Clusters.ClusterA.AttributeA): +Endpoint = specific, Cluster = specific, Attribute = specific (endpoint, +Clusters.ClusterA): Endpoint = specific, Cluster = specific, Attribute = _ +(Clusters.ClusterA.AttributeA): Endpoint = _, Cluster = specific, Attribute = +specific endpoint: Endpoint = specific, Cluster = _, Attribute = _ +Clusters.ClusterA: Endpoint = _, Cluster = specific, Attribute = _ '_' or (): +Endpoint = _, Cluster = _, Attribute = _ + +The cluster and attributes specified above are to be selected from the generated +cluster objects. + +e.g. ReadAttribute(1, [ 1 ] ) -- case 4 above. ReadAttribute(1, [ +Clusters.BasicInformation ] ) -- case 5 above. ReadAttribute(1, [ (1, +Clusters.BasicInformation.Attributes.Location ] ) -- case 1 above. + +dataVersionFilters: A list of tuples of (endpoint, cluster, data version). + +events: A list of tuples of varying types depending on the type of read being +requested: (endpoint, Clusters.ClusterA.EventA, urgent): Endpoint = specific, +Cluster = specific, Event = specific, Urgent = True/False (endpoint, +Clusters.ClusterA, urgent): Endpoint = specific, Cluster = specific, Event = _, +Urgent = True/False (Clusters.ClusterA.EventA, urgent): Endpoint = _, Cluster = +specific, Event = specific, Urgent = True/False endpoint: Endpoint = specific, +Cluster = _, Event = _, Urgent = True/False Clusters.ClusterA: Endpoint = _, +Cluster = specific, Event = _, Urgent = True/False '_' or (): Endpoint = _, +Cluster = _, Event = _, Urgent = True/False + +eventNumberFilter: Optional minimum event number filter. + +returnClusterObject: This returns the data as consolidated cluster objects, with +all attributes for a cluster inside a single cluster-wide cluster object. + +reportInterval: A tuple of two int-s for (MinIntervalFloor, MaxIntervalCeiling). +Used by establishing subscriptions. When not provided, a read request will be +sent. + +**Returns**: + +- AsyncReadTransaction.ReadResponse. Please see ReadAttribute and ReadEvent + for examples of how to access data. + +**Raises**: + +- InteractionModelError (chip.interaction_model) on error + + + +#### ReadAttribute + +```python +async def ReadAttribute( + nodeid: int, + attributes: typing. + List[typing.Union[ + None, # Empty tuple, all wildcard + typing.Tuple[int], # Endpoint + # Wildcard endpoint, Cluster id present + typing.Tuple[typing.Type[ClusterObjects.Cluster]], + # Wildcard endpoint, Cluster + Attribute present + typing.Tuple[typing.Type[ClusterObjects.ClusterAttributeDescriptor]], + # Wildcard attribute id + typing.Tuple[int, typing.Type[ClusterObjects.Cluster]], + # Concrete path + typing.Tuple[int, + typing.Type[ClusterObjects.ClusterAttributeDescriptor]]]], + dataVersionFilters: typing.List[typing.Tuple[ + int, typing.Type[ClusterObjects.Cluster], int]] = None, + returnClusterObject: bool = False, + reportInterval: typing.Tuple[int, int] = None, + fabricFiltered: bool = True, + keepSubscriptions: bool = False, + autoResubscribe: bool = True) +``` + +Read a list of attributes from a target node, this is a wrapper of +DeviceController.Read() + +nodeId: Target's Node ID attributes: A list of tuples of varying types depending +on the type of read being requested: (endpoint, Clusters.ClusterA.AttributeA): +Endpoint = specific, Cluster = specific, Attribute = specific (endpoint, +Clusters.ClusterA): Endpoint = specific, Cluster = specific, Attribute = _ +(Clusters.ClusterA.AttributeA): Endpoint = _, Cluster = specific, Attribute = +specific endpoint: Endpoint = specific, Cluster = _, Attribute = _ +Clusters.ClusterA: Endpoint = _, Cluster = specific, Attribute = _ '_' or (): +Endpoint = _, Cluster = _, Attribute = _ + +The cluster and attributes specified above are to be selected from the generated +cluster objects. + +e.g. ReadAttribute(1, [ 1 ] ) -- case 4 above. ReadAttribute(1, [ +Clusters.BasicInformation ] ) -- case 5 above. ReadAttribute(1, [ (1, +Clusters.BasicInformation.Attributes.Location ] ) -- case 1 above. + +returnClusterObject: This returns the data as consolidated cluster objects, with +all attributes for a cluster inside a single cluster-wide cluster object. + +reportInterval: A tuple of two int-s for (MinIntervalFloor, MaxIntervalCeiling). +Used by establishing subscriptions. When not provided, a read request will be +sent. + +**Returns**: + +- subscription request: ClusterAttribute.SubscriptionTransaction To get + notified on attribute change use SetAttributeUpdateCallback on the returned + SubscriptionTransaction. This is used to set a callback function, which is a + callable of type Callable[[TypedAttributePath, SubscriptionTransaction], + None] Get the attribute value from the change path using GetAttribute on the + SubscriptionTransaction You can await changes in the main loop using a + trigger mechanism from the callback. ex. queue.SimpleQueue + +- read request: AsyncReadTransaction.ReadResponse.attributes. This is of type + AttributeCache.attributeCache (Attribute.py), which is a dict mapping + endpoints to a list of Cluster (ClusterObjects.py) classes (dict[int, + List[Cluster]]) Access as + returned_object[endpoint_id][][] Ex. To + access the OnTime attribute from the OnOff cluster on endpoint 1 + returned_object[1][clusters.onoff][Clusters.OnOff.Attributes.OnTime] + +**Raises**: + +- InteractionModelError (chip.interaction_model) on error + + + +#### ReadEvent + +```python +async def ReadEvent( + nodeid: int, + events: typing.List[typing.Union[ + None, # Empty tuple, all wildcard + typing.Tuple[str, int], # all wildcard with urgency set + typing.Tuple[int, int], # Endpoint, + # Wildcard endpoint, Cluster id present + typing.Tuple[typing.Type[ClusterObjects.Cluster], int], + # Wildcard endpoint, Cluster + Event present + typing.Tuple[typing.Type[ClusterObjects.ClusterEvent], int], + # Wildcard event id + typing.Tuple[int, typing.Type[ClusterObjects.Cluster], int], + # Concrete path + typing.Tuple[int, typing.Type[ClusterObjects.ClusterEvent], int]]], + eventNumberFilter: typing.Optional[int] = None, + fabricFiltered: bool = True, + reportInterval: typing.Tuple[int, int] = None, + keepSubscriptions: bool = False, + autoResubscribe: bool = True) +``` + +Read a list of events from a target node, this is a wrapper of +DeviceController.Read() + +nodeId: Target's Node ID events: A list of tuples of varying types depending on +the type of read being requested: (endpoint, Clusters.ClusterA.EventA, urgent): +Endpoint = specific, Cluster = specific, Event = specific, Urgent = True/False +(endpoint, Clusters.ClusterA, urgent): Endpoint = specific, Cluster = specific, +Event = _, Urgent = True/False (Clusters.ClusterA.EventA, urgent): Endpoint = _, +Cluster = specific, Event = specific, Urgent = True/False endpoint: Endpoint = +specific, Cluster = _, Event = _, Urgent = True/False Clusters.ClusterA: +Endpoint = _, Cluster = specific, Event = _, Urgent = True/False '_' or (): +Endpoint = _, Cluster = _, Event = _, Urgent = True/False + +The cluster and events specified above are to be selected from the generated +cluster objects. + +e.g. ReadEvent(1, [ 1 ] ) -- case 4 above. ReadEvent(1, [ +Clusters.BasicInformation ] ) -- case 5 above. ReadEvent(1, [ (1, +Clusters.BasicInformation.Events.Location ] ) -- case 1 above. + +eventNumberFilter: Optional minimum event number filter. reportInterval: A tuple +of two int-s for (MinIntervalFloor, MaxIntervalCeiling). Used by establishing +subscriptions. When not provided, a read request will be sent. + +**Returns**: + +- subscription request: ClusterAttribute.SubscriptionTransaction To get + notified on event subscriptions, use the SetEventUpdateCallback function on + the returned SubscriptionTransaction. This is a callable of type + Callable[[EventReadResult, SubscriptionTransaction], None] You can await + events using a trigger mechanism in the callback. ex. queue.SimpleQueue + +- read request: AsyncReadTransaction.ReadResponse.events. This is a + List[ClusterEvent]. + +**Raises**: + +- InteractionModelError (chip.interaction_model) on error + + + +#### ZCLSend + +```python +def ZCLSend(cluster, command, nodeid, endpoint, groupid, args, blocking=False) +``` + +Wrapper over SendCommand that catches the exceptions Returns a tuple of +(errorCode, CommandResponse) + + + +#### ZCLReadAttribute + +```python +def ZCLReadAttribute(cluster, + attribute, + nodeid, + endpoint, + groupid, + blocking=True) +``` + +Wrapper over ReadAttribute for a single attribute Returns an AttributeReadResult + + + +#### ZCLWriteAttribute + +```python +def ZCLWriteAttribute(cluster: str, + attribute: str, + nodeid, + endpoint, + groupid, + value, + dataVersion=0, + blocking=True) +``` + +Wrapper over WriteAttribute for a single attribute return PyChipError + + + +#### ZCLSubscribeAttribute + +```python +def ZCLSubscribeAttribute(cluster, + attribute, + nodeid, + endpoint, + minInterval, + maxInterval, + blocking=True, + keepSubscriptions=False, + autoResubscribe=True) +``` + +Wrapper over ReadAttribute for a single attribute Returns a +SubscriptionTransaction. See ReadAttribute for more information. + + + +#### InitGroupTestingData + +```python +def InitGroupTestingData() +``` + +Populates the Device Controller's GroupDataProvider with known test group info +and keys. + + + +## ChipDeviceController + +```python +class ChipDeviceController(ChipDeviceControllerBase) +``` + +The ChipDeviceCommissioner binding, named as ChipDeviceController + +TODO: This class contains DEPRECATED functions, we should update the test +scripts to avoid the usage of those functions. + + + +#### Commission + +```python +def Commission(nodeid) -> PyChipError +``` + +Start the auto-commissioning process on a node after establishing a PASE +connection. This function is intended to be used in conjunction with +`EstablishPASESessionBLE` or `EstablishPASESessionIP`. It can be called either +before or after the DevicePairingDelegate receives the OnPairingComplete call. +Commissioners that want to perform simple auto-commissioning should use the +supplied "PairDevice" functions above, which will establish the PASE connection +and commission automatically. + +**Returns**: + +- `bool` - True if successful, False otherwise. + + + +#### CommissionThread + +```python +def CommissionThread(discriminator, setupPinCode, nodeId, + threadOperationalDataset: bytes) -> PyChipError +``` + +Commissions a Thread device over BLE + + + +#### CommissionWiFi + +```python +def CommissionWiFi(discriminator, setupPinCode, nodeId, ssid: str, + credentials: str) -> PyChipError +``` + +Commissions a Wi-Fi device over BLE. + + + +#### SetWiFiCredentials + +```python +def SetWiFiCredentials(ssid: str, credentials: str) +``` + +Set the Wi-Fi credentials to set during commissioning. + + + +#### SetThreadOperationalDataset + +```python +def SetThreadOperationalDataset(threadOperationalDataset) +``` + +Set the Thread operational dataset to set during commissioning. + + + +#### ResetCommissioningParameters + +```python +def ResetCommissioningParameters() +``` + +Sets the commissioning parameters back to the default values. + + + +#### SetTimeZone + +```python +def SetTimeZone(offset: int, validAt: int, name: str = "") +``` + +Set the time zone to set during commissioning. Currently only one time zone +entry is supported + + + +#### SetDSTOffset + +```python +def SetDSTOffset(offset: int, validStarting: int, validUntil: int) +``` + +Set the DST offset to set during commissioning. Currently only one DST entry is +supported + + + +#### SetDefaultNTP + +```python +def SetDefaultNTP(defaultNTP: str) +``` + +Set the DefaultNTP to set during commissioning + + + +#### SetTrustedTimeSource + +```python +def SetTrustedTimeSource(nodeId: int, endpoint: int) +``` + +Set the trusted time source nodeId to set during commissioning. This must be a +node on the commissioner fabric. + + + +#### SetCheckMatchingFabric + +```python +def SetCheckMatchingFabric(check: bool) +``` + +Instructs the auto-commissioner to perform a matching fabric check before +commissioning. + + + +#### GetFabricCheckResult + +```python +def GetFabricCheckResult() -> int +``` + +Returns the fabric check result if SetCheckMatchingFabric was used. + + + +#### CommissionOnNetwork + +```python +def CommissionOnNetwork( + nodeId: int, + setupPinCode: int, + filterType: DiscoveryFilterType = DiscoveryFilterType.NONE, + filter: typing.Any = None, + discoveryTimeoutMsec: int = 30000) -> PyChipError +``` + +Does the routine for OnNetworkCommissioning, with a filter for mDNS discovery. +Supported filters are: + + DiscoveryFilterType.NONE + DiscoveryFilterType.SHORT_DISCRIMINATOR + DiscoveryFilterType.LONG_DISCRIMINATOR + DiscoveryFilterType.VENDOR_ID + DiscoveryFilterType.DEVICE_TYPE + DiscoveryFilterType.COMMISSIONING_MODE + DiscoveryFilterType.INSTANCE_NAME + DiscoveryFilterType.COMMISSIONER + DiscoveryFilterType.COMPRESSED_FABRIC_ID + +The filter can be an integer, a string or None depending on the actual type of +selected filter. + + + +#### CommissionWithCode + +```python +def CommissionWithCode( + setupPayload: str, + nodeid: int, + discoveryType: DiscoveryType = DiscoveryType.DISCOVERY_ALL +) -> PyChipError +``` + +Commission with the given nodeid from the setupPayload. setupPayload may be a QR +or manual code. + + + +#### CommissionIP + +```python +def CommissionIP(ipaddr: str, setupPinCode: int, nodeid: int) -> PyChipError +``` + +DEPRECATED, DO NOT USE! Use `CommissionOnNetwork` or `CommissionWithCode` + + + +#### IssueNOCChain + +```python +def IssueNOCChain(csr: Clusters.OperationalCredentials.Commands.CSRResponse, + nodeId: int) +``` + +Issue an NOC chain using the associated OperationalCredentialsDelegate. The NOC +chain will be provided in TLV cert format. + + + +## BareChipDeviceController + +```python +class BareChipDeviceController(ChipDeviceControllerBase) +``` + +A bare device controller without AutoCommissioner support. + + + +#### \_\_init\_\_ + +```python +def __init__(operationalKey: p256keypair.P256Keypair, + noc: bytes, + icac: typing.Union[bytes, None], + rcac: bytes, + ipk: typing.Union[bytes, None], + adminVendorId: int, + name: str = None) +``` + +Creates a controller without AutoCommissioner. + +The allocated controller uses the noc, icac, rcac and ipk instead of the +default, random generated certificates / keys. Which is suitable for creating a +controller for manually signing certificates for testing. + +**Arguments**: + +- `operationalKey` - A P256Keypair object for the operational key of the + controller. +- `noc` - The NOC for the controller, in bytes. +- `icac` - The optional ICAC for the controller. +- `rcac` - The RCAC for the controller. +- `ipk` - The optional IPK for the controller, when None is provided, the + defaultIpk will be used. +- `adminVendorId` - The adminVendorId of the controller. +- `name` - The name of the controller, for debugging use only. diff --git a/docs/testing/GenerateChipDeviceCtrlDoc.sh b/docs/testing/GenerateChipDeviceCtrlDoc.sh new file mode 100755 index 00000000000000..f1d3f323c7a45c --- /dev/null +++ b/docs/testing/GenerateChipDeviceCtrlDoc.sh @@ -0,0 +1,26 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) + +pydoc-markdown -m chip.ChipDeviceCtrl '{ + renderer: { + type: markdown, + descriptive_class_title: false, + render_toc: true, + insert_header_anchors: true + } + }' >"$SCRIPT_DIR"/ChipDeviceCtrlAPI.md diff --git a/docs/testing/python.md b/docs/testing/python.md index 3af81e2394fe85..1f946a38333ecd 100644 --- a/docs/testing/python.md +++ b/docs/testing/python.md @@ -1,6 +1,500 @@ # Python framework tests -This file is a placeholder for python framework test information. +The python test framework is built on top of the ChipDeviceCtrl.py python +controller API and the Mobly test framework. Python tests are interaction tests, +and can be used for certification testing, and / or integration testing in the +CI. -NOTE: be sure to include information about how you need to commission with the -python controller, not chip-tool and how to do that in the scripts +Python tests located in src/python_testing + +## Resources for getting started + +- [src/python_testing/hello_test.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/hello_test.py) - + sample test showing test setup and test harness integration +- [https://github.com/google/mobly/blob/master/docs/tutorial.md](https://github.com/google/mobly/blob/master/docs/tutorial.md) +- [ChipDeviceCtrl.py](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/chip/ChipDeviceCtrl.py) - + Controller implementation - [API documentation](./ChipDeviceCtrlAPI.md) +- [scripts/tests/run_python_test.py](https://github.com/project-chip/connectedhomeip/blob/master/scripts/tests/run_python_test.py) + to easily set up app and script for testing - used in CI + +## Writing Python tests + +- All test classes inherit from MatterBaseTest in + [matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py) + - support for commissioning using the python controller + - default controller (self.default_controller) of type ChipDeviceCtrl + - MatterBaseTest inherits from the Mobly BaseTestClass +- Test function(s) (start with test\_) and are all run automatically + - To run in the test harness, the test name must be test_TC_PICSCODE\_#\_# + - more information about integration with the test harness can be + found in [Test Harness helpers](#test-harness-helpers) section + - any tests that use async function (read / write / commands) should be + decorated with the @async_test_body decorator +- Use ChipDeviceCtrl to interact with the DUT + - Controller API is in ChipDeviceCtrl.py (see API doc in file) + - some support functions in matter_testing_support.py +- Use Mobly assertions for failing tests +- self.step() along with a steps\_ function to mark test plan steps for cert + tests +- + +### A simple test + +``` +class TC_MYTEST_1_1(MatterBaseTest): + + @async_test_body + async def test_TC_MYTEST_1_1(self): + + vendor_name = await self.read_single_attribute_check_success( + dev_ctrl=self.default_controller, # defaults to +self.default_controlller + node_id = self.dut_node_id, # defaults to +self.dut_node_id + cluster=Clusters.BasicInformation, + attribute=Clusters.BasicInformation.Attributes.VendorName, + endpoint = 0, #defaults to 0 + ) + asserts.assert_equal(vendor_name, “Test vendor name”, “Unexpected vendor name”) + +if __name__ == "__main__": +default_matter_test_main() +``` + +--- + +In this test, asserts.assert_equal is used to fail the test on condition failure +(throws an exception). + +Because the test requires the use of the async function +read_single_attribute_check_success, the test is decorated with the +`@async_test_body` decorator + +The default_matter_test_main() function is used to run the test on the command +line. These two lines should appear verbatim at the bottom of every python test +file. + +## Cluster Codegen + +- [Objects.py](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/chip/clusters/Objects.py) + for codegen, +- [ClusterObjects.py](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/chip/clusters/ClusterObjects.py) + for classes + +Common import used in test files: `import chip.clusters as Clusters` + +Each cluster is defined in the `Clusters.` namespace and contains +always: + +- id +- descriptor + +Each `Clusters.` will include the appropriate sub-classes (if +defined for the cluster): + +- Enums +- Bitmaps +- Structs +- Attributes +- Commands +- Events + +### Attributes + +Attributes derive from ClusterAttributeDescriptor + +Each `Clusters..Attributes.` class has: + +- cluster_id +- attribute_id +- attribute_type +- value + +Example: + +- class - Clusters.OnOff.Attributes.OnTime + - used for Read commands +- instance - Clusters.OnOff.Attributes.OnTime(5) + - sets the value to 5 + - pass the instance to write commands to write the value + +### Commands + +Commands derive from ClusterCommand + +Each `Clusters..Commands.` class has: + +- cluster_id +- command_id +- is_client +- response_type (None for status response) +- descriptor +- data members (if required) + +Example: + +- Clusters.OnOff.Commands.OnWithTimedOff(onOffControl=0, onTime=5, + offWaitTime=8) +- Clusters.OnOff.Commands.OnWithTimedOff() + - command with no fields + +### Events + +Events derive from ClusterEvent + +Each `Clusters..Events.` class has: + +- cluster_id +- event_id +- descriptor +- data members if required + +Example: + +- Clusters.AccessControl.Events.AccessControlEntryChanged.adminNodeID + +### Enums + +Enums derive from MatterIntEnum + +Each `Clusters..Enum.` has + +- k +- kUnknownEnumValue (used for testing, do not transmit) + +Example: + +- Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister + +### Bitmaps + +Bitmaps derive from IntFlag + +Each `Clusters..Bitmaps.` has: - k + +Special class: + +- class Feature(IntFlag) - contains the feature map bitmaps + +Example: + +- Clusters.LaundryWasherControls.Bitmaps.Feature.kSpin + +### Structs + +Structs derive from ClusterObject + +Each `Clusters..Structs.` has: + +- descriptor +- data members + +Example + +- Clusters.BasicInformation.Structs.ProductAppearanceStruct( +- finish=Clusters.BasicInformation.Enums.ProductFinishEnum.kFabric, +- primaryColor=Clusters.BasicInformation.Enums.ColorEnum.kBlack) + +## Accessing Clusters and Cluster Elements by ID + +[ClusterObjects.py](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/chip/clusters/ClusterObjects.py) +has a set of objects that map ID to the code generated object. + +`chip.clusters.ClusterObjects.ALL_CLUSTERS` + +- dict[int, Cluster] - maps cluster ID to Cluster class +- cluster = chip.clusters.ClusterObjects.ALL_CLUSTERS[cluster_id] + +`chip.clusters.ClusterObjects.ALL_ATTRIBUTES` + +- dict[int, dict[int, ClusterAttributeDescriptor]] - maps cluster ID to a dict + of attribute ID to attribute class +- attr = chip.clusters.ClusterObjects.ALL_ATTRIBUTES[cluster_id][attribute_id] + +`chip.clusters.ClusterObjects.ALL_ACCEPTED_COMMANDS/ALL_GENERATED_COMMANDS` + +- dict[int, dict[int, ClusterCommand]] +- cmd = chip.clusters.ClusterObjects.ALL_ACCEPTED_COMMANDS[cluster_id][cmd_id] + +## ChipDeviceCtrl API + +The ChipDeviceCtrl API is implemented in +[ChipDeviceCtrl.py](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/chip/ChipDeviceCtrl.py). + +The ChipDeviceCtrl implements a python-based controller that can be used to +commission and control devices. The API is documented here in the +[ChipDeviceCtrl API documentation](./ChipDeviceCtrlAPI.md) + +The API doc gives full descriptions of the APIs being used. The most commonly +used functions are linked below + +### [Read](./ChipDeviceCtrlAPI.md#read) + +- Read both attributes and events +- Can handle wildcard or concrete path + +### [ReadAttribute](./ChipDeviceCtrlAPI.md#readattribute) + +- convenience wrapper for Read for attributes + +Examples: Wildcard read (all clusters, all endpoints): + +`await dev_ctrl.ReadAttribute(node_id, [()])` + +Wildcard read (single endpoint 0) + +`await dev_ctrl.ReadAttribute(node_id, [(0)])` + +Wildcard read (single cluster from single endpoint 0) + +`await dev_ctrl.ReadAttribute(node_id, [(1, Clusters.OnOff)])` + +Single attribute + +`await dev_ctrl.ReadAttribute(node_id, [(1, Clusters.OnOff.Attributes.OnTime)])` + +Multi-path + +`await dev_ctrl.ReadAttribute(node_id, [(1, Clusters.OnOff.Attributes.OnTime),(1, Clusters.OnOff.Attributes.OnOff)])` + +### [ReadEvent](./ChipDeviceCtrlAPI.md#readevent) + +- convenience wrapper for Read +- Similar to ReadAttribute, but the tuple includes urgency as the last number + +Example: + +``` +urgent = 1 + +await dev_ctrl ReadEvent(node_id, [(1, +Clusters.TimeSynchronization.Events.MissingTrustedTimeSource, urgent)]) +``` + +### Subscriptions + +Subscriptions are handled in the Read / ReadAttribute / ReadEvent APIs. To +initiate a subscription, set the `reportInterval` tuple to set the floor and +ceiling. The `keepSubscriptions` and `autoResubscribe` parameters also apply to +subscriptions. + +Subscription return `ClusterAttribute.SubscriptionTransaction`. This can be used +to set callbacks. The object is returned after the priming data read is +complete, and the values there are used to populate the cache. The attribute +callbacks are called on update. + +- SetAttributeUpdateCallback + - Callable[[TypedAttributePath, SubscriptionTransaction], None] +- SetEventUpdateCallback + - Callable[[EventReadResult, SubscriptionTransaction], None] +- await changes in the main loop using a trigger mechanism from the callback. + +Example for setting callbacks: + +``` +q = queue.Queue() +cb = SimpleEventCallback("cb", cluster_id, event_id, q) + +urgent = 1 +subscription = await dev_ctrl.ReadEvent(nodeid=1, events=[(1, event, urgent)], reportInterval=[1, 3]) +subscription.SetEventUpdateCallback(callback=cb) + +try: + q.get(block=True, timeout=timeout) +except queue.Empty: + asserts.assert_fail(“Timeout on event”) +``` + +### [WriteAttribute](./ChipDeviceCtrlAPI.md#writeattribute) + +Handles concrete paths only (per spec), can handle lists. Returns list of +PyChipError + +- Instantiate the `ClusterAttributeDescriptor` class with the value you want + to send, tuple is (endpoint, attribute) + - use timedRequestTimeoutMs for timed request actions + +Example: + +``` +res = await devCtrl.WriteAttribute(nodeid=0, attributes=[(0,Clusters.BasicInformation.Attributes.NodeLabel("Test"))]) +asserts.assert_equal(ret[0].status, Status.Success, “write failed”) +``` + +### [SendCommand](./ChipDeviceCtrlAPI.md#sendcommand) + +- Instantiate the command with the values you need to populate +- If there is a non-status return, it’s returned from the command +- If there is a pure status return it will return nothing +- Raises InteractionModelError on failure + +Example: + +``` +pai = await dev_ctrl.SendCommand(nodeid, 0, Clusters.OperationalCredentials.Commands.CertificateChainRequest(2)) +``` + +## MatterBaseTest helpers + +- Because we tend to do a lot of single read / single commands in tests, we + added a couple of helpers in MatterBaseTest that use some of the default + values + - read_single_attribute_check_success + - read_single_attribute_expect_error + - send_single_cmd +- step() function to mark step progress for the test harness +- skip / skip_step / skip_remaining_steps functions for test harness + integration +- check_pics / pics_guard to handle pics + +## Mobly helpers + +The test system is based on Mobly, and the +[matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py) +class provides some helpers for Mobly integration + +- default_matter_test_main + - Sets up commissioning and finds all tests, parses command arguments + +use as: + +``` +if __name__ == "__main__": +default_matter_test_main() +``` + +- Mobly will run all functions starting with test\_ by default + - use --tests command line argument to specify +- Setup / teardown functions + - setup_class / teardown_class + - setup_test / teardown_test + - Don’t forget to call the super() if you override these + +## Test harness helpers + +The python testing system also includes several functions for integrations with +the test harness. To integrate with the test harness, you can define the +following functions on your class to allow the test harness UI to properly work +through your tests. + +All of these functions are demonstrated in the +[hello_example.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/hello_test.py) +reference. + +- step enumeration + - define a function called `steps_YourFunctionName` to allow the test + harness to display the steps + - use the self.step(``) function to walk through the steps +- test description + - define a function called `desc_YourFunctionName` to send back a string + with the test description +- top level PICS + - To guard your test on a top level PICS, define a function called + `pics_YourFunctionName` to send back a list of pics. If this function is + omitted, the test will be run for every endpoint on every device. +- overriding the default timeout + - if the test is exceptionally long running, define a property function + `default_timeout` to adjust the timeout. The default is 90 seconds + +Deferred failures: For some tests, it makes sense to perform the entire test +before failing and collect all the errors so the developers can address all the +failures without needing to re-run the test multiple times. For example, tests +that look at every attribute on the cluster and perform independent operations +on them etc. + +For such tests, use the ProblemNotice format and the convenience functions: + +- self.record_error +- self.record_warning + +These functions keep track of the problems, and will print them at the end of +the test. The test will not be failed until the assert is called. + +A good example of this type of test can be found in the device basic composition +tests, where all the test steps are independent and performed on a single read. +See +[Device Basic Composition tests](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/TC_DeviceBasicComposition.py) + +## Command line arguments + +- Use help to get a full list +- --commissioning-method + - need to re-commission to python controller as chip-tool and python + commissioner do not share a credentials +- --discriminator, --passcode, --qr-code, --manual-code +- --tests to select tests +- --PICS +- --int-arg, --bool-arg, --float-arg, --string-arg, --json-arg, --hex-arg + - specify as key:value ex --bool-arg pixit_name:False + - used for custom arguments to scripts (PIXITs) + +## PICS and PIXITS + +- PICS + - use --PICS on the command line to specify the PICS file + - use check_pics to gate steps in a file +- have_whatever = check_pics(“PICS.S.WHATEVER”) +- PIXITs + - use --int-arg, --bool-arg etc on the command line to specify PIXITs + - Warn users if they don’t set required values, add instructions in the + comments +- pixit_value = self.user_params.get("pixit_name", default) + +## Support functions + +To create a controller on a new fabric: + +``` +new_CA = self.certificate_authority_manager.NewCertificateAuthority() + +new_fabric_admin = new_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, +fabricId=self.matter_test_config.fabric_id + 1) + +TH2 = new_fabric_admin.NewController(nodeId=112233) +``` + +Open a commissioning window (ECW): + +``` +params = self.OpenCommissioningWindow(dev_ctrl=self.default_controller, node_id=self.dut_node_id) +``` + +To create a new controller on the SAME fabric, allocate a new controller from +the fabric admin + +Fabric admin for default controller: + +``` +fa=self.certificate_authority_manager.activeCaList[0].adminList[0] +second_ctrl = fa.new_fabric_admin.NewController(nodeId=node_id) +``` + +## other support functions + +- basic_composition_support + - wildcard read, whole device analysis +- CommissioningFlowBlocks + - various commissioning support for core tests +- spec_parsing_support + - parsing data model XML into python readable format + +# Running tests locally + +You can run the python script as-is for local testing against an already-running +DUT + +`./scripts/tests/run_python_test.py` is a convenient script to fire up an +example DUT on the host, with factory reset support + +`./scripts/tests/run_python_test.py --factoryreset --app --app-args "whatever" --script --script-args "whatever"` + +Note that devices must be commissioned by the python test harness to run tests. +chip-tool and the python test harness DO NOT share a fabric. + +# Running tests in CI + +- add to .github/workflows/tests.yaml repl_tests_linux +- don’t forget to set the PICS file to the ci-pics-values +- if there are things in your test that will fail on CI (ex. test vendor + checks), gate them on the PICS_SDK_CI_ONLY + - is_ci = self.check_pics('PICS_SDK_CI_ONLY') diff --git a/docs/testing/yaml.md b/docs/testing/yaml.md index 2099d623c1b3db..107c761fbef71e 100644 --- a/docs/testing/yaml.md +++ b/docs/testing/yaml.md @@ -293,6 +293,11 @@ All YAML tests assume that the DUT has previously been commissioned before running. DUTs should be commissioned using chip-tool. Use the same KVS file when running the test. +By default, the tests use node ID 0x12344321. The easiest way to run the tests +is to commission with this node ID. Alternately, you can change the target node +ID on the command line, as shown in the [Running the tests](#running-the-tests) +section. + #### Running the tests There are several options for running tests locally. Because the YAML runner @@ -338,6 +343,10 @@ with -- ``` +Each test defines a default endpoint to target. Root node cluster tests run +against endpoint 0 by default. Most other cluster tests run against endpoint 1. +You can set the endpoint for the test using the `endpoint` config variable. + #### Factory resetting the DUT On the host machine, you can simulate a factory reset by deleting the KVS file. diff --git a/examples/air-purifier-app/air-purifier-common/BUILD.gn b/examples/air-purifier-app/air-purifier-common/BUILD.gn index 9715f88e65f2b3..aaf01bf29b7ba0 100755 --- a/examples/air-purifier-app/air-purifier-common/BUILD.gn +++ b/examples/air-purifier-app/air-purifier-common/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("air-purifier-common") { zap_file = "air-purifier-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/air-purifier-app/zap-generated" is_server = true } diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.zap b/examples/air-purifier-app/air-purifier-common/air-purifier-app.zap index b868916264f4ba..516cb763153e1f 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.zap +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 99, + "featureLevel": 100, "creator": "zap", "keyValuePairs": [ { @@ -1581,10 +1581,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1597,10 +1597,10 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0002", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2903,7 +2903,6 @@ "define": "FAN_CONTROL_CLUSTER", "side": "server", "enabled": 1, - "apiMaturity": "provisional", "commands": [ { "name": "Step", @@ -7610,7 +7609,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x0", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -7626,7 +7625,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x00", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -7641,7 +7640,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7657,7 +7656,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7673,7 +7672,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7689,7 +7688,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7747,7 +7746,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7763,8 +7762,8 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": null, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -7779,8 +7778,8 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": null, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -7795,8 +7794,8 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": null, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -7811,7 +7810,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7827,7 +7826,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7843,7 +7842,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7859,7 +7858,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7875,7 +7874,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7891,7 +7890,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8039,7 +8038,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8055,7 +8054,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8071,7 +8070,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8087,7 +8086,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8136,43 +8135,48 @@ "endpointTypeIndex": 0, "profileId": 259, "endpointId": 0, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 1, "profileId": 259, "endpointId": 1, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 2, "profileId": 259, "endpointId": 2, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 3, "profileId": 259, "endpointId": 3, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 4, "profileId": 259, "endpointId": 4, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 5, "profileId": 259, "endpointId": 5, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null } - ], - "log": [] + ] } \ No newline at end of file diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/BUILD.gn b/examples/air-quality-sensor-app/air-quality-sensor-common/BUILD.gn index 6ca5be5ba634db..5cdba00ee78fc0 100755 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/BUILD.gn +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("air-quality-sensor-common") { zap_file = "air-quality-sensor-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/air-quality-sensor-app/zap-generated" is_server = true } diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter index 1f165eecdcc27a..48db2c71b380bb 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter @@ -829,7 +829,7 @@ cluster SoftwareDiagnostics = 52 { /** The Thread Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems */ cluster ThreadNetworkDiagnostics = 53 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum ConnectionStatusEnum : enum8 { kConnected = 0; @@ -2203,7 +2203,7 @@ endpoint 0 { callback attribute operationalDatasetComponents; callback attribute activeNetworkFaultsList; ram attribute featureMap default = 0x000F; - ram attribute clusterRevision default = 1; + ram attribute clusterRevision default = 2; handle command ResetCounts; } diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap index 06db369cc4e3b6..1ba46389e28a9e 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 99, + "featureLevel": 100, "creator": "zap", "keyValuePairs": [ { @@ -1529,10 +1529,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1545,10 +1545,10 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0002", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2733,7 +2733,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "2", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6054,14 +6054,16 @@ "endpointTypeIndex": 0, "profileId": 259, "endpointId": 0, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 1, "profileId": 259, "endpointId": 1, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null } ] } \ No newline at end of file diff --git a/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp b/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp index 8be44e55cc9e17..41a53d4fd94c7d 100644 --- a/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp +++ b/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp @@ -19,11 +19,11 @@ #include "AirQualitySensorAppAttrUpdateDelegate.h" #include -#include #include #include #include #include +#include #include #include diff --git a/examples/air-quality-sensor-app/linux/README.md b/examples/air-quality-sensor-app/linux/README.md index 73139ef4aeeacb..b1c2e92461d8f0 100644 --- a/examples/air-quality-sensor-app/linux/README.md +++ b/examples/air-quality-sensor-app/linux/README.md @@ -136,10 +136,11 @@ $ echo '{"Name":"TemperatureMeasurement","NewValue":1800}' > /tmp/chip_air_quali ### Trigger Humidity change event -Generate event `RelativeHumidityMeasurement`, to change the temperate value. +Generate event `RelativeHumidityMeasurement`, to change the relative humidity +value (6000 for 60,0 %). ``` -$ echo '{"Name":"RelativeHumidityMeasurement","NewValue":60}' > /tmp/chip_air_quality_fifo_ +$ echo '{"Name":"RelativeHumidityMeasurement","NewValue":6000}' > /tmp/chip_air_quality_fifo_ ``` ### Trigger concentration change event @@ -165,3 +166,28 @@ value. ``` $ echo '{"Name":"NitrogenDioxideConcentrationMeasurement","NewValue":1}' > /tmp/chip_air_quality_fifo_ ``` + +Generate event `Pm1ConcentrationMeasurement`, to change the PM1 value. + +``` +echo '{"Name":"Pm1ConcentrationMeasurement","NewValue":1}' > /tmp/chip_air_quality_fifo_ +``` + +Generate event `Pm25ConcentrationMeasurement`, to change the PM2.5 value. + +``` +echo '{"Name":"Pm25ConcentrationMeasurement","NewValue":2.5}' > /tmp/chip_air_quality_fifo_ +``` + +Generate event `Pm10ConcentrationMeasurement`, to change the PM10 value. + +``` +echo '{"Name":"Pm10ConcentrationMeasurement","NewValue":10}' > /tmp/chip_air_quality_fifo_ +``` + +Generate event `TotalVolatileOrganicCompoundsConcentrationMeasurement`, to +change the TVOC value. + +``` +$ echo '{"Name":"TotalVolatileOrganicCompoundsConcentrationMeasurement","NewValue":100}' > /tmp/chip_air_quality_fifo_ +``` diff --git a/examples/all-clusters-app/all-clusters-common/BUILD.gn b/examples/all-clusters-app/all-clusters-common/BUILD.gn index 0210fcedb2c646..1b29a9c2775353 100644 --- a/examples/all-clusters-app/all-clusters-common/BUILD.gn +++ b/examples/all-clusters-app/all-clusters-common/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("all-clusters-common") { zap_file = "all-clusters-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/all-clusters-app/zap-generated" is_server = true } 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 62dc0d7d84c3fa..2c54d75c7e6b06 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 @@ -1814,7 +1814,7 @@ cluster SoftwareDiagnostics = 52 { /** The Thread Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems */ cluster ThreadNetworkDiagnostics = 53 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum ConnectionStatusEnum : enum8 { kConnected = 0; @@ -4455,6 +4455,40 @@ provisional cluster EnergyEvse = 153 { timed command ClearTargets(): DefaultSuccess = 7; } +/** This cluster provides an interface to specify preferences for how devices should consume energy. */ +provisional cluster EnergyPreference = 155 { + revision 1; + + enum EnergyPriorityEnum : enum8 { + kComfort = 0; + kSpeed = 1; + kEfficiency = 2; + kWaterConsumption = 3; + } + + bitmap Feature : bitmap32 { + kEnergyBalance = 0x1; + kLowPowerModeSensitivity = 0x2; + } + + struct BalanceStruct { + percent step = 0; + optional char_string<64> label = 1; + } + + readonly attribute optional BalanceStruct energyBalances[] = 0; + attribute optional int8u currentEnergyBalance = 1; + readonly attribute optional EnergyPriorityEnum energyPriorities[] = 2; + readonly attribute optional BalanceStruct lowPowerModeSensitivities[] = 3; + attribute optional int8u currentLowPowerModeSensitivity = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** The Power Topology Cluster provides a mechanism for expressing how power is flowing between endpoints. */ provisional cluster PowerTopology = 156 { revision 1; @@ -5835,7 +5869,7 @@ cluster RelativeHumidityMeasurement = 1029 { /** Attributes and commands for configuring occupancy sensing, and reporting occupancy status. */ cluster OccupancySensing = 1030 { - revision 3; + revision 4; enum OccupancySensorTypeEnum : enum8 { kPIR = 0; @@ -7504,7 +7538,7 @@ endpoint 0 { callback attribute operationalDatasetComponents; callback attribute activeNetworkFaultsList; ram attribute featureMap default = 0x000F; - ram attribute clusterRevision default = 1; + ram attribute clusterRevision default = 2; handle command ResetCounts; } @@ -7727,7 +7761,7 @@ endpoint 1 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0001; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command Off; handle command On; @@ -8361,6 +8395,20 @@ endpoint 1 { handle command ClearTargets; } + server cluster EnergyPreference { + callback attribute energyBalances; + ram attribute currentEnergyBalance; + callback attribute energyPriorities; + callback attribute lowPowerModeSensitivities; + ram attribute currentLowPowerModeSensitivity; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 3; + ram attribute clusterRevision default = 1; + } + server cluster PowerTopology { callback attribute availableEndpoints; callback attribute activeEndpoints; @@ -8692,7 +8740,7 @@ endpoint 1 { ram attribute occupancySensorType; ram attribute occupancySensorTypeBitmap; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 3; + ram attribute clusterRevision default = 4; } server cluster CarbonMonoxideConcentrationMeasurement { @@ -9086,7 +9134,7 @@ endpoint 2 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0001; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command Off; handle command On; @@ -9159,7 +9207,7 @@ endpoint 2 { ram attribute occupancySensorType; ram attribute occupancySensorTypeBitmap; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 3; + ram attribute clusterRevision default = 4; } } endpoint 65534 { diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 0a2a3faf1b37e8..683f2dd75658ba 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 99, + "featureLevel": 100, "creator": "zap", "keyValuePairs": [ { @@ -17,12 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", @@ -30,6 +24,12 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data with some extensions" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" } ], "endpointTypes": [ @@ -4331,7 +4331,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "2", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6659,7 +6659,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6895,7 +6895,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8312,7 +8312,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -14240,6 +14240,193 @@ } ] }, + { + "name": "Energy Preference", + "code": 155, + "mfgCode": null, + "define": "ENERGY_PREFERENCE_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "EnergyBalances", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentEnergyBalance", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EnergyPriorities", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LowPowerModeSensitivities", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentLowPowerModeSensitivity", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Power Topology", "code": 156, @@ -14247,6 +14434,7 @@ "define": "POWER_TOPOLOGY_CLUSTER", "side": "server", "enabled": 1, + "apiMaturity": "provisional", "attributes": [ { "name": "AvailableEndpoints", @@ -16282,7 +16470,6 @@ "define": "FAN_CONTROL_CLUSTER", "side": "server", "enabled": 1, - "apiMaturity": "provisional", "commands": [ { "name": "Step", @@ -18565,7 +18752,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -23807,7 +23994,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -24578,7 +24765,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -25102,28 +25289,32 @@ "endpointTypeIndex": 0, "profileId": 259, "endpointId": 0, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "MA-onofflight", "endpointTypeIndex": 1, "profileId": 259, "endpointId": 1, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "MA-onofflight", "endpointTypeIndex": 2, "profileId": 259, "endpointId": 2, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 3, "profileId": 259, "endpointId": 65534, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null } ] } \ No newline at end of file diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp new file mode 100644 index 00000000000000..cd9b47dd7979e6 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp @@ -0,0 +1,137 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using namespace chip; +using namespace chip::app::Clusters::EnergyPreference; +using namespace chip::app::Clusters::EnergyPreference::Structs; + +static BalanceStruct::Type gsEnergyBalances[] = { + { .step = 0, .label = Optional("Efficient"_span) }, + { .step = 50, .label = Optional() }, + { .step = 100, .label = Optional("Comfort"_span) }, +}; + +static BalanceStruct::Type gsPowerBalances[] = { + { .step = 0, .label = Optional("1 Minute"_span) }, + { .step = 12, .label = Optional("5 Minutes"_span) }, + { .step = 24, .label = Optional("10 Minutes"_span) }, + { .step = 36, .label = Optional("15 Minutes"_span) }, + { .step = 48, .label = Optional("20 Minutes"_span) }, + { .step = 60, .label = Optional("25 Minutes"_span) }, + { .step = 70, .label = Optional("30 Minutes"_span) }, + { .step = 80, .label = Optional("60 Minutes"_span) }, + { .step = 90, .label = Optional("120 Minutes"_span) }, + { .step = 100, .label = Optional("Never"_span) }, +}; + +// assumes it'll be the only delegate for it's lifetime. +struct EPrefDelegate : public Delegate +{ + EPrefDelegate(); + virtual ~EPrefDelegate(); + + CHIP_ERROR GetEnergyBalanceAtIndex(chip::EndpointId aEndpoint, size_t aIndex, chip::Percent & aOutStep, + chip::Optional & aOutLabel) override; + CHIP_ERROR GetEnergyPriorityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, EnergyPriorityEnum & priority) override; + CHIP_ERROR GetLowPowerModeSensitivityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, chip::Percent & aOutStep, + chip::Optional & aOutLabel) override; + + size_t GetNumEnergyBalances(chip::EndpointId aEndpoint) override; + size_t GetNumLowPowerModeSensitivities(chip::EndpointId aEndpoint) override; +}; + +EPrefDelegate::EPrefDelegate() : Delegate() +{ + VerifyOrDie(GetDelegate() == nullptr); + SetDelegate(this); +} + +EPrefDelegate::~EPrefDelegate() +{ + VerifyOrDie(GetDelegate() == this); + SetDelegate(nullptr); +} + +size_t EPrefDelegate::GetNumEnergyBalances(chip::EndpointId aEndpoint) +{ + return (ArraySize(gsEnergyBalances)); +} + +size_t EPrefDelegate::GetNumLowPowerModeSensitivities(chip::EndpointId aEndpoint) +{ + return (ArraySize(gsEnergyBalances)); +} + +CHIP_ERROR +EPrefDelegate::GetEnergyBalanceAtIndex(chip::EndpointId aEndpoint, size_t aIndex, chip::Percent & aOutStep, + chip::Optional & aOutLabel) +{ + if (aIndex < GetNumEnergyBalances(aEndpoint)) + { + aOutStep = gsEnergyBalances[aIndex].step; + if (gsEnergyBalances[aIndex].label.HasValue()) + { + chip::CopyCharSpanToMutableCharSpan(gsEnergyBalances[aIndex].label.Value(), aOutLabel.Value()); + } + else + { + aOutLabel.ClearValue(); + } + return CHIP_NO_ERROR; + } + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR +EPrefDelegate::GetEnergyPriorityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, EnergyPriorityEnum & priority) +{ + static EnergyPriorityEnum priorities[] = { EnergyPriorityEnum::kEfficiency, EnergyPriorityEnum::kComfort }; + + if (aIndex < ArraySize(priorities)) + { + priority = priorities[aIndex]; + return CHIP_NO_ERROR; + } + + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR +EPrefDelegate::GetLowPowerModeSensitivityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, chip::Percent & aOutStep, + chip::Optional & aOutLabel) +{ + if (aIndex < GetNumLowPowerModeSensitivities(aEndpoint)) + { + aOutStep = gsPowerBalances[aIndex].step; + if (gsPowerBalances[aIndex].label.HasValue()) + { + chip::CopyCharSpanToMutableCharSpan(gsPowerBalances[aIndex].label.Value(), aOutLabel.Value()); + } + else + { + aOutLabel.ClearValue(); + } + return CHIP_NO_ERROR; + } + + return CHIP_ERROR_NOT_FOUND; +} + +static EPrefDelegate gsDelegate; diff --git a/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp b/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp index 2070e1b86754fe..d258b8261a1aed 100644 --- a/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp @@ -55,15 +55,6 @@ CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_ void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperationalError & err) { - OperationalState::OperationalStateEnum state = - static_cast(GetInstance()->GetCurrentOperationalState()); - - if (state == OperationalState::OperationalStateEnum::kStopped || state == OperationalState::OperationalStateEnum::kError) - { - err.Set(to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState)); - return; - } - // placeholder implementation auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)); if (error == CHIP_NO_ERROR) @@ -78,15 +69,6 @@ void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperat void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOperationalError & err) { - OperationalState::OperationalStateEnum state = - static_cast(GetInstance()->GetCurrentOperationalState()); - - if (state == OperationalState::OperationalStateEnum::kStopped || state == OperationalState::OperationalStateEnum::kError) - { - err.Set(to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState)); - return; - } - // placeholder implementation auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index 0d8b99c117716e..2afdd4e8d70942 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -153,13 +153,17 @@ endif (matter_enable_ota_requestor) list( APPEND ${list_chip_main_sources} + ${chip_dir}/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp @@ -168,6 +172,10 @@ list( ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/rvc-operational-state-delegate-impl.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/microwave-oven-mode.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp + ${chip_dir}/examples/all-clusters-app/ameba/main/chipinterface.cpp ${chip_dir}/examples/all-clusters-app/ameba/main/BindingHandler.cpp ${chip_dir}/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp @@ -177,6 +185,8 @@ list( ${chip_dir}/examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp ${chip_dir}/examples/all-clusters-app/ameba/main/SmokeCOAlarmManager.cpp + ${chip_dir}/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp ${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp ${chip_dir}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp @@ -227,6 +237,8 @@ target_include_directories( ${chip_dir}/zzz_generated/app-common ${chip_dir}/examples/all-clusters-app/all-clusters-common ${chip_dir}/examples/all-clusters-app/all-clusters-common/include + ${chip_dir}/examples/microwave-oven-app/microwave-oven-common + ${chip_dir}/examples/microwave-oven-app/microwave-oven-common/include ${chip_dir}/examples/energy-management-app/energy-management-common/include ${chip_dir}/examples/all-clusters-app/ameba/main/include ${chip_dir}/examples/platform/ameba diff --git a/examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp b/examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp index feb346b892f6bb..d03dbcd42ae0bd 100644 --- a/examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp +++ b/examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp @@ -79,6 +79,7 @@ static void RegisterManualOperationCommands() { &ManualRVCCommandHandler, "rvc", " Usage: manual rvc " }, { &ManualRefrigeratorAlarmCommandHandler, "refalm", " Usage: manual refalm " }, { &ManualDishWasherAlarmCommandHandler, "dishalm", " Usage: manual dishalm " }, + { &ManualOvenCavityOperationalStateCommandHandler, "oven-opstate", " Usage: manual dishalm " }, }; static const shell_command_t sManualOperationalStateSubCommands[] = { @@ -123,6 +124,14 @@ static void RegisterManualOperationCommands() { &ManualDishWasherAlarmSetLowerCommandHandler, "lower", "lower Usage: manual dishalm lower" }, }; + static const shell_command_t sManualOvenCavityOperationalStateSubCommands[] = { + { &ManualOvenCavityOperationalStateCommandHelpHandler, "help", "Usage: manual oven-opstate " }, + { &ManualOvenCavityOperationalStateSetStateCommandHandler, "set-state", + "set-state Usage: manual oven-opstate set-state " }, + { &ManualOvenCavityOperationalStateSetErrorCommandHandler, "set-error", + "set-error Usage: manual oven-opstate set-error " }, + }; + static const shell_command_t sManualOperationCommand = { &ManualOperationCommandHandler, "manual", "Manual Operation commands. Usage: manual " }; @@ -139,6 +148,8 @@ static void RegisterManualOperationCommands() ArraySize(sManualRefrigeratorAlarmStateSubCommands)); sShellManualDishWasherAlarmStateSubCommands.RegisterCommands(sManualDishWasherAlarmSubCommands, ArraySize(sManualDishWasherAlarmSubCommands)); + sShellManualOvenCavityOperationalStateSubCommands.RegisterCommands(sManualOvenCavityOperationalStateSubCommands, + ArraySize(sManualOvenCavityOperationalStateSubCommands)); Engine::Root().RegisterCommands(&sManualOperationCommand, 1); } diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index 20de9cd1ff0124..c9547136035f81 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "BindingHandler.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" @@ -28,13 +29,16 @@ #include #include +#include #include #include #include #include #include +#include #include #include +#include #include #include #include @@ -43,6 +47,7 @@ #include #include #if CONFIG_ENABLE_AMEBA_TEST_EVENT_TRIGGER +#include #include #endif @@ -140,11 +145,11 @@ static void InitServer(intptr_t context) static chip::CommonCaseDeviceServerInitParams initParams; #if CONFIG_ENABLE_AMEBA_TEST_EVENT_TRIGGER - // TODO(#31723): Show to customers that they can do `Server::GetInstance().GetTestEventTriggerDelegate().AddHandler(xxx)` - // to add custom handlers during their app init, after InitServer. static AmebaTestEventTriggerDelegate sTestEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; #endif + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; initParams.InitializeStaticResourcesBeforeServerInit(); @@ -166,6 +171,12 @@ static void InitServer(intptr_t context) InitManualOperation(); #endif app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + MatterMicrowaveOvenServerInit(); +#if CONFIG_ENABLE_AMEBA_TEST_EVENT_TRIGGER + static SmokeCOTestEventTriggerHandler sSmokeCOTestEventTriggerHandler; + Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&sSmokeCOTestEventTriggerHandler); +#endif + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); } extern "C" void ChipTest(void) @@ -213,3 +224,9 @@ void emberAfLaundryWasherControlsClusterInitCallback(EndpointId endpoint) { LaundryWasherControlsServer::SetDefaultDelegate(endpoint, &LaundryWasherControlDelegate::getLaundryWasherControlDelegate()); } + +using namespace chip::app::Clusters::LaundryDryerControls; +void emberAfLaundryDryerControlsClusterInitCallback(EndpointId endpoint) +{ + LaundryDryerControlsServer::SetDefaultDelegate(endpoint, &LaundryDryerControlDelegate::getLaundryDryerControlDelegate()); +} diff --git a/examples/all-clusters-app/ameba/main/include/AmebaObserver.h b/examples/all-clusters-app/ameba/main/include/AmebaObserver.h new file mode 100644 index 00000000000000..a19c9c99954def --- /dev/null +++ b/examples/all-clusters-app/ameba/main/include/AmebaObserver.h @@ -0,0 +1,47 @@ +/* + * + * 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 +#include +#include + +namespace chip { + +class AmebaObserver : public AppDelegate, public FabricTable::Delegate +{ +public: + // Commissioning Observer + void OnCommissioningSessionEstablishmentError(CHIP_ERROR err) override + { + ChipLogProgress(DeviceLayer, "Ameba Observer: Commissioning error (0x%x)", err); + // Handle commissioning errror here + } + // Fabric Observer + void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override + { + ChipLogProgress(DeviceLayer, "Ameba Observer: Fabric 0x%x has been Removed", fabricIndex); + if (chip::Server::GetInstance().GetFabricTable().FabricCount() == 0) + { + // Customer code + } + } +}; + +} // namespace chip diff --git a/examples/all-clusters-app/ameba/main/include/ManualOperationalStateCommand.h b/examples/all-clusters-app/ameba/main/include/ManualOperationalStateCommand.h index fc2825576e6b72..31e186ae77d2a8 100644 --- a/examples/all-clusters-app/ameba/main/include/ManualOperationalStateCommand.h +++ b/examples/all-clusters-app/ameba/main/include/ManualOperationalStateCommand.h @@ -19,6 +19,7 @@ #include "controller/InvokeInteraction.h" #include "controller/ReadInteraction.h" #include "operational-state-delegate-impl.h" +#include "oven-operational-state-delegate.h" #include "rvc-operational-state-delegate-impl.h" #if CONFIG_ENABLE_CHIP_SHELL @@ -39,6 +40,7 @@ using Shell::streamer_printf; Engine sShellManualOperationalStateSubCommands; Engine sShellManualRVCOperationalStateSubCommands; +Engine sShellManualOvenCavityOperationalStateSubCommands; #endif // defined(ENABLE_CHIP_SHELL) #if CONFIG_ENABLE_CHIP_SHELL @@ -183,4 +185,71 @@ CHIP_ERROR ManualRVCOperationalStateSetErrorCommandHandler(int argc, char ** arg return CHIP_NO_ERROR; } + +/******************************************************** + * Oven Cavity Operational State Functions + *********************************************************/ + +CHIP_ERROR ManualOvenCavityOperationalStateCommandHelpHandler(int argc, char ** argv) +{ + sShellManualOvenCavityOperationalStateSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ManualOvenCavityOperationalStateCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return ManualOvenCavityOperationalStateCommandHelpHandler(argc, argv); + } + + return sShellManualOvenCavityOperationalStateSubCommands.ExecCommand(argc, argv); +} + +CHIP_ERROR ManualOvenCavityOperationalStateSetStateCommandHandler(int argc, char ** argv) +{ + if (argc != 1) + { + return ManualOvenCavityOperationalStateCommandHelpHandler(argc, argv); + } + uint32_t state = atoi(argv[0]); + + CHIP_ERROR err; + err = OvenCavityOperationalState::GetOperationalStateInstance()->SetOperationalState(state); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "ManualOvenCavityOperationalStateSetStateCommandHandler Failed!\r\n"); + } + + return err; +} + +CHIP_ERROR ManualOvenCavityOperationalStateSetErrorCommandHandler(int argc, char ** argv) +{ + if (argc != 1) + { + return ManualOvenCavityOperationalStateCommandHelpHandler(argc, argv); + } + + GenericOperationalError err(to_underlying(ErrorStateEnum::kNoError)); + uint32_t error = atoi(argv[0]); + + switch (error) + { + case to_underlying(OvenCavityOperationalState::ErrorStateEnum::kNoError): // 0x00, 0 + case to_underlying(OvenCavityOperationalState::ErrorStateEnum::kUnableToStartOrResume): // 0x01, 1 + case to_underlying(OvenCavityOperationalState::ErrorStateEnum::kUnableToCompleteOperation): // 0x02, 2 + case to_underlying(OvenCavityOperationalState::ErrorStateEnum::kCommandInvalidInState): // 0x03, 3 + err.errorStateID = error; + break; + default: + err.errorStateID = to_underlying(OvenCavityOperationalState::ErrorStateEnum::kUnknownEnumValue); // 0x04, 4 + break; + } + + OvenCavityOperationalState::GetOperationalStateInstance()->OnOperationalErrorDetected(err); + + return CHIP_NO_ERROR; +} #endif // CONFIG_ENABLE_CHIP_SHELL diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index d7817027369adf..60ee180c1337fd 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -14,6 +14,7 @@ guides to get started. - [Cluster control](#cluster-control) - [Matter OTA guide](../../../docs/guides/esp32/ota.md) - [RPC console and Device Tracing](../../../docs/guides/esp32/rpc_console.md) +- [Multiple Network Interfaces](#multiple-network-interfaces) --- @@ -37,6 +38,24 @@ Usage: $ ./out/debug/chip-tool levelcontrol move-to-level Level=10 TransitionTime=0 OptionMask=0 OptionOverride=0 ``` +### Multiple Network Interfaces + +The data model of this example includes a secondary NetworkCommissioning +Endpoint with another NetworkCommissioning cluster. The Endpoint Id for the +secondary NetworkCommissioning Endpoint is 65534. The secondary +NetworkCommissioning Endpoint can be used to manage the driver of extra network +interface. + +For ESP32-C6 DevKits, if `CHIP_DEVICE_CONFIG_ENABLE_WIFI` and +`CHIP_DEVICE_CONFIG_ENABLE_THREAD` are both enabled, the NetworkCommissioning +cluster in Endpoint 0 will be used for Thread network driver and the same +cluster on Endpoint 65534 will be used for Wi-Fi network driver. + +For ESP32-Ethernet-Kits, if `CHIP_DEVICE_CONFIG_ENABLE_WIFI` and +`CHIP_DEVICE_CONFIG_ENABLE_ETHERNET` are both enabled, the NetworkCommissioning +cluster in Endpoint 0 will be used for Ethernet network driver and the same +cluster on Endpoint 65534 will be used for Wi-Fi network driver. + --- This demo app illustrates controlling OnOff cluster (Server) attributes of an diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 238f0e899c340d..63851b1deeb611 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -96,8 +96,11 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/valve-configuration-and-control-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-dryer-controls-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-preference-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-energy-measurement-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-power-measurement-server" ) diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 4893cf1b8f1475..a3af54f3a22e06 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -114,7 +114,7 @@ static void InitServer(intptr_t context) { Esp32AppServer::Init(&sCallbacks); // Init ZCL Data Model and CHIP App Server AND Initialize device attestation config -#if !(CHIP_DEVICE_CONFIG_ENABLE_WIFI && CHIP_DEVICE_CONFIG_ENABLE_THREAD) +#if !(CHIP_DEVICE_CONFIG_ENABLE_WIFI && (CHIP_DEVICE_CONFIG_ENABLE_THREAD || CHIP_DEVICE_CONFIG_ENABLE_ETHERNET)) // We only have network commissioning on endpoint 0. emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); #endif diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp index b2fe3a90b59f3f..d1bab3649f0b67 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp @@ -19,12 +19,12 @@ #include "AllClustersCommandDelegate.h" #include -#include #include #include #include #include #include +#include #include #include diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 998f98a19cd3de..3d52ef748de90d 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -40,6 +40,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/electrical-energy-measurement-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp", diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index 775f4a1c0f324c..8760bcb92d456c 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index f8d117790fac3d..efdee7153b493c 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -45,6 +45,13 @@ #include "OTAUtil.h" #endif +#ifdef CONFIG_CHIP_CRYPTO_PSA +#include +#ifdef CONFIG_CHIP_MIGRATE_OPERATIONAL_KEYS_TO_ITS +#include "MigrationManager.h" +#endif +#endif + #include #include #include @@ -88,6 +95,9 @@ bool sHaveBLEConnections = false; app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +#ifdef CONFIG_CHIP_CRYPTO_PSA +chip::Crypto::PSAOperationalKeystore sPSAOperationalKeystore{}; +#endif } // namespace namespace LedConsts { @@ -209,11 +219,24 @@ CHIP_ERROR AppTask::Init() static OTATestEventTriggerHandler sOtaTestEventTriggerHandler{}; VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR); VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sOtaTestEventTriggerHandler) == CHIP_NO_ERROR); +#ifdef CONFIG_CHIP_CRYPTO_PSA + initParams.operationalKeystore = &sPSAOperationalKeystore; +#endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); +#ifdef CONFIG_CHIP_MIGRATE_OPERATIONAL_KEYS_TO_ITS + err = MoveOperationalKeysFromKvsToIts(sLocalInitData.mServerInitParams->persistentStorageDelegate, + sLocalInitData.mServerInitParams->operationalKeystore); + if (err != CHIP_NO_ERROR) + { + LOG_ERR("MoveOperationalKeysFromKvsToIts() failed"); + return err; + } +#endif + gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); diff --git a/examples/all-clusters-app/nxp/common/main/AppTask.cpp b/examples/all-clusters-app/nxp/common/main/AppTask.cpp index 9dc60db217cf9a..7f4c1f257d0405 100644 --- a/examples/all-clusters-app/nxp/common/main/AppTask.cpp +++ b/examples/all-clusters-app/nxp/common/main/AppTask.cpp @@ -2,7 +2,7 @@ * * Copyright (c) 2021-2023 Project CHIP Authors * Copyright (c) 2021 Google LLC. - * Copyright 2023 NXP + * Copyright 2023-2024 NXP * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,463 +17,41 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "AppTask.h" -#include "AppEvent.h" #include "CHIPDeviceManager.h" -#include "DeviceCallbacks.h" -#include "binding-handler.h" -#include "lib/core/ErrorStr.h" -#include -#include -#include - -#if CHIP_DEVICE_CONFIG_ENABLE_WPA -#include -#endif // CHIP_DEVICE_CONFIG_ENABLE_WPA - -#include -#include -#include -#include -#include -#include -#include -#include - +#include "ICDUtil.h" +#include #include -#include "AppFactoryData.h" -#include "AppMatterButton.h" -#include "AppMatterCli.h" - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -#include "OTARequestorInitiator.h" -#endif - -#if ENABLE_OTA_PROVIDER -#include -#endif - -#if CHIP_ENABLE_OPENTHREAD -#include -#endif - -#if TCP_DOWNLOAD -#include "TcpDownload.h" -#endif - -#ifndef APP_TASK_STACK_SIZE -#define APP_TASK_STACK_SIZE ((configSTACK_DEPTH_TYPE) 6144 / sizeof(portSTACK_TYPE)) -#endif -#ifndef APP_TASK_PRIORITY -#define APP_TASK_PRIORITY 2 -#endif -#define APP_EVENT_QUEUE_SIZE 10 - -static QueueHandle_t sAppEventQueue; - using namespace chip; -using namespace chip::TLV; -using namespace ::chip::Credentials; -using namespace ::chip::DeviceLayer; -using namespace ::chip::DeviceManager; -using namespace ::chip::app::Clusters; - -chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; - -#if CHIP_DEVICE_CONFIG_ENABLE_WPA -namespace { -chip::app::Clusters::NetworkCommissioning::Instance - sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, - &(::chip::DeviceLayer::NetworkCommissioning::NXPWiFiDriver::GetInstance())); -} // namespace - -void NetWorkCommissioningInstInit() -{ - sWiFiNetworkCommissioningInstance.Init(); -} -#endif // CHIP_DEVICE_CONFIG_ENABLE_WPA - -AppTask AppTask::sAppTask; - -CHIP_ERROR AppTask::StartAppTask() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - TaskHandle_t taskHandle; - - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); - if (sAppEventQueue == NULL) - { - err = CHIP_ERROR_NO_MEMORY; - ChipLogError(DeviceLayer, "Failed to allocate app event queue"); - assert(err == CHIP_NO_ERROR); - } - - if (xTaskCreate(&AppTask::AppTaskMain, "AppTaskMain", APP_TASK_STACK_SIZE, &sAppTask, APP_TASK_PRIORITY, &taskHandle) != pdPASS) - { - err = CHIP_ERROR_NO_MEMORY; - ChipLogError(DeviceLayer, "Failed to start app task"); - assert(err == CHIP_NO_ERROR); - } - - return err; -} +using namespace chip::app::Clusters; -#if CHIP_ENABLE_OPENTHREAD -void LockOpenThreadTask(void) +void AllClustersApp::AppTask::PreInitMatterStack() { - chip::DeviceLayer::ThreadStackMgr().LockThreadStack(); + ChipLogProgress(DeviceLayer, "Welcome to NXP All Clusters Demo App"); } -void UnlockOpenThreadTask(void) +void AllClustersApp::AppTask::PostInitMatterStack() { - chip::DeviceLayer::ThreadStackMgr().UnlockThreadStack(); + chip::app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&chip::NXP::App::GetICDUtil()); } -#endif -void AppTask::InitServer(intptr_t arg) +void AllClustersApp::AppTask::PostInitMatterServerInstance() { - static chip::CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); - -#if CHIP_ENABLE_OPENTHREAD - // Init ZCL Data Model and start server - chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams; - nativeParams.lockCb = LockOpenThreadTask; - nativeParams.unlockCb = UnlockOpenThreadTask; - nativeParams.openThreadInstancePtr = chip::DeviceLayer::ThreadStackMgrImpl().OTInstance(); - initParams.endpointNativeParams = static_cast(&nativeParams); -#endif - VerifyOrDie((chip::Server::GetInstance().Init(initParams)) == CHIP_NO_ERROR); - - gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); - chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); - -#ifdef DEVICE_TYPE_ALL_CLUSTERS // Disable last fixed endpoint, which is used as a placeholder for all of the // supported clusters so that ZAP will generated the requisite code. emberAfEndpointEnableDisable(emberAfEndpointFromIndex(static_cast(emberAfFixedEndpointCount() - 1)), false); -#endif /* DEVICE_TYPE_ALL_CLUSTERS */ - -#if ENABLE_OTA_PROVIDER - InitOTAServer(); -#endif -} - -CHIP_ERROR AppTask::Init() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - /* Init Chip memory management before the stack */ - chip::Platform::MemoryInit(); - - /* Initialize Matter factory data before initializing the Matter stack */ - err = AppFactoryData_PreMatterStackInit(); - - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Pre Factory Data Provider init failed"); - goto exit; - } - - /* - * Initialize the CHIP stack. - * Would also initialize all required platform modules - */ - err = PlatformMgr().InitChipStack(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "PlatformMgr().InitChipStack() failed: %s", ErrorStr(err)); - goto exit; - } - - /* Initialize Matter factory data after initializing the Matter stack */ - err = AppFactoryData_PostMatterStackInit(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Post Factory Data Provider init failed"); - goto exit; - } - - /* - * Register all application callbacks allowing to be informed of stack events - */ - err = CHIPDeviceManager::GetInstance().Init(&deviceCallbacks); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "CHIPDeviceManager.Init() failed: %s", ErrorStr(err)); - goto exit; - } - -#if CHIP_DEVICE_CONFIG_ENABLE_WPA - ConnectivityMgrImpl().StartWiFiManagement(); -#endif - -#if CHIP_ENABLE_OPENTHREAD - err = ThreadStackMgr().InitThreadStack(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Error during ThreadStackMgr().InitThreadStack()"); - goto exit; - } - - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); - if (err != CHIP_NO_ERROR) - { - goto exit; - } -#endif - - /* - * Schedule an event to the Matter stack to initialize - * the ZCL Data Model and start server - */ - PlatformMgr().ScheduleWork(InitServer, 0); - - /* Init binding handlers */ - err = InitBindingHandlers(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "InitBindingHandlers failed: %s", ErrorStr(err)); - goto exit; - } - -#if CHIP_DEVICE_CONFIG_ENABLE_WPA - NetWorkCommissioningInstInit(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_WPA - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - /* If an update is under test make it permanent */ - OTARequestorInitiator::Instance().HandleSelfTest(); -#endif - - /* Register Matter CLI cmds */ - err = AppMatterCli_RegisterCommands(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Error during AppMatterCli_RegisterCommands"); - goto exit; - } - /* Register Matter buttons */ - err = AppMatterButton_registerButtons(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Error during AppMatterButton_registerButtons"); - goto exit; - } - - err = DisplayDeviceInformation(); - if (err != CHIP_NO_ERROR) - goto exit; - - /* Start a task to run the CHIP Device event loop. */ - err = PlatformMgr().StartEventLoopTask(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Error during PlatformMgr().StartEventLoopTask()"); - goto exit; - } - -#if CHIP_ENABLE_OPENTHREAD - // Start OpenThread task - err = ThreadStackMgrImpl().StartThreadTask(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Error during ThreadStackMgrImpl().StartThreadTask()"); - goto exit; - } -#endif - -#if TCP_DOWNLOAD - EnableTcpDownloadComponent(); -#endif - -exit: - return err; -} - -void AppTask::AppTaskMain(void * pvParameter) -{ - AppTask * task = (AppTask *) pvParameter; - CHIP_ERROR err; - AppEvent event; - - ChipLogProgress(DeviceLayer, "Welcome to NXP All Clusters Demo App"); - - err = task->Init(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "AppTask.Init() failed"); - assert(err == CHIP_NO_ERROR); - } - - while (true) - { - BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY); - while (eventReceived == pdTRUE) - { - sAppTask.DispatchEvent(&event); - eventReceived = xQueueReceive(sAppEventQueue, &event, 0); - } - } -} - -CHIP_ERROR AppTask::DisplayDeviceInformation(void) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t discriminator; - uint32_t setupPasscode; - uint16_t vendorId; - uint16_t productId; - char currentSoftwareVer[ConfigurationManager::kMaxSoftwareVersionStringLength + 1]; - - err = GetCommissionableDataProvider()->GetSetupDiscriminator(discriminator); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Couldn't get discriminator: %s", ErrorStr(err)); - goto exit; - } - ChipLogProgress(DeviceLayer, "Setup discriminator: %u (0x%x)", discriminator, discriminator); - - err = GetCommissionableDataProvider()->GetSetupPasscode(setupPasscode); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Couldn't get setupPasscode: %s", ErrorStr(err)); - goto exit; - } - ChipLogProgress(DeviceLayer, "Setup passcode: %lu (0x%lx)", setupPasscode, setupPasscode); - - err = GetDeviceInstanceInfoProvider()->GetVendorId(vendorId); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Couldn't get vendorId: %s", ErrorStr(err)); - goto exit; - } - ChipLogProgress(DeviceLayer, "Vendor ID: %u (0x%x)", vendorId, vendorId); - - err = GetDeviceInstanceInfoProvider()->GetProductId(productId); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Couldn't get productId: %s", ErrorStr(err)); - goto exit; - } - ChipLogProgress(DeviceLayer, "nProduct ID: %u (0x%x)", productId, productId); - - // QR code will be used with CHIP Tool -#if CONFIG_NETWORK_LAYER_BLE - PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE)); -#else - PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kOnNetwork)); -#endif /* CONFIG_NETWORK_LAYER_BLE */ - - err = ConfigurationMgr().GetSoftwareVersionString(currentSoftwareVer, sizeof(currentSoftwareVer)); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Get current software version error"); - goto exit; - } - - ChipLogProgress(DeviceLayer, "Current Software Version: %s", currentSoftwareVer); - -exit: - return err; -} - -void AppTask::PostEvent(const AppEvent * aEvent) -{ - if (sAppEventQueue != NULL) - { - if (!xQueueSend(sAppEventQueue, aEvent, 0)) - { - ChipLogError(DeviceLayer, "Failed to post event to app task event queue"); - } - } -} - -void AppTask::DispatchEvent(AppEvent * aEvent) -{ - if (aEvent->Handler) - { - aEvent->Handler(aEvent); - } - else - { - ChipLogProgress(DeviceLayer, "Event received with no handler. Dropping event."); - } -} - -void AppTask::StartCommissioning(intptr_t arg) -{ - /* Check the status of the commissioning */ - if (ConfigurationMgr().IsFullyProvisioned()) - { - ChipLogProgress(DeviceLayer, "Device already commissioned"); - } - else if (chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen()) - { - ChipLogProgress(DeviceLayer, "Commissioning window already opened"); - } - else - { - chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow(); - } -} - -void AppTask::StopCommissioning(intptr_t arg) -{ - /* Check the status of the commissioning */ - if (ConfigurationMgr().IsFullyProvisioned()) - { - ChipLogProgress(DeviceLayer, "Device already commissioned"); - } - else if (!chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen()) - { - ChipLogProgress(DeviceLayer, "Commissioning window not opened"); - } - else - { - chip::Server::GetInstance().GetCommissioningWindowManager().CloseCommissioningWindow(); - } -} - -void AppTask::SwitchCommissioningState(intptr_t arg) -{ - /* Check the status of the commissioning */ - if (ConfigurationMgr().IsFullyProvisioned()) - { - ChipLogProgress(DeviceLayer, "Device already commissioned"); - } - else if (!chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen()) - { - chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow(); - } - else - { - chip::Server::GetInstance().GetCommissioningWindowManager().CloseCommissioningWindow(); - } -} - -void AppTask::StartCommissioningHandler(void) -{ - /* Publish an event to the Matter task to always set the commissioning state in the Matter task context */ - PlatformMgr().ScheduleWork(StartCommissioning, 0); -} - -void AppTask::StopCommissioningHandler(void) -{ - /* Publish an event to the Matter task to always set the commissioning state in the Matter task context */ - PlatformMgr().ScheduleWork(StopCommissioning, 0); } -void AppTask::SwitchCommissioningStateHandler(void) +// This returns an instance of this class. +AllClustersApp::AppTask & AllClustersApp::AppTask::GetDefaultInstance() { - /* Publish an event to the Matter task to always set the commissioning state in the Matter task context */ - PlatformMgr().ScheduleWork(SwitchCommissioningState, 0); + static AllClustersApp::AppTask sAppTask; + return sAppTask; } -void AppTask::FactoryResetHandler(void) +chip::NXP::App::AppTaskBase & chip::NXP::App::GetAppTask() { - /* Emit the ShutDown event before factory reset */ - chip::Server::GetInstance().GenerateShutDownEvent(); - chip::Server::GetInstance().ScheduleFactoryReset(); + return AllClustersApp::AppTask::GetDefaultInstance(); } diff --git a/examples/all-clusters-app/nxp/common/main/DeviceCallbacks.cpp b/examples/all-clusters-app/nxp/common/main/DeviceCallbacks.cpp index 419ad3b3003b2e..527fa79702f6fb 100644 --- a/examples/all-clusters-app/nxp/common/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/nxp/common/main/DeviceCallbacks.cpp @@ -24,154 +24,96 @@ **/ #include "DeviceCallbacks.h" +#include +#include #include +#include #include #include #include -#if CHIP_ENABLE_OPENTHREAD && CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED -#include "openthread-system.h" -#include "ot_platform_common.h" -#endif /* CHIP_ENABLE_OPENTHREAD && CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED */ -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -#include "OTARequestorInitiator.h" -#endif +using namespace chip::app; +void OnTriggerEffect(::Identify * identify) +{ + switch (identify->mCurrentEffectIdentifier) + { + case Clusters::Identify::EffectIdentifierEnum::kBlink: + ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kBlink"); + break; + case Clusters::Identify::EffectIdentifierEnum::kBreathe: + ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kBreathe"); + break; + case Clusters::Identify::EffectIdentifierEnum::kOkay: + ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kOkay"); + break; + case Clusters::Identify::EffectIdentifierEnum::kChannelChange: + ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kChannelChange"); + break; + default: + ChipLogProgress(Zcl, "No identifier effect"); + return; + } +} Identify gIdentify0 = { chip::EndpointId{ 1 }, [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStart"); }, [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStop"); }, - chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, - [](Identify *) { ChipLogProgress(Zcl, "onIdentifyTriggerEffect"); }, + chip::app::Clusters::Identify::IdentifyTypeEnum::kNone, + OnTriggerEffect, }; Identify gIdentify1 = { chip::EndpointId{ 1 }, [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStart"); }, [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStop"); }, - chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, - [](Identify *) { ChipLogProgress(Zcl, "onIdentifyTriggerEffect"); }, + chip::app::Clusters::Identify::IdentifyTypeEnum::kNone, + OnTriggerEffect, }; using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::System; using namespace ::chip::DeviceLayer; +using namespace chip::app::Clusters; -void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) -{ - ChipLogDetail(DeviceLayer, "DeviceEventCallback: 0x%04x", event->Type); - switch (event->Type) - { - case DeviceEventType::kWiFiConnectivityChange: - OnWiFiConnectivityChange(event); - break; - - case DeviceEventType::kInternetConnectivityChange: - OnInternetConnectivityChange(event); - break; - - case DeviceEventType::kInterfaceIpAddressChanged: - OnInterfaceIpAddressChanged(event); - break; - -#if CHIP_ENABLE_OPENTHREAD && CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - case DeviceEventType::kCommissioningComplete: - DeviceCallbacks::OnComissioningComplete(event); - break; -#endif - case DeviceLayer::DeviceEventType::kDnssdInitialized: - ChipLogProgress(DeviceLayer, "kDnssdInitialized"); -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - /* Initialize OTA Requestor */ - OTARequestorInitiator::Instance().InitOTA(reinterpret_cast(&OTARequestorInitiator::Instance())); -#endif - break; - } -} - -void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t type, - uint16_t size, uint8_t * value) +void AllClustersApp::DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, + AttributeId attributeId, uint8_t type, uint16_t size, + uint8_t * value) { ChipLogProgress(DeviceLayer, "endpointId " ChipLogFormatMEI " clusterId " ChipLogFormatMEI " attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", ChipLogValueMEI(endpointId), ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId), type, *value, size); -} - -void DeviceCallbacks::OnWiFiConnectivityChange(const ChipDeviceEvent * event) -{ - if (event->WiFiConnectivityChange.Result == kConnectivity_Established) - { - ChipLogProgress(DeviceLayer, "WiFi connection established"); - } - else if (event->WiFiConnectivityChange.Result == kConnectivity_Lost) + switch (clusterId) { - ChipLogProgress(DeviceLayer, "WiFi connection lost"); + case Clusters::OnOff::Id: + OnOnOffPostAttributeChangeCallback(endpointId, attributeId, value); + break; } } -void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event) +void AllClustersApp::DeviceCallbacks::OnOnOffPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, + uint8_t * value) { - if (event->InternetConnectivityChange.IPv4 == kConnectivity_Established) - { - char ip_addr[Inet::IPAddress::kMaxStringLength]; - event->InternetConnectivityChange.ipAddress.ToString(ip_addr); - ChipLogProgress(DeviceLayer, "Server ready at: %s:%d", ip_addr, CHIP_PORT); - } - else if (event->InternetConnectivityChange.IPv4 == kConnectivity_Lost) - { - ChipLogProgress(DeviceLayer, "Lost IPv4 connectivity..."); - } - if (event->InternetConnectivityChange.IPv6 == kConnectivity_Established) - { - char ip_addr[Inet::IPAddress::kMaxStringLength]; - event->InternetConnectivityChange.ipAddress.ToString(ip_addr); - ChipLogProgress(DeviceLayer, "IPv6 Server ready at: [%s]:%d", ip_addr, CHIP_PORT); - } - else if (event->InternetConnectivityChange.IPv6 == kConnectivity_Lost) + switch (attributeId) { - ChipLogProgress(DeviceLayer, "Lost IPv6 connectivity..."); + case Clusters::OnOff::Attributes::OnOff::Id: + break; + + default:; } } -void DeviceCallbacks::OnInterfaceIpAddressChanged(const ChipDeviceEvent * event) +// This returns an instance of this class. +AllClustersApp::DeviceCallbacks & AllClustersApp::DeviceCallbacks::GetDefaultInstance() { - switch (event->InterfaceIpAddressChanged.Type) - { - case InterfaceIpChangeType::kIpV4_Assigned: - ChipLogProgress(DeviceLayer, "Interface IPv4 address assigned"); - break; - case InterfaceIpChangeType::kIpV4_Lost: - ChipLogProgress(DeviceLayer, "Interface IPv4 address lost"); - break; - case InterfaceIpChangeType::kIpV6_Assigned: - ChipLogProgress(DeviceLayer, "Interface IPv6 address assigned"); - break; - case InterfaceIpChangeType::kIpV6_Lost: - ChipLogProgress(DeviceLayer, "Interface IPv6 address lost"); - break; - } + static AllClustersApp::DeviceCallbacks sDeviceCallbacks; + return sDeviceCallbacks; } -#if CHIP_ENABLE_OPENTHREAD && CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED -void DeviceCallbacks::OnComissioningComplete(const chip::DeviceLayer::ChipDeviceEvent * event) +chip::DeviceManager::CHIPDeviceManagerCallbacks & chip::NXP::App::GetDeviceCallbacks() { - /* - * If a transceiver supporting a multiprotocol scenario is used, a check of the provisioning state is required, - * so that we can inform the transceiver to stop BLE to give the priority to another protocol. - * For example it is the case when a K32W0 transceiver supporting OT+BLE+Zigbee is used. When the device is already provisioned, - * BLE is no more required and the transceiver needs to be informed so that Zigbee can be switched on and BLE switched off. - * - * If a transceiver does not support such vendor property the cmd would be ignored. - */ - if (ConfigurationMgr().IsFullyProvisioned()) - { - ChipLogDetail(DeviceLayer, "Provisioning complete, stopping BLE\n"); - ThreadStackMgrImpl().LockThreadStack(); - PlatformMgrImpl().StopBLEConnectivity(); - ThreadStackMgrImpl().UnlockThreadStack(); - } + return AllClustersApp::DeviceCallbacks::GetDefaultInstance(); } -#endif diff --git a/examples/all-clusters-app/nxp/common/main/include/AppEvent.h b/examples/all-clusters-app/nxp/common/main/include/AppEvent.h index 8047da99982e23..a0dad141a27055 100644 --- a/examples/all-clusters-app/nxp/common/main/include/AppEvent.h +++ b/examples/all-clusters-app/nxp/common/main/include/AppEvent.h @@ -19,7 +19,7 @@ #pragma once struct AppEvent; -typedef void (*EventHandler)(AppEvent *); +using EventHandler = void (*)(const AppEvent &); struct AppEvent { diff --git a/examples/all-clusters-app/nxp/common/main/include/AppTask.h b/examples/all-clusters-app/nxp/common/main/include/AppTask.h index e276e287aa92a6..9bda003e25344a 100644 --- a/examples/all-clusters-app/nxp/common/main/include/AppTask.h +++ b/examples/all-clusters-app/nxp/common/main/include/AppTask.h @@ -2,6 +2,7 @@ * * Copyright (c) 2020 Project CHIP Authors * Copyright (c) 2021-2023 Google LLC. + * Copyright 2024 NXP * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,47 +20,31 @@ #pragma once -#include -#include - -#include "AppEvent.h" -#include "DeviceCallbacks.h" - -class AppTask +#if CONFIG_APP_FREERTOS_OS +#include "AppTaskFreeRTOS.h" +#else +#include "AppTaskZephyr.h" +#endif +namespace AllClustersApp { +#if CONFIG_APP_FREERTOS_OS +class AppTask : public chip::NXP::App::AppTaskFreeRTOS +#else +class AppTask : public chip::NXP::App::AppTaskZephyr +#endif { public: - CHIP_ERROR StartAppTask(); - static void AppTaskMain(void * pvParameter); - - void PostEvent(const AppEvent * event); - - /* Commissioning handlers */ - void StartCommissioningHandler(void); - void StopCommissioningHandler(void); - void SwitchCommissioningStateHandler(void); - - /* FactoryResetHandler */ - void FactoryResetHandler(void); - -private: - DeviceCallbacks deviceCallbacks; - - friend AppTask & GetAppTask(void); - - CHIP_ERROR Init(); - void DispatchEvent(AppEvent * event); - CHIP_ERROR DisplayDeviceInformation(void); - - /* Functions that would be called in the Matter task context */ - static void StartCommissioning(intptr_t arg); - static void StopCommissioning(intptr_t arg); - static void SwitchCommissioningState(intptr_t arg); - static void InitServer(intptr_t arg); - - static AppTask sAppTask; + ~AppTask() override{}; + void PreInitMatterStack(void) override; + void PostInitMatterStack(void) override; + void PostInitMatterServerInstance(void) override; + // This returns an instance of this class. + static AppTask & GetDefaultInstance(); }; - -inline AppTask & GetAppTask(void) -{ - return AppTask::sAppTask; -} +} // namespace AllClustersApp +/** + * Returns the application-specific implementation of the AppTaskBase object. + * + * Applications can use this to gain access to features of the AppTaskBase + * that are specific to the selected application. + */ +chip::NXP::App::AppTaskBase & GetAppTask(); diff --git a/examples/all-clusters-app/nxp/common/main/include/DeviceCallbacks.h b/examples/all-clusters-app/nxp/common/main/include/DeviceCallbacks.h index 2a37a2dfb99a94..748905b52ad736 100644 --- a/examples/all-clusters-app/nxp/common/main/include/DeviceCallbacks.h +++ b/examples/all-clusters-app/nxp/common/main/include/DeviceCallbacks.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-2023 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,24 +26,27 @@ #pragma once #include "CHIPDeviceManager.h" -#include -#include +#include "CommonDeviceCallbacks.h" -class DeviceCallbacks : public chip::DeviceManager::CHIPDeviceManagerCallbacks +namespace AllClustersApp { +class DeviceCallbacks : public chip::NXP::App::CommonDeviceCallbacks { public: - virtual void DeviceEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); - virtual void PostAttributeChangeCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, - uint8_t type, uint16_t size, uint8_t * value); + // This returns an instance of this class. + static DeviceCallbacks & GetDefaultInstance(); + void PostAttributeChangeCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, + uint8_t type, uint16_t size, uint8_t * value); private: - void OnWiFiConnectivityChange(const chip::DeviceLayer::ChipDeviceEvent * event); - void OnInternetConnectivityChange(const chip::DeviceLayer::ChipDeviceEvent * event); - void OnSessionEstablished(const chip::DeviceLayer::ChipDeviceEvent * event); - void OnInterfaceIpAddressChanged(const chip::DeviceLayer::ChipDeviceEvent * event); void OnOnOffPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value); void OnIdentifyPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value); -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - void OnComissioningComplete(const chip::DeviceLayer::ChipDeviceEvent * event); -#endif }; + +/** + * Returns the application-specific implementation of the CommonDeviceCallbacks object. + * + * Applications can use this to gain access to features of the CommonDeviceCallbacks + * that are specific to the selected application. + */ +chip::DeviceManager::CHIPDeviceManagerCallbacks & GetDeviceCallbacks(); +} // namespace AllClustersApp diff --git a/examples/all-clusters-app/nxp/common/main/main.cpp b/examples/all-clusters-app/nxp/common/main/main.cpp index c2305cf9ac4eb6..b2aadab98ceb8b 100644 --- a/examples/all-clusters-app/nxp/common/main/main.cpp +++ b/examples/all-clusters-app/nxp/common/main/main.cpp @@ -37,7 +37,7 @@ extern "C" int main(int argc, char * argv[]) TaskHandle_t taskHandle; PlatformMgrImpl().HardwareInit(); - GetAppTask().StartAppTask(); + chip::NXP::App::GetAppTask().Start(); vTaskStartScheduler(); } diff --git a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn index 6f167c92ce5be2..02cce50f266eb1 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn +++ b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn @@ -35,24 +35,42 @@ assert(target_os == "freertos") assert(nxp_platform == "rt/rw61x") declare_args() { - # This defines the device type as a "thermostat" by default, - # use "all-clusters" in order to build the all-clusters-app - nxp_device_type = "thermostat" + # Allows to start the tcp download test app + tcp_download = false + + # Allows to start the wifi connect test app + wifi_connect = false + + # The 2 params below are used only if tcp_download or wifi_connect are true, otherwise they're unused. + wifi_ssid = "" + wifi_password = "" + + # Setup discriminator as argument + setup_discriminator = 3840 } example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}" +common_example_dir = "${chip_root}/examples/platform/nxp/common" -if (nxp_device_type == "thermostat") { - app_common_folder = "${nxp_device_type}/nxp/zap" -} else { - app_common_folder = "${nxp_device_type}-app/${nxp_device_type}-common" +if (tcp_download == true && wifi_connect == true) { + assert("Cannot enable tcp_download and wifi_connect at the same time!") } +app_common_folder = "all-clusters-app/all-clusters-common" + # Create here the SDK instance. # Particular sources/defines/includes could be added/changed depending on the target application. rt_sdk("sdk") { defines = [] + # To be moved, temporary mbedtls config fix to build app with factory data + if (chip_enable_secure_dac_private_key_storage == 1) { + defines += [ + "MBEDTLS_NIST_KW_C", + "MBEDTLS_PSA_CRYPTO_CLIENT", + ] + } + cflags = [] public_deps = [] public_configs = [] @@ -75,6 +93,15 @@ rt_sdk("sdk") { # Indicate the default path to OpenThreadConfig.h include_dirs += [ "${example_platform_dir}/app/project_include/openthread" ] + + # For matter with BR feature, increase FreeRTOS heap size + if (chip_enable_wifi && chip_enable_openthread) { + defines += [ "configTOTAL_HEAP_SIZE=(size_t)(160 * 1024)" ] + } + + defines += [ + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", + ] } # Create the SDK driver instance. @@ -85,12 +112,18 @@ rw61x_sdk_drivers("sdk_driver") { rt_executable("all_cluster_app") { output_name = "chip-rw61x-all-cluster-example" - defines = [ "CONFIG_RENDEZVOUS_MODE=7" ] + defines = [ + "CONFIG_RENDEZVOUS_MODE=7", + "CONFIG_APP_FREERTOS_OS=1", + ] + + if (chip_enable_openthread) { + defines += [ "CONFIG_NET_L2_OPENTHREAD=1" ] + } include_dirs = [ "../../common/main/include", "../../common/main", - "${chip_root}/examples/all-clusters-app/all-clusters-common/include", "${chip_root}/examples/providers/", ] @@ -98,34 +131,54 @@ rt_executable("all_cluster_app") { sources = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", - "../../common/main/AppFactoryDataDefaultImpl.cpp", - "../../common/main/AppMatterButtonEmpty.cpp", - "../../common/main/AppMatterCli.cpp", "../../common/main/AppTask.cpp", - "../../common/main/CHIPDeviceManager.cpp", "../../common/main/DeviceCallbacks.cpp", "../../common/main/ZclCallbacks.cpp", "../../common/main/include/AppEvent.h", "../../common/main/include/AppTask.h", - "../../common/main/include/CHIPDeviceManager.h", "../../common/main/include/DeviceCallbacks.h", "../../common/main/main.cpp", ] - deps = [ "${chip_root}/examples/${app_common_folder}" ] - - if (nxp_device_type == "all-clusters") { - defines += [ "DEVICE_TYPE_ALL_CLUSTERS" ] + if (chip_enable_secure_dac_private_key_storage == 1) { + sources += [ + "${example_platform_dir}/factory_data/source/AppFactoryDataExample.cpp", + ] + } else { sources += [ - "${chip_root}/examples/${app_common_folder}/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/${app_common_folder}/src/EnergyEvseManager.cpp", - "${chip_root}/examples/${app_common_folder}/src/bridged-actions-stub.cpp", - "${chip_root}/examples/${app_common_folder}/src/energy-evse-stub.cpp", - "${chip_root}/examples/${app_common_folder}/src/smco-stub.cpp", - "${chip_root}/examples/${app_common_folder}/src/static-supported-modes-manager.cpp", + "${common_example_dir}/factory_data/source/AppFactoryDataDefaultImpl.cpp", ] } + # App common files + include_dirs += [ + "${common_example_dir}/icd/include", + "${common_example_dir}/matter_button/include", + "${common_example_dir}/matter_cli/include", + "${common_example_dir}/device_manager/include", + "${common_example_dir}/device_callbacks/include", + "${common_example_dir}/app_task/include", + "${common_example_dir}/factory_data/include", + ] + + sources += [ + "${common_example_dir}/app_task/source/AppTaskBase.cpp", + "${common_example_dir}/app_task/source/AppTaskFreeRTOS.cpp", + "${common_example_dir}/device_callbacks/source/CommonDeviceCallbacks.cpp", + "${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp", + "${common_example_dir}/icd/source/ICDUtil.cpp", + "${common_example_dir}/matter_button/source/AppMatterButtonEmpty.cpp", + "${common_example_dir}/matter_cli/source/AppMatterCli.cpp", + ] + + deps = [ "${chip_root}/examples/${app_common_folder}" ] + + sources += [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", + ] + if (chip_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ @@ -135,17 +188,53 @@ rt_executable("all_cluster_app") { } if (chip_enable_ota_requestor) { + include_dirs += [ "${common_example_dir}/ota_requestor/include" ] sources += [ - "${chip_root}/examples/platform/nxp/common/OTARequestorInitiator.cpp", - "${chip_root}/examples/platform/nxp/common/OTARequestorInitiator.h", + "${common_example_dir}/ota_requestor/source/OTARequestorInitiator.cpp", + "${common_example_dir}/ota_requestor/source/OTARequestorInitiatorCommon.cpp", + ] + } + + if (wifi_connect) { + defines += [ + "WIFI_CONNECT_TASK=1", + "WIFI_CONNECT=1", + ] + + if (!chip_enable_matter_cli) { + assert(wifi_ssid != "" && wifi_password != "", + "WiFi SSID and password must be specified at build time!") + } + + if (wifi_ssid != "") { + defines += [ "WIFI_SSID=\"${wifi_ssid}\"" ] + } + + if (wifi_password != "") { + defines += [ "WIFI_PASSWORD=\"${wifi_password}\"" ] + } + + include_dirs += [ "${common_example_dir}/wifi_connect/include" ] + sources += [ "${common_example_dir}/wifi_connect/source/WifiConnect.cpp" ] + } + + if (tcp_download) { + defines += [ "CONFIG_CHIP_TCP_DOWNLOAD=1" ] + defines += [ + "WIFI_CONNECT=1", + "WIFI_SSID=\"${wifi_ssid}\"", + "WIFI_PASSWORD=\"${wifi_password}\"", ] - include_dirs += [ "${chip_root}/examples/platform/nxp/common" ] + + include_dirs += [ "${common_example_dir}/tcp_download_test/include" ] + sources += + [ "${common_example_dir}/tcp_download_test/source/TcpDownload.cpp" ] } # In case a dedicated assert function needs to be supported the flag sdk_fsl_assert_support should be set to false # The would add to the build a dedicated application assert implementation. if (!sdk_fsl_assert_support) { - sources += [ "../../common/main/AppAssert.cpp" ] + sources += [ "${common_example_dir}/app_assert/source/AppAssert.cpp" ] } cflags = [ "-Wconversion" ] diff --git a/examples/all-clusters-app/nxp/rt/rw61x/README.md b/examples/all-clusters-app/nxp/rt/rw61x/README.md index d5b436d9fee8e1..8a6889909dffa3 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/README.md +++ b/examples/all-clusters-app/nxp/rt/rw61x/README.md @@ -25,13 +25,13 @@ commissioning and different cluster control. The RW61x all-cluster application provides a working demonstration of the RW610/RW612 board integration, built using the Project CHIP codebase and the NXP -RW612 SDK. The example supports basic ZCL commands and acts as a thermostat -device-type. +RW612 SDK. The example supports: - Matter over Wi-Fi - Matter over Openthread +- Matter over Wi-Fi with OpenThread Border Router support. ### Hardware requirements @@ -46,6 +46,12 @@ For Matter over WiFi configuration : - BLE antenna (to plug in Ant1) - Wi-Fi antenna (to plug in Ant2) +For Matter over Wi-Fi with OpenThread Border Router : + +- [`NXP RD-RW612-BGA`] board +- BLE/15.4 antenna (to plug in Ant1) +- Wi-Fi antenna (to plug in Ant2) + ## Building @@ -56,22 +62,26 @@ distribution (the demo-application was compiled on Ubuntu 20.04). - Follow instruction in [BUILDING.md](../../../../../docs/guides/BUILDING.md) to setup the environment to be able to build Matter. -- Download [RD-RW612 SDK v2.13.1](https://mcuxpresso.nxp.com/en/select). +- Download + [RD-RW612 SDK for Project CHIP](https://mcuxpresso.nxp.com/en/select). Creating an nxp.com account is required before being able to download the SDK. Once the account is created, login and follow the steps for downloading SDK. The SDK Builder UI selection should be similar with the one from the - image below. In case you do not have access to the SDK, please ask your NXP - representative. + image below. ![MCUXpresso SDK Download](../../../../platform/nxp/rt/rw61x/doc/images/mcux-sdk-download.PNG) (Note: All SDK components should be selected. If size is an issue Azure RTOS component can be omitted.) + Please refer to Matter release notes for getting the latest released SDK. + - Start building the application. ``` user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_SDK_ROOT=/home/user/Desktop/SDK_RW612/ +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive +user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/bootstrap.sh user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/all-clusters-app/nxp/rt/rw61x/ ``` @@ -87,13 +97,26 @@ user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw61x #### Building with Matter over Thread configuration on RW612 -- Build the Openthread configuration with BLE commissioning. +- Build Matter-over-Thread configuration with BLE commissioning. ``` user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw61x$ gn gen --args="chip_enable_openthread=true chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=true is_sdk_package=true" out/debug user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw61x$ ninja -C out/debug ``` +#### Building with Matter over Wifi + OpenThread Border Router configuration on RW612 + +This configuration requires enabling the Matter CLI in order to control the +Thread network on the Border Router. + +- Build Matter with Border Router configuration with BLE commissioning + (ble-wifi) : + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw610$ gn gen --args="chip_enable_wifi=true chip_enable_openthread=true chip_enable_matter_cli=true is_sdk_package=true openthread_root=\"//third_party/connectedhomeip/third_party/openthread/ot-nxp/openthread-br\"" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw610$ ninja -C out/debug +``` + #### General information The resulting output file can be found in @@ -108,8 +131,8 @@ Optional GN options that can be added when building an application: - To switch the SDK type used, the argument `is_=true` must be added to the _gn gen_ command (with being either sdk_package or sdk_internal). -- By default, the RW612 A1 board revision will be chosen. To switch to an A0 - revision, the argument `board_version=\"A0\"` must be added to the _gn gen_ +- By default, the RW612 A1 board revision will be chosen. To switch to an A2 + revision, the argument `board_version=\"A2\"` must be added to the _gn gen_ command. - To build the application in debug mode, the argument `is_debug=true optimize_debug=false` must be added to the _gn gen_ command. @@ -120,7 +143,7 @@ Optional GN options that can be added when building an application: - To build the application with the OTA Requestor enabled, the arguments `chip_enable_ota_requestor=true no_mcuboot=false` must be added to the _gn gen_ command. (More information about the OTA Requestor feature in - [OTA Requestor README](README_OTA_Requestor.md))) + [OTA Requestor README](../../../../../docs/guides/nxp_rw61x_ota_software_update.md) ## Manufacturing data @@ -133,6 +156,21 @@ The all cluster app demonstrates the usage of encrypted Matter manufacturing data storage. Matter manufacturing data should be encrypted using an AES 128 software key before flashing them to the device flash. +Using DAC private key secure usage: Experimental feature, contain some +limitation: potential concurrent access issue during sign with dac key operation +due to the lack of protection between multiple access to `ELS` crypto module. +The argument `chip_enable_secure_dac_private_key_storage=1` must be added to the +_gn gen_ command to enable secure private DAC key usage with S50. +`chip_with_factory_data=1` must have been added to the _gn gen_ command + +DAC private key generation: The argument `chip_convert_dac_private_key=1` must +be added to the _gn gen_ command to enable DAC private plain key conversion to +blob with S50. `chip_enable_secure_dac_private_key_storage=1` must have been +added to the _gn gen_ command + +`ELS` contain concurrent access risks. They must be fixed before enabling it by +default. + ## Flashing and debugging @@ -213,6 +251,16 @@ The "ble-wifi" pairing method can be used in order to commission the device. The "ble-thread" pairing method can be used in order to commission the device. +#### Matter over wifi with openthread border router configuration : + +In order to create or join a Thread network on the Matter Border Router, the +`otcli` commands from the matter CLI can be used. For more information about +using the matter shell, follow instructions from +['Testing the all-clusters application with Matter CLI'](#testing-the-all-clusters-application-with-matter-cli-enabled). + +In this configuration, the device can be commissioned over Wi-Fi with the +'ble-wifi' pairing method. + ### Testing the all-clusters application without Matter CLI: 1. Prepare the board with the flashed `All-cluster application` (as shown @@ -284,6 +332,41 @@ Here are described steps to use the all-cluster-app with the Matter CLI enabled it is described [here](../../../../chip-tool/README.md#using-the-client-to-send-matter-commands). +For Matter with OpenThread Border Router support, the matter CLI can be used to +start/join the Thread network, using the following ot-cli commands. (Note that +setting channel, panid, and network key is not enough anymore because of an Open +Thread stack update. We first need to initialize a new dataset.) + +``` +> otcli dataset init new +Done +> otcli dataset +Active Timestamp: 1 +Channel: 25 +Channel Mask: 0x07fff800 +Ext PAN ID: 42af793f623aab54 +Mesh Local Prefix: fd6e:c358:7078:5a8d::/64 +Network Key: f824658f79d8ca033fbb85ecc3ca91cc +Network Name: OpenThread-b870 +PAN ID: 0xb870 +PSKc: f438a194a5e968cc43cc4b3a6f560ca4 +Security Policy: 672 onrc 0 +Done +> otcli dataset panid 0xabcd +Done +> otcli dataset channel 25 +Done +> otcli dataset commit active +Done +> otcli ifconfig up +Done +> otcli thread start +Done +> otcli state +leader +Done +``` + ## OTA Software Update diff --git a/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h index 9fe84849fd753f..2653e97705fe39 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h @@ -50,8 +50,13 @@ #if !CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA // Use a default pairing code if one hasn't been provisioned in flash. +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#endif + +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 +#endif // Use a default pairing code if one hasn't been provisioned in flash. #define CHIP_DEVICE_CONFIG_USE_TEST_PAIRING_CODE "CHIPUS" diff --git a/examples/all-clusters-minimal-app/all-clusters-common/BUILD.gn b/examples/all-clusters-minimal-app/all-clusters-common/BUILD.gn index 9991df1e8274ea..cd518cb42fe388 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/BUILD.gn +++ b/examples/all-clusters-minimal-app/all-clusters-common/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("all-clusters-common") { zap_file = "all-clusters-minimal-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/all-clusters-minimal-app/zap-generated" is_server = true } diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index dbb244cf6265b3..0c9569504c7846 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -1694,7 +1694,7 @@ cluster SoftwareDiagnostics = 52 { /** The Thread Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems */ cluster ThreadNetworkDiagnostics = 53 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum ConnectionStatusEnum : enum8 { kConnected = 0; @@ -4428,7 +4428,7 @@ cluster RelativeHumidityMeasurement = 1029 { /** Attributes and commands for configuring occupancy sensing, and reporting occupancy status. */ cluster OccupancySensing = 1030 { - revision 3; + revision 4; enum OccupancySensorTypeEnum : enum8 { kPIR = 0; @@ -6120,7 +6120,7 @@ endpoint 0 { callback attribute operationalDatasetComponents; callback attribute activeNetworkFaultsList; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; + ram attribute clusterRevision default = 2; } server cluster WiFiNetworkDiagnostics { @@ -6571,7 +6571,7 @@ endpoint 1 { ram attribute occupancySensorType; ram attribute occupancySensorTypeBitmap; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 3; + ram attribute clusterRevision default = 4; } server cluster WakeOnLan { @@ -6916,7 +6916,7 @@ endpoint 2 { ram attribute occupancySensorType; ram attribute occupancySensorTypeBitmap; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 3; + ram attribute clusterRevision default = 4; } } endpoint 65534 { diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index 2d64015215a5ce..3294f430a3e337 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 99, + "featureLevel": 100, "creator": "zap", "keyValuePairs": [ { @@ -2618,10 +2618,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2634,10 +2634,10 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0002", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2993,7 +2993,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "2", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6999,7 +6999,6 @@ "define": "FAN_CONTROL_CLUSTER", "side": "server", "enabled": 1, - "apiMaturity": "provisional", "attributes": [ { "name": "FanMode", @@ -7998,7 +7997,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -11824,7 +11823,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -12348,28 +12347,32 @@ "endpointTypeIndex": 0, "profileId": 259, "endpointId": 0, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "MA-onofflight", "endpointTypeIndex": 1, "profileId": 259, "endpointId": 1, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "MA-onofflight", "endpointTypeIndex": 2, "profileId": 259, "endpointId": 2, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 3, "profileId": 259, "endpointId": 65534, - "networkId": 0 + "networkId": 0, + "parentEndpointIdentifier": null } ] } \ No newline at end of file diff --git a/examples/all-clusters-minimal-app/linux/main-common.cpp b/examples/all-clusters-minimal-app/linux/main-common.cpp index a6fd0a9866220e..d9f0a51cd747cf 100644 --- a/examples/all-clusters-minimal-app/linux/main-common.cpp +++ b/examples/all-clusters-minimal-app/linux/main-common.cpp @@ -19,10 +19,10 @@ #include "include/tv-callbacks.h" #include #include -#include #include #include #include +#include #include #include #include diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index 02f0704f080a58..b3c8b951372c0f 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -34,6 +34,13 @@ #include "OTAUtil.h" #endif +#ifdef CONFIG_CHIP_CRYPTO_PSA +#include +#ifdef CHIP_MIGRATE_OPERATIONAL_KEYS_TO_ITS +#include "MigrationManager.h" +#endif +#endif + #include #include #include @@ -59,6 +66,10 @@ FactoryResetLEDsWrapper<3> sFactoryResetLEDs{ { FACTORY_RESET_SIGNAL_LED, FACTOR bool sIsNetworkProvisioned = false; bool sIsNetworkEnabled = false; bool sHaveBLEConnections = false; + +#ifdef CONFIG_CHIP_CRYPTO_PSA +chip::Crypto::PSAOperationalKeystore sPSAOperationalKeystore{}; +#endif } // namespace namespace LedConsts { @@ -155,10 +166,23 @@ CHIP_ERROR AppTask::Init() #endif static chip::CommonCaseDeviceServerInitParams initParams; +#ifdef CONFIG_CHIP_CRYPTO_PSA + initParams.operationalKeystore = &sPSAOperationalKeystore; +#endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); +#ifdef CONFIG_CHIP_MIGRATE_OPERATIONAL_KEYS_TO_ITS + err = MoveOperationalKeysFromKvsToIts(sLocalInitData.mServerInitParams->persistentStorageDelegate, + sLocalInitData.mServerInitParams->operationalKeystore); + if (err != CHIP_NO_ERROR) + { + LOG_ERR("MoveOperationalKeysFromKvsToIts() failed"); + return err; + } +#endif + // We only have network commissioning on endpoint 0. emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); ConfigurationMgr().LogDeviceConfig(); diff --git a/examples/shell/nxp/k32w/k32w0/.gn b/examples/android/CHIPTest/.gn similarity index 89% rename from examples/shell/nxp/k32w/k32w0/.gn rename to examples/android/CHIPTest/.gn index 81cec9d11a421b..3b11e2ba2e62ee 100644 --- a/examples/shell/nxp/k32w/k32w0/.gn +++ b/examples/android/CHIPTest/.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Project CHIP Authors +# Copyright (c) 2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,8 +21,5 @@ buildconfig = "${build_root}/config/BUILDCONFIG.gn" check_system_includes = true default_args = { - target_cpu = "arm" - target_os = "freertos" - import("//args.gni") } diff --git a/examples/android/CHIPTest/BUILD.gn b/examples/android/CHIPTest/BUILD.gn new file mode 100644 index 00000000000000..673a8c416f3260 --- /dev/null +++ b/examples/android/CHIPTest/BUILD.gn @@ -0,0 +1,83 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") + +import("${build_root}/config/android_abi.gni") +import("${chip_root}/build/chip/chip_build.gni") +import("${chip_root}/build/chip/java/rules.gni") +import("${chip_root}/build/chip/tools.gni") + +shared_library("jni") { + output_name = "libCHIPTest" + + sources = [ "app/src/main/cpp/CHIPTest-JNI.cpp" ] + + deps = [ + "${chip_root}/src:tests", + "${chip_root}/src/controller/java", + "${chip_root}/src/controller/java:onboarding_payload", + "${chip_root}/src/lib", + "${chip_root}/src/lib/support", + "${chip_root}/src/lib/support:pw_tests_wrapper", + "${chip_root}/src/lib/support:test_utils", + "${chip_root}/src/lib/support:testing_nlunit", + "${chip_root}/src/lib/support/jsontlv", + "${chip_root}/src/platform", + "${chip_root}/src/platform/android", + "${chip_root}/src/platform/android:java", + "${chip_root}/src/platform/logging:android", + "${chip_root}/src/platform/tests:tests", + "${chip_root}/third_party/inipp", + "${chip_root}/third_party/nlfaultinjection:nlfaultinjection", + ] + + cflags = [ "-Wconversion" ] + + output_dir = "${root_out_dir}/lib/jni/${android_abi}" + + ldflags = [ "-Wl,--gc-sections" ] + + libs = [ "log" ] +} + +android_library("java") { + output_name = "CHIPTest.jar" + + deps = [ + ":android", + "${chip_root}/third_party/android_deps:annotation", + ] + + data_deps = [ + ":jni", + "${chip_root}/build/chip/java:shared_cpplib", + ] + + sources = [ "app/src/main/java/com/tcl/chip/chiptest/TestEngine.java" ] + + javac_flags = [ "-Xlint:deprecation" ] +} + +java_prebuilt("android") { + jar_path = "${android_sdk_root}/platforms/android-26/android.jar" +} + +group("default") { + deps = [ + ":java", + ":jni", + ] +} diff --git a/examples/android/CHIPTest/app/build.gradle b/examples/android/CHIPTest/app/build.gradle index e7aa3be805d55f..a6bd5dc0b7d8a6 100644 --- a/examples/android/CHIPTest/app/build.gradle +++ b/examples/android/CHIPTest/app/build.gradle @@ -25,9 +25,7 @@ android { externalNativeBuild { cmake { - arguments "-DMATTER_SDK_SOURCE_BUILD="+matterSdkSourceBuild \ - , "-DMATTER_SDK_BUILD_ROOT="+matterBuildSrcDir \ - , "-DMATTER_SDK_UTEST_LIB="+matterUTestLib + targets "default" } } } @@ -52,23 +50,22 @@ android { jvmTarget = '1.8' } - externalNativeBuild { - cmake { - path file('src/main/cpp/CMakeLists.txt') - version '3.10.2' - } - } - buildFeatures { viewBinding true } + sourceSets { + main { + jniLibs.srcDirs = ['libs/jniLibs'] + java.srcDirs = [ + 'src/main/java', + 'src/main/jni', + ] + } + } } dependencies { - if(!matterSdkSourceBuild.toBoolean()) { - implementation fileTree(dir: "libs", include: ["*.jar"]) - } - + implementation fileTree(dir: "libs", include: ["*.jar", "*.so"]) implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.appcompat:appcompat:1.3.1' diff --git a/examples/android/CHIPTest/app/src/main/cpp/CHIPTest-JNI.cpp b/examples/android/CHIPTest/app/src/main/cpp/CHIPTest-JNI.cpp index c1d9ffe2e1c985..9f663b4afad8d7 100644 --- a/examples/android/CHIPTest/app/src/main/cpp/CHIPTest-JNI.cpp +++ b/examples/android/CHIPTest/app/src/main/cpp/CHIPTest-JNI.cpp @@ -25,12 +25,14 @@ #include #include -#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include #include @@ -38,54 +40,28 @@ using namespace chip; namespace { JavaVM * sJVM; -jclass sTestEngineCls = NULL; -jclass sTestEngineExceptionCls = NULL; } // namespace -static void ThrowError(JNIEnv * env, CHIP_ERROR errToThrow); -static CHIP_ERROR N2J_Error(JNIEnv * env, CHIP_ERROR inErr, jthrowable & outEx); -// static void ReportError(JNIEnv * env, CHIP_ERROR cbErr, const char * functName); +static void ReportError(JNIEnv * env, CHIP_ERROR cbErr, const char * functName); jint JNI_OnLoad(JavaVM * jvm, void * reserved) { CHIP_ERROR err = CHIP_NO_ERROR; - JNIEnv * env; + JNIEnv * env = nullptr; ChipLogProgress(Test, "JNI_OnLoad() called"); - // Save a reference to the JVM. Will need this to call back into Java. - JniReferences::GetInstance().SetJavaVm(jvm, "com/tcl/chip/chiptest/TestEngine"); sJVM = jvm; + err = AndroidChipPlatformJNI_OnLoad(jvm, reserved); + VerifyOrReturnValue(err == CHIP_NO_ERROR, JNI_ERR, ReportError(env, err, __FUNCTION__), JNI_OnUnload(jvm, reserved)); // Get a JNI environment object. env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV); + VerifyOrReturnValue(env != nullptr, JNI_ERR, ReportError(env, err, __FUNCTION__)); + JniLocalReferenceScope scope(env); - ChipLogProgress(Test, "Loading Java class references."); + ChipLogProgress(Test, "JNI_OnLoad() complete"); - // Get various class references need by the API. - jobject testEngineCls; - err = JniReferences::GetInstance().GetLocalClassRef(env, "com/tcl/chip/chiptest/TestEngine", sTestEngineCls); - SuccessOrExit(err); - err = sTestEngineCls.Init(testEngineCls); - SuccessOrExit(err); - jobject testEngineExceptionCls; - err = JniReferences::GetInstance().GetLocalClassRef(env, "com/tcl/chip/chiptest/TestEngineException", sTestEngineExceptionCls); - SuccessOrExit(err); - err = sTestEngineExceptionCls.Init(testEngineExceptionCls); - SuccessOrExit(err); - ChipLogProgress(Test, "Java class references loaded."); - - err = AndroidChipPlatformJNI_OnLoad(jvm, reserved); - SuccessOrExit(err); - -exit: - if (err != CHIP_NO_ERROR) - { - ThrowError(env, err); - JNI_OnUnload(jvm, reserved); - } - - return (err == CHIP_NO_ERROR) ? JNI_VERSION_1_6 : JNI_ERR; + return JNI_VERSION_1_6; } void JNI_OnUnload(JavaVM * jvm, void * reserved) @@ -94,12 +70,12 @@ void JNI_OnUnload(JavaVM * jvm, void * reserved) AndroidChipPlatformJNI_OnUnload(jvm, reserved); - sJVM = NULL; + sJVM = nullptr; } -void ReportError(JNIEnv * env, CHIP_ERROR cbErr, const char * functName) +static void ReportError(JNIEnv * env, CHIP_ERROR cbErr, const char * functName) { - if (cbErr == CHIP_JNI_ERROR_EXCEPTION_THROWN) + if (cbErr == CHIP_JNI_ERROR_EXCEPTION_THROWN && env != nullptr) { ChipLogError(Test, "Java exception thrown in %s", functName); env->ExceptionDescribe(); @@ -110,13 +86,19 @@ void ReportError(JNIEnv * env, CHIP_ERROR cbErr, const char * functName) switch (cbErr.AsInteger()) { case CHIP_JNI_ERROR_TYPE_NOT_FOUND.AsInteger(): - errStr = "JNI type not found"; + errStr = "CHIP Device Test Error: JNI type not found"; break; case CHIP_JNI_ERROR_METHOD_NOT_FOUND.AsInteger(): - errStr = "JNI method not found"; + errStr = "CHIP Device Test Error: JNI method not found"; break; case CHIP_JNI_ERROR_FIELD_NOT_FOUND.AsInteger(): - errStr = "JNI field not found"; + errStr = "CHIP Device Test Error: JNI field not found"; + break; + case CHIP_JNI_ERROR_DEVICE_NOT_FOUND.AsInteger(): + errStr = "CHIP Device Test Error: Device not found"; + break; + case CHIP_JNI_ERROR_EXCEPTION_THROWN.AsInteger(): + errStr = "CHIP Device Test Error: Java exception thrown, env is nullptr"; break; default: errStr = ErrorStr(cbErr); @@ -126,72 +108,26 @@ void ReportError(JNIEnv * env, CHIP_ERROR cbErr, const char * functName) } } -void ThrowError(JNIEnv * env, CHIP_ERROR errToThrow) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - jthrowable ex; - - err = N2J_Error(env, errToThrow, ex); - if (err == CHIP_NO_ERROR) - { - env->Throw(ex); - } -} - -CHIP_ERROR N2J_Error(JNIEnv * env, CHIP_ERROR inErr, jthrowable & outEx) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - const char * errStr = NULL; - jstring errStrObj = NULL; - jmethodID constructor; - - env->ExceptionClear(); - constructor = env->GetMethodID(sTestEngineExceptionCls.ObjectRef(), "", "(ILjava/lang/String;)V"); - VerifyOrExit(constructor != NULL, err = CHIP_JNI_ERROR_METHOD_NOT_FOUND); - - switch (inErr.AsInteger()) - { - case CHIP_JNI_ERROR_TYPE_NOT_FOUND.AsInteger(): - errStr = "CHIP Device Test Error: JNI type not found"; - break; - case CHIP_JNI_ERROR_METHOD_NOT_FOUND.AsInteger(): - errStr = "CHIP Device Test Error: JNI method not found"; - break; - case CHIP_JNI_ERROR_FIELD_NOT_FOUND.AsInteger(): - errStr = "CHIP Device Test Error: JNI field not found"; - break; - case CHIP_JNI_ERROR_DEVICE_NOT_FOUND.AsInteger(): - errStr = "CHIP Device Test Error: Device not found"; - break; - default: - errStr = ErrorStr(inErr); - break; - } - errStrObj = (errStr != NULL) ? env->NewStringUTF(errStr) : NULL; - - outEx = (jthrowable) env->NewObject(sTestEngineExceptionCls.ObjectRef(), constructor, static_cast(inErr.AsInteger()), - errStrObj); - VerifyOrExit(!env->ExceptionCheck(), err = CHIP_JNI_ERROR_EXCEPTION_THROWN); - -exit: - env->DeleteLocalRef(errStrObj); - return err; -} - static void onLog(const char * fmt, ...) { CHIP_ERROR err = CHIP_NO_ERROR; jmethodID method; - jstring strObj = NULL; - char str[512] = { 0 }; + jstring strObj = nullptr; + jclass sTestEngineCls = nullptr; + char str[512] = {}; va_list args; ChipLogProgress(Test, "Received onLog"); JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV); + VerifyOrReturn(env != nullptr, ChipLogError(Test, "Could not get JNIEnv for current thread")); + JniLocalReferenceScope scope(env); + + // Get various class references need by the API. + err = JniReferences::GetInstance().GetLocalClassRef(env, "com/tcl/chip/chiptest/TestEngine", sTestEngineCls); + SuccessOrExit(err); - method = env->GetStaticMethodID(sTestEngineCls.ObjectRef(), "onTestLog", "(Ljava/lang/String;)V"); - VerifyOrExit(method != NULL, err = CHIP_JNI_ERROR_NO_ENV); + method = env->GetStaticMethodID(sTestEngineCls, "onTestLog", "(Ljava/lang/String;)V"); + VerifyOrExit(method != nullptr, err = CHIP_JNI_ERROR_NO_ENV); va_start(args, fmt); vsnprintf(str, sizeof(str), fmt, args); @@ -201,17 +137,13 @@ static void onLog(const char * fmt, ...) ChipLogProgress(Test, "Calling Java onTestLog"); env->ExceptionClear(); - env->CallStaticVoidMethod(sTestEngineCls.ObjectRef(), method, strObj); + env->CallStaticVoidMethod(sTestEngineCls, method, strObj); VerifyOrExit(!env->ExceptionCheck(), err = CHIP_JNI_ERROR_EXCEPTION_THROWN); exit: env->ExceptionClear(); env->DeleteLocalRef(strObj); - - if (err != CHIP_NO_ERROR) - { - ReportError(env, err, __FUNCTION__); - } + VerifyOrReturn(err != CHIP_NO_ERROR, ReportError(env, err, __FUNCTION__)); } static void jni_log_name(struct _nlTestSuite * inSuite) @@ -261,8 +193,10 @@ static nl_test_output_logger_t jni_test_logger = { extern "C" JNIEXPORT jint Java_com_tcl_chip_chiptest_TestEngine_runTest(JNIEnv * env, jclass clazz) { nlTestSetLogger(&jni_test_logger); - + chip::DeviceLayer::StackLock lock; + // TODO [PW_MIGRATION] Remove NLUnit tests call after migration jint ret = RunRegisteredUnitTests(); + ret += chip::test::RunAllTests(); return ret; } diff --git a/examples/android/CHIPTest/app/src/main/cpp/CMakeLists.txt b/examples/android/CHIPTest/app/src/main/cpp/CMakeLists.txt deleted file mode 100644 index 7c86548554fea5..00000000000000 --- a/examples/android/CHIPTest/app/src/main/cpp/CMakeLists.txt +++ /dev/null @@ -1,66 +0,0 @@ -# For more information about using CMake with Android Studio, read the -# documentation: https://d.android.com/studio/projects/add-native-code.html - -# Sets the minimum version of CMake required to build the native library. -cmake_minimum_required(VERSION 3.10.2) - -# Declares and names the project. -project("chiptest") - -message(STATUS "MATTER_SDK_SOURCE_BUILD=${MATTER_SDK_SOURCE_BUILD}") -message(STATUS "MATTER_SDK_BUILD_ROOT=${MATTER_SDK_BUILD_ROOT}") -message(STATUS "MATTER_SDK_UTEST_LIB=${MATTER_SDK_UTEST_LIB}") - -set(MATTER_SDK_ROOT "${PROJECT_SOURCE_DIR}/../../../../../../..") - -if(IS_ABSOLUTE ${MATTER_SDK_BUILD_ROOT}) -set(MATTER_SDK_BUILD ${MATTER_SDK_BUILD_ROOT}) -else() -set(MATTER_SDK_BUILD "${MATTER_SDK_ROOT}/${MATTER_SDK_BUILD_ROOT}") -endif() - -message(STATUS "MATTER_SDK_ROOT=${MATTER_SDK_ROOT}") -message(STATUS "MATTER_SDK_BUILD=${MATTER_SDK_BUILD}") - -set(CHIPTest_srcs - CHIPTest-JNI.cpp) -add_library(CHIPTest SHARED ${CHIPTest_srcs}) -set_property(TARGET CHIPTest APPEND PROPERTY INCLUDE_DIRECTORIES - ${MATTER_SDK_ROOT}/src/include/ - ${MATTER_SDK_ROOT}/src/ - ${MATTER_SDK_BUILD}/gen/include/ - ${MATTER_SDK_ROOT}/src/lib/ - ${MATTER_SDK_ROOT}/config/standalone/ - ${MATTER_SDK_ROOT}/third_party/nlassert/repo/include/ - ${MATTER_SDK_ROOT}/third_party/nlio/repo/include/ - ${MATTER_SDK_ROOT}/third_party/nlfaultinjection/include/ - ${MATTER_SDK_ROOT}/third_party/nlunit-test/repo/src/) -set_target_properties(CHIPTest PROPERTIES COMPILE_DEFINITIONS "CHIP_HAVE_CONFIG_H=1") - -set(CHIPTest_Libs - -Wl,--start-group - ${MATTER_SDK_BUILD}/obj/src/lib/core/lib/libChipCore.a - ${MATTER_SDK_BUILD}/obj/src/lib/support/lib/libSupportLayer.a - ${MATTER_SDK_BUILD}/lib/libnlunit-test.a - ${MATTER_SDK_BUILD}/obj/src/ble/lib/libBleLayer.a - ${MATTER_SDK_BUILD}/obj/src/inet/lib/libInetLayer.a - ${MATTER_SDK_BUILD}/obj/src/platform/logging/lib/android.a - ${MATTER_SDK_BUILD}/lib/libnlfaultinjection.a - ${MATTER_SDK_BUILD}/obj/src/system/lib/libSystemLayer.a - ${MATTER_SDK_BUILD}/obj/src/platform/lib/libDeviceLayer.a - ${MATTER_SDK_BUILD}/obj/src/platform/android/lib/libAndroidPlatform.a - ${MATTER_SDK_BUILD}/obj/src/crypto/lib/libChipCrypto.a - ${MATTER_SDK_BUILD}/lib/libmbedtls.a - -llog - - -Wl,-whole-archive - ${MATTER_SDK_BUILD}/lib/${MATTER_SDK_UTEST_LIB} - -Wl,-no-whole-archive - - -Wl,--end-group - ) -target_link_libraries(CHIPTest ${CHIPTest_Libs}) - -#if( MATTER_SDK_SRC_DIR ) -# include(../../../../${MATTER_SDK_SRC_DIR}/CMakeLists.txt) -#endif() diff --git a/examples/android/CHIPTest/args.gni b/examples/android/CHIPTest/args.gni new file mode 100644 index 00000000000000..df7c34af9c20ae --- /dev/null +++ b/examples/android/CHIPTest/args.gni @@ -0,0 +1,40 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +import("//build_overrides/pigweed.gni") + +chip_project_config_include_dirs = [ "${chip_root}/config/standalone" ] + +chip_build_test_static_libraries = false + +chip_build_tests = true + +chip_monolithic_tests = false + +pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" + +pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "$dir_pw_log_basic" + +pw_unit_test_BACKEND = "$dir_pw_unit_test:light" + +# TODO: Make sure only unit tests link against this +pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", +] diff --git a/examples/android/CHIPTest/build_overrides b/examples/android/CHIPTest/build_overrides new file mode 120000 index 00000000000000..e578e73312ebd1 --- /dev/null +++ b/examples/android/CHIPTest/build_overrides @@ -0,0 +1 @@ +../../build_overrides \ No newline at end of file diff --git a/examples/android/CHIPTest/third_party/connectedhomeip b/examples/android/CHIPTest/third_party/connectedhomeip new file mode 120000 index 00000000000000..2259b00e7b8deb --- /dev/null +++ b/examples/android/CHIPTest/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../. \ No newline at end of file diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt index 2da072a85fa243..7aaaa8d6724756 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt @@ -95,7 +95,7 @@ class CHIPToolActivity : } } - override fun onCommissioningComplete(code: Int, nodeId: Long) { + override fun onCommissioningComplete(code: Long, nodeId: Long) { runOnUiThread { Toast.makeText(this, getString(R.string.commissioning_completed, code), Toast.LENGTH_SHORT) .show() diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt index 77c59d75d00c36..0534f7f3ee3589 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt @@ -22,6 +22,8 @@ import android.util.Log import chip.devicecontroller.ChipDeviceController import chip.devicecontroller.ControllerParams import chip.devicecontroller.GetConnectedDeviceCallbackJni.GetConnectedDeviceCallback +import chip.devicecontroller.ICDCheckInDelegate +import chip.devicecontroller.ICDClientInfo import chip.platform.AndroidBleManager import chip.platform.AndroidChipPlatform import chip.platform.ChipMdnsCallbackImpl @@ -48,13 +50,35 @@ object ChipClient { if (!this::chipDeviceController.isInitialized) { chipDeviceController = - ChipDeviceController(ControllerParams.newBuilder().setControllerVendorId(VENDOR_ID).build()) + ChipDeviceController( + ControllerParams.newBuilder() + .setControllerVendorId(VENDOR_ID) + .setEnableServerInteractions(true) + .build() + ) // Set delegate for attestation trust store for device attestation verifier. // It will replace the default attestation trust store. chipDeviceController.setAttestationTrustStoreDelegate( ExampleAttestationTrustStoreDelegate(chipDeviceController) ) + + chipDeviceController.setICDCheckInDelegate( + object : ICDCheckInDelegate { + override fun onCheckInComplete(info: ICDClientInfo) { + Log.d(TAG, "onCheckInComplete : $info") + } + + override fun onKeyRefreshNeeded(info: ICDClientInfo): ByteArray? { + Log.d(TAG, "onKeyRefreshNeeded : $info") + return null + } + + override fun onKeyRefreshDone(errorCode: Long) { + Log.d(TAG, "onKeyRefreshDone : $errorCode") + } + } + ) } return chipDeviceController @@ -69,7 +93,10 @@ object ChipClient { AndroidBleManager(context), PreferencesKeyValueStoreManager(context), PreferencesConfigurationManager(context), - NsdManagerServiceResolver(context), + NsdManagerServiceResolver( + context, + NsdManagerServiceResolver.NsdManagerResolverAvailState() + ), NsdManagerServiceBrowser(context), ChipMdnsCallbackImpl(), DiagnosticDataProviderImpl(context) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/GenericChipDeviceListener.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/GenericChipDeviceListener.kt index 2d126e31c6c426..2eb2a1c77fa042 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/GenericChipDeviceListener.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/GenericChipDeviceListener.kt @@ -12,15 +12,15 @@ open class GenericChipDeviceListener : ChipDeviceController.CompletionListener { // No op } - override fun onPairingComplete(code: Int) { + override fun onPairingComplete(code: Long) { // No op } - override fun onPairingDeleted(code: Int) { + override fun onPairingDeleted(code: Long) { // No op } - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { + override fun onCommissioningComplete(nodeId: Long, errorCode: Long) { // No op } @@ -33,7 +33,7 @@ open class GenericChipDeviceListener : ChipDeviceController.CompletionListener { // No op } - override fun onCommissioningStatusUpdate(nodeId: Long, stage: String, errorCode: Int) { + override fun onCommissioningStatusUpdate(nodeId: Long, stage: String, errorCode: Long) { // No op } @@ -57,7 +57,7 @@ open class GenericChipDeviceListener : ChipDeviceController.CompletionListener { // No op } - override fun onICDRegistrationComplete(errorCode: Int, icdDeviceInfo: ICDDeviceInfo) { + override fun onICDRegistrationComplete(errorCode: Long, icdDeviceInfo: ICDDeviceInfo) { // No op } } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/attestation/ExampleAttestationTrustStoreDelegate.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/attestation/ExampleAttestationTrustStoreDelegate.kt index f62be2ce7dbbc6..33ad938f144fb9 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/attestation/ExampleAttestationTrustStoreDelegate.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/attestation/ExampleAttestationTrustStoreDelegate.kt @@ -3,6 +3,7 @@ package com.google.chip.chiptool.attestation import android.util.Base64 import chip.devicecontroller.AttestationTrustStoreDelegate import chip.devicecontroller.ChipDeviceController +import chip.devicecontroller.DeviceAttestation import java.util.* class ExampleAttestationTrustStoreDelegate(val chipDeviceController: ChipDeviceController) : @@ -13,9 +14,7 @@ class ExampleAttestationTrustStoreDelegate(val chipDeviceController: ChipDeviceC override fun getProductAttestationAuthorityCert(skid: ByteArray): ByteArray? { return paaCerts .map { Base64.decode(it, Base64.DEFAULT) } - .firstOrNull { cert -> - Arrays.equals(chipDeviceController.extractSkidFromPaaCert(cert), skid) - } + .firstOrNull { cert -> Arrays.equals(DeviceAttestation.extractSkidFromPaaCert(cert), skid) } } companion object { diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt index 0662ec08dc2146..5378f65da9d44e 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt @@ -17,6 +17,7 @@ import chip.devicecontroller.model.AttributeWriteRequest import chip.devicecontroller.model.ChipAttributePath import chip.devicecontroller.model.ChipEventPath import chip.devicecontroller.model.NodeState +import chip.devicecontroller.model.Status import com.google.chip.chiptool.ChipClient import com.google.chip.chiptool.GenericChipDeviceListener import com.google.chip.chiptool.R @@ -97,7 +98,7 @@ class BasicClientFragment : Fragment() { inner class ChipControllerCallback : GenericChipDeviceListener() { override fun onConnectDeviceComplete() {} - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { + override fun onCommissioningComplete(nodeId: Long, errorCode: Long) { Log.d(TAG, "onCommissioningComplete for nodeId $nodeId: $errorCode") } @@ -138,7 +139,13 @@ class BasicClientFragment : Fragment() { val attributeId = BasicInformation.Attribute.valueOf(attributeName).id val devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } ChipClient.getDeviceController(requireContext()) .readPath( @@ -181,7 +188,13 @@ class BasicClientFragment : Fragment() { private suspend fun sendWriteAttribute(attribute: BasicInformation.Attribute, tlv: ByteArray) { val clusterId = BasicInformation.ID val devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } ChipClient.getDeviceController(requireContext()) .write( @@ -191,8 +204,8 @@ class BasicClientFragment : Fragment() { Log.e(TAG, "Write ${attribute.name} failure", ex) } - override fun onResponse(attributePath: ChipAttributePath?) { - showMessage("Write ${attribute.name} success") + override fun onResponse(attributePath: ChipAttributePath, status: Status) { + showMessage("Write ${attribute.name} response: $status") } }, devicePtr, diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt index 8943801c080c80..48370305e74713 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt @@ -271,11 +271,16 @@ class GroupSettingFragment : Fragment() { private suspend fun sendKeySetWrite( groupKeySetStruct: GroupKeyManagementClusterGroupKeySetStruct ) { - val cluster = - ChipClusters.GroupKeyManagementCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val cluster = ChipClusters.GroupKeyManagementCluster(devicePtr, 0) + cluster.keySetWrite( object : ChipClusters.DefaultClusterCallback { override fun onError(e: Exception?) { @@ -311,11 +316,15 @@ class GroupSettingFragment : Fragment() { } private suspend fun writeGroupKeyMap(groupId: UInt, groupKeySetId: UInt) { - val cluster = - ChipClusters.GroupKeyManagementCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val cluster = ChipClusters.GroupKeyManagementCluster(devicePtr, 0) cluster.writeGroupKeyMapAttribute( object : ChipClusters.DefaultClusterCallback { override fun onError(e: Exception?) { @@ -356,11 +365,16 @@ class GroupSettingFragment : Fragment() { } private suspend fun sendAddGroup(groupId: UInt, groupName: String) { - val cluster = - ChipClusters.GroupsCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val cluster = ChipClusters.GroupsCluster(devicePtr, 0) + cluster.addGroup( object : ChipClusters.GroupsCluster.AddGroupResponseCallback { override fun onError(e: Exception?) { @@ -379,11 +393,15 @@ class GroupSettingFragment : Fragment() { } private suspend fun readAccessControl() { - val cluster = - ChipClusters.AccessControlCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val cluster = ChipClusters.AccessControlCluster(devicePtr, 0) cluster.readAclAttribute( object : ChipClusters.AccessControlCluster.AclAttributeCallback { override fun onError(e: Exception?) { @@ -437,12 +455,16 @@ class GroupSettingFragment : Fragment() { groupId: UInt, privilege: UInt ) { + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } // If GroupID is already added to AccessControl, do not add it. - val cluster = - ChipClusters.AccessControlCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val cluster = ChipClusters.AccessControlCluster(devicePtr, 0) val sendEntry = ArrayList() for (entry in value) { if ( @@ -517,7 +539,7 @@ class GroupSettingFragment : Fragment() { } inner class ChipControllerCallback : GenericChipDeviceListener() { - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { + override fun onCommissioningComplete(nodeId: Long, errorCode: Long) { Log.d(TAG, "onCommissioningComplete for nodeId $nodeId: $errorCode") } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/MultiAdminClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/MultiAdminClientFragment.kt index a82f0ee60ccf35..6faeb9bdb65ebc 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/MultiAdminClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/MultiAdminClientFragment.kt @@ -102,7 +102,7 @@ class MultiAdminClientFragment : Fragment() { inner class ChipControllerCallback : GenericChipDeviceListener() { override fun onConnectDeviceComplete() {} - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { + override fun onCommissioningComplete(nodeId: Long, errorCode: Long) { Log.d(TAG, "onCommissioningComplete for nodeId $nodeId: $errorCode") } @@ -121,8 +121,16 @@ class MultiAdminClientFragment : Fragment() { private suspend fun sendBasicCommissioningCommandClick() { val testDuration = binding.timeoutEd.text.toString().toInt() + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } deviceController.openPairingWindowCallback( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, testDuration, object : OpenCommissioningCallback { override fun onError(status: Int, deviceId: Long) { @@ -140,7 +148,13 @@ class MultiAdminClientFragment : Fragment() { val testDuration = binding.timeoutEd.text.toString().toInt() val testIteration = 1000 val devicePointer = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } var setupPinCode: Long? = null if (!binding.setupPinCodeEd.text.toString().isEmpty()) { @@ -181,6 +195,14 @@ class MultiAdminClientFragment : Fragment() { null ) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } deviceController.invoke( object : InvokeCallback { override fun onError(ex: Exception?) { @@ -193,7 +215,7 @@ class MultiAdminClientFragment : Fragment() { showMessage("Revoke Commissioning success") } }, - getConnectedDevicePointer(), + devicePointer, invokeElement, timedInvokeTimeout, 0 @@ -208,6 +230,16 @@ class MultiAdminClientFragment : Fragment() { val attributeId = attribute.id val attributeName = attribute.name val attributePath = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.readAttributePath( object : ReportCallback { override fun onReport(nodeState: NodeState?) { @@ -230,16 +262,12 @@ class MultiAdminClientFragment : Fragment() { showMessage("read $attributeName - error : ${e?.message}") } }, - getConnectedDevicePointer(), + devicePointer, listOf(attributePath), 0 ) } - private suspend fun getConnectedDevicePointer(): Long { - return ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) - } - private fun showMessage(msg: String) { requireActivity().runOnUiThread { binding.multiAdminClusterCommandStatus.text = msg } } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OnOffClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OnOffClientFragment.kt index 7994deb2f07a13..2d82628dbdee40 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OnOffClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OnOffClientFragment.kt @@ -105,6 +105,15 @@ class OnOffClientFragment : Fragment() { val attributePath = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + ChipClient.getDeviceController(requireContext()) .readPath( object : ReportCallback { @@ -128,7 +137,7 @@ class OnOffClientFragment : Fragment() { showMessage("On/Off attribute value: $value") } }, - getConnectedDevicePointer(), + devicePointer, listOf(attributePath), null, false, @@ -181,6 +190,15 @@ class OnOffClientFragment : Fragment() { ) } + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.subscribeToPath( subscriptionEstablishedCallback, resubscriptionAttemptCallback, @@ -211,7 +229,7 @@ class OnOffClientFragment : Fragment() { showReportMessage(message) } }, - getConnectedDevicePointer(), + devicePointer, listOf(attributePath), null, minInterval, @@ -225,7 +243,7 @@ class OnOffClientFragment : Fragment() { inner class ChipControllerCallback : GenericChipDeviceListener() { override fun onConnectDeviceComplete() {} - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { + override fun onCommissioningComplete(nodeId: Long, errorCode: Long) { Log.d(TAG, "onCommissioningComplete for nodeId $nodeId: $errorCode") showMessage("Address update complete for nodeId $nodeId with code $errorCode") } @@ -265,6 +283,15 @@ class OnOffClientFragment : Fragment() { null ) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.invoke( object : InvokeCallback { override fun onError(ex: Exception?) { @@ -277,7 +304,7 @@ class OnOffClientFragment : Fragment() { showMessage("MoveToLevel command success") } }, - getConnectedDevicePointer(), + devicePointer, invokeElement, 0, 0 @@ -298,6 +325,15 @@ class OnOffClientFragment : Fragment() { null ) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.invoke( object : InvokeCallback { override fun onError(ex: Exception?) { @@ -310,17 +346,13 @@ class OnOffClientFragment : Fragment() { showMessage("${commandId.name} command success") } }, - getConnectedDevicePointer(), + devicePointer, invokeElement, 0, 0 ) } - private suspend fun getConnectedDevicePointer(): Long { - return ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) - } - private fun showMessage(msg: String) { requireActivity().runOnUiThread { binding.commandStatusTv.text = msg } } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OpCredClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OpCredClientFragment.kt index 0314f9d82e652c..fd69b93837c50b 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OpCredClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OpCredClientFragment.kt @@ -76,7 +76,7 @@ class OpCredClientFragment : Fragment() { inner class ChipControllerCallback : GenericChipDeviceListener() { override fun onConnectDeviceComplete() {} - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { + override fun onCommissioningComplete(nodeId: Long, errorCode: Long) { Log.d(TAG, "onCommissioningComplete for nodeId $nodeId: $errorCode") } @@ -100,7 +100,13 @@ class OpCredClientFragment : Fragment() { val attributeId = attribute.id val devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } ChipClient.getDeviceController(requireContext()) .readPath( @@ -137,7 +143,13 @@ class OpCredClientFragment : Fragment() { private suspend fun sendRemoveFabricsBtnClick(fabricIndex: UInt) { val devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } // TODO : Need to be implement poj-to-tlv val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt index 87735856fa4844..13caa7b50ea09a 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt @@ -32,6 +32,7 @@ import chip.devicecontroller.model.AttributeWriteRequest import chip.devicecontroller.model.ChipAttributePath import chip.devicecontroller.model.ChipEventPath import chip.devicecontroller.model.NodeState +import chip.devicecontroller.model.Status import com.google.chip.chiptool.ChipClient import com.google.chip.chiptool.GenericChipDeviceListener import com.google.chip.chiptool.R @@ -113,6 +114,14 @@ class OtaProviderClientFragment : Fragment() { val attributeId = ClusterIDMapping.AccessControl.Attribute.Acl.id val attributePath = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } deviceController.readAttributePath( object : ReportCallback { override fun onError( @@ -135,7 +144,7 @@ class OtaProviderClientFragment : Fragment() { requireActivity().runOnUiThread { showAddAccessControlDialog(tlv) } } }, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, listOf(attributePath), 0 ) @@ -216,6 +225,15 @@ class OtaProviderClientFragment : Fragment() { newEntry.toTlv(AnonymousTag, tlvWriter) tlvWriter.endArray() + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.write( object : WriteAttributesCallback { override fun onError(attributePath: ChipAttributePath?, e: Exception?) { @@ -223,12 +241,12 @@ class OtaProviderClientFragment : Fragment() { showMessage("Error : ${e.toString()}") } - override fun onResponse(attributePath: ChipAttributePath?) { + override fun onResponse(attributePath: ChipAttributePath, status: Status) { Log.d(TAG, "onResponse") - showMessage("write Success") + showMessage("$attributePath : Write response: $status") } }, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, listOf( AttributeWriteRequest.newInstance( 0, @@ -248,6 +266,14 @@ class OtaProviderClientFragment : Fragment() { val clusterId = ClusterIDMapping.OtaSoftwareUpdateRequestor.ID val attributeId = attribute.id val path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } deviceController.readAttributePath( object : ReportCallback { override fun onError( @@ -278,7 +304,7 @@ class OtaProviderClientFragment : Fragment() { showMessage("OtaSoftwareUpdateRequestor ${attribute.name} value: $value") } }, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, listOf(path), 0 ) @@ -343,6 +369,15 @@ class OtaProviderClientFragment : Fragment() { val writeRequest = AttributeWriteRequest.newInstance(endpoint, clusterId, attributeId, tlv) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.write( object : WriteAttributesCallback { override fun onError(attributePath: ChipAttributePath?, e: Exception?) { @@ -350,12 +385,12 @@ class OtaProviderClientFragment : Fragment() { showMessage("error : ${e.toString()}") } - override fun onResponse(attributePath: ChipAttributePath?) { + override fun onResponse(attributePath: ChipAttributePath, status: Status) { Log.d(TAG, "onResponse") - showMessage("write success") + showMessage("$attributePath : Write response: $status") } }, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, listOf(writeRequest), 0, 0 @@ -460,11 +495,17 @@ class OtaProviderClientFragment : Fragment() { private suspend fun sendAnnounceOTAProviderBtnClick() { requireActivity().runOnUiThread { updateOTAStatusBtnClick() } + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val otaRequestCluster = - ChipClusters.OtaSoftwareUpdateRequestorCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - OTA_REQUESTER_ENDPOINT_ID - ) + ChipClusters.OtaSoftwareUpdateRequestorCluster(devicePtr, OTA_REQUESTER_ENDPOINT_ID) otaRequestCluster.announceOTAProvider( object : DefaultClusterCallback { override fun onSuccess() { @@ -641,7 +682,7 @@ class OtaProviderClientFragment : Fragment() { } inner class ChipControllerCallback : GenericChipDeviceListener() { - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { + override fun onCommissioningComplete(nodeId: Long, errorCode: Long) { Log.d(TAG, "onCommissioningComplete for nodeId $nodeId: $errorCode") showMessage("Address update complete for nodeId $nodeId with code $errorCode") } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt index cad12a5a54bc98..88d9ed63c4f91e 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt @@ -155,7 +155,13 @@ class SensorClientFragment : Fragment() { val clusterName = binding.clusterNameSpinner.selectedItem.toString() val clusterId = CLUSTERS[clusterName]!!["clusterId"] as Long val attributeId = CLUSTERS[clusterName]!!["attributeId"] as Long - val device = ChipClient.getConnectedDevicePointer(requireContext(), deviceId) + val device = + try { + ChipClient.getConnectedDevicePointer(requireContext(), deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return + } val callback = makeReadCallback(clusterName, false) deviceController.readAttributePath( @@ -177,7 +183,13 @@ class SensorClientFragment : Fragment() { val clusterName = binding.clusterNameSpinner.selectedItem.toString() val clusterId = CLUSTERS[clusterName]!!["clusterId"] as Long val attributeId = CLUSTERS[clusterName]!!["attributeId"] as Long - val device = ChipClient.getConnectedDevicePointer(requireContext(), deviceId) + val device = + try { + ChipClient.getConnectedDevicePointer(requireContext(), deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return + } val callback = makeReadCallback(clusterName, true) deviceController.subscribeToAttributePath( diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt index 1978951e02e210..2ffbec50c746a2 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt @@ -16,7 +16,7 @@ import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope import chip.devicecontroller.ChipDeviceController import chip.devicecontroller.ChipIdLookup -import chip.devicecontroller.InvokeCallback +import chip.devicecontroller.ExtendableInvokeCallback import chip.devicecontroller.ReportCallback import chip.devicecontroller.ResubscriptionAttemptCallback import chip.devicecontroller.SubscriptionEstablishedCallback @@ -26,7 +26,10 @@ import chip.devicecontroller.model.ChipAttributePath import chip.devicecontroller.model.ChipEventPath import chip.devicecontroller.model.ChipPathId import chip.devicecontroller.model.InvokeElement +import chip.devicecontroller.model.InvokeResponseData +import chip.devicecontroller.model.NoInvokeResponseData import chip.devicecontroller.model.NodeState +import chip.devicecontroller.model.Status import com.google.chip.chiptool.ChipClient import com.google.chip.chiptool.R import com.google.chip.chiptool.databinding.WildcardFragmentBinding @@ -56,6 +59,8 @@ class WildcardFragment : Fragment() { private val attributePath = ArrayList() private val eventPath = ArrayList() + private val writePath = ArrayList() + private val invokePath = ArrayList() private val subscribeIdList = ArrayList() private val reportCallback = @@ -88,29 +93,47 @@ class WildcardFragment : Fragment() { private val writeAttributeCallback = object : WriteAttributesCallback { + var viewText = "" + override fun onError(attributePath: ChipAttributePath?, ex: Exception?) { Log.e(TAG, "Report error for $attributePath: $ex") + viewText += "onError : $attributePath - $ex\n" } - override fun onResponse(attributePath: ChipAttributePath?) { - val text = "$attributePath : Write Success" - requireActivity().runOnUiThread { binding.outputTv.text = text } + override fun onResponse(attributePath: ChipAttributePath, status: Status) { + viewText += "$attributePath : Write response: $status\n" } override fun onDone() { - Log.i(TAG, "write attribute Done") + requireActivity().runOnUiThread { + binding.outputTv.text = viewText + viewText = "" + } } } - private val invokeCallback = - object : InvokeCallback { + private val extendableInvokeCallback = + object : ExtendableInvokeCallback { + var viewText = "" + override fun onError(e: java.lang.Exception?) { + viewText += "Invoke onError : $e\n" Log.e(TAG, "Report error", e) } - override fun onResponse(invokeElement: InvokeElement?, successCode: Long) { - val text = "Invoke Response : $invokeElement, $successCode" - requireActivity().runOnUiThread { binding.outputTv.text = text } + override fun onResponse(invokeResponseData: InvokeResponseData?) { + viewText += "Invoke Response : $invokeResponseData\n" + } + + override fun onNoResponse(noInvokeResponseData: NoInvokeResponseData?) { + viewText += "Invoke onNoResponse : $noInvokeResponseData\n" + } + + override fun onDone() { + requireActivity().runOnUiThread { + binding.outputTv.text = viewText + viewText = "" + } } } @@ -122,41 +145,27 @@ class WildcardFragment : Fragment() { _binding = WildcardFragmentBinding.inflate(inflater, container, false) scope = viewLifecycleOwner.lifecycleScope - binding.selectTypeRadioGroup.setOnCheckedChangeListener { _, i -> - val readBtnOn = (i == R.id.readRadioBtn) - val subscribeBtnOn = (i == R.id.subscribeRadioBtn) - val writeBtnOn = (i == R.id.writeRadioBtn) - val invokeBtnOn = (i == R.id.invokeRadioBtn) - - binding.addLayout.visibility = getVisibility(readBtnOn || subscribeBtnOn) - binding.attributeIdLabel.visibility = getVisibility(readBtnOn || subscribeBtnOn || writeBtnOn) - binding.attributeIdEd.visibility = getVisibility(readBtnOn || subscribeBtnOn || writeBtnOn) - binding.eventIdLabel.visibility = getVisibility(readBtnOn || subscribeBtnOn) - binding.eventIdEd.visibility = getVisibility(readBtnOn || subscribeBtnOn) - binding.commandIdLabel.visibility = getVisibility(invokeBtnOn) - binding.commandIdEd.visibility = getVisibility(invokeBtnOn) - binding.isUrgentLabel.visibility = getVisibility(subscribeBtnOn) - binding.isUrgentSp.visibility = getVisibility(subscribeBtnOn) - binding.shutdownSubscriptionBtn.visibility = getVisibility(subscribeBtnOn) - } + val writeTypeSpinnerAdapter = + ArrayAdapter( + requireActivity(), + android.R.layout.simple_spinner_dropdown_item, + TLV_MAP.keys.toList() + ) + binding.writeValueTypeSp.adapter = writeTypeSpinnerAdapter - binding.sendBtn.setOnClickListener { - if (binding.readRadioBtn.isChecked) { - showReadDialog() - } else if (binding.subscribeRadioBtn.isChecked) { - showSubscribeDialog() - } else if (binding.writeRadioBtn.isChecked) { - showWriteDialog() - } else if (binding.invokeRadioBtn.isChecked) { - showInvokeDialog() - } + binding.selectTypeRadioGroup.setOnCheckedChangeListener { _, radioBtnId -> + setVisibilityEachView(radioBtnId) } + binding.sendBtn.setOnClickListener { showDialog() } + binding.shutdownSubscriptionBtn.setOnClickListener { showShutdownSubscriptionDialog() } - binding.addAttributeBtn.setOnClickListener { addPathList(ATTRIBUTE) } - binding.addEventBtn.setOnClickListener { addPathList(EVENT) } + binding.addAttributeBtn.setOnClickListener { addPathList(SendType.ATTRIBUTE) } + binding.addEventBtn.setOnClickListener { addPathList(SendType.EVENT) } + binding.addListBtn.setOnClickListener { addRequest() } binding.resetBtn.setOnClickListener { resetPath() } + binding.writeInvokeresetBtn.setOnClickListener { resetPath() } addressUpdateFragment = childFragmentManager.findFragmentById(R.id.addressUpdateFragment) as AddressUpdateFragment @@ -164,6 +173,58 @@ class WildcardFragment : Fragment() { return binding.root } + private fun setVisibilityEachView(radioBtnId: Int) { + val readBtnOn = (radioBtnId == R.id.readRadioBtn) + val subscribeBtnOn = (radioBtnId == R.id.subscribeRadioBtn) + val writeBtnOn = (radioBtnId == R.id.writeRadioBtn) + val invokeBtnOn = (radioBtnId == R.id.invokeRadioBtn) + + binding.addAttributeBtn.visibility = getVisibility(readBtnOn || subscribeBtnOn) + binding.addEventBtn.visibility = getVisibility(readBtnOn || subscribeBtnOn) + binding.resetBtn.visibility = getVisibility(readBtnOn || subscribeBtnOn) + binding.attributeIdLabel.visibility = getVisibility(readBtnOn || subscribeBtnOn || writeBtnOn) + binding.attributeIdEd.visibility = getVisibility(readBtnOn || subscribeBtnOn || writeBtnOn) + binding.eventIdLabel.visibility = getVisibility(readBtnOn || subscribeBtnOn) + binding.eventIdEd.visibility = getVisibility(readBtnOn || subscribeBtnOn) + binding.addListBtn.visibility = getVisibility(writeBtnOn || invokeBtnOn) + binding.commandIdLabel.visibility = getVisibility(invokeBtnOn) + binding.commandIdEd.visibility = getVisibility(invokeBtnOn) + binding.isUrgentLabel.visibility = getVisibility(subscribeBtnOn) + binding.isUrgentSp.visibility = getVisibility(subscribeBtnOn) + binding.writeValueLabel.visibility = getVisibility(writeBtnOn) + binding.writeValueEd.visibility = getVisibility(writeBtnOn) + binding.writeValueTypeLabel.visibility = getVisibility(writeBtnOn) + binding.writeValueTypeSp.visibility = getVisibility(writeBtnOn) + binding.dataVersionLabel.visibility = getVisibility(writeBtnOn) + binding.dataVersionEd.visibility = getVisibility(writeBtnOn) + binding.invokeValueLabel.visibility = getVisibility(invokeBtnOn) + binding.invokeValueEd.visibility = getVisibility(invokeBtnOn) + binding.shutdownSubscriptionBtn.visibility = getVisibility(subscribeBtnOn) + binding.writeInvokeresetBtn.visibility = getVisibility(writeBtnOn || invokeBtnOn) + + resetPath() + } + + private fun showDialog() { + if (binding.readRadioBtn.isChecked) { + showReadDialog() + } else if (binding.subscribeRadioBtn.isChecked) { + showSubscribeDialog() + } else if (binding.writeRadioBtn.isChecked) { + showWriteDialog() + } else if (binding.invokeRadioBtn.isChecked) { + showInvokeDialog() + } + } + + private fun addRequest() { + if (binding.writeRadioBtn.isChecked) { + addWriteRequest() + } else { + addInvokeRequest() + } + } + private fun getVisibility(isShowing: Boolean): Int { return if (isShowing) { View.VISIBLE @@ -172,7 +233,7 @@ class WildcardFragment : Fragment() { } } - private fun addPathList(type: Int) { + private fun addPathList(type: SendType) { val endpointId = getChipPathIdForText(binding.endpointIdEd.text.toString()) val clusterId = getChipPathIdForText(binding.clusterIdEd.text.toString()) val attributeId = getChipPathIdForText(binding.attributeIdEd.text.toString()) @@ -182,9 +243,9 @@ class WildcardFragment : Fragment() { (binding.subscribeRadioBtn.isChecked) && (binding.isUrgentSp.selectedItem.toString().toBoolean()) - if (type == ATTRIBUTE) { + if (type == SendType.ATTRIBUTE) { attributePath.add(ChipAttributePath.newInstance(endpointId, clusterId, attributeId)) - } else if (type == EVENT) { + } else if (type == SendType.EVENT) { eventPath.add(ChipEventPath.newInstance(endpointId, clusterId, eventId, isUrgent)) } updateAddListView() @@ -193,6 +254,8 @@ class WildcardFragment : Fragment() { private fun resetPath() { attributePath.clear() eventPath.clear() + writePath.clear() + invokePath.clear() updateAddListView() } @@ -204,6 +267,12 @@ class WildcardFragment : Fragment() { for (event in eventPath) { builder.append("event($event)\n") } + for (write in writePath) { + builder.append("WritePath($write)\n") + } + for (invoke in invokePath) { + builder.append("InvokePath($invoke)\n") + } binding.sendListView.text = builder.toString() } @@ -269,12 +338,18 @@ class WildcardFragment : Fragment() { "ResubscriptionAttempt terminationCause:$terminationCause, nextResubscribeIntervalMsec:$nextResubscribeIntervalMsec" ) } - + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return + } deviceController.subscribeToPath( subscriptionEstablishedCallback, resubscriptionAttemptCallback, reportCallback, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, attributePath.ifEmpty { null }, eventPath.ifEmpty { null }, minInterval, @@ -287,9 +362,16 @@ class WildcardFragment : Fragment() { } private suspend fun read(isFabricFiltered: Boolean, eventMin: Long?) { + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return + } deviceController.readPath( reportCallback, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, attributePath.ifEmpty { null }, eventPath.ifEmpty { null }, isFabricFiltered, @@ -298,13 +380,11 @@ class WildcardFragment : Fragment() { ) } - private suspend fun write( - writeValueType: String, - writeValue: String, - dataVersion: Int?, - timedRequestTimeoutMs: Int, - imTimeoutMs: Int - ) { + private fun addWriteRequest() { + val writeValue = binding.writeValueEd.text.toString() + val writeValueType = binding.writeValueTypeSp.selectedItem.toString() + val dataVersion = binding.dataVersionEd.text.toString() + val endpointId = if (!addressUpdateFragment.isGroupId()) { getChipPathIdForText(binding.endpointIdEd.text.toString()) @@ -315,10 +395,10 @@ class WildcardFragment : Fragment() { val attributeId = getChipPathIdForText(binding.attributeIdEd.text.toString()) val version = - if (dataVersion == null) { + if (dataVersion.isEmpty()) { Optional.empty() } else { - Optional.of(dataVersion) + Optional.of(dataVersion.toInt()) } lateinit var writeRequest: AttributeWriteRequest @@ -350,20 +430,15 @@ class WildcardFragment : Fragment() { version ) } - - deviceController.write( - writeAttributeCallback, - addressUpdateFragment.getDevicePointer(requireContext()), - listOf(writeRequest), - timedRequestTimeoutMs, - imTimeoutMs - ) + writePath.add(writeRequest) + updateAddListView() } - private suspend fun invoke(invokeJson: String, timedRequestTimeoutMs: Int, imTimeoutMs: Int) { + private fun addInvokeRequest() { val endpointId = getChipPathIdForText(binding.endpointIdEd.text.toString()) val clusterId = getChipPathIdForText(binding.clusterIdEd.text.toString()) val commandId = getChipPathIdForText(binding.commandIdEd.text.toString()) + val invokeJson = binding.invokeValueEd.text.toString() val jsonString = invokeJson.ifEmpty { "{}" } val invokeElement = @@ -378,10 +453,39 @@ class WildcardFragment : Fragment() { } else { InvokeElement.newInstance(endpointId, clusterId, commandId, null, jsonString) } - deviceController.invoke( - invokeCallback, - addressUpdateFragment.getDevicePointer(requireContext()), - invokeElement, + invokePath.add(invokeElement) + updateAddListView() + } + + private suspend fun write(timedRequestTimeoutMs: Int, imTimeoutMs: Int) { + val devicePtr = + try { + addressUpdateFragment.getDevicePointer(requireContext()) + } catch (e: IllegalStateException) { + Log.d(TAG, "getDevicePointer exception", e) + return + } + deviceController.write( + writeAttributeCallback, + devicePtr, + writePath, + timedRequestTimeoutMs, + imTimeoutMs + ) + } + + private suspend fun invoke(timedRequestTimeoutMs: Int, imTimeoutMs: Int) { + val devicePtr = + try { + addressUpdateFragment.getDevicePointer(requireContext()) + } catch (e: IllegalStateException) { + Log.d(TAG, "getDevicePointer exception", e) + return + } + deviceController.extendableInvoke( + extendableInvokeCallback, + devicePtr, + invokePath, timedRequestTimeoutMs, imTimeoutMs ) @@ -426,31 +530,14 @@ class WildcardFragment : Fragment() { private fun showWriteDialog() { binding.outputTv.text = "" val dialogView = requireActivity().layoutInflater.inflate(R.layout.write_dialog, null) - val writeValueTypeSp = dialogView.findViewById(R.id.writeValueTypeSp) - val spinnerAdapter = - ArrayAdapter( - requireActivity(), - android.R.layout.simple_spinner_dropdown_item, - TLV_MAP.keys.toList() - ) - writeValueTypeSp.adapter = spinnerAdapter val dialog = AlertDialog.Builder(requireContext()).apply { setView(dialogView) }.create() dialogView.findViewById