diff --git a/.clang-tidy b/.clang-tidy index cda8ea53a5f4cc..1998473bf95879 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ --- -Checks: 'bugprone-*,-bugprone-not-null-terminated-result,-bugprone-suspicious-memory-comparison,-bugprone-argument-comment,-bugprone-unused-return-value,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-bugprone-macro-parentheses,-bugprone-forward-declaration-namespace,-bugprone-forwarding-reference-overload,-bugprone-undelegated-constructor,-bugprone-sizeof-expression,-bugprone-implicit-widening-of-multiplication-result,-bugprone-too-small-loop-variable,-bugprone-narrowing-conversions,-bugprone-misplaced-widening-cast,-bugprone-suspicious-include,-bugprone-signed-char-misuse,-bugprone-copy-constructor-init,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-core.NullDereference,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-core.uninitialized.Branch,-clang-analyzer-optin.performance,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-cplusplus.Move,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-nullability.NullablePassedToNonnull,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-unix.cstring.NullArg,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-nullability.NullPassedToNonnull,-clang-analyzer-unix.Malloc,-clang-analyzer-valist.Unterminated,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-diagnostic-implicit-int-conversion' +Checks: 'bugprone-*,-bugprone-not-null-terminated-result,-bugprone-suspicious-memory-comparison,-bugprone-argument-comment,-bugprone-unused-return-value,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-bugprone-macro-parentheses,-bugprone-forward-declaration-namespace,-bugprone-forwarding-reference-overload,-bugprone-undelegated-constructor,-bugprone-sizeof-expression,-bugprone-implicit-widening-of-multiplication-result,-bugprone-too-small-loop-variable,-bugprone-narrowing-conversions,-bugprone-misplaced-widening-cast,-bugprone-suspicious-include,-bugprone-signed-char-misuse,-bugprone-copy-constructor-init,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-core.NullDereference,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-core.uninitialized.Branch,-clang-analyzer-optin.performance,-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-cplusplus.Move,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-nullability.NullablePassedToNonnull,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-unix.cstring.NullArg,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-nullability.NullPassedToNonnull,-clang-analyzer-unix.Malloc,-clang-analyzer-valist.Unterminated,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-diagnostic-implicit-int-conversion' WarningsAsErrors: '*' HeaderFilterRegex: '(src|examples|zzz_generated|credentials)' diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index db98809f615b97..8c987aacb69624 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -95,6 +95,7 @@ ATWC AudioOutput auth AuthMode +autoApplyImage autocompletion autoconnect autocrlf @@ -912,6 +913,7 @@ outgoingCommands OxygenConcentrationMeasurement OzoneConcentrationMeasurement PAA +PAAs PacketBuffer PAI PairDevice @@ -1113,6 +1115,7 @@ showDocumentation shubhamdp SIGINT SiLabs +Silabs's SiliconLabs SimpleFileExFlags SimpleLink @@ -1435,3 +1438,4 @@ UTF localedef nameserver nmcli +tsan diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 84b0c28d9873e5..92adeac81dd3cb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -160,13 +160,22 @@ jobs: for BUILD_TYPE in gcc_release clang; do case $BUILD_TYPE in "gcc_release") GN_ARGS='is_debug=false';; - "clang") GN_ARGS='is_clang=true pw_command_launcher="`pwd`/../scripts/helpers/clang-tidy-launcher.py"';; + "clang") GN_ARGS='is_clang=true';; esac - scripts/build/gn_gen.sh --args="$GN_ARGS" - scripts/run_in_build_env.sh "ninja -C ./out" - scripts/tests/gn_tests.sh + BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh done + - name: Clang-tidy validation + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/run-clang-tidy-on-compile-commands.py \ + --no-log-timestamps \ + --compile-database out/clang/compile_commands.json \ + check \ + " - name: Run Tests with sanitizers timeout-minutes: 30 env: @@ -189,13 +198,12 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --no-log-timestamps \ - --target linux-x64-all-clusters-ipv6only \ - --target linux-x64-chip-tool-ipv6only \ - --target linux-x64-minmdns-ipv6only \ + --target linux-x64-all-clusters-ipv6only-clang \ + --target linux-x64-chip-tool-ipv6only-clang \ + --target linux-x64-minmdns-ipv6only-clang \ --target linux-x64-rpc-console \ build \ " - - name: Run fake linux tests with build_examples timeout-minutes: 15 run: | @@ -321,20 +329,36 @@ jobs: scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" - name: Setup Build, Run Build and Run Tests timeout-minutes: 120 - # Just go ahead and do the "all" build; on Darwin that's fairly - # fast. If this ever becomes slow, we can think about ways to do - # the examples-linux-standalone.yaml tests on darwin without too - # much code duplication. run: | - for BUILD_TYPE in clang python_lib; do + for BUILD_TYPE in default python_lib; do case $BUILD_TYPE in - "clang") GN_ARGS='is_clang=true target_os="all" is_asan=true pw_command_launcher="`pwd`/../scripts/helpers/clang-tidy-launcher.py"';; + # We want to build various standalone example apps + # (similar to what examples-linux-standalone.yaml + # does), so use target_os="all" to get those picked + # up as part of the "unified" build. But then to + # save CI resources we want to exclude a few + # redundant things: + # + # * the mbedtls build, since we don't really plan to + # use that on Darwin. + # * the "host clang" build, which uses the pigweed + # clang. + "default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false enable_host_gcc_mbedtls_build=false';; "python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';; esac - scripts/build/gn_gen.sh --args="$GN_ARGS" - scripts/run_in_build_env.sh "ninja -C ./out" - scripts/tests/gn_tests.sh + BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh done + - name: Clang-tidy validation + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/run-clang-tidy-on-compile-commands.py \ + --no-log-timestamps \ + --compile-database out/default/compile_commands.json \ + check \ + " - name: Uploading diagnostic logs uses: actions/upload-artifact@v2 if: ${{ failure() }} && ${{ !env.ACT }} diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 598995649776ba..70d47f833cfb1e 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -26,7 +26,7 @@ jobs: # TODO ESP32 https://github.com/project-chip/connectedhomeip/issues/1510 esp32: name: ESP32 - timeout-minutes: 80 + timeout-minutes: 90 runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' @@ -111,7 +111,7 @@ jobs: esp32_1: name: ESP32_1 - timeout-minutes: 70 + timeout-minutes: 90 runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index bcfa353c6c5aee..fc6b784a92bfe3 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -90,8 +90,7 @@ jobs: - name: Build example Standalone All Clusters Server timeout-minutes: 5 run: | - scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/all_clusters_debug \ - chip_bypass_rendezvous=true + scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/all_clusters_debug .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ linux debug all-clusters-app \ out/all_clusters_debug/chip-all-clusters-app \ diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 48db1803792002..715d858646040a 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -111,7 +111,7 @@ jobs: /tmp/bloat_reports/ - name: Build example nRF Connect SDK Lighting App on nRF52840 DK with RPC if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' - timeout-minutes: 10 + timeout-minutes: 20 run: | scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk_nrf52840 -DOVERLAY_CONFIG=rpc.overlay .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6dab37ab7a264e..018d102b583cfc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -274,7 +274,7 @@ jobs: - name: Run Tests timeout-minutes: 30 run: | - scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset -- -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout' + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang/chip-all-clusters-app --factoryreset --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' - name: Uploading core files uses: actions/upload-artifact@v2 if: ${{ failure() }} && ${{ !env.ACT }} @@ -356,7 +356,7 @@ jobs: - name: Run Tests timeout-minutes: 30 run: | - scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset --app-params "--discriminator 3840 --interface-id -1" -- -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout' + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang/chip-all-clusters-app --factoryreset --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' - name: Uploading core files uses: actions/upload-artifact@v2 if: ${{ failure() }} && ${{ !env.ACT }} diff --git a/config/ameba/args.gni b/config/ameba/args.gni index fe49e059010256..57c21e2d02e8c2 100755 --- a/config/ameba/args.gni +++ b/config/ameba/args.gni @@ -29,7 +29,6 @@ chip_build_tests = false chip_inet_config_enable_tcp_endpoint = true chip_inet_config_enable_udp_endpoint = true -chip_bypass_rendezvous = false chip_config_network_layer_ble = true custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba" diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index 7571426a4f78a0..48151240e39202 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -275,7 +275,6 @@ chip_gn_arg_bool ("chip_build_tests" CONFIG_CHIP_BUILD_TEST chip_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) chip_gn_arg_bool ("chip_build_libshell" CONFIG_CHIP_LIB_SHELL) chip_gn_arg_bool ("chip_with_platform_mbedtls" CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS) -chip_gn_arg_bool ("chip_bypass_rendezvous" CONFIG_CHIP_BYPASS_RENDEZVOUS) chip_gn_arg_bool ("chip_build_pw_rpc_lib" CONFIG_CHIP_PW_RPC) chip_gn_arg_bool ("chip_enable_data_model" CONFIG_CHIP_DATA_MODEL) if (CONFIG_CHIP_PW_RPC) diff --git a/config/nrfconnect/app/sample-defaults.conf b/config/nrfconnect/app/sample-defaults.conf index 8ad73904dfb977..7145c2d7b704c9 100644 --- a/config/nrfconnect/app/sample-defaults.conf +++ b/config/nrfconnect/app/sample-defaults.conf @@ -22,6 +22,7 @@ CONFIG_STD_CPP14=y CONFIG_LOG=y CONFIG_LOG_MODE_MINIMAL=y CONFIG_MATTER_LOG_LEVEL_DBG=y +CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_PRINTK_SYNC=y CONFIG_ASSERT=y CONFIG_HW_STACK_PROTECTION=y @@ -107,3 +108,12 @@ CONFIG_MBEDTLS_POLY1305_C=n CONFIG_MBEDTLS_CHACHAPOLY_C=n CONFIG_MBEDTLS_GCM_C=n CONFIG_MBEDTLS_RSA_C=n + +# Disable not used shell modules +CONFIG_SENSOR_SHELL=n +CONFIG_DEVICE_SHELL=n +CONFIG_DATE_SHELL=n +CONFIG_DEVMEM_SHELL=n +CONFIG_MCUBOOT_SHELL=n +CONFIG_CLOCK_CONTROL_NRF_SHELL=n +CONFIG_FLASH_SHELL=n diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index e1b593e0f04b6f..bdc434f656a6e2 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -63,8 +63,8 @@ macro(chip_gn_arg_string ARG STRING) string(APPEND CHIP_GN_ARGS "--arg-string\n${ARG}\n${STRING}\n") endmacro() -macro(chip_gn_arg_bool ARG BOOLEAN) - if (${BOOLEAN}) +macro(chip_gn_arg_bool ARG) + if (${ARGN}) string(APPEND CHIP_GN_ARGS "--arg\n${ARG}\ntrue\n") else() string(APPEND CHIP_GN_ARGS "--arg\n${ARG}\nfalse\n") @@ -214,6 +214,10 @@ chip_gn_arg_bool ("chip_build_tests" CONFIG_CHIP_BUILD_TE chip_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) chip_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS) chip_gn_arg_bool ("chip_build_libshell" CONFIG_CHIP_LIB_SHELL) +chip_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 1) +chip_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3) +chip_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4) +chip_gn_arg_bool ("chip_automation_logging" "false") if (CONFIG_CHIP_ROTATING_DEVICE_ID) chip_gn_arg_bool("chip_enable_rotating_device_id" "true") diff --git a/config/standalone/CHIPProjectConfig.h b/config/standalone/CHIPProjectConfig.h index 4b008de5f09d3b..919897fcf7ecae 100644 --- a/config/standalone/CHIPProjectConfig.h +++ b/config/standalone/CHIPProjectConfig.h @@ -69,6 +69,14 @@ #define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 4 #endif +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1 +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0" +#endif + // // Default of 8 ECs is not sufficient for some of the unit tests // that try to validate multiple simultaneous interactions. diff --git a/credentials/development/fetch-development-paa-certs-from-dcl.py b/credentials/development/fetch-development-paa-certs-from-dcl.py new file mode 100644 index 00000000000000..7ac67b275c220f --- /dev/null +++ b/credentials/development/fetch-development-paa-certs-from-dcl.py @@ -0,0 +1,131 @@ +#!/usr/bin/python + +# +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Script that was used to fetch CHIP Development Product Attestation Authority (PAA) +# certificates from DCL. +# The script expects the path to the dcld tool binary as an input argument. +# +# Usage example when the script is run from the CHIP SDK root directory: +# python ./credentials/development/fetch-development-paa-certs-from-dcl.py /path/to/dcld +# +# The result will be stored in: +# credentials/development/paa-root-certs +# + +import os +import sys +import subprocess +import copy +import re +from cryptography.hazmat.primitives import serialization +from cryptography import x509 + + +def parse_paa_root_certs(cmdpipe, paa_list): + """ + example output of a query to all x509 root certs in DCL: + + certs: + - subject: CN=Non Production ONLY - XFN PAA Class 3 + subject_key_id: F8:99:A9:D5:AD:71:71:E4:C3:81:7F:14:10:7F:78:F0:D9:F7:62:E9 + - subject: CN=Matter Development PAA + subject_key_id: FA:92:CF:9:5E:FA:42:E1:14:30:65:16:32:FE:FE:1B:2C:77:A7:C8 + - subject: CN=Matter PAA 1,O=Google,C=US,1.3.6.1.4.1.37244.2.1=#130436303036 + subject_key_id: B0:0:56:81:B8:88:62:89:62:80:E1:21:18:A1:A8:BE:9:DE:93:21 + - subject: CN=Matter Test PAA,1.3.6.1.4.1.37244.2.1=#130431323544 + subject_key_id: E2:90:8D:36:9C:3C:A3:C1:13:BB:9:E2:4D:C1:CC:C5:A6:66:91:D4 + + Brief: + This method will search for the first line that contains ': ' char sequence. + From there, it assumes every 2 lines contain subject and subject key id info of + a valid PAA root certificate. + The paa_list parameter will contain a list of all valid PAA Root certificates + from DCL. + """ + + result = {} + + while True: + line = cmdpipe.stdout.readline() + if not line: + break + else: + if b': ' in line: + key, value = line.split(b': ') + result[key.strip(b' -')] = value.strip() + parse_paa_root_certs.counter += 1 + if parse_paa_root_certs.counter % 2 == 0: + paa_list.append(copy.deepcopy(result)) + + +def write_paa_root_cert(cmdpipe, subject): + filename = 'paa-root-certs/dcld_mirror_' + \ + re.sub('[^a-zA-Z0-9_-]', '', re.sub('[=, ]', '_', subject)) + with open(filename + '.pem', 'wb+') as outfile: + while True: + line = cmdpipe.stdout.readline() + if not line: + break + else: + if b'pem_cert: |' in line: + while True: + line = cmdpipe.stdout.readline() + outfile.write(line.strip(b' \t')) + if b'-----END CERTIFICATE-----' in line: + break + # convert pem file to der + with open(filename + '.pem', 'rb') as infile: + pem_certificate = x509.load_pem_x509_certificate(infile.read()) + with open(filename + '.der', 'wb+') as outfile: + der_certificate = pem_certificate.public_bytes( + serialization.Encoding.DER) + outfile.write(der_certificate) + + +def main(): + if len(sys.argv) == 2: + dcld = sys.argv[1] + else: + sys.exit( + "Error: Please specify exactly one input argument; the path to the dcld tool binary") + + previous_dir = os.getcwd() + abspath = os.path.dirname(sys.argv[0]) + os.chdir(abspath) + + os.makedirs('paa-root-certs', exist_ok=True) + + cmdpipe = subprocess.Popen([dcld, 'query', 'pki', 'all-x509-root-certs'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + paa_list = [] + parse_paa_root_certs.counter = 0 + parse_paa_root_certs(cmdpipe, paa_list) + + for paa in paa_list: + cmdpipe = subprocess.Popen( + [dcld, 'query', 'pki', 'x509-cert', '-u', + paa[b'subject'].decode("utf-8"), '-k', paa[b'subject_key_id'].decode("utf-8")], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + write_paa_root_cert(cmdpipe, paa[b'subject'].decode("utf-8")) + + os.chdir(previous_dir) + + +if __name__ == "__main__": + main() diff --git a/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.der b/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.der new file mode 100644 index 00000000000000..cb287bf8862bd4 Binary files /dev/null and b/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.der differ diff --git a/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.pem b/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.pem new file mode 100644 index 00000000000000..04c5822162ee48 --- /dev/null +++ b/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAgIITqjoMYLUHBwwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMTA2Mjgx +NDIzNDNaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABLbLY3KIfyko9brIGqnZOuJDHK2p154kL2UXfvnO2TKijs0Duq9qj8oYShpQ +NUKWDUU/MD8fGUIddR6Pjxqam3WjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBQ +qoAC9NkyqaAFOPZTaK0P/8jvu8m+t9pWmDXPmqdRDgIgI7rI/g8j51RFtlM5CBpH +mUkpxyqvChVI1A0DTVFLJd4= +-----END CERTIFICATE----- diff --git a/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.der b/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.der new file mode 100644 index 00000000000000..44898404bc0a27 Binary files /dev/null and b/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.der differ diff --git a/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.pem b/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.pem new file mode 100644 index 00000000000000..119b901d2b128e --- /dev/null +++ b/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBkTCCATegAwIBAgIHC4+6qN2G7jAKBggqhkjOPQQDAjAaMRgwFgYDVQQDDA9N +YXR0ZXIgVGVzdCBQQUEwIBcNMjEwNjI4MTQyMzQzWhgPOTk5OTEyMzEyMzU5NTla +MBoxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQTBZMBMGByqGSM49AgEGCCqGSM49 +AwEHA0IABBDvAqgah7aBIfuo0xl4+AejF+UKqKgoRGgokUuTPejt1KXDnJ/3Gkzj +ZH/X9iZTt9JJX8ukwPR/h2iAA54HIEqjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEw +DgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR4XOcFuGuPTm/Hk6pgy0PqaWiC1TAf +BgNVHSMEGDAWgBR4XOcFuGuPTm/Hk6pgy0PqaWiC1TAKBggqhkjOPQQDAgNIADBF +AiEAue/bPqBqUuwL8B5h2u0sLRVt22zwFBAdq3mPrAX6R+UCIGAGHT411g2dSw1E +ja12EvfoXFguP8MS3Bh5TdNzcV5d +-----END CERTIFICATE----- diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.der new file mode 100644 index 00000000000000..56f4e1d436ec53 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.pem new file mode 100644 index 00000000000000..b55bd3978d74d2 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBoDCCAUagAwIBAgIIV9Oi0B4xgZAwCgYIKoZIzj0EAwIwITEfMB0GA1UEAwwW +TWF0dGVyIERldmVsb3BtZW50IFBBQTAgFw0yMTA2MjgxNDIzNDNaGA85OTk5MTIz +MTIzNTk1OVowITEfMB0GA1UEAwwWTWF0dGVyIERldmVsb3BtZW50IFBBQTBZMBMG +ByqGSM49AgEGCCqGSM49AwEHA0IABBsPJZQuPZKr1nBMGieBoDjsUyEsTatYsL48 +QL37SSMjQhx53MetcBgQBxINyG8KiSU9iZPrN6tlLvjbE3XlsUWjZjBkMBIGA1Ud +EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBT6ks8JXvpC +4RQwZRYy/v4bLHenyDAfBgNVHSMEGDAWgBT6ks8JXvpC4RQwZRYy/v4bLHenyDAK +BggqhkjOPQQDAgNIADBFAiBQp5AzZLZT/w6kY9xoSobdJccxo57+s8IM0t7RtmB+ +LwIhAK/U7UtqmeX4xVIdcB68+f1TuTlP2A/FmZL/Plu7tgo1 +-----END CERTIFICATE----- diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.der new file mode 100644 index 00000000000000..9b018d8fe77a3d Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.pem new file mode 100644 index 00000000000000..a22831feda63f3 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB7TCCAZOgAwIBAgIBATAKBggqhkjOPQQDAjBLMQswCQYDVQQGEwJVUzEPMA0G +A1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFBIDExFDASBgorBgEEAYKi +fAIBDAQ2MDA2MCAXDTIxMTIwODIwMjYwM1oYDzIxMjExMjA4MjAyNjAzWjBLMQsw +CQYDVQQGEwJVUzEPMA0GA1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFB +IDExFDASBgorBgEEAYKifAIBDAQ2MDA2MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD +QgAE8iZX+exx8NDV7jYKorx3EcsD1gessexUTSimIfvFI2PySlReMjJDVCGIzXor +hTYFOzwMAx4b6ogNMIUmcW7uT6NmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAOBgNV +HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLAAVoG4iGKJYoDhIRihqL4J3pMhMB8GA1Ud +IwQYMBaAFLAAVoG4iGKJYoDhIRihqL4J3pMhMAoGCCqGSM49BAMCA0gAMEUCIQCV +c26cVlyqjhQfcgN3udpne6zZQdyVMNLRWZn3EENBkAIgasUeFU8zaUt8bKNWd0k+ +4RQp5Cp5wYzrE8AxJ9BiA/E= +-----END CERTIFICATE----- diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.der new file mode 100644 index 00000000000000..388fe3b6594076 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.pem new file mode 100644 index 00000000000000..bf9fa469f7397c --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByjCCAXCgAwIBAgIUFkdW6XaPDQDsJ3530eRkiOtYbWQwCgYIKoZIzj0EAwIw +MDEuMCwGA1UEAwwlTm9uIFByb2R1Y3Rpb24gT05MWSAtIFhGTiBQQUEgQ2xhc3Mg +MzAgFw0yMTEyMTQwMzI3MzZaGA8yMDUxMTIwNzAzMjczNlowMDEuMCwGA1UEAwwl +Tm9uIFByb2R1Y3Rpb24gT05MWSAtIFhGTiBQQUEgQ2xhc3MgMzBZMBMGByqGSM49 +AgEGCCqGSM49AwEHA0IABB+Unq8KdMuQ6xWFKtAVGreDGzDlyLrpuSIZ86eMswgu +4xvjijYN6iljia1HjxVTTRdieROa7mpoLD7qEUC5yjmjZjBkMBIGA1UdEwEB/wQI +MAYBAf8CAQEwHwYDVR0jBBgwFoAU+Jmp1a1xceTDgX8UEH948Nn3YukwHQYDVR0O +BBYEFPiZqdWtcXHkw4F/FBB/ePDZ92LpMA4GA1UdDwEB/wQEAwIBhjAKBggqhkjO +PQQDAgNIADBFAiBYIsjeauI2nDknU1ThEDzyGfg4F9tLSkiuTrTJGr5EqQIhAMFX +bxTzgOfx0RPgpEU8syFEYyXCBcv4hV14rWddc08G +-----END CERTIFICATE----- diff --git a/docs/guides/matter-repl.md b/docs/guides/matter-repl.md index 52e0c31ba271c2..89655045887095 100644 --- a/docs/guides/matter-repl.md +++ b/docs/guides/matter-repl.md @@ -224,23 +224,20 @@ example, you can run: It provides some extra options, for example: ``` - --app TEXT Local application to use, omit to use external apps, use - a path for a specific binary or use a filename to search - under the current matter checkout. - - --factoryreset Remove app config and repl configs (/tmp/chip* and - /tmp/repl*) before running the tests. - - --app-params TEXT The extra parameters passed to the device. - --script PATH Test script to use. - --help Show this message and exit. +optional arguments: + -h, --help show this help message and exit + --app APP Path to local application to use, omit to use external apps. + --factoryreset Remove app config and repl configs (/tmp/chip* and /tmp/repl*) before running the tests. + --app-args APP_ARGS The extra parameters passed to the device side app. + --script SCRIPT Path to the test script to use, omit to use the default test script (mobile-device-test.py). + --script-args SCRIPT_ARGS Arguments for the REPL test script ``` You can pass your own flags for mobile-device-test.py by appending them to the command line with two dashes, for example: ``` -./scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset -- -t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout +./scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang/chip-all-clusters-app --factoryreset --script-args "-t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout" ``` will pass `-t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout` to 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 a7b2a1a7b228da..245ad5d324e88c 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 @@ -1971,17 +1971,26 @@ server cluster MediaPlayback = 1286 { } server cluster ModeSelect = 80 { + bitmap ModeSelectFeature : BITMAP32 { + kDeponoff = 0x1; + } + struct ModeOptionStruct { CHAR_STRING<32> label = 0; INT8U mode = 1; INT32U semanticTag = 2; } - readonly attribute int8u currentMode = 0; - readonly attribute ModeOptionStruct supportedModes[] = 1; - attribute int8u onMode = 2; - readonly attribute int8u startUpMode = 3; - readonly attribute char_string<32> description = 4; + readonly attribute char_string<32> description = 0; + readonly attribute nullable enum16 standardNamespace = 1; + readonly attribute ModeOptionStruct supportedModes[] = 2; + readonly attribute int8u currentMode = 3; + attribute nullable int8u startUpMode = 4; + attribute nullable int8u onMode = 5; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; request struct ChangeToModeRequest { @@ -2262,6 +2271,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -2274,7 +2289,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; 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 513cf3c479e308..491c2d88690c48 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 @@ -7963,7 +7963,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "NVM", "singleton": 0, "bounded": 0, "defaultValue": "0x00", @@ -8032,6 +8032,51 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -8462,11 +8507,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -8477,11 +8522,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -8492,11 +8537,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -8889,6 +8934,66 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -10376,7 +10481,7 @@ "commands": [], "attributes": [ { - "name": "CurrentMode", + "name": "Description", "code": 0, "mfgCode": null, "side": "server", @@ -10384,19 +10489,19 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "Coffee", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "SupportedModes", + "name": "StandardNamespace", "code": 1, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -10406,12 +10511,12 @@ "reportableChange": 0 }, { - "name": "OnMode", + "name": "SupportedModes", "code": 2, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -10421,12 +10526,12 @@ "reportableChange": 0 }, { - "name": "StartUpMode", + "name": "CurrentMode", "code": 3, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "NVM", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -10436,15 +10541,90 @@ "reportableChange": 0 }, { - "name": "Description", + "name": "StartUpMode", "code": 4, "mfgCode": null, "side": "server", "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OnMode", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "Coffee", + "defaultValue": "255", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "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", + "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", + "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", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -14661,6 +14841,66 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 5642b9869fce69..0b333950067ca7 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -65,7 +65,6 @@ There are two commissioning modes supported by Ameba platform: 1. In "connectedhomeip/config/ameba/args.gni" - - set `chip_bypass_rendezvous = false` - Set `chip_config_network_layer_ble = true` 2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" @@ -82,7 +81,6 @@ There are two commissioning modes supported by Ameba platform: 1. In "connectedhomeip/config/ameba/args.gni" - - set `chip_bypass_rendezvous = false` - Set `chip_config_network_layer_ble = false` 2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" @@ -129,7 +127,7 @@ to be On or Off. - Launch the chip-rpc console after resetting Ameba board - $ python3 -m chip_rpc.console --device /dev/tty -b 115200 + $ chip-console --device /dev/tty -b 115200 - Get and Set lighting directly using the RPC console diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index f6e062ce40982a..9af884bd7fabfd 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -148,18 +148,14 @@ that are currently supported include `ESP32-DevKitC` (default), ## Commissioning and cluster control -Commissioning can be carried out using WiFi, BLE or Bypass. +Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. $ idf.py menuconfig -Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. If Rendezvous Mode is -ByPass then set the credentials of the WiFi Network (i.e. SSID and Password from -menuconfig). - -`idf.py menuconfig -> Component config -> CHIP Device Layer -> WiFi Station Options` +Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. NOTE: to avoid build error `undefined reference to 'chip::DevelopmentCerts::kDacPublicKey'`, set VID to @@ -319,7 +315,7 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console - python -m chip_rpc.console --device /dev/ttyUSB0 + chip-console --device /dev/ttyUSB0 From within the console you can then invoke rpcs: diff --git a/examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp b/examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp index 1578b7df5e911a..248bd9cab29d55 100644 --- a/examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp @@ -74,12 +74,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp index 888b6e01228d8c..6de5269640521c 100644 --- a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp @@ -28,10 +28,13 @@ #include "Globals.h" #include "LEDWidget.h" #include "WiFiWidget.h" +#include "esp_bt.h" #include "esp_check.h" #include "esp_err.h" #include "esp_heap_caps.h" #include "esp_log.h" +#include "esp_nimble_hci.h" +#include "nimble/nimble_port.h" #include "route_hook/esp_route_hook.h" #include #include @@ -114,9 +117,27 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_ ESP_LOGI(TAG, "CHIPoBLE disconnected"); break; - case DeviceEventType::kCommissioningComplete: + case DeviceEventType::kCommissioningComplete: { ESP_LOGI(TAG, "Commissioning complete"); - break; +#if CONFIG_BT_NIMBLE_ENABLED && CONFIG_DEINIT_BLE_ON_COMMISSIONING_COMPLETE + int ret = nimble_port_stop(); + if (ret == 0) + { + nimble_port_deinit(); + esp_err_t err = esp_nimble_hci_and_controller_deinit(); + err += esp_bt_mem_release(ESP_BT_MODE_BLE); + if (err == ESP_OK) + { + ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed"); + } + } + else + { + ESP_LOGW(TAG, "nimble_port_stop() failed"); + } +#endif + } + break; case DeviceEventType::kInterfaceIpAddressChanged: if ((event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV4_Assigned) || diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index b305e3c8863d6a..b1a935811f318b 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -51,8 +51,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_SOFTAP bool "Soft-AP" config RENDEZVOUS_MODE_BLE @@ -87,7 +85,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_SOFTAP default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_ON_NETWORK @@ -111,6 +108,11 @@ menu "Demo" help Each board has a status led, define its pin number. + config DEINIT_BLE_ON_COMMISSIONING_COMPLETE + bool "Disable and DeInit BLE on commissioning complete" + default y + help + Disable and deinit BLE and reclaim all its memory, once the commissioning is successful and Commissioning complete event is received in the application. endmenu menu "PW RPC Debug channel" diff --git a/examples/all-clusters-app/mbed/config.in b/examples/all-clusters-app/mbed/config.in index e1bc59c07a44b0..ecf3bb53b4623b 100644 --- a/examples/all-clusters-app/mbed/config.in +++ b/examples/all-clusters-app/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_OTA_REQUESTOR=y CONFIG_CHIP_DATA_MODEL=y diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt index 8d51e9c7e8fd27..ea6962845cdf1a 100644 --- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt @@ -73,8 +73,11 @@ target_sources(app PRIVATE ${GEN_DIR}/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp ${NRFCONNECT_COMMON}/util/LEDWidget.cpp) - chip_configure_data_model(app INCLUDE_SERVER ZAP_FILE ${ALL_CLUSTERS_COMMON_DIR}/all-clusters-app.zap ) + +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) +endif() diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index e7590fd6d575b9..2cc10a47512849 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -31,6 +31,10 @@ #include #include +#if CONFIG_CHIP_OTA_REQUESTOR +#include "OTAUtil.h" +#endif + #include #include #include @@ -127,9 +131,11 @@ CHIP_ERROR AppTask::Init() // Initialize CHIP server SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); ReturnErrorOnFailure(chip::Server::GetInstance().Init()); +#if CONFIG_CHIP_OTA_REQUESTOR + InitBasicOTARequestor(); +#endif ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE)); - InitOTARequestor(); // Add CHIP event handler and start CHIP thread. // Note that all the initialization code should happen prior to this point to avoid data races @@ -144,18 +150,6 @@ CHIP_ERROR AppTask::Init() return err; } -void AppTask::InitOTARequestor() -{ -#if CONFIG_CHIP_OTA_REQUESTOR - mOTAImageProcessor.SetOTADownloader(&mBDXDownloader); - mBDXDownloader.SetImageProcessorDelegate(&mOTAImageProcessor); - mOTARequestorDriver.Init(&mOTARequestor, &mOTAImageProcessor); - mOTARequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); - mOTARequestor.Init(chip::Server::GetInstance(), mOTARequestorStorage, mOTARequestorDriver, mBDXDownloader); - chip::SetRequestorInstance(&mOTARequestor); -#endif -} - CHIP_ERROR AppTask::StartApp() { ReturnErrorOnFailure(Init()); diff --git a/examples/all-clusters-app/nrfconnect/main/include/AppTask.h b/examples/all-clusters-app/nrfconnect/main/include/AppTask.h index b05a7d30ff3d3d..e7402653f7237c 100644 --- a/examples/all-clusters-app/nrfconnect/main/include/AppTask.h +++ b/examples/all-clusters-app/nrfconnect/main/include/AppTask.h @@ -19,14 +19,6 @@ #include -#if CONFIG_CHIP_OTA_REQUESTOR -#include -#include -#include -#include -#include -#endif - struct k_timer; class AppEvent; class LEDWidget; @@ -51,7 +43,6 @@ class AppTask CHIP_ERROR Init(); void DispatchEvent(AppEvent * aEvent); - void InitOTARequestor(); // statics needed to interact with zephyr C API static void CancelTimer(void); @@ -72,12 +63,4 @@ class AppTask bool mIsThreadProvisioned{ false }; bool mIsThreadEnabled{ false }; bool mHaveBLEConnections{ false }; - -#if CONFIG_CHIP_OTA_REQUESTOR - chip::DefaultOTARequestorStorage mOTARequestorStorage; - chip::DeviceLayer::GenericOTARequestorDriver mOTARequestorDriver; - chip::DeviceLayer::OTAImageProcessorImpl mOTAImageProcessor; - chip::BDXDownloader mBDXDownloader; - chip::OTARequestor mOTARequestor; -#endif }; diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index 097b604c564f99..8f534c5f6478df 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -661,6 +661,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } diff --git a/examples/bridge-app/esp32/README.md b/examples/bridge-app/esp32/README.md index df50e4becfce52..12ca5f4160fead 100644 --- a/examples/bridge-app/esp32/README.md +++ b/examples/bridge-app/esp32/README.md @@ -155,18 +155,14 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). ## Commissioning and cluster control -Commissioning can be carried out using WiFi, BLE or Bypass. +Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. $ idf.py menuconfig -Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. If Rendezvous Mode is -Bypass then set the credentials of the WiFi Network (i.e. SSID and Password from -menuconfig). - -`idf.py menuconfig -> Component config -> CHIP Device Layer -> WiFi Station Options` +Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. 2. Now flash the device with the same command as before. (Use the right `/dev` device) diff --git a/examples/bridge-app/esp32/main/CHIPDeviceManager.cpp b/examples/bridge-app/esp32/main/CHIPDeviceManager.cpp index f4be7aacd8bf08..add55587dd3eb7 100644 --- a/examples/bridge-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/bridge-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/bridge-app/esp32/main/Kconfig.projbuild b/examples/bridge-app/esp32/main/Kconfig.projbuild index 11f2471dad4d2e..5bb496b1599a43 100644 --- a/examples/bridge-app/esp32/main/Kconfig.projbuild +++ b/examples/bridge-app/esp32/main/Kconfig.projbuild @@ -6,8 +6,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -21,7 +19,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/examples/build_overrides/pigweed_environment.gni b/examples/build_overrides/pigweed_environment.gni new file mode 120000 index 00000000000000..bb2374b01537e6 --- /dev/null +++ b/examples/build_overrides/pigweed_environment.gni @@ -0,0 +1 @@ +../../build_overrides/pigweed_environment.gni \ No newline at end of file diff --git a/examples/chip-tool-darwin/templates/commands.zapt b/examples/chip-tool-darwin/templates/commands.zapt index 9355d72c0b6a5c..61ad1914a2abbd 100644 --- a/examples/chip-tool-darwin/templates/commands.zapt +++ b/examples/chip-tool-darwin/templates/commands.zapt @@ -207,7 +207,6 @@ private: {{/unless}} {{/if}} -{{#unless (isStrEqual chipCallback.name "Unsupported")}} {{#if isReportableAttribute}} class SubscribeAttribute{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}: public ModelCommand { @@ -236,7 +235,9 @@ public: params:params subscriptionEstablished: NULL reportHandler:^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { NSLog(@"{{asUpperCamelCase parent.name}}.{{asUpperCamelCase name}} response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait){ + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -254,7 +255,6 @@ private: }; {{/if}} -{{/unless}} {{/chip_server_cluster_attributes}} {{/chip_client_clusters}} @@ -272,7 +272,6 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} {{! TODO: Various types (floats, structs) not supported here. }} - {{#unless (isStrEqual chipCallback.name "Unsupported")}} make_unique(), // {{#if isWritableAttribute}} {{! No list support for writing yet. Need to figure out how to @@ -284,7 +283,6 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{#if isReportableAttribute}} make_unique(), // {{/if}} - {{/unless}} {{/chip_server_cluster_attributes}} }; diff --git a/examples/chip-tool-darwin/templates/partials/test_cluster.zapt b/examples/chip-tool-darwin/templates/partials/test_cluster.zapt index 3b49c707311442..9f2ac193e903da 100644 --- a/examples/chip-tool-darwin/templates/partials/test_cluster.zapt +++ b/examples/chip-tool-darwin/templates/partials/test_cluster.zapt @@ -107,7 +107,8 @@ class {{filename}}: public TestCommandBridge {{else}} {{#if (isString type)}}@"{{/if}}{{definedValue}}{{#if (isString type)}}"{{/if}} {{~/if~}} - {{/chip_tests_item_parameters}}); + {{/chip_tests_item_parameters}} + {{additionalArguments}}); {{else}} CHIPDevice * device = GetConnectedDevice(); CHIPTest{{asUpperCamelCase cluster}} * cluster = [[CHIPTest{{asUpperCamelCase cluster}} alloc] initWithDevice:device endpoint:{{endpoint}} queue:mCallbackQueue]; diff --git a/examples/chip-tool-darwin/templates/tests.js b/examples/chip-tool-darwin/templates/tests.js index 7cd1779c34e63a..87e68b38512571 100644 --- a/examples/chip-tool-darwin/templates/tests.js +++ b/examples/chip-tool-darwin/templates/tests.js @@ -234,7 +234,6 @@ function getTests() 'TestIdentifyCluster', 'TestLogCommands', 'TestOperationalCredentialsCluster', - 'TestModeSelectCluster', 'TestBinding', ]; diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 8f0be3b24f0b2d..03f97a667ad84a 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -76,6 +76,7 @@ static_library("chip-tool-utils") { "${chip_root}/src/app/tests/suites/commands/system", "${chip_root}/src/app/tests/suites/pics", "${chip_root}/src/controller/data_model", + "${chip_root}/src/credentials:file_attestation_trust_store", "${chip_root}/src/lib", "${chip_root}/src/platform", "${chip_root}/third_party/inipp", diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index 8424541088f710..c31348a1780e98 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -105,6 +105,20 @@ devices log when they start up) and try to pair with the first one it discovers. In all these cases, the device will be assigned node id `${NODE_ID_TO_ASSIGN}` (which must be a decimal number or a 0x-prefixed hex number). +#### Trust Store + +Trust store will be automatically created using the default Test Attestation +PAA. To use a different set of PAAs, pass the path using the optional parameter +--paa-trust-store-path while running the built executable. Trusted PAAs are +available at credentials/development/paa-root-certs/. + +The command below will select a set of trusted PAAs to be used during +Attestation Verification. It will also discover devices with long discriminator +3840 and try to pair with the first one it discovers using the provided setup +code. + + $ chip-tool pairing onnetwork-long ${NODE_ID_TO_ASSIGN} 20202021 3840 --paa-trust-store-path path/to/PAAs + ### Forget the currently-commissioned device $ chip-tool pairing unpair diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index fe981615def3b8..51475fb1e06c3c 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -36,6 +37,22 @@ constexpr chip::FabricId kIdentityAlphaFabricId = 1; constexpr chip::FabricId kIdentityBetaFabricId = 2; constexpr chip::FabricId kIdentityGammaFabricId = 3; +namespace { +const chip::Credentials::AttestationTrustStore * GetTestFileAttestationTrustStore(const char * paaTrustStorePath) +{ + static chip::Credentials::FileAttestationTrustStore attestationTrustStore{ paaTrustStorePath }; + + if (attestationTrustStore.IsInitialized()) + { + return &attestationTrustStore; + } + else + { + return nullptr; + } +} +} // namespace + CHIP_ERROR CHIPCommand::Run() { StartTracing(); @@ -58,8 +75,19 @@ CHIP_ERROR CHIPCommand::Run() factoryInitParams.listenPort = port; ReturnLogErrorOnFailure(DeviceControllerFactory::GetInstance().Init(factoryInitParams)); - // TODO(issue #15209): Replace this trust store with file-based trust store - const chip::Credentials::AttestationTrustStore * trustStore = chip::Credentials::GetTestAttestationTrustStore(); + const chip::Credentials::AttestationTrustStore * trustStore = mPaaTrustStorePath.HasValue() + ? GetTestFileAttestationTrustStore(mPaaTrustStorePath.Value()) + : chip::Credentials::GetTestAttestationTrustStore(); + ; + if (mPaaTrustStorePath.HasValue() && trustStore == nullptr) + { + ChipLogError(chipTool, "No PAAs found in path: %s", mPaaTrustStorePath.Value()); + ChipLogError(chipTool, + "Please specify a valid path containing trusted PAA certificates using [--paa-trust-store-path paa/file/path] " + "argument"); + + return CHIP_ERROR_INVALID_ARGUMENT; + } ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityNull, kIdentityNullFabricId, trustStore)); ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityAlpha, kIdentityAlphaFabricId, trustStore)); @@ -107,7 +135,7 @@ void CHIPCommand::StartTracing() { chip::trace::SetTraceStream(new chip::trace::TraceStreamFile(mTraceFile.Value())); } - else if (mTraceLog.HasValue() && mTraceLog.Value() == true) + else if (mTraceLog.HasValue() && mTraceLog.Value()) { chip::trace::SetTraceStream(new chip::trace::TraceStreamLog()); } @@ -224,6 +252,7 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(std::string key, chip::FabricId f ReturnLogErrorOnFailure(ephemeralKey.Initialize()); ReturnLogErrorOnFailure(mCredIssuerCmds->GenerateControllerNOCChain(mCommissionerStorage.GetLocalNodeId(), fabricId, + mCommissionerStorage.GetCommissionerCATs(), ephemeralKey, rcacSpan, icacSpan, nocSpan)); commissionerParams.operationalKeypair = &ephemeralKey; commissionerParams.controllerRCAC = rcacSpan; diff --git a/examples/chip-tool/commands/common/Commands.cpp b/examples/chip-tool/commands/common/Commands.cpp index e6b98bc0662b40..0e444768ac5739 100644 --- a/examples/chip-tool/commands/common/Commands.cpp +++ b/examples/chip-tool/commands/common/Commands.cpp @@ -227,23 +227,23 @@ void Commands::ShowCluster(std::string executable, std::string clusterName, Comm if (IsGlobalCommand(command->GetName())) { - if (strcmp(command->GetName(), "read") == 0 && readCommand == false) + if (strcmp(command->GetName(), "read") == 0 && !readCommand) { readCommand = true; } - else if (strcmp(command->GetName(), "write") == 0 && writeCommand == false) + else if (strcmp(command->GetName(), "write") == 0 && !writeCommand) { writeCommand = true; } - else if (strcmp(command->GetName(), "subscribe") == 0 && subscribeCommand == false) + else if (strcmp(command->GetName(), "subscribe") == 0 && !subscribeCommand) { subscribeCommand = true; } - else if (strcmp(command->GetName(), "read-event") == 0 && readEventCommand == false) + else if (strcmp(command->GetName(), "read-event") == 0 && !readEventCommand) { readEventCommand = true; } - else if (strcmp(command->GetName(), "subscribe-event") == 0 && subscribeEventCommand == false) + else if (strcmp(command->GetName(), "subscribe-event") == 0 && !subscribeEventCommand) { subscribeEventCommand = true; } diff --git a/examples/chip-tool/commands/common/CredentialIssuerCommands.h b/examples/chip-tool/commands/common/CredentialIssuerCommands.h index 0682aef4876da5..951ef86efceb40 100644 --- a/examples/chip-tool/commands/common/CredentialIssuerCommands.h +++ b/examples/chip-tool/commands/common/CredentialIssuerCommands.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -63,6 +63,7 @@ class CredentialIssuerCommands * * @param[in] nodeId The desired NodeId for the generated NOC Chain - May be optional/unused in some implementations. * @param[in] fabricId The desired FabricId for the generated NOC Chain - May be optional/unused in some implementations. + * @param[in] cats The desired CATs for the generated NOC Chain - May be optional/unused in some implementations. * @param[in] keypair The desired Keypair for the generated NOC Chain - May be optional/unused in some implementations. * @param[in,out] rcac Buffer to hold the Root Certificate of the generated NOC Chain. * @param[in,out] icac Buffer to hold the Intermediate Certificate of the generated NOC Chain. @@ -70,7 +71,7 @@ class CredentialIssuerCommands * * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code. */ - virtual CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, chip::Crypto::P256Keypair & keypair, - chip::MutableByteSpan & rcac, chip::MutableByteSpan & icac, - chip::MutableByteSpan & noc) = 0; + virtual CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, const chip::CATValues & cats, + chip::Crypto::P256Keypair & keypair, chip::MutableByteSpan & rcac, + chip::MutableByteSpan & icac, chip::MutableByteSpan & noc) = 0; }; diff --git a/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h b/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h index 8d6f7deeeb30d8..74646c8b5f10ba 100644 --- a/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h +++ b/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,11 +42,11 @@ class ExampleCredentialIssuerCommands : public CredentialIssuerCommands return CHIP_NO_ERROR; } chip::Controller::OperationalCredentialsDelegate * GetCredentialIssuer() override { return &mOpCredsIssuer; } - CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, chip::Crypto::P256Keypair & keypair, - chip::MutableByteSpan & rcac, chip::MutableByteSpan & icac, - chip::MutableByteSpan & noc) override + CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, const chip::CATValues & cats, + chip::Crypto::P256Keypair & keypair, chip::MutableByteSpan & rcac, + chip::MutableByteSpan & icac, chip::MutableByteSpan & noc) override { - return mOpCredsIssuer.GenerateNOCChainAfterValidation(nodeId, fabricId, keypair.Pubkey(), rcac, icac, noc); + return mOpCredsIssuer.GenerateNOCChainAfterValidation(nodeId, fabricId, cats, keypair.Pubkey(), rcac, icac, noc); } private: diff --git a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp index abc94a593e3948..bd39eb855b715b 100644 --- a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp +++ b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp @@ -18,30 +18,40 @@ #include "OpenCommissioningWindowCommand.h" +#include + using namespace ::chip; CHIP_ERROR OpenCommissioningWindowCommand::RunCommand() { - return CurrentCommissioner().GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); + mWindowOpener = Platform::MakeUnique(&CurrentCommissioner()); + if (mCommissioningWindowOption == Controller::CommissioningWindowOpener::CommissioningWindowOption::kOriginalSetupCode) + { + return mWindowOpener->OpenBasicCommissioningWindow(mNodeId, System::Clock::Seconds16(mTimeout), + &mOnOpenBasicCommissioningWindowCallback); + } + + if (mCommissioningWindowOption == Controller::CommissioningWindowOpener::CommissioningWindowOption::kTokenWithRandomPIN) + { + SetupPayload ignored; + return mWindowOpener->OpenCommissioningWindow(mNodeId, System::Clock::Seconds16(mTimeout), mIteration, mDiscriminator, + NullOptional, &mOnOpenCommissioningWindowCallback, ignored, + /* readVIDPIDAttributes */ true); + } + + ChipLogError(chipTool, "Unknown commissioning window option: %d", to_underlying(mCommissioningWindowOption)); + return CHIP_ERROR_INVALID_ARGUMENT; } -void OpenCommissioningWindowCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device) -{ - OpenCommissioningWindowCommand * command = reinterpret_cast(context); - VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null")); - command->OpenCommissioningWindow(); -} -void OpenCommissioningWindowCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR err) +void OpenCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err, + chip::SetupPayload payload) { LogErrorOnFailure(err); - OpenCommissioningWindowCommand * command = reinterpret_cast(context); - VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectionFailureFn: context is null")); - command->SetCommandExitStatus(err); + OnOpenBasicCommissioningWindowResponse(context, remoteId, err); } -void OpenCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err, - chip::SetupPayload payload) +void OpenCommissioningWindowCommand::OnOpenBasicCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err) { LogErrorOnFailure(err); @@ -49,10 +59,3 @@ void OpenCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * co VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnOpenCommissioningWindowCommand: context is null")); command->SetCommandExitStatus(err); } - -CHIP_ERROR OpenCommissioningWindowCommand::OpenCommissioningWindow() -{ - return CurrentCommissioner().OpenCommissioningWindowWithCallback( - mNodeId, mTimeout, mIteration, mDiscriminator, mCommissioningWindowOption, &mOnOpenCommissioningWindowCallback, - /* readVIDPIDAttributes */ true); -} diff --git a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h index d29e328dde22da..b06f13ffea84e8 100644 --- a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h +++ b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h @@ -20,13 +20,16 @@ #include "../common/CHIPCommand.h" +#include +#include + class OpenCommissioningWindowCommand : public CHIPCommand { public: OpenCommissioningWindowCommand(CredentialIssuerCommands * credIssuerCommands) : - CHIPCommand("open-commissioning-window", credIssuerCommands), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), - mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this), - mOnOpenCommissioningWindowCallback(OnOpenCommissioningWindowResponse, this) + CHIPCommand("open-commissioning-window", credIssuerCommands), + mOnOpenCommissioningWindowCallback(OnOpenCommissioningWindowResponse, this), + mOnOpenBasicCommissioningWindowCallback(OnOpenBasicCommissioningWindowResponse, this) { AddArgument("node-id", 0, UINT64_MAX, &mNodeId); AddArgument("option", 0, 2, &mCommissioningWindowOption); @@ -41,17 +44,16 @@ class OpenCommissioningWindowCommand : public CHIPCommand private: NodeId mNodeId; - ChipDeviceController::CommissioningWindowOption mCommissioningWindowOption; + chip::Controller::CommissioningWindowOpener::CommissioningWindowOption mCommissioningWindowOption; uint16_t mTimeout; uint32_t mIteration; uint16_t mDiscriminator; - CHIP_ERROR OpenCommissioningWindow(); - static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device); - static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error); + chip::Platform::UniquePtr mWindowOpener; + static void OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload); + static void OnOpenBasicCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status); - chip::Callback::Callback mOnDeviceConnectedCallback; - chip::Callback::Callback mOnDeviceConnectionFailureCallback; chip::Callback::Callback mOnOpenCommissioningWindowCallback; + chip::Callback::Callback mOnOpenBasicCommissioningWindowCallback; }; diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 2f08fa6a89f61c..36cd8b785ac4f1 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -53,7 +53,7 @@ void TestCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHI auto * command = static_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "Test command context is null")); - LogErrorOnFailure(command->ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogErrorOnFailure(command->ContinueOnChipMainThread(error)); } void TestCommand::Exit(std::string message) diff --git a/examples/chip-tool/config/PersistentStorage.cpp b/examples/chip-tool/config/PersistentStorage.cpp index f5ef4eaf94ab6e..d580a80ece50a7 100644 --- a/examples/chip-tool/config/PersistentStorage.cpp +++ b/examples/chip-tool/config/PersistentStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,11 +32,12 @@ using namespace ::chip; using namespace ::chip::Controller; using namespace ::chip::Logging; -constexpr const char kDefaultSectionName[] = "Default"; -constexpr const char kPortKey[] = "ListenPort"; -constexpr const char kLoggingKey[] = "LoggingLevel"; -constexpr const char kLocalNodeIdKey[] = "LocalNodeId"; -constexpr LogCategory kDefaultLoggingLevel = kLogCategory_Detail; +constexpr const char kDefaultSectionName[] = "Default"; +constexpr const char kPortKey[] = "ListenPort"; +constexpr const char kLoggingKey[] = "LoggingLevel"; +constexpr const char kLocalNodeIdKey[] = "LocalNodeId"; +constexpr const char kCommissionerCATsKey[] = "CommissionerCATs"; +constexpr LogCategory kDefaultLoggingLevel = kLogCategory_Detail; std::string GetFilename(const char * name) { @@ -238,3 +239,29 @@ CHIP_ERROR PersistentStorage::SetLocalNodeId(NodeId value) uint64_t nodeId = Encoding::LittleEndian::HostSwap64(value); return SyncSetKeyValue(kLocalNodeIdKey, &nodeId, sizeof(nodeId)); } + +CATValues PersistentStorage::GetCommissionerCATs() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + CATValues cats; + chip::CATValues::Serialized serializedCATs; + uint16_t size = chip::CATValues::kSerializedLength; + err = SyncGetKeyValue(kCommissionerCATsKey, serializedCATs, size); + if (err == CHIP_NO_ERROR && size == chip::CATValues::kSerializedLength) + { + err = cats.Deserialize(serializedCATs); + if (err == CHIP_NO_ERROR) + { + return cats; + } + } + return chip::kUndefinedCATs; +} + +CHIP_ERROR PersistentStorage::SetCommissionerCATs(const CATValues & cats) +{ + chip::CATValues::Serialized serializedCATs; + ReturnErrorOnFailure(cats.Serialize(serializedCATs)); + + return SyncSetKeyValue(kCommissionerCATsKey, serializedCATs, sizeof(serializedCATs)); +} diff --git a/examples/chip-tool/config/PersistentStorage.h b/examples/chip-tool/config/PersistentStorage.h index fd06571c1b6b61..35c5e8653d607f 100644 --- a/examples/chip-tool/config/PersistentStorage.h +++ b/examples/chip-tool/config/PersistentStorage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,6 +42,12 @@ class PersistentStorage : public chip::PersistentStorageDelegate // Store local node id. CHIP_ERROR SetLocalNodeId(chip::NodeId nodeId); + // Return the stored local device (commissioner) CASE Authenticated Tags (CATs). + chip::CATValues GetCommissionerCATs(); + + // Store local CATs. + CHIP_ERROR SetCommissionerCATs(const chip::CATValues & cats); + private: CHIP_ERROR CommitConfig(const char * name); inipp::Ini mConfig; diff --git a/examples/chip-tool/templates/tests/partials/test_cluster.zapt b/examples/chip-tool/templates/tests/partials/test_cluster.zapt index 27616a54ed9c2e..dbd550ba87a176 100644 --- a/examples/chip-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/tests/partials/test_cluster.zapt @@ -203,7 +203,8 @@ class {{filename}}Suite: public TestCommand {{~else if (isString type)}}"{{definedValue}}" {{else}}{{definedValue}} {{~/if~}} - {{/chip_tests_item_parameters}}); + {{/chip_tests_item_parameters}} + {{additionalArguments}}); } {{else if isWait}} CHIP_ERROR {{>testCommand}}() @@ -211,7 +212,7 @@ class {{filename}}Suite: public TestCommand const chip::EndpointId endpoint = {{#if (chip_tests_config_has "endpoint")}}mEndpoint.HasValue() ? mEndpoint.Value() : {{/if}}{{endpoint}}; ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: {{cluster}} {{#if isAttribute}}Attribute: {{attribute}}{{else}}Command: {{wait}}{{/if}}] {{label}}", endpoint); {{#*inline "waitForTypeName"}}{{#if isAttribute}}Attribute{{else}}Command{{/if}}{{/inline}} - {{#*inline "waitForTypeId"}}chip::app::Clusters::{{asUpperCamelCase cluster}}::{{#if isAttribute}}Attributes::{{attribute}}{{else}}Commands::{{wait}}{{/if}}::Id{{/inline}} + {{#*inline "waitForTypeId"}}chip::app::Clusters::{{asUpperCamelCase cluster}}::{{#if isAttribute}}Attributes::{{asUpperCamelCase attribute}}{{else}}Commands::{{asUpperCamelCase wait}}{{/if}}::Id{{/inline}} ClearAttributeAndCommandPaths(); m{{>waitForTypeName}}Path = chip::app::Concrete{{>waitForTypeName}}Path(endpoint, chip::app::Clusters::{{asUpperCamelCase cluster}}::Id, {{>waitForTypeId}}); return CHIP_NO_ERROR; @@ -275,11 +276,9 @@ class {{filename}}Suite: public TestCommand {{> maybeWait }} {{else}} chip::Controller::{{asUpperCamelCase cluster}}ClusterTest cluster; - {{#if isGroupCommand}} - cluster.AssociateWithGroup({{>device}}, groupId); - {{else}} + {{#unless isGroupCommand}} cluster.Associate({{>device}}, endpoint); - {{/if}} + {{/unless}} {{#if (chip_tests_item_has_list)}} ListFreer listFreer;{{/if}} {{#chip_tests_item_parameters}} @@ -288,11 +287,18 @@ class {{filename}}Suite: public TestCommand {{/chip_tests_item_parameters}} {{#if isWriteAttribute}} + {{#if isGroupCommand}} + ReturnErrorOnFailure(cluster.WriteAttribute(groupId, {{>device}}->GetSecureSession().Value()->GetFabricIndex(), {{>device}}->GetDeviceId(),{{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}} + {{~> maybeTimedInteractionTimeout ~}} + , {{>staticDoneResponse}} + )); + {{> maybeWait }} + {{else}} ReturnErrorOnFailure(cluster.WriteAttribute({{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}} {{~> maybeTimedInteractionTimeout ~}} - {{~#if isGroupCommand}}, {{>staticDoneResponse}}{{/if~}} )); {{> maybeWait }} + {{/if}} {{else if isReadEvent}} ReturnErrorOnFailure(cluster.ReadEvent<{{zapTypeToDecodableClusterObjectType event ns=cluster isArgument=true}}>(this, {{>staticSuccessResponse}}, {{>staticFailureResponse}})); {{else if isSubscribeEvent}} diff --git a/examples/chip-tool/templates/tests/tests.js b/examples/chip-tool/templates/tests/tests.js index 2ec09673855475..12d68973fef460 100644 --- a/examples/chip-tool/templates/tests/tests.js +++ b/examples/chip-tool/templates/tests/tests.js @@ -449,6 +449,10 @@ function getTests() 'Test_TC_RH_2_2', ]; + const SecureChannel = [ + 'Test_TC_SC_4_2', + ]; + const Switch = [ 'Test_TC_SWTCH_2_1', 'Test_TC_SWTCH_2_2', @@ -578,6 +582,7 @@ function getTests() PressureMeasurement, // PumpConfigurationControl, // RelativeHumidityMeasurement, // + SecureChannel, // Switch, // TemperatureMeasurement, // Thermostat, // diff --git a/examples/common/pigweed/rpc_console/README.md b/examples/common/pigweed/rpc_console/README.md index 1b50a83812f08a..202d02b4ab68a5 100644 --- a/examples/common/pigweed/rpc_console/README.md +++ b/examples/common/pigweed/rpc_console/README.md @@ -39,7 +39,7 @@ files required for CHIP. To start the console provide the path to the device, for example: - $ python -m chip_rpc.console --device /dev/ttyUSB0 + $ chip-console --device /dev/ttyUSB0 An example RPC command: diff --git a/examples/common/pigweed/rpc_console/py/BUILD.gn b/examples/common/pigweed/rpc_console/py/BUILD.gn index 67c6164eeaf1c4..bcc57f42a7f07a 100644 --- a/examples/common/pigweed/rpc_console/py/BUILD.gn +++ b/examples/common/pigweed/rpc_console/py/BUILD.gn @@ -20,16 +20,13 @@ import("$dir_pw_build/python_dist.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") pw_python_package("chip_rpc") { - generate_setup = { - metadata = { - name = "chip_rpc" - version = "0.0.1" - } - options = { - install_requires = [ "ipython" ] - } - } + setup = [ + "pyproject.toml", + "setup.cfg", + "setup.py", + ] sources = [ + "chip_rpc/__init__.py", "chip_rpc/console.py", "chip_rpc/plugins/device_toolbar.py", "chip_rpc/plugins/helper_scripts.py", diff --git a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py index 34567bbd19ca64..66daafbf1035c5 100644 --- a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py +++ b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py @@ -30,7 +30,6 @@ rpcs - used to invoke RPCs device - the serial device used for communication client - the pw_rpc.Client - scripts - helper scripts for working with chip devices protos - protocol buffer messages indexed by proto package An example RPC command: @@ -47,7 +46,7 @@ from concurrent.futures import ThreadPoolExecutor import sys import threading -from typing import Any, BinaryIO +from typing import Any, BinaryIO, Collection from chip_rpc.plugins.device_toolbar import DeviceToolbar from chip_rpc.plugins.helper_scripts import HelperScripts @@ -59,6 +58,10 @@ from pw_rpc import callback_client from pw_rpc.console_tools.console import ClientInfo, flattened_rpc_completions +from pw_tokenizer.database import LoadTokenDatabases +from pw_tokenizer.detokenize import Detokenizer, detokenize_base64 +from pw_tokenizer import tokens + # Protos from attributes_service import attributes_service_pb2 from button_service import button_service_pb2 @@ -112,6 +115,11 @@ def _parse_args(): '--raw_serial', action="store_true", help=('Use raw serial instead of HDLC/RPC')) + parser.add_argument("--token-databases", + metavar='elf_or_token_database', + nargs="+", + action=LoadTokenDatabases, + help="Path to tokenizer database csv file(s).") group.add_argument('-s', '--socket-addr', type=str, @@ -152,6 +160,7 @@ def _start_ipython_raw_terminal() -> None: interactive_console.hide_windows('Host Logs') interactive_console.hide_windows('Serial Debug') + interactive_console.hide_windows('Python Repl') # Setup Python logger propagation interactive_console.setup_python_logging() @@ -236,7 +245,8 @@ def read(self, num_bytes: int = PW_RPC_MAX_PACKET_SIZE): def write_to_output(data: bytes, - unused_output: BinaryIO = sys.stdout.buffer,): + unused_output: BinaryIO = sys.stdout.buffer, + detokenizer=None): log_line = data RegexStruct = namedtuple('RegexStruct', 'platform type regex match_num') LEVEL_MAPPING = {"I": logging.INFO, "W": logging.WARNING, "P": logging.INFO, @@ -276,9 +286,17 @@ def write_to_output(data: bytes, fields.update(match.groupdict()) if "level" in match.groupdict(): fields["level"] = LEVEL_MAPPING[fields["level"]] + if detokenizer: + _LOG.warn(fields["msg"]) + if len(fields["msg"]) % 2: + # TODO the msg likely wrapped, trim for now + fields["msg"] = fields["msg"][:-1] + fields["msg"] = detokenizer.detokenize( + bytes.fromhex(fields["msg"])) break + _DEVICE_LOG.log(fields["level"], fields["msg"], extra={'extra_metadata_fields': { - "time": fields["time"], "type": fields["type"], "mod": fields["mod"]}}) + "timestamp": fields["time"], "type": fields["type"], "mod": fields["mod"]}}) def _read_raw_serial(read: Callable[[], bytes], output): @@ -294,6 +312,7 @@ def _read_raw_serial(read: Callable[[], bytes], output): def console(device: str, baudrate: int, + token_databases: Collection[tokens.Database], socket_addr: str, output: Any, raw_serial: bool) -> int: """Starts an interactive RPC console for HDLC.""" # argparse.FileType doesn't correctly handle '-' for binary files. @@ -323,15 +342,22 @@ def read(): return serial_device.read(8192) default_stream_timeout_s=None, ) + detokenizer = Detokenizer(tokens.Database.merged(*token_databases), + show_errors=False) if token_databases else None + if raw_serial: threading.Thread(target=_read_raw_serial, daemon=True, - args=(read, write_to_output)).start() + args=(read, + lambda data: write_to_output( + data, output, detokenizer), + )).start() _start_ipython_raw_terminal() else: _start_ipython_hdlc_terminal( HdlcRpcClient(read, PROTOS, default_channels(write), - lambda data: write_to_output(data, output), + lambda data: write_to_output( + data, output, detokenizer), client_impl=callback_client_impl) ) return 0 diff --git a/examples/common/pigweed/rpc_console/py/pyproject.toml b/examples/common/pigweed/rpc_console/py/pyproject.toml new file mode 100644 index 00000000000000..bc6b8958f9666c --- /dev/null +++ b/examples/common/pigweed/rpc_console/py/pyproject.toml @@ -0,0 +1,16 @@ +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +[build-system] +requires = ['setuptools', 'wheel'] +build-backend = 'setuptools.build_meta' diff --git a/examples/common/pigweed/rpc_console/py/setup.cfg b/examples/common/pigweed/rpc_console/py/setup.cfg new file mode 100644 index 00000000000000..a60214e5ab05e8 --- /dev/null +++ b/examples/common/pigweed/rpc_console/py/setup.cfg @@ -0,0 +1,29 @@ +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +[metadata] +name = chip_rpc +version = 0.0.1 + +[options] +packages = find: +zip_safe = False +install_requires = + pw_console + pw_hdlc + pw_protobuf_compiler + pw_rpc + pw_tokenizer + +[options.entry_points] +console_scripts = chip-console = chip_rpc.console:main diff --git a/examples/common/pigweed/rpc_console/py/setup.py b/examples/common/pigweed/rpc_console/py/setup.py new file mode 100644 index 00000000000000..ba255890ff2490 --- /dev/null +++ b/examples/common/pigweed/rpc_console/py/setup.py @@ -0,0 +1,17 @@ +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import setuptools # type: ignore + +setuptools.setup() # Package definition in setup.cfg diff --git a/examples/common/pigweed/rpc_services/Device.h b/examples/common/pigweed/rpc_services/Device.h index fc5605d7dbd538..e0979365529f3f 100644 --- a/examples/common/pigweed/rpc_services/Device.h +++ b/examples/common/pigweed/rpc_services/Device.h @@ -160,8 +160,7 @@ class Device : public pw_rpc::nanopb::Device::Service virtual pw::Status SetPairingInfo(const chip_rpc_PairingInfo & request, pw_protobuf_Empty & response) { if (DeviceLayer::GetCommissionableDataProvider()->SetSetupPasscode(request.code) != CHIP_NO_ERROR || - DeviceLayer::GetCommissionableDataProvider()->SetSetupDiscriminator(request.discriminator) != - CHIP_NO_ERROR) + DeviceLayer::GetCommissionableDataProvider()->SetSetupDiscriminator(request.discriminator) != CHIP_NO_ERROR) { return pw::Status::Unknown(); } diff --git a/examples/common/tracing/TraceHandlers.cpp b/examples/common/tracing/TraceHandlers.cpp index fb131dd6d46fab..d0c54d07c7c7a1 100644 --- a/examples/common/tracing/TraceHandlers.cpp +++ b/examples/common/tracing/TraceHandlers.cpp @@ -214,9 +214,27 @@ std::string PayloadHeaderToJson(const PayloadHeader * payloadHeader) return jsonBody; } -bool SecureMessageSentHandler(const TraceEventFields & eventFields, TraceHandlerContext * context) +std::string PreparedSecureMessageDataToJson(const TracePreparedSecureMessageData * data, const std::string & peerAddressKey) { - if (eventFields.dataSize != sizeof(TraceSecureMessageSentData)) + const System::PacketBuffer * packetBuffer = data->packetBuffer->operator->(); + std::string jsonBody = "{"; + jsonBody += AsFirstJsonKey(peerAddressKey, AsJsonString(data->peerAddress)); + jsonBody += ", "; + jsonBody += AsFirstJsonKey("payload_size", std::to_string(packetBuffer->DataLength())); + jsonBody += ", "; + jsonBody += AsFirstJsonKey("payload_hex", AsJsonHexString(packetBuffer->Start(), packetBuffer->DataLength())); + jsonBody += ", "; + jsonBody += AsFirstJsonKey("buffer_ptr", std::to_string(reinterpret_cast(packetBuffer))); + jsonBody += "}"; + + return jsonBody; +} + +bool SecureMessageSentHandler(const TraceEventFields & eventFields, void * context) +{ + TraceHandlerContext * ourContext = reinterpret_cast(context); + if ((std::string{ eventFields.dataFormat } != kTraceMessageSentDataFormat) || + (eventFields.dataSize != sizeof(TraceSecureMessageSentData))) { return false; } @@ -232,7 +250,7 @@ bool SecureMessageSentHandler(const TraceEventFields & eventFields, TraceHandler jsonBody += AsFirstJsonKey("payload_hex", AsJsonHexString(eventData->packetPayload, eventData->packetSize)); jsonBody += "}"; - TraceOutput * sink = context->sink; + TraceOutput * sink = ourContext->sink; sink->StartEvent(std::string{ kTraceMessageEvent } + "." + kTraceMessageSentDataFormat); sink->AddField("json", jsonBody); sink->FinishEvent(); @@ -240,9 +258,11 @@ bool SecureMessageSentHandler(const TraceEventFields & eventFields, TraceHandler return true; } -bool SecureMessageReceivedHandler(const TraceEventFields & eventFields, TraceHandlerContext * context) +bool SecureMessageReceivedHandler(const TraceEventFields & eventFields, void * context) { - if (eventFields.dataSize != sizeof(TraceSecureMessageReceivedData)) + TraceHandlerContext * ourContext = reinterpret_cast(context); + if ((std::string{ eventFields.dataFormat } != kTraceMessageReceivedDataFormat) || + (eventFields.dataSize != sizeof(TraceSecureMessageReceivedData))) { return false; } @@ -261,7 +281,7 @@ bool SecureMessageReceivedHandler(const TraceEventFields & eventFields, TraceHan jsonBody += AsFirstJsonKey("payload_hex", AsJsonHexString(eventData->packetPayload, eventData->packetSize)); jsonBody += "}"; - TraceOutput * sink = context->sink; + TraceOutput * sink = ourContext->sink; sink->StartEvent(std::string{ kTraceMessageEvent } + "." + kTraceMessageReceivedDataFormat); sink->AddField("json", jsonBody); sink->FinishEvent(); @@ -271,25 +291,40 @@ bool SecureMessageReceivedHandler(const TraceEventFields & eventFields, TraceHan return true; } -// TODO: Framework this into a registry of handlers for different message types. -bool TraceDefaultHandler(const TraceEventFields & eventFields, void * context) +bool PreparedMessageSentHandler(const TraceEventFields & eventFields, void * context) { TraceHandlerContext * ourContext = reinterpret_cast(context); - if (ourContext == nullptr) + if ((std::string{ eventFields.dataFormat } != kTracePreparedMessageSentDataFormat) || + (eventFields.dataSize != sizeof(TracePreparedSecureMessageData))) { return false; } - if (std::string{ eventFields.dataFormat } == kTraceMessageSentDataFormat) - { - return SecureMessageSentHandler(eventFields, ourContext); - } - else if (std::string{ eventFields.dataFormat } == kTraceMessageReceivedDataFormat) + const auto * eventData = reinterpret_cast(eventFields.dataBuffer); + TraceOutput * sink = ourContext->sink; + sink->StartEvent(std::string{ kTraceMessageEvent } + "." + kTracePreparedMessageSentDataFormat); + sink->AddField("json", PreparedSecureMessageDataToJson(eventData, "destination")); + sink->FinishEvent(); + + return true; +} + +bool PreparedMessageReceivedHandler(const TraceEventFields & eventFields, void * context) +{ + TraceHandlerContext * ourContext = reinterpret_cast(context); + if ((std::string{ eventFields.dataFormat } != kTracePreparedMessageReceivedDataFormat) || + (eventFields.dataSize != sizeof(TracePreparedSecureMessageData))) { - return SecureMessageReceivedHandler(eventFields, ourContext); + return false; } - return false; + const auto * eventData = reinterpret_cast(eventFields.dataBuffer); + TraceOutput * sink = ourContext->sink; + sink->StartEvent(std::string{ kTraceMessageEvent } + "." + kTracePreparedMessageReceivedDataFormat); + sink->AddField("json", PreparedSecureMessageDataToJson(eventData, "source")); + sink->FinishEvent(); + + return true; } } // namespace @@ -302,7 +337,10 @@ void SetTraceStream(TraceStream * stream) void InitTrace() { void * context = &gTraceHandlerContext; - RegisterTraceHandler(TraceDefaultHandler, context); + RegisterTraceHandler(SecureMessageSentHandler, context); + RegisterTraceHandler(SecureMessageReceivedHandler, context); + RegisterTraceHandler(PreparedMessageSentHandler, context); + RegisterTraceHandler(PreparedMessageReceivedHandler, context); } void DeInitTrace() diff --git a/examples/ipv6only-app/esp32/README.md b/examples/ipv6only-app/esp32/README.md index 21972720729bd9..0bc7ef61eef976 100644 --- a/examples/ipv6only-app/esp32/README.md +++ b/examples/ipv6only-app/esp32/README.md @@ -96,7 +96,7 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console: - $ python -m chip_rpc.console --device /dev/ttyUSB0 -b 115200 + $ chip-console --device /dev/ttyUSB0 -b 115200 An example flow of performing a scan, connecting, and getting the IPv6 address: diff --git a/examples/light-switch-app/efr32/BUILD.gn b/examples/light-switch-app/efr32/BUILD.gn index 412917bba38279..599d6efa3ea182 100644 --- a/examples/light-switch-app/efr32/BUILD.gn +++ b/examples/light-switch-app/efr32/BUILD.gn @@ -62,21 +62,26 @@ declare_args() { show_qr_code = true } +# 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) +} + # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false } -if (use_rs911x || use_wf200) { + +# Enables LCD on supported devices +lcd_on = show_qr_code + +# WiFi settings +if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" - if (use_rs911x) { - wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" - import("${wifi_sdk_dir}/rs911x/rs911x.gni") - } else { - import("${wifi_sdk_dir}/wf200/wf200.gni") - } -} -efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] -if (use_rs911x || use_wf200) { + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", "LWIP_ARP=1", @@ -85,6 +90,13 @@ if (use_rs911x || use_wf200) { "LWIP_IPV6_ND=1", "LWIP_IGMP=1", ] + + if (use_rs911x) { + wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" + import("${wifi_sdk_dir}/rs911x/rs911x.gni") + } else { + import("${wifi_sdk_dir}/wf200/wf200.gni") + } } efr32_sdk("sdk") { @@ -113,25 +125,25 @@ efr32_sdk("sdk") { "PW_RPC_ENABLED", ] } - 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 - # Thread also uses LWIP - # - defines += efr32_lwip_defs - } + # 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 (use_rs911x || use_wf200) { if (sl_wfx_config_softap) { defines += [ "SL_WFX_CONFIG_SOFTAP" ] } @@ -163,12 +175,13 @@ efr32_executable("light_switch_app") { deps = [ ":sdk", - "${chip_root}/examples/common/QRCode", "${chip_root}/examples/light-switch-app/light-switch-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", ] - if (!use_rs911x && !use_wf200) { + + # OpenThread Settings + if (chip_enable_openthread) { deps += [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", @@ -192,35 +205,42 @@ efr32_executable("light_switch_app") { sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] } - 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 + # 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 } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs } - if (show_qr_code) { + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + deps += [ "${chip_root}/examples/common/QRCode" ] + } } if (chip_enable_pw_rpc) { @@ -278,6 +298,14 @@ efr32_executable("light_switch_app") { ] } + # WiFi Settings + if (chip_enable_wifi) { + ldflags += [ + "-Wl,--defsym", + "-Wl,SILABS_WIFI=1", + ] + } + output_dir = root_out_dir } diff --git a/examples/light-switch-app/efr32/README.md b/examples/light-switch-app/efr32/README.md index 641b6ddd55882b..a4c9d154c5a6c8 100644 --- a/examples/light-switch-app/efr32/README.md +++ b/examples/light-switch-app/efr32/README.md @@ -347,7 +347,7 @@ via 2002::2 - To use the chip-rpc console after it has been installed run: - `python3 -m chip_rpc.console --device /dev/tty. -b 115200 -o //pw_log.out` + `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 @@ -382,3 +382,27 @@ 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) + +## 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" 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 139b4bb066fbd7..2b8a5b7a3ce829 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 @@ -1084,6 +1084,12 @@ client cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1096,7 +1102,7 @@ client cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute attrib_id attributeList[] = 65531; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index 03841064f9424e..19cc15e7a8234c 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -63,7 +63,6 @@ There are two commissioning modes supported by Ameba platform: 1. In "connectedhomeip/config/ameba/args.gni" - - set `chip_bypass_rendezvous = false` - Set `chip_config_network_layer_ble = true` 2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" @@ -79,7 +78,6 @@ There are two commissioning modes supported by Ameba platform: 1. In "connectedhomeip/config/ameba/args.gni" - - set `chip_bypass_rendezvous = false` - Set `chip_config_network_layer_ble = false` 2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" diff --git a/examples/lighting-app/cyw30739/src/main.cpp b/examples/lighting-app/cyw30739/src/main.cpp index 9ec4cc5c6e3a63..544819f781a876 100644 --- a/examples/lighting-app/cyw30739/src/main.cpp +++ b/examples/lighting-app/cyw30739/src/main.cpp @@ -156,15 +156,7 @@ void EventHandler(const ChipDeviceEvent * event, intptr_t arg) } } -void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) -{ -#if CHIP_BYPASS_RENDEZVOUS - if (event->ThreadStateChange.NetDataChanged && !ConnectivityMgr().IsThreadProvisioned()) - { - ThreadStackMgr().JoinerStart(); - } -#endif /* CHIP_BYPASS_RENDEZVOUS */ -} +void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) {} void LightManagerCallback(LightingManager::Actor_t actor, LightingManager::Action_t action, uint8_t level) { diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index ab64c2f757c2a4..3d93d8919e6ef7 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -62,21 +62,26 @@ declare_args() { show_qr_code = true } +# 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) +} + # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false } -if (use_rs911x || use_wf200) { + +# Enables LCD on supported devices +lcd_on = show_qr_code + +# WiFi settings +if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" - if (use_rs911x) { - wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" - import("${wifi_sdk_dir}/rs911x/rs911x.gni") - } else { - import("${wifi_sdk_dir}/wf200/wf200.gni") - } -} -efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] -if (use_rs911x || use_wf200) { + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", "LWIP_ARP=1", @@ -85,6 +90,13 @@ if (use_rs911x || use_wf200) { "LWIP_IPV6_ND=1", "LWIP_IGMP=1", ] + + if (use_rs911x) { + wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" + import("${wifi_sdk_dir}/rs911x/rs911x.gni") + } else { + import("${wifi_sdk_dir}/wf200/wf200.gni") + } } efr32_sdk("sdk") { @@ -113,24 +125,25 @@ efr32_sdk("sdk") { "PW_RPC_ENABLED", ] } - 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 - # Thread also uses LWIP - # - defines += efr32_lwip_defs - } - if (use_rs911x || use_wf200) { + # 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" ] } @@ -161,12 +174,13 @@ efr32_executable("lighting_app") { deps = [ ":sdk", - "${chip_root}/examples/common/QRCode", "${chip_root}/examples/lighting-app/lighting-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", ] - if (!use_rs911x && !use_wf200) { + + # OpenThread Settings + if (chip_enable_openthread) { deps += [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", @@ -190,35 +204,43 @@ efr32_executable("lighting_app") { sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] } - 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 + # 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 } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs } - if (show_qr_code) { + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + + deps += [ "${chip_root}/examples/common/QRCode" ] + } } if (chip_enable_pw_rpc) { @@ -279,7 +301,9 @@ efr32_executable("lighting_app") { "-fstack-usage", ] } - if (use_rs911x || use_wf200) { + + # WiFi Settings + if (chip_enable_wifi) { ldflags += [ "-Wl,--defsym", "-Wl,SILABS_WIFI=1", diff --git a/examples/lighting-app/efr32/README.md b/examples/lighting-app/efr32/README.md index bc802db4cd2b20..a6fc76292a8d4a 100644 --- a/examples/lighting-app/efr32/README.md +++ b/examples/lighting-app/efr32/README.md @@ -290,7 +290,7 @@ via 2002::2 `pip3 install out/debug/chip_rpc_console_wheels/*.whl` - To use the chip-rpc console after it has been installed run: - `python3 -m chip_rpc.console --device /dev/tty. -b 115200 -o //pw_log.out` + `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 @@ -331,3 +331,28 @@ commands to multiples devices at once. Please refer to the [chip-tool documentation](../../chip-tool/README.md) _Configuring the server side for Group Commands_ and _Using the Client to Send Group (Multicast) Matter Commands_ + +## 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 to be +passed to the build scripts. + +### 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" diff --git a/examples/lighting-app/efr32/src/AppTask.cpp b/examples/lighting-app/efr32/src/AppTask.cpp index 1ed50c2a8bb952..21f47ad76072e4 100644 --- a/examples/lighting-app/efr32/src/AppTask.cpp +++ b/examples/lighting-app/efr32/src/AppTask.cpp @@ -21,8 +21,10 @@ #include "AppConfig.h" #include "AppEvent.h" #include "LEDWidget.h" +#ifdef DISPLAY_ENABLED #include "lcd.h" #include "qrcodegen.h" +#endif // DISPLAY_ENABLED #include "sl_simple_led_instances.h" #include #include diff --git a/examples/lighting-app/esp32/main/CHIPDeviceManager.cpp b/examples/lighting-app/esp32/main/CHIPDeviceManager.cpp index 5da54e42a021ba..ee7962ed549a72 100644 --- a/examples/lighting-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/lighting-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/lighting-app/esp32/main/DeviceCallbacks.cpp b/examples/lighting-app/esp32/main/DeviceCallbacks.cpp index f1697ec10da1e6..a9187fe053d91e 100644 --- a/examples/lighting-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/lighting-app/esp32/main/DeviceCallbacks.cpp @@ -26,9 +26,12 @@ #include "DeviceCallbacks.h" #include "LEDWidget.h" +#include "esp_bt.h" #include "esp_err.h" #include "esp_heap_caps.h" #include "esp_log.h" +#include "esp_nimble_hci.h" +#include "nimble/nimble_port.h" #include "route_hook/esp_route_hook.h" #include #include @@ -66,9 +69,27 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_ ESP_LOGI(TAG, "CHIPoBLE disconnected"); break; - case DeviceEventType::kCommissioningComplete: + case DeviceEventType::kCommissioningComplete: { ESP_LOGI(TAG, "Commissioning complete"); - break; +#if CONFIG_BT_NIMBLE_ENABLED && CONFIG_DEINIT_BLE_ON_COMMISSIONING_COMPLETE + int ret = nimble_port_stop(); + if (ret == 0) + { + nimble_port_deinit(); + esp_err_t err = esp_nimble_hci_and_controller_deinit(); + err += esp_bt_mem_release(ESP_BT_MODE_BLE); + if (err == ESP_OK) + { + ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed"); + } + } + else + { + ESP_LOGW(TAG, "nimble_port_stop() failed"); + } +#endif + } + break; case DeviceEventType::kInterfaceIpAddressChanged: if ((event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV4_Assigned) || diff --git a/examples/lighting-app/esp32/main/Kconfig.projbuild b/examples/lighting-app/esp32/main/Kconfig.projbuild index 839c53f3997d5c..46e6b2dda401ea 100644 --- a/examples/lighting-app/esp32/main/Kconfig.projbuild +++ b/examples/lighting-app/esp32/main/Kconfig.projbuild @@ -85,8 +85,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -100,10 +98,14 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD default 8 if RENDEZVOUS_MODE_ETHERNET + config DEINIT_BLE_ON_COMMISSIONING_COMPLETE + bool "Disable and DeInit BLE on commissioning complete" + default y + help + Disable and deinit BLE and reclaim all its memory, once the commissioning is successful and Commissioning complete event is received in the application. endmenu diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 411ac5a9a7a41f..30e7bd4a280f51 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1162,6 +1162,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1174,7 +1180,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/lighting-app/linux/README.md b/examples/lighting-app/linux/README.md index 03f079532cad75..262f1a6e2a6073 100644 --- a/examples/lighting-app/linux/README.md +++ b/examples/lighting-app/linux/README.md @@ -130,7 +130,7 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** `pip3 install out/debug/chip_rpc_console_wheels/*.whl` - To use the chip-rpc console after it has been installed run: - `python3 -m chip_rpc.console -s localhost:33000 -o //pw_log.out` + `chip-console -s localhost:33000 -o //pw_log.out` - Then you can Get and Set the light using the RPCs: `rpcs.chip.rpc.Lighting.Get()` diff --git a/examples/lighting-app/mbed/README.md b/examples/lighting-app/mbed/README.md index e9f3ac7b99054d..8c39ce7b772414 100644 --- a/examples/lighting-app/mbed/README.md +++ b/examples/lighting-app/mbed/README.md @@ -266,7 +266,7 @@ parameters as arguments: Example: - python -m chip_rpc.console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out + chip-console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out To control the lighting type the following command, where you define if 'on' state is true or false: diff --git a/examples/lighting-app/mbed/config.in b/examples/lighting-app/mbed/config.in index f55d13d9e9dd68..2456569bfe6fc7 100644 --- a/examples/lighting-app/mbed/config.in +++ b/examples/lighting-app/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_PW_RPC=y CONFIG_CHIP_OTA_REQUESTOR=y diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index 1656937b0b050a..c3a87f4b99ced2 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -100,6 +100,10 @@ chip_configure_data_model(app GEN_DIR ${GEN_DIR}/lighting-app/zap-generated ) +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) +endif() + if(BUILD_WITH_DFU STREQUAL "BLE") target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index 2d4ca5f2b940b2..ac041d994de9c5 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -563,7 +563,7 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console - $ python -m chip_rpc.console --device /dev/ttyUSB0 + $ chip-console --device /dev/ttyUSB0 From within the console you can then invoke rpcs: diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index 8aae4a4487aeb5..a05cca313beb5b 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -40,11 +40,7 @@ #include #if CONFIG_CHIP_OTA_REQUESTOR -#include -#include -#include -#include -#include +#include "OTAUtil.h" #endif #include @@ -85,14 +81,6 @@ bool sIsThreadProvisioned = false; bool sIsThreadEnabled = false; bool sHaveBLEConnections = false; -#if CONFIG_CHIP_OTA_REQUESTOR -DefaultOTARequestorStorage sRequestorStorage; -GenericOTARequestorDriver sOTARequestorDriver; -OTAImageProcessorImpl sOTAImageProcessor; -chip::BDXDownloader sBDXDownloader; -chip::OTARequestor sOTARequestor; -#endif - } // namespace AppTask AppTask::sAppTask; @@ -179,9 +167,11 @@ CHIP_ERROR AppTask::Init() // Initialize CHIP server SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); - InitOTARequestor(); chip::app::DnssdServer::Instance().SetExtendedDiscoveryTimeoutSecs(kExtDiscoveryTimeoutSecs); ReturnErrorOnFailure(chip::Server::GetInstance().Init()); +#if CONFIG_CHIP_OTA_REQUESTOR + InitBasicOTARequestor(); +#endif ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); @@ -199,18 +189,6 @@ CHIP_ERROR AppTask::Init() return err; } -void AppTask::InitOTARequestor() -{ -#if CONFIG_CHIP_OTA_REQUESTOR - sOTAImageProcessor.SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&sOTAImageProcessor); - sOTARequestorDriver.Init(&sOTARequestor, &sOTAImageProcessor); - sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - sOTARequestor.Init(Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); - chip::SetRequestorInstance(&sOTARequestor); -#endif -} - CHIP_ERROR AppTask::StartApp() { ReturnErrorOnFailure(Init()); @@ -401,11 +379,6 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (chip::Server::GetInstance().AddTestCommissioning() != CHIP_NO_ERROR) - { - LOG_ERR("Failed to add test pairing"); - } - if (!chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned()) { StartDefaultThreadNetwork(); diff --git a/examples/lighting-app/nrfconnect/main/include/AppTask.h b/examples/lighting-app/nrfconnect/main/include/AppTask.h index 2f635e8d44afbb..71767b76284584 100644 --- a/examples/lighting-app/nrfconnect/main/include/AppTask.h +++ b/examples/lighting-app/nrfconnect/main/include/AppTask.h @@ -56,7 +56,6 @@ class AppTask friend AppTask & GetAppTask(void); CHIP_ERROR Init(); - void InitOTARequestor(); static void ActionInitiated(LightingManager::Action_t aAction, int32_t aActor); static void ActionCompleted(LightingManager::Action_t aAction, int32_t aActor); diff --git a/examples/lighting-app/nrfconnect/prj.conf b/examples/lighting-app/nrfconnect/prj.conf index 387d0c698da6aa..9851733db5f347 100644 --- a/examples/lighting-app/nrfconnect/prj.conf +++ b/examples/lighting-app/nrfconnect/prj.conf @@ -37,6 +37,7 @@ CONFIG_BT_DEVICE_NAME="MatterLight" # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp index 2d0fbf08c1e918..375cf6d8aa960d 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -127,7 +127,7 @@ CHIP_ERROR AppTask::Init() gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - gImageProcessor.SetOTAImageFile(CharSpan("test.txt")); + gImageProcessor.SetOTAImageFile("test.txt"); gImageProcessor.SetOTADownloader(&gDownloader); // Connect the gDownloader and Image Processor objects diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index 5602acc36ca53d..92e1dde232983d 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -105,13 +105,6 @@ CHIP_ERROR AppTask::Init() ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); - ret = chip::Server::GetInstance().AddTestCommissioning(); - if (ret != CHIP_NO_ERROR) - { - LOG_ERR("Failed to add test pairing"); - return ret; - } - return CHIP_NO_ERROR; } diff --git a/examples/lock-app/cc13x2x7_26x2x7/args.gni b/examples/lock-app/cc13x2x7_26x2x7/args.gni index 21aca9d359af72..2b1db21d690d61 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/args.gni +++ b/examples/lock-app/cc13x2x7_26x2x7/args.gni @@ -34,7 +34,6 @@ chip_enable_ota_requestor = true # BLE options chip_config_network_layer_ble = true -chip_bypass_rendezvous = false # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h b/examples/lock-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h index 4079b251280ddc..30f5633cc3bc7f 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h +++ b/examples/lock-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h @@ -23,38 +23,7 @@ * */ -#ifndef OPENTHREAD_PLATFORM_CONFIG_H -#define OPENTHREAD_PLATFORM_CONFIG_H - -// Disable the Nordic-supplied OpenThread logging facilities and use -// the facilities provided by the CHIP Device Layer -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP - -// When operating in a less than ideal RF environment, having a more forgiving configuration -// of OpenThread makes thread a great deal more reliable. -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0 -#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4 - -// Enable periodic parent search to speed up finding a better parent. -#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0 -#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65 -#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0 - -// Use smaller maximum interval to speed up reattaching. -#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms - -#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 -#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0 -#define UART_AS_SERIAL_TRANSPORT 1 -#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 - -#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 +#pragma once // Use the TI-supplied default platform configuration for remainder #include "openthread-core-cc13x2_26x2-config.h" - -#endif // OPENTHREAD_PLATFORM_CONFIG_H diff --git a/examples/lock-app/cyw30739/src/main.cpp b/examples/lock-app/cyw30739/src/main.cpp index ccd12f86dfb329..00c0f91f52648b 100644 --- a/examples/lock-app/cyw30739/src/main.cpp +++ b/examples/lock-app/cyw30739/src/main.cpp @@ -170,15 +170,7 @@ void EventHandler(const ChipDeviceEvent * event, intptr_t arg) } } -void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) -{ -#if CHIP_BYPASS_RENDEZVOUS - if (event->ThreadStateChange.NetDataChanged && !ConnectivityMgr().IsThreadProvisioned()) - { - ThreadStackMgr().JoinerStart(); - } -#endif /* CHIP_BYPASS_RENDEZVOUS */ -} +void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) {} void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor) { diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 870737f8047f42..2c4954f2a16899 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -61,21 +61,26 @@ declare_args() { show_qr_code = true } +# 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) +} + # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false } -if (use_rs911x || use_wf200) { + +# Enables LCD on supported devices +lcd_on = show_qr_code + +# WiFi settings +if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" - if (use_rs911x) { - wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" - import("${wifi_sdk_dir}/rs911x/rs911x.gni") - } else { - import("${wifi_sdk_dir}/wf200/wf200.gni") - } -} -efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] -if (use_rs911x || use_wf200) { + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", "LWIP_ARP=1", @@ -84,6 +89,13 @@ if (use_rs911x || use_wf200) { "LWIP_IPV6_ND=1", "LWIP_IGMP=1", ] + + if (use_rs911x) { + wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" + import("${wifi_sdk_dir}/rs911x/rs911x.gni") + } else { + import("${wifi_sdk_dir}/wf200/wf200.gni") + } } efr32_sdk("sdk") { @@ -119,16 +131,24 @@ efr32_sdk("sdk") { 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 - # Thread also uses LWIP - # - defines += efr32_lwip_defs - } - if (use_rs911x || use_wf200) { + # 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" ] } @@ -160,7 +180,6 @@ efr32_executable("lock_app") { deps = [ ":sdk", - "${chip_root}/examples/common/QRCode", "${chip_root}/examples/lock-app/lock-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", @@ -168,7 +187,9 @@ efr32_executable("lock_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${examples_plat_dir}:efr-matter-shell", ] - if (!use_rs911x && !use_wf200) { + + # OpenThread Settings + if (chip_enable_openthread) { deps += [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", @@ -192,36 +213,43 @@ efr32_executable("lock_app") { sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] } - 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 + # 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 } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs } - if (show_qr_code) { + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c" ] - defines += [ "DISPLAY_ENABLED" ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + + deps += [ "${chip_root}/examples/common/QRCode" ] + } } if (chip_enable_pw_rpc) { @@ -282,7 +310,9 @@ efr32_executable("lock_app") { "-fstack-usage", ] } - if (use_rs911x || use_wf200) { + + # WiFi Settings + if (chip_enable_wifi) { ldflags += [ "-Wl,--defsym", "-Wl,SILABS_WIFI=1", diff --git a/examples/lock-app/efr32/README.md b/examples/lock-app/efr32/README.md index 4c82af13cfb24b..65442b31d84229 100644 --- a/examples/lock-app/efr32/README.md +++ b/examples/lock-app/efr32/README.md @@ -297,3 +297,27 @@ 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) + +## 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" diff --git a/examples/lock-app/efr32/src/AppTask.cpp b/examples/lock-app/efr32/src/AppTask.cpp index 59a5c7b22c6654..ec4bb10f44a964 100644 --- a/examples/lock-app/efr32/src/AppTask.cpp +++ b/examples/lock-app/efr32/src/AppTask.cpp @@ -21,8 +21,10 @@ #include "AppConfig.h" #include "AppEvent.h" #include "LEDWidget.h" +#ifdef DISPLAY_ENABLED #include "lcd.h" #include "qrcodegen.h" +#endif // DISPLAY_ENABLED #include "sl_simple_led_instances.h" #include #include diff --git a/examples/lock-app/esp32/README.md b/examples/lock-app/esp32/README.md index 8cc35eaf597e8f..f44bc3f07b791f 100644 --- a/examples/lock-app/esp32/README.md +++ b/examples/lock-app/esp32/README.md @@ -97,18 +97,14 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). ## Commissioning and cluster control -Commissioning can be carried out using WiFi, BLE or Bypass. +Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. $ idf.py menuconfig -Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. If Rendezvous Mode is -Bypass then set the credentials of the WiFi Network (i.e. SSID and Password from -menuconfig). - -`idf.py menuconfig -> Component config -> CHIP Device Layer -> WiFi Station Options` +Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. 2. Now flash the device with the same command as before. (Use the right `/dev` device) @@ -216,7 +212,7 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console - python -m chip_rpc.console --device /dev/ttyUSB0 + chip-console --device /dev/ttyUSB0 From within the console you can then invoke rpcs: diff --git a/examples/lock-app/esp32/main/AppTask.cpp b/examples/lock-app/esp32/main/AppTask.cpp index 7b5a727b4dab54..efb179407c9594 100644 --- a/examples/lock-app/esp32/main/AppTask.cpp +++ b/examples/lock-app/esp32/main/AppTask.cpp @@ -103,7 +103,7 @@ CHIP_ERROR AppTask::Init() sLockLED.Set(!BoltLockMgr().IsUnlocked()); - UpdateClusterState(); + chip::DeviceLayer::SystemLayer().ScheduleWork(UpdateClusterState, nullptr); ConfigurationMgr().LogDeviceConfig(); @@ -462,7 +462,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } /* if unlocked then it locked it first*/ -void AppTask::UpdateClusterState(void) +void AppTask::UpdateClusterState(chip::System::Layer *, void * context) { uint8_t newValue = !BoltLockMgr().IsUnlocked(); diff --git a/examples/lock-app/esp32/main/CHIPDeviceManager.cpp b/examples/lock-app/esp32/main/CHIPDeviceManager.cpp index 579e68ada9c8d9..b6d0db29573370 100644 --- a/examples/lock-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/lock-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/lock-app/esp32/main/Kconfig.projbuild b/examples/lock-app/esp32/main/Kconfig.projbuild index 36dc37930eda26..e2ec051d774fe1 100644 --- a/examples/lock-app/esp32/main/Kconfig.projbuild +++ b/examples/lock-app/esp32/main/Kconfig.projbuild @@ -26,8 +26,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -55,7 +53,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/examples/lock-app/esp32/main/include/AppTask.h b/examples/lock-app/esp32/main/include/AppTask.h index 8d25e15981736c..ba7121b1554495 100644 --- a/examples/lock-app/esp32/main/include/AppTask.h +++ b/examples/lock-app/esp32/main/include/AppTask.h @@ -65,7 +65,7 @@ class AppTask static void LockActionEventHandler(AppEvent * aEvent); static void TimerEventHandler(TimerHandle_t xTimer); - static void UpdateClusterState(void); + static void UpdateClusterState(chip::System::Layer *, void * context); void StartTimer(uint32_t aTimeoutMs); diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 4a626b3e1d55b9..308d393702ed8c 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -648,6 +648,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -660,7 +666,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/lock-app/mbed/README.md b/examples/lock-app/mbed/README.md index 076794944445b8..7f6db4d2886c4a 100644 --- a/examples/lock-app/mbed/README.md +++ b/examples/lock-app/mbed/README.md @@ -256,7 +256,7 @@ parameters as arguments: Example: - python -m chip_rpc.console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out + chip-console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out To control the lock type the following command, where you define if 'on' state is true or false: diff --git a/examples/lock-app/mbed/config.in b/examples/lock-app/mbed/config.in index 87619681f691c0..4725fbcd62a77e 100644 --- a/examples/lock-app/mbed/config.in +++ b/examples/lock-app/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_PW_RPC=y CONFIG_CHIP_OTA_REQUESTOR=n diff --git a/examples/lock-app/nrfconnect/CMakeLists.txt b/examples/lock-app/nrfconnect/CMakeLists.txt index 44d8a35b11b8ff..9c813ca962a5c4 100644 --- a/examples/lock-app/nrfconnect/CMakeLists.txt +++ b/examples/lock-app/nrfconnect/CMakeLists.txt @@ -91,6 +91,10 @@ chip_configure_data_model(app ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../lock-common/lock-app.zap ) +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) +endif() + if(BUILD_WITH_DFU STREQUAL "BLE") target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 6ca2aa26d525e4..42219b1dcffb07 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -36,11 +36,7 @@ #include #if CONFIG_CHIP_OTA_REQUESTOR -#include -#include -#include -#include -#include +#include "OTAUtil.h" #endif #include @@ -74,14 +70,6 @@ bool sIsThreadProvisioned = false; bool sIsThreadEnabled = false; bool sHaveBLEConnections = false; -#if CONFIG_CHIP_OTA_REQUESTOR -DefaultOTARequestorStorage sRequestorStorage; -GenericOTARequestorDriver sOTARequestorDriver; -OTAImageProcessorImpl sOTAImageProcessor; -chip::BDXDownloader sBDXDownloader; -chip::OTARequestor sOTARequestor; -#endif - } // namespace AppTask AppTask::sAppTask; @@ -161,8 +149,10 @@ CHIP_ERROR AppTask::Init() // Initialize CHIP server SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); - InitOTARequestor(); ReturnErrorOnFailure(chip::Server::GetInstance().Init()); +#if CONFIG_CHIP_OTA_REQUESTOR + InitBasicOTARequestor(); +#endif ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); @@ -180,18 +170,6 @@ CHIP_ERROR AppTask::Init() return err; } -void AppTask::InitOTARequestor() -{ -#if CONFIG_CHIP_OTA_REQUESTOR - sOTAImageProcessor.SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&sOTAImageProcessor); - sOTARequestorDriver.Init(&sOTARequestor, &sOTAImageProcessor); - sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - sOTARequestor.Init(Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); - chip::SetRequestorInstance(&sOTARequestor); -#endif -} - CHIP_ERROR AppTask::StartApp() { ReturnErrorOnFailure(Init()); @@ -377,11 +355,6 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (chip::Server::GetInstance().AddTestCommissioning() != CHIP_NO_ERROR) - { - LOG_ERR("Failed to add test pairing"); - } - if (!ConnectivityMgr().IsThreadProvisioned()) { StartDefaultThreadNetwork(); diff --git a/examples/lock-app/nrfconnect/main/include/AppTask.h b/examples/lock-app/nrfconnect/main/include/AppTask.h index 1106723152b261..2789d15a41e229 100644 --- a/examples/lock-app/nrfconnect/main/include/AppTask.h +++ b/examples/lock-app/nrfconnect/main/include/AppTask.h @@ -44,7 +44,6 @@ class AppTask friend AppTask & GetAppTask(void); CHIP_ERROR Init(); - void InitOTARequestor(); static void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor); static void ActionCompleted(BoltLockManager::Action_t aAction, int32_t aActor); diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/prj.conf index 5a059b5108bc08..dabdbeef761f31 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/prj.conf @@ -38,6 +38,7 @@ CONFIG_BT_DEVICE_NAME="MatterLock" # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" diff --git a/examples/ota-provider-app/esp32/main/CHIPDeviceManager.cpp b/examples/ota-provider-app/esp32/main/CHIPDeviceManager.cpp index f4be7aacd8bf08..add55587dd3eb7 100644 --- a/examples/ota-provider-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/ota-provider-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/ota-provider-app/esp32/main/Kconfig.projbuild b/examples/ota-provider-app/esp32/main/Kconfig.projbuild index b5a506f24a24fc..483b7585dc68c6 100644 --- a/examples/ota-provider-app/esp32/main/Kconfig.projbuild +++ b/examples/ota-provider-app/esp32/main/Kconfig.projbuild @@ -26,8 +26,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -41,7 +39,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/examples/ota-provider-app/esp32/main/main.cpp b/examples/ota-provider-app/esp32/main/main.cpp index 546df355fa285c..fad067f2c9b0ca 100644 --- a/examples/ota-provider-app/esp32/main/main.cpp +++ b/examples/ota-provider-app/esp32/main/main.cpp @@ -36,12 +36,13 @@ #include using chip::Callback::Callback; -using namespace ::chip; -using namespace ::chip::Shell; -using namespace ::chip::System; -using namespace ::chip::Credentials; -using namespace ::chip::DeviceManager; -using namespace ::chip::DeviceLayer; +using namespace chip; +using namespace chip::Shell; +using namespace chip::System; +using namespace chip::Credentials; +using namespace chip::DeviceManager; +using namespace chip::DeviceLayer; +using namespace chip::app::Clusters::OtaSoftwareUpdateProvider; CHIP_ERROR OnBlockQuery(void * context, chip::System::PacketBufferHandle & blockBuf, size_t & size, bool & isEof, uint32_t offset); void OnTransferComplete(void * context); @@ -124,7 +125,7 @@ static void InitServer(intptr_t context) ESP_LOGI(TAG, "The OTA image size: %d", otaImageLen); if (otaImageLen > 0) { - otaProvider.SetQueryImageBehavior(OTAProviderExample::kRespondWithUpdateAvailable); + otaProvider.SetQueryImageStatus(OTAQueryStatus::kUpdateAvailable); otaProvider.SetOTAFilePath(otaFilename); } diff --git a/examples/ota-provider-app/linux/README.md b/examples/ota-provider-app/linux/README.md index b9693154bc1305..7293b068867e0e 100644 --- a/examples/ota-provider-app/linux/README.md +++ b/examples/ota-provider-app/linux/README.md @@ -24,8 +24,6 @@ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug c | -t/--delayedQueryActionTimeSec