From 42e6f431b9b50e9351f50e53b36ac7555100292f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 25 Jul 2023 14:44:22 -0400 Subject: [PATCH 01/16] Make C++17 the default everywhere (#28269) * Make cpp17 the default * Restyle * Add a clean for build on linux, since I had a run out of space --------- Co-authored-by: Andrei Litvin --- .github/workflows/build.yaml | 2 ++ build/config/compiler/compiler.gni | 7 +------ config/ameba/args.gni | 1 - config/mbed/CMakeLists.txt | 4 +--- examples/chef/silabs/with_pw_rpc.gni | 2 -- examples/chip-tool/args.gni | 3 --- examples/common/tracing/BUILD.gn | 5 +---- examples/light-switch-app/genio/with_pw_rpc.gni | 2 -- examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni | 2 -- examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni | 2 -- examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni | 2 -- examples/lighting-app/genio/with_pw_rpc.gni | 2 -- examples/lighting-app/qpg/with_pw_rpc.gni | 2 -- examples/lighting-app/silabs/with_pw_rpc.gni | 2 -- examples/lock-app/genio/with_pw_rpc.gni | 2 -- examples/lock-app/qpg/with_pw_rpc.gni | 2 -- examples/lock-app/silabs/with_pw_rpc.gni | 2 -- examples/ota-requestor-app/genio/with_pw_rpc.gni | 2 -- examples/pump-app/silabs/with_pw_rpc.gni | 2 -- examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni | 2 -- examples/thermostat/genio/with_pw_rpc.gni | 2 -- src/test_driver/efr32/args.gni | 1 - 22 files changed, 5 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 14ced0ab7474a8..c3914b86230305 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -174,6 +174,8 @@ jobs: BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false" scripts/run_in_build_env.sh "ninja -C ./out/gcc_release" BUILD_TYPE=gcc_release scripts/tests/gn_tests.sh + - name: Clean output + run: rm -rf ./out - name: Run Tests with sanitizers env: LSAN_OPTIONS: detect_leaks=1 diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index 12a93863be8ce0..74dc224f3ecec7 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -43,12 +43,7 @@ declare_args() { c_standard = "gnu11" # C++ standard level (value for -std flag). - if (current_os == "linux" || current_os == "mac" || current_os == "ios" || - current_os == "android") { - cpp_standard = "gnu++17" - } else { - cpp_standard = "gnu++14" - } + cpp_standard = "gnu++17" # enable libfuzzer is_libfuzzer = false diff --git a/config/ameba/args.gni b/config/ameba/args.gni index 51634a9d738da6..a60eee6db2887c 100755 --- a/config/ameba/args.gni +++ b/config/ameba/args.gni @@ -37,4 +37,3 @@ custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba" pw_build_PIP_CONSTRAINTS = [ "//third_party/connectedhomeip/scripts/setup/constraints.txt" ] -cpp_standard = "c++17" diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index a7006062f12ace..88567b604e3254 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -106,9 +106,7 @@ matter_get_compiler_flags_from_targets("${CONFIG_CHIP_EXTERNAL_TARGETS}") matter_add_flags(-D__LINUX_ERRNO_EXTENSIONS__=1) matter_add_flags(-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=) -if (CONFIG_CHIP_PW_RPC) - matter_add_gnu_cpp_standard("17") -endif() +matter_add_gnu_cpp_standard("17") if (CONFIG_MBED_BSD_SOCKET_TRACE) matter_add_flags(-DMBED_BSD_SOCKET_TRACE=1) diff --git a/examples/chef/silabs/with_pw_rpc.gni b/examples/chef/silabs/with_pw_rpc.gni index f07744d855c6f9..ec2d4cff28e7ad 100644 --- a/examples/chef/silabs/with_pw_rpc.gni +++ b/examples/chef/silabs/with_pw_rpc.gni @@ -24,7 +24,5 @@ silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true -cpp_standard = "gnu++17" - # Light app on EFR enables tracing server pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/chip-tool/args.gni b/examples/chip-tool/args.gni index 96dd37f02f03a1..a0b30a430f23f3 100644 --- a/examples/chip-tool/args.gni +++ b/examples/chip-tool/args.gni @@ -25,8 +25,5 @@ chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true -# Perfetto requires C++17 -cpp_standard = "gnu++17" - matter_log_json_payload_hex = true matter_log_json_payload_decode_full = true diff --git a/examples/common/tracing/BUILD.gn b/examples/common/tracing/BUILD.gn index 57eaaca3952245..266c3fc0f31581 100644 --- a/examples/common/tracing/BUILD.gn +++ b/examples/common/tracing/BUILD.gn @@ -19,10 +19,7 @@ import("${chip_root}/build/chip/buildconfig_header.gni") import("${chip_root}/src/lib/lib.gni") declare_args() { - # TODO: cpp_standard check is not ideal, it should be >= 17, - # however for now this is what we use in compilations - matter_commandline_enable_perfetto_tracing = - current_os == "linux" && cpp_standard == "gnu++17" + matter_commandline_enable_perfetto_tracing = current_os == "linux" } config("default_config") { diff --git a/examples/light-switch-app/genio/with_pw_rpc.gni b/examples/light-switch-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/light-switch-app/genio/with_pw_rpc.gni +++ b/examples/light-switch-app/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni index f398cda41f8c7d..4b76ad23d426ac 100644 --- a/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni @@ -22,8 +22,6 @@ import("${chip_root}/examples/platform/bouffalolab/bl602/args.gni") chip_enable_pw_rpc = true -cpp_standard = "gnu++17" - # pigweed updated to a1bd248 makes compile conversion errors; # it seems riscv gcc (version > 10) can fixes this issue. # let's disable strict warnings for RPC enabled for now. diff --git a/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni index 0a075b0e27228c..130936065cd57c 100644 --- a/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni @@ -22,8 +22,6 @@ import("${chip_root}/examples/platform/bouffalolab/bl702/args.gni") chip_enable_pw_rpc = true -cpp_standard = "gnu++17" - # pigweed updated to a1bd248 makes compile conversion errors; # it seems riscv gcc (version > 10) can fixes this issue. # let's disable strict warnings for RPC enabled for now. diff --git a/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni index 81aacad443b43c..5d7ce27c99df3d 100644 --- a/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni @@ -22,6 +22,4 @@ import("${chip_root}/examples/platform/bouffalolab/bl702l/args.gni") chip_enable_pw_rpc = true chip_build_pw_trace_lib = false - -cpp_standard = "gnu++17" #pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/lighting-app/genio/with_pw_rpc.gni b/examples/lighting-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/lighting-app/genio/with_pw_rpc.gni +++ b/examples/lighting-app/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/lighting-app/qpg/with_pw_rpc.gni b/examples/lighting-app/qpg/with_pw_rpc.gni index 2c388aa153388e..a2d2b536b17682 100644 --- a/examples/lighting-app/qpg/with_pw_rpc.gni +++ b/examples/lighting-app/qpg/with_pw_rpc.gni @@ -22,5 +22,3 @@ qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/lighting-app/silabs/with_pw_rpc.gni b/examples/lighting-app/silabs/with_pw_rpc.gni index f8af7659ce1ed8..b53832f4b3d468 100644 --- a/examples/lighting-app/silabs/with_pw_rpc.gni +++ b/examples/lighting-app/silabs/with_pw_rpc.gni @@ -25,7 +25,5 @@ app_data_model = "${chip_root}/examples/lighting-app/lighting-common" chip_enable_pw_rpc = true chip_enable_openthread = true -cpp_standard = "gnu++17" - # Light app on EFR enables tracing server pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/lock-app/genio/with_pw_rpc.gni b/examples/lock-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/lock-app/genio/with_pw_rpc.gni +++ b/examples/lock-app/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/lock-app/qpg/with_pw_rpc.gni b/examples/lock-app/qpg/with_pw_rpc.gni index 60eff2c6f10c42..6f195eee957169 100644 --- a/examples/lock-app/qpg/with_pw_rpc.gni +++ b/examples/lock-app/qpg/with_pw_rpc.gni @@ -22,5 +22,3 @@ import("${chip_root}/examples/platform/qpg/args.gni") qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true - -cpp_standard = "gnu++17" diff --git a/examples/lock-app/silabs/with_pw_rpc.gni b/examples/lock-app/silabs/with_pw_rpc.gni index 2592790c03e2ce..c919d90189eb7c 100644 --- a/examples/lock-app/silabs/with_pw_rpc.gni +++ b/examples/lock-app/silabs/with_pw_rpc.gni @@ -26,8 +26,6 @@ chip_enable_pw_rpc = true chip_enable_openthread = true chip_openthread_ftd = true -cpp_standard = "gnu++17" - # To fit in flash chip_detail_logging = false show_qr_code = false diff --git a/examples/ota-requestor-app/genio/with_pw_rpc.gni b/examples/ota-requestor-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/ota-requestor-app/genio/with_pw_rpc.gni +++ b/examples/ota-requestor-app/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/pump-app/silabs/with_pw_rpc.gni b/examples/pump-app/silabs/with_pw_rpc.gni index bade7c7ea1f376..fb05fde8b4ccc3 100644 --- a/examples/pump-app/silabs/with_pw_rpc.gni +++ b/examples/pump-app/silabs/with_pw_rpc.gni @@ -26,7 +26,5 @@ chip_enable_pw_rpc = true chip_enable_openthread = true chip_build_pw_trace_lib = true -cpp_standard = "gnu++17" - # Light app on EFR enables tracing server pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni b/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni index d06a784404a350..9b757515aceca9 100644 --- a/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni +++ b/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni @@ -25,5 +25,3 @@ app_data_model = "${chip_root}/examples/smoke-co-alarm-app/smoke-co-alarm-common" chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/thermostat/genio/with_pw_rpc.gni b/examples/thermostat/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/thermostat/genio/with_pw_rpc.gni +++ b/examples/thermostat/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/src/test_driver/efr32/args.gni b/src/test_driver/efr32/args.gni index 2ef6653a0181e2..a8d442d5c2140e 100644 --- a/src/test_driver/efr32/args.gni +++ b/src/test_driver/efr32/args.gni @@ -21,7 +21,6 @@ import("${chip_root}/src/platform/silabs/efr32/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true -cpp_standard = "gnu++17" chip_build_tests = true chip_enable_openthread = true chip_openthread_ftd = true From 88f9a4480c634a20d8420d1c9c8f4a71321354f2 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 25 Jul 2023 16:59:22 -0400 Subject: [PATCH 02/16] Add ipv6only build for rpc target, to not run out of ram when linking after #28104 (#28276) Co-authored-by: Andrei Litvin --- integrations/cloudbuild/smoke-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index 05511e2b184670..a745ee172004cc 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -32,7 +32,7 @@ steps: ./scripts/build/build_examples.py --enable-flashbundle --target esp32-devkitc-light-rpc --target esp32-m5stack-all-clusters-ipv6only --target - esp32-m5stack-all-clusters-rpc --target + esp32-m5stack-all-clusters-rpc-ipv6only --target esp32-m5stack-light --target esp32-m5stack-light-ipv6only --target esp32-m5stack-ota-requestor build --create-archives From d9a747bade926b93df7a221b020060145e011ae5 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 25 Jul 2023 20:24:14 -0400 Subject: [PATCH 03/16] Fix handling of cluster state cache min event number. (#28273) When initializing a new ReadClient with an existing ClusterStateCache, we should be setting the min event number to 1 more than the last event the cache saw. ReadClient was not doing this correctly. --- src/app/ReadClient.cpp | 7 +- src/controller/tests/TestEventCaching.cpp | 79 +++++++++++++------ .../tests/TestEventNumberCaching.cpp | 49 ++++++++---- .../Framework/CHIPTests/MTRDeviceTests.m | 1 + 4 files changed, 95 insertions(+), 41 deletions(-) diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 23b57df99ddbcf..c9df6638b708ef 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -1186,7 +1186,12 @@ CHIP_ERROR ReadClient::GetMinEventNumber(const ReadPrepareParams & aReadPrepareP } else { - return mpCallback.GetHighestReceivedEventNumber(aEventMin); + ReturnErrorOnFailure(mpCallback.GetHighestReceivedEventNumber(aEventMin)); + if (aEventMin.HasValue()) + { + // We want to start with the first event _after_ the last one we received. + aEventMin.SetValue(aEventMin.Value() + 1); + } } return CHIP_NO_ERROR; } diff --git a/src/controller/tests/TestEventCaching.cpp b/src/controller/tests/TestEventCaching.cpp index 06100250bdc2f4..24a101aeeb95b8 100644 --- a/src/controller/tests/TestEventCaching.cpp +++ b/src/controller/tests/TestEventCaching.cpp @@ -128,9 +128,16 @@ class TestReadCallback : public app::ClusterStateCache::Callback { public: TestReadCallback() : mClusterCacheAdapter(*this) {} - void OnDone(app::ReadClient *) {} + void OnDone(app::ReadClient *) override {} + + void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override + { + ++mEventsSeen; + } app::ClusterStateCache mClusterCacheAdapter; + + size_t mEventsSeen = 0; }; namespace { @@ -181,6 +188,7 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) chip::EventNumber lastEventNumber; GenerateEvents(apSuite, firstEventNumber, lastEventNumber); + NL_TEST_ASSERT(apSuite, lastEventNumber > firstEventNumber); app::EventPathParams eventPath; eventPath.mEndpointId = kTestEndpointId; @@ -203,10 +211,12 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) uint8_t generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -216,21 +226,23 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); - NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == 4); + NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); // // Re-run the iterator but pass in a path filter: EP*/TestCluster/EID* // generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -241,17 +253,19 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) }, app::EventPathParams(kInvalidEndpointId, Clusters::UnitTesting::Id, kInvalidEventId)); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); // // Re-run the iterator but pass in a path filter: EP*/TestCluster/TestEvent // generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -262,17 +276,20 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) }, app::EventPathParams(kInvalidEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Events::TestEvent::Id)); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); // - // Re-run the iterator but pass in a min event number filter (EventNumber = 1). We should only receive 4 events. + // Re-run the iterator but pass in a min event number filter + // (EventNumber = firstEventNumber + 1). We should only receive 4 events. // generationCount = 1; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber + 1); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -281,20 +298,23 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) generationCount++; return CHIP_NO_ERROR; }, - app::EventPathParams(), 1); + app::EventPathParams(), firstEventNumber + 1); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); // - // Re-run the iterator but pass in a min event number filter (EventNumber = 1) AND a path filter. We should only receive 4 + // Re-run the iterator but pass in a min event number filter + // (EventNumber = firstEventNumber + 1) AND a path filter. We should only receive 4 // events. // generationCount = 1; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber + 1); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -303,14 +323,15 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) generationCount++; return CHIP_NO_ERROR; }, - app::EventPathParams(kInvalidEndpointId, Clusters::UnitTesting::Id, kInvalidEventId), 1); + app::EventPathParams(kInvalidEndpointId, Clusters::UnitTesting::Id, kInvalidEventId), firstEventNumber + 1); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); } // // Generate more events. // + const EventNumber oldFirstEventNumber = firstEventNumber; GenerateEvents(apSuite, firstEventNumber, lastEventNumber); { @@ -327,10 +348,12 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) // uint8_t generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, oldFirstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= oldFirstEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -341,7 +364,7 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(apSuite, generationCount == 10); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - oldFirstEventNumber + 1); Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); @@ -368,18 +391,28 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) app::ReadClient::InteractionType::Read); readCallback.mClusterCacheAdapter.ClearEventCache(); - readCallback.mClusterCacheAdapter.SetHighestReceivedEventNumber(3); + constexpr EventNumber kLastSeenEventNumber = 3; + NL_TEST_ASSERT(apSuite, kLastSeenEventNumber < lastEventNumber); + readCallback.mClusterCacheAdapter.SetHighestReceivedEventNumber(kLastSeenEventNumber); + readParams.mEventNumber.ClearValue(); + + readCallback.mEventsSeen = 0; NL_TEST_ASSERT(apSuite, readClient.SendRequest(readParams) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); - uint8_t generationCount = 4; + // We should only get events with event numbers larger than kHighestEventNumberSeen. + NL_TEST_ASSERT(apSuite, readCallback.mEventsSeen == lastEventNumber - kLastSeenEventNumber); + + uint8_t generationCount = kLastSeenEventNumber + 1; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber > kLastSeenEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -390,10 +423,10 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(apSuite, generationCount == 10); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - oldFirstEventNumber + 1); Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); - NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == 9); + NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); } // diff --git a/src/controller/tests/TestEventNumberCaching.cpp b/src/controller/tests/TestEventNumberCaching.cpp index 8c291013e874c5..982e98fcc2cc05 100644 --- a/src/controller/tests/TestEventNumberCaching.cpp +++ b/src/controller/tests/TestEventNumberCaching.cpp @@ -128,9 +128,16 @@ class TestReadCallback : public app::ClusterStateCache::Callback { public: TestReadCallback() : mClusterCacheAdapter(*this, Optional::Missing(), false /*cacheData*/) {} - void OnDone(app::ReadClient *) {} + void OnDone(app::ReadClient *) override {} + + void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override + { + ++mEventsSeen; + } app::ClusterStateCache mClusterCacheAdapter; + + size_t mEventsSeen = 0; }; namespace { @@ -178,6 +185,7 @@ void TestReadEvents::TestEventNumberCaching(nlTestSuite * apSuite, void * apCont chip::EventNumber lastEventNumber; GenerateEvents(apSuite, firstEventNumber, lastEventNumber); + NL_TEST_ASSERT(apSuite, lastEventNumber > firstEventNumber); app::EventPathParams eventPath; eventPath.mEndpointId = kTestEndpointId; @@ -201,23 +209,22 @@ void TestReadEvents::TestEventNumberCaching(nlTestSuite * apSuite, void * apCont ctx.DrainAndServiceIO(); - readCallback.mClusterCacheAdapter.ForEachEventData([&apSuite, &readCallback](const app::EventHeader & header) { - NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); - NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); - NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, readCallback.mEventsSeen == lastEventNumber - firstEventNumber + 1); + + readCallback.mClusterCacheAdapter.ForEachEventData([&apSuite](const app::EventHeader & header) { + // We are not caching data. + NL_TEST_ASSERT(apSuite, false); - Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; - NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) != CHIP_NO_ERROR); return CHIP_NO_ERROR; }); readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); - NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == 4); + NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); } // // Clear out the event cache and set its highest received event number to a non zero value. Validate that - // we don't receive events lower than that value. + // we don't receive events except ones larger than that value. // { app::ReadClient readClient(engine, &ctx.GetExchangeManager(), readCallback.mClusterCacheAdapter.GetBufferedCallback(), @@ -227,24 +234,32 @@ void TestReadEvents::TestEventNumberCaching(nlTestSuite * apSuite, void * apCont Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); NL_TEST_ASSERT(apSuite, !highestEventNumber.HasValue()); - readCallback.mClusterCacheAdapter.SetHighestReceivedEventNumber(3); + const EventNumber kHighestEventNumberSeen = lastEventNumber - 1; + NL_TEST_ASSERT(apSuite, kHighestEventNumberSeen < lastEventNumber); + + readCallback.mClusterCacheAdapter.SetHighestReceivedEventNumber(kHighestEventNumberSeen); + + readCallback.mEventsSeen = 0; + + readParams.mEventNumber.ClearValue(); + NL_TEST_ASSERT(apSuite, !readParams.mEventNumber.HasValue()); NL_TEST_ASSERT(apSuite, readClient.SendRequest(readParams) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); - readCallback.mClusterCacheAdapter.ForEachEventData([&apSuite, &readCallback](const app::EventHeader & header) { - NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); - NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); - NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + // We should only get events with event numbers larger than kHighestEventNumberSeen. + NL_TEST_ASSERT(apSuite, readCallback.mEventsSeen == lastEventNumber - kHighestEventNumberSeen); + + readCallback.mClusterCacheAdapter.ForEachEventData([&apSuite](const app::EventHeader & header) { + // We are not caching data. + NL_TEST_ASSERT(apSuite, false); - Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; - NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) != CHIP_NO_ERROR); return CHIP_NO_ERROR; }); readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); - NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == 4); + NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); } NL_TEST_ASSERT(apSuite, ctx.GetExchangeManager().GetNumActiveExchanges() == 0); diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index a4e0577f8f92ef..0d9b693296bc2d 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -1484,6 +1484,7 @@ - (void)test017_TestMTRDeviceBasics [self waitForExpectations:@[ subscriptionExpectation ] timeout:60]; XCTAssertNotEqual(attributeReportsReceived, 0); + XCTAssertNotEqual(eventReportsReceived, 0); attributeReportsReceived = 0; eventReportsReceived = 0; From 9c90f0f21c93256cab4347e7b1d0f2abe136b1b0 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Wed, 26 Jul 2023 04:05:31 +0200 Subject: [PATCH 04/16] [chiptool.py] Add show_adapter_logs option to chiptool.py (#28258) --- scripts/tests/yaml/chiptool.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/tests/yaml/chiptool.py b/scripts/tests/yaml/chiptool.py index f36e29f22e0e4b..757d304312d77b 100755 --- a/scripts/tests/yaml/chiptool.py +++ b/scripts/tests/yaml/chiptool.py @@ -32,8 +32,9 @@ @click.pass_context -def send_yaml_command(ctx, test_name: str, server_path: str, server_arguments: str, pics: str, additional_pseudo_clusters_directory: str, commands: List[str]): - kwargs = {'test_name': test_name, 'pics': pics, 'additional_pseudo_clusters_directory': additional_pseudo_clusters_directory} +def send_yaml_command(ctx, test_name: str, server_path: str, server_arguments: str, show_adapter_logs: bool, pics: str, additional_pseudo_clusters_directory: str, commands: List[str]): + kwargs = {'test_name': test_name, 'show_adapter_logs': show_adapter_logs, 'pics': pics, + 'additional_pseudo_clusters_directory': additional_pseudo_clusters_directory} index = 0 while len(commands) - index > 1: @@ -83,6 +84,8 @@ def chiptool_runner_options(f): help='Name of a websocket server to run at launch.')(f) f = click.option('--server_arguments', type=str, default='interactive server', help='Optional arguments to pass to the websocket server at launch.')(f) + f = click.option('--show_adapter_logs', type=bool, default=False, show_default=True, + help='Show additional logs provided by the adapter.')(f) f = click.option('--trace_file', type=click.Path(), default=None, help='Optional file path to save the tracing output to.')(f) f = click.option('--trace_decode', type=bool, default=True, @@ -126,14 +129,14 @@ def maybe_update_stop_on_error(ctx): @click.argument('commands', nargs=-1) @chiptool_runner_options @click.pass_context -def chiptool_py(ctx, commands: List[str], server_path: str, server_name: str, server_arguments: str, trace_file: str, trace_decode: bool, delay_in_ms: int, continueonfailure: bool, pics: str, additional_pseudo_clusters_directory: str): +def chiptool_py(ctx, commands: List[str], server_path: str, server_name: str, server_arguments: str, show_adapter_logs: bool, trace_file: str, trace_decode: bool, delay_in_ms: int, continueonfailure: bool, pics: str, additional_pseudo_clusters_directory: str): success = False server_arguments = maybe_update_server_arguments(ctx) maybe_update_stop_on_error(ctx) if len(commands) > 1 and commands[0] == 'tests': - success = send_yaml_command(commands[1], server_path, server_arguments, pics, + success = send_yaml_command(commands[1], server_path, server_arguments, show_adapter_logs, pics, additional_pseudo_clusters_directory, commands[2:]) else: if server_path is None and server_name: From 67324e6f593a95fdec8a8de50c10a5d368348e0c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 26 Jul 2023 00:46:22 -0400 Subject: [PATCH 05/16] Update various bits to c++17 and gnu++17. (#28280) A number of gnu++14/c++14/c++11/gnu++11 got missed. --- .vscode/c_cpp_properties.json | 16 ++++++++-------- .vscode/settings.json | 2 +- examples/all-clusters-app/ameba/chip_main.cmake | 3 +-- .../ameba/chip_main.cmake | 3 +-- examples/bridge-app/esp32/CMakeLists.txt | 2 +- examples/chef/ameba/chip_main.cmake | 3 +-- examples/light-switch-app/ameba/chip_main.cmake | 3 +-- examples/lighting-app/ameba/chip_main.cmake | 3 +-- examples/ota-provider-app/esp32/CMakeLists.txt | 2 +- examples/ota-requestor-app/ameba/chip_main.cmake | 3 +-- examples/persistent-storage/esp32/CMakeLists.txt | 2 +- examples/shell/esp32/CMakeLists.txt | 2 +- .../CHIPTool/CHIPTool.xcodeproj/project.pbxproj | 4 ++-- .../Framework/Matter.xcodeproj/project.pbxproj | 4 ++-- third_party/ti_simplelink_sdk/BUILD.gn | 2 +- .../ti_simplelink_sdk/ti_simplelink_sdk.gni | 2 +- 16 files changed, 25 insertions(+), 31 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 425b49fdf84ae3..ef2ff751283ba9 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -5,7 +5,7 @@ "compileCommands": "${workspaceFolder}/out/debug/compile_commands.gcc.json", "compilerPath": "/usr/bin/gcc", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-x64", "browse": { "path": ["${workspaceFolder}/out/debug/"], @@ -17,7 +17,7 @@ "compileCommands": "${workspaceFolder}/out/debug/compile_commands.clang.json", "compilerPath": "/usr/bin/clang", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "clang-x64", "browse": { "path": ["${workspaceFolder}/out/debug/"], @@ -29,7 +29,7 @@ "compileCommands": "${workspaceFolder}/out/debug/compile_commands.mbedtls.json", "compilerPath": "/usr/bin/gcc", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-x64", "browse": { "path": ["${workspaceFolder}/out/debug/"], @@ -39,7 +39,7 @@ { "name": "Android x64 debug (GN)", "cStandard": "c11", - "cppStandard": "c++11", + "cppStandard": "gnu++17", "intelliSenseMode": "clang-x64", "compileCommands": "${workspaceFolder}/out/debug/compile_commands.android_x64.json", "compilerPath": "/opt/android/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android24-clang", @@ -51,7 +51,7 @@ { "name": "Android arm64 debug (GN)", "cStandard": "c11", - "cppStandard": "c++11", + "cppStandard": "gnu++17", "intelliSenseMode": "clang-arm64", "compileCommands": "${workspaceFolder}/out/debug/compile_commands.android_arm64.json", "compilerPath": "/opt/android/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang", @@ -63,7 +63,7 @@ { "name": "EFR32 examples debug (GN)", "cStandard": "c11", - "cppStandard": "c++11", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-arm", "compileCommands": "${workspaceFolder}/out/debug/compile_commands.efr32.json", "compilerPath": "/opt/ARM-software/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc", @@ -75,7 +75,7 @@ { "name": "nRF Connect examples debug (GN)", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-arm", "compilerPath": "/opt/ARM-software/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc", "browse": { @@ -86,7 +86,7 @@ { "name": "Tizen examples debug (GN)", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-arm", "compilerPath": "/opt/tizen-sdk/tools/arm-linux-gnueabi-gcc-9.2/bin/arm-linux-gnueabi-gcc", "compileCommands": "${workspaceFolder}/out/debug/compile_commands.tizen_arm.json", diff --git a/.vscode/settings.json b/.vscode/settings.json index e1a1725bcfbadb..7524bf25d83ec2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -166,7 +166,7 @@ ], "clang-format.fallbackStyle": "WebKit", "files.trimFinalNewlines": true, - "C_Cpp.default.cppStandard": "gnu++14", + "C_Cpp.default.cppStandard": "gnu++17", "C_Cpp.default.cStandard": "gnu11", "cmake.configureOnOpen": false, "search.followSymlinks": false, diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index 77bea5ccfe132f..9aa14765fa7923 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -298,8 +298,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/all-clusters-minimal-app/ameba/chip_main.cmake b/examples/all-clusters-minimal-app/ameba/chip_main.cmake index 95b062a636f0a6..6eed28e5dec0da 100755 --- a/examples/all-clusters-minimal-app/ameba/chip_main.cmake +++ b/examples/all-clusters-minimal-app/ameba/chip_main.cmake @@ -258,8 +258,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/bridge-app/esp32/CMakeLists.txt b/examples/bridge-app/esp32/CMakeLists.txt index 1e7c544310462c..d5a5732e145274 100644 --- a/examples/bridge-app/esp32/CMakeLists.txt +++ b/examples/bridge-app/esp32/CMakeLists.txt @@ -29,7 +29,7 @@ set(EXTRA_COMPONENT_DIRS # TODO: add CHIPProjectAppConfig.h to esp32 project(chip-bridge-app) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H;-DCHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT=16" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H;-DCHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT=16" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For the C3, project_include.cmake sets -Wno-format, but does not clear various # flags that depend on -Wformat diff --git a/examples/chef/ameba/chip_main.cmake b/examples/chef/ameba/chip_main.cmake index c92f1e0b471eb0..bc4ef4a9308bc1 100755 --- a/examples/chef/ameba/chip_main.cmake +++ b/examples/chef/ameba/chip_main.cmake @@ -114,8 +114,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/light-switch-app/ameba/chip_main.cmake b/examples/light-switch-app/ameba/chip_main.cmake index 23d8d66feea2d4..71deaa9938e494 100755 --- a/examples/light-switch-app/ameba/chip_main.cmake +++ b/examples/light-switch-app/ameba/chip_main.cmake @@ -287,8 +287,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/lighting-app/ameba/chip_main.cmake b/examples/lighting-app/ameba/chip_main.cmake index 5d8b85dd1e6a14..727b7e4d554868 100755 --- a/examples/lighting-app/ameba/chip_main.cmake +++ b/examples/lighting-app/ameba/chip_main.cmake @@ -274,8 +274,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/ota-provider-app/esp32/CMakeLists.txt b/examples/ota-provider-app/esp32/CMakeLists.txt index d9abb2fe27f3d3..156c9366e183b1 100644 --- a/examples/ota-provider-app/esp32/CMakeLists.txt +++ b/examples/ota-provider-app/esp32/CMakeLists.txt @@ -30,7 +30,7 @@ set(EXTRA_COMPONENT_DIRS ) project(chip-ota-provider-app) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For the C3, project_include.cmake sets -Wno-format, but does not clear various # flags that depend on -Wformat diff --git a/examples/ota-requestor-app/ameba/chip_main.cmake b/examples/ota-requestor-app/ameba/chip_main.cmake index a7aecb06707370..ed14a6424eab40 100644 --- a/examples/ota-requestor-app/ameba/chip_main.cmake +++ b/examples/ota-requestor-app/ameba/chip_main.cmake @@ -91,8 +91,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/persistent-storage/esp32/CMakeLists.txt b/examples/persistent-storage/esp32/CMakeLists.txt index 372d88c2729db1..86bf87b7a4a4d5 100644 --- a/examples/persistent-storage/esp32/CMakeLists.txt +++ b/examples/persistent-storage/esp32/CMakeLists.txt @@ -28,7 +28,7 @@ set(EXTRA_COMPONENT_DIRS ) project(chip-persistent-storage) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For the C3, project_include.cmake sets -Wno-format, but does not clear various # flags that depend on -Wformat diff --git a/examples/shell/esp32/CMakeLists.txt b/examples/shell/esp32/CMakeLists.txt index 1b1c919acef6ee..3b23f33624aeb6 100644 --- a/examples/shell/esp32/CMakeLists.txt +++ b/examples/shell/esp32/CMakeLists.txt @@ -29,7 +29,7 @@ set(EXTRA_COMPONENT_DIRS ) project(chip-shell) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For the C3, project_include.cmake sets -Wno-format, but does not clear various diff --git a/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj b/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj index a7993016697d66..67692af8f88bc4 100644 --- a/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj +++ b/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj @@ -447,7 +447,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -508,7 +508,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index ba81628e65a01a..8dc126d5e24f2a 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -1686,7 +1686,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -1858,7 +1858,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/third_party/ti_simplelink_sdk/BUILD.gn b/third_party/ti_simplelink_sdk/BUILD.gn index 8f6c4806d2182a..363d94685955fe 100644 --- a/third_party/ti_simplelink_sdk/BUILD.gn +++ b/third_party/ti_simplelink_sdk/BUILD.gn @@ -110,7 +110,7 @@ config("ti_simplelink_freertos_config") { config("ti_simplelink_posix_config") { include_dirs = [ "${ti_simplelink_sdk_root}/source/ti/posix/gcc" ] cflags_c = [ "-std=c11" ] - cflags_cc = [ "-std=c++14" ] + cflags_cc = [ "-std=c++17" ] cflags = [ "-Wno-maybe-uninitialized", "-Wno-sign-compare", diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni index 08ef9bd1c6fd8a..06c925ff8b0774 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni @@ -277,7 +277,7 @@ template("ti_simplelink_sdk") { config("${sdk_target_name}_posix_config") { include_dirs = [ "${ti_simplelink_sdk_root}/source/ti/posix/gcc" ] cflags_c = [ "-std=c11" ] - cflags_cc = [ "-std=c++14" ] + cflags_cc = [ "-std=c++17" ] cflags = [ "-Wno-maybe-uninitialized", "-Wno-sign-compare", From b9de4753b309a186046ca9102cdc2cb8a8953785 Mon Sep 17 00:00:00 2001 From: EricZijian_Siter Date: Wed, 26 Jul 2023 15:21:28 +0800 Subject: [PATCH 06/16] [SMCO] Assign five values to HIEST_PRI_ALARM (#28247) Co-authored-by: Hare --- .../certification/Test_TC_SMCO_2_6.yaml | 20 +++++++++++++++---- .../chip-tool/zap-generated/test/Commands.h | 16 +++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml b/src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml index 5d68637c3b5a46..0b13078763c4cb 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml @@ -60,6 +60,18 @@ config: HIEST_PRI_ALARM: type: int8u defaultValue: 1 + HIEST_PRI_ALARM_2: + type: int8u + defaultValue: 2 + HIEST_PRI_ALARM_3: + type: int8u + defaultValue: 7 + HIEST_PRI_ALARM_4: + type: int8u + defaultValue: 7 + HIEST_PRI_ALARM_5: + type: int8u + defaultValue: 3 tests: - label: "Commission DUT to TH" @@ -334,7 +346,7 @@ tests: command: "readAttribute" attribute: "ExpressedState" response: - value: HIEST_PRI_ALARM + value: HIEST_PRI_ALARM_2 constraints: type: enum8 @@ -371,7 +383,7 @@ tests: command: "readAttribute" attribute: "ExpressedState" response: - value: HIEST_PRI_ALARM + value: HIEST_PRI_ALARM_3 constraints: type: enum8 @@ -409,7 +421,7 @@ tests: command: "readAttribute" attribute: "ExpressedState" response: - value: HIEST_PRI_ALARM + value: HIEST_PRI_ALARM_4 constraints: type: enum8 @@ -447,7 +459,7 @@ tests: command: "readAttribute" attribute: "ExpressedState" response: - value: HIEST_PRI_ALARM + value: HIEST_PRI_ALARM_5 constraints: type: enum8 diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index ce0c3be66f3523..e800416ec18db5 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -63224,6 +63224,10 @@ class Test_TC_SMCO_2_6Suite : public TestCommand AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarm); AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarmClear); AddArgument("HIEST_PRI_ALARM", 0, UINT8_MAX, &mHiestPriAlarm); + AddArgument("HIEST_PRI_ALARM_2", 0, UINT8_MAX, &mHiestPriAlarm2); + AddArgument("HIEST_PRI_ALARM_3", 0, UINT8_MAX, &mHiestPriAlarm3); + AddArgument("HIEST_PRI_ALARM_4", 0, UINT8_MAX, &mHiestPriAlarm4); + AddArgument("HIEST_PRI_ALARM_5", 0, UINT8_MAX, &mHiestPriAlarm5); } ~Test_TC_SMCO_2_6Suite() {} @@ -63247,6 +63251,10 @@ class Test_TC_SMCO_2_6Suite : public TestCommand chip::Optional mTestEventTriggerInterconnectCoAlarm; chip::Optional mTestEventTriggerInterconnectCoAlarmClear; chip::Optional mHiestPriAlarm; + chip::Optional mHiestPriAlarm2; + chip::Optional mHiestPriAlarm3; + chip::Optional mHiestPriAlarm4; + chip::Optional mHiestPriAlarm5; chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } @@ -63420,7 +63428,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand { chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm2.HasValue() ? mHiestPriAlarm2.Value() : 2U)); VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); } break; @@ -63442,7 +63450,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand { chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm3.HasValue() ? mHiestPriAlarm3.Value() : 7U)); VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); } break; @@ -63464,7 +63472,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand { chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm4.HasValue() ? mHiestPriAlarm4.Value() : 7U)); VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); } break; @@ -63486,7 +63494,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand { chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm5.HasValue() ? mHiestPriAlarm5.Value() : 3U)); VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); } break; From 1d49d9ef588c3ec4f0da829783e4b7c8885053b3 Mon Sep 17 00:00:00 2001 From: William Date: Wed, 26 Jul 2023 10:36:21 +0100 Subject: [PATCH 07/16] Fix memory leak when destroying ModeBase delegates (#28267) * Fixes #28265 * Fixed typo. --- .../all-clusters-common/src/dishwasher-mode.cpp | 3 ++- .../all-clusters-common/src/laundry-washer-mode.cpp | 3 ++- .../all-clusters-app/all-clusters-common/src/rvc-modes.cpp | 6 ++++-- .../all-clusters-app/all-clusters-common/src/tcc-mode.cpp | 3 ++- src/app/clusters/mode-base-server/mode-base-server.h | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp b/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp index c96ec297a2e2d2..65de4f9dc6e85e 100644 --- a/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp @@ -85,7 +85,8 @@ void DishwasherMode::Shutdown() } if (gDishwasherModeDelegate != nullptr) { - gDishwasherModeDelegate->~DishwasherModeDelegate(); + delete gDishwasherModeDelegate; + gDishwasherModeDelegate = nullptr; } } diff --git a/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp b/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp index 9d05b4b58850e0..bf5337277ce430 100644 --- a/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp @@ -84,7 +84,8 @@ void LaundryWasherMode::Shutdown() } if (gLaundryWasherModeDelegate != nullptr) { - gLaundryWasherModeDelegate->~LaundryWasherModeDelegate(); + delete gLaundryWasherModeDelegate; + gLaundryWasherModeDelegate = nullptr; } } diff --git a/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp b/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp index 9a95054c26f8ab..81fa54965c2172 100644 --- a/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp @@ -97,7 +97,8 @@ void RvcRunMode::Shutdown() } if (gRvcRunModeDelegate != nullptr) { - gRvcRunModeDelegate->~RvcRunModeDelegate(); + delete gRvcRunModeDelegate; + gRvcRunModeDelegate = nullptr; } } @@ -180,7 +181,8 @@ void RvcCleanMode::Shutdown() } if (gRvcCleanModeDelegate != nullptr) { - gRvcCleanModeDelegate->~RvcCleanModeDelegate(); + delete gRvcCleanModeDelegate; + gRvcCleanModeDelegate = nullptr; } } diff --git a/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp b/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp index 30b8c03075e2ea..8f3c865aecaf0e 100644 --- a/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp @@ -84,7 +84,8 @@ void RefrigeratorAndTemperatureControlledCabinetMode::Shutdown() } if (gTccModeDelegate != nullptr) { - gTccModeDelegate->~TccModeDelegate(); + delete gTccModeDelegate; + gTccModeDelegate = nullptr; } } diff --git a/src/app/clusters/mode-base-server/mode-base-server.h b/src/app/clusters/mode-base-server/mode-base-server.h index 3e1b77bcbf7e2a..b75eeb85e67481 100644 --- a/src/app/clusters/mode-base-server/mode-base-server.h +++ b/src/app/clusters/mode-base-server/mode-base-server.h @@ -241,7 +241,7 @@ class Delegate // todo change once there is a clear public interface for the OnOff cluster data dependencies (#27508) static IntrusiveList gModeBaseAliasesInstances; -// This does not return a refernce to const IntrusiveList, because the caller might need +// This does not return a reference to const IntrusiveList, because the caller might need // to change the state of the instances in the list and const IntrusiveList only allows // access to const Instance. IntrusiveList & GetModeBaseInstanceList(); From bae8aff50036f939baa2b61a7ca1d895e94be3cf Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 26 Jul 2023 09:47:08 -0400 Subject: [PATCH 08/16] [cloudbuild] Fix CHEF builds for esp32. (#28295) Adds the workaround for gdbgui for chef builds as well. Chef failures were missed because we had a 'keep going' flag to builds. Removed that one as we should actually fix errors not ignore them. --- integrations/cloudbuild/chef.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 7e750750f5f76a..4ec78c51730b1a 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -16,8 +16,9 @@ steps: env: - PW_ENVIRONMENT_ROOT=/pwenv args: - - ./examples/chef/chef.py --build_all --keep_going --build_exclude - noip + - >- + perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt && + ./examples/chef/chef.py --build_all --build_exclude noip id: CompileAll waitFor: - Bootstrap @@ -30,7 +31,7 @@ steps: env: - PW_ENVIRONMENT_ROOT=/pwenv args: - - ./examples/chef/chef.py --build_all --keep_going --build_include + - ./examples/chef/chef.py --build_all --build_include linux_arm64_ipv6only.*noip id: CompileNoip waitFor: From 6c4368f1f59ca01d10516a07a94e36b8785edc1a Mon Sep 17 00:00:00 2001 From: shgutte <102281713+shgutte@users.noreply.github.com> Date: Wed, 26 Jul 2023 19:35:53 +0530 Subject: [PATCH 09/16] [Silabs] BLE bug fixes for Wi-Fi devices (#27842) * ble bug fixes with NCP and SOC * Restyled by clang-format * Added changes for BLEManager event * Added changes according to comments * Added TODO for RSI_ERROR define * removed the semaphore changes * applied retyled patch --------- Co-authored-by: bhmanda-silabs Co-authored-by: Restyled.io --- src/platform/silabs/rs911x/BLEManagerImpl.cpp | 48 +++++++++++++++---- src/platform/silabs/rs911x/rsi_ble_config.h | 6 +++ 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index 5719b816b95676..4f04daf464730f 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -60,8 +60,6 @@ extern "C" { #include #endif -extern uint16_t rsi_ble_measurement_hndl; -extern rsi_ble_event_conn_status_t conn_event_to_app; extern sl_wfx_msg_t event_msg; StaticTask_t rsiBLETaskStruct; @@ -589,8 +587,21 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) { ChipLogError(DeviceLayer, "rsi_ble_set_advertise_data() success: %ld", result); } - - // err = MapBLEError(result); + index = 0; + responseData[index++] = 0x02; // length + responseData[index++] = CHIP_ADV_DATA_TYPE_FLAGS; // AD type : flags + responseData[index++] = CHIP_ADV_DATA_FLAGS; + responseData[index++] = CHIP_ADV_SHORT_UUID_LEN + 1; // AD length + responseData[index++] = CHIP_ADV_DATA_TYPE_UUID; // AD type : uuid + responseData[index++] = ShortUUID_CHIPoBLEService[0]; // AD value + responseData[index++] = ShortUUID_CHIPoBLEService[1]; + + responseData[index++] = static_cast(mDeviceNameLength + 1); // length + responseData[index++] = CHIP_ADV_DATA_TYPE_NAME; // AD type : name + memcpy(&responseData[index], mDeviceName, mDeviceNameLength); // AD value + index += mDeviceNameLength; + + rsi_ble_set_scan_response_data(responseData, index); ChipLogProgress(DeviceLayer, "ConfigureAdvertisingData End"); exit: @@ -659,8 +670,16 @@ int32_t BLEManagerImpl::SendBLEAdvertisementCommand(void) ble_adv.filter_type = RSI_BLE_ADV_FILTER_TYPE; ble_adv.direct_addr_type = RSI_BLE_ADV_DIR_ADDR_TYPE; rsi_ascii_dev_address_to_6bytes_rev(ble_adv.direct_addr, (int8_t *) RSI_BLE_ADV_DIR_ADDR); - ble_adv.adv_int_min = RSI_BLE_ADV_INT_MIN; - ble_adv.adv_int_max = RSI_BLE_ADV_INT_MAX; + if (mFlags.Has(Flags::kFastAdvertisingEnabled)) + { + ble_adv.adv_int_min = CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MIN; + ble_adv.adv_int_max = CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MAX; + } + else + { + ble_adv.adv_int_min = CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MIN; + ble_adv.adv_int_max = CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX; + } ble_adv.own_addr_type = LE_RANDOM_ADDRESS; ble_adv.adv_channel_map = RSI_BLE_ADV_CHANNEL_MAP; return rsi_ble_start_advertising_with_values(&ble_adv); @@ -781,6 +800,10 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt) CHIP_ERROR err = CHIP_NO_ERROR; bool isIndicationEnabled = false; ChipDeviceEvent event; + CHIPoBLEConState * bleConnState; + + bleConnState = GetConnectionState(event_msg.connectionHandle); + VerifyOrExit(bleConnState != NULL, err = CHIP_ERROR_NO_MEMORY); // Determine if the client is enabling or disabling notification/indication. if (evt->att_value[0] != 0) @@ -792,9 +815,12 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt) if (isIndicationEnabled) { - // Post an event to the CHIP queue to process either a CHIPoBLE Subscribe or Unsubscribe based on - // whether the client is enabling or disabling indications. + // If indications are not already enabled for the connection... + if (!bleConnState->subscribed) { + bleConnState->subscribed = 1; + // Post an event to the CHIP queue to process either a CHIPoBLE Subscribe or Unsubscribe based on + // whether the client is enabling or disabling indications. event.Type = DeviceEventType::kCHIPoBLESubscribe; event.CHIPoBLESubscribe.ConId = 1; // TODO:: To be replaced by device mac address err = PlatformMgr().PostEvent(&event); @@ -802,10 +828,16 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt) } else { + bleConnState->subscribed = 0; event.Type = DeviceEventType::kCHIPoBLEUnsubscribe; event.CHIPoBLESubscribe.ConId = 1; // TODO:: To be replaced by device mac address err = PlatformMgr().PostEvent(&event); } +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "HandleTXCharCCCDWrite() failed: %s", ErrorStr(err)); + } } void BLEManagerImpl::HandleRXCharWrite(rsi_ble_event_write_t * evt) diff --git a/src/platform/silabs/rs911x/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h index 550e29fda03ed2..c308a391209a74 100644 --- a/src/platform/silabs/rs911x/rsi_ble_config.h +++ b/src/platform/silabs/rs911x/rsi_ble_config.h @@ -24,6 +24,12 @@ * * Macros * ******************************************************/ //! application event list +// TODO: remove this define after integration of the new wifi sdk +#ifndef RSI_FAILURE +// failure return value +#define RSI_FAILURE -1 +#endif + #define RSI_BLE_CONN_EVENT (0x01) #define RSI_BLE_DISCONN_EVENT (0x02) #define RSI_BLE_GATT_WRITE_EVENT (0x03) From 142b064517ea57a3ccf241a5f534b6536b4d9248 Mon Sep 17 00:00:00 2001 From: mideayanghui <106149377+mideayanghui@users.noreply.github.com> Date: Wed, 26 Jul 2023 22:31:51 +0800 Subject: [PATCH 10/16] [OPSTATE] fix :optimize event api (#28285) * [feature]: optimize OPSTATE event api * Restyled by clang-format * optimize OPSTATE api * move the place of OPSTATE event class * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../operational-state-delegate.h | 15 --- .../operational-state-server.cpp | 96 +++++++++++++------ .../operational-state-server.h | 10 +- .../tests/TestOperationalStateDelegate.cpp | 37 ------- 4 files changed, 74 insertions(+), 84 deletions(-) diff --git a/src/app/clusters/operational-state-server/operational-state-delegate.h b/src/app/clusters/operational-state-server/operational-state-delegate.h index 6fd29bd7d48480..34bbe2d1ba10c0 100644 --- a/src/app/clusters/operational-state-server/operational-state-delegate.h +++ b/src/app/clusters/operational-state-server/operational-state-delegate.h @@ -187,21 +187,6 @@ struct GenericOperationalPhase char mPhaseNameBuffer[kOperationalPhaseNameMaxSize]; }; -/** - * A class which represents the operational completion of an Operational State cluster derivation instance. - */ -struct GenericOperationCompletion : public app::Clusters::OperationalState::Events::OperationCompletion::Type -{ - GenericOperationCompletion(uint8_t aCompletionErrorCode, - const Optional> & aTotalOperationalTime = NullOptional, - const Optional> & aPausedTime = NullOptional) - { - completionErrorCode = aCompletionErrorCode; - totalOperationalTime = aTotalOperationalTime; - pausedTime = aPausedTime; - } -}; - /** * A delegate to handle application logic of the Operational State aliased Cluster. * The delegate API assumes there will be separate delegate objects for each cluster instance. diff --git a/src/app/clusters/operational-state-server/operational-state-server.cpp b/src/app/clusters/operational-state-server/operational-state-server.cpp index a91f13d2f257a5..5fa7473f0e1641 100644 --- a/src/app/clusters/operational-state-server/operational-state-server.cpp +++ b/src/app/clusters/operational-state-server/operational-state-server.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -46,6 +45,55 @@ using namespace chip::app::Clusters::OperationalState::Attributes; using Status = Protocols::InteractionModel::Status; +/** + * A class which represents the operational error event of an Operational State cluster derivation instance. + */ +class GenericErrorEvent : private app::Clusters::OperationalState::Events::OperationalError::Type +{ + using super = app::Clusters::OperationalState::Events::OperationalError::Type; + +public: + GenericErrorEvent(ClusterId aClusterId, const Structs::ErrorStateStruct::Type & aError) : mClusterId(aClusterId) + { + errorState = aError; + } + using super::GetEventId; + using super::GetPriorityLevel; + ClusterId GetClusterId() const { return mClusterId; } + using super::Encode; + using super::kIsFabricScoped; + +private: + ClusterId mClusterId; +}; + +/** + * A class which represents the operational completion event of an Operational State cluster derivation instance. + */ +class GenericOperationCompletionEvent : private app::Clusters::OperationalState::Events::OperationCompletion::Type +{ + using super = app::Clusters::OperationalState::Events::OperationCompletion::Type; + +public: + GenericOperationCompletionEvent(ClusterId aClusterId, uint8_t aCompletionErrorCode, + const Optional> & aTotalOperationalTime = NullOptional, + const Optional> & aPausedTime = NullOptional) : + mClusterId(aClusterId) + { + completionErrorCode = aCompletionErrorCode; + totalOperationalTime = aTotalOperationalTime; + pausedTime = aPausedTime; + } + using super::GetEventId; + using super::GetPriorityLevel; + ClusterId GetClusterId() const { return mClusterId; } + using super::Encode; + using super::kIsFabricScoped; + +private: + ClusterId mClusterId; +}; + CHIP_ERROR OperationalStateServer::Init() { // Check if the cluster has been selected in zap @@ -302,44 +350,34 @@ CHIP_ERROR OperationalStateServer::Read(const ConcreteReadAttributePath & aPath, return CHIP_NO_ERROR; } -void OperationalStateServer::OnOperationalErrorDetect(const Structs::ErrorStateStruct::Type & aError) +void OperationalStateServer::OnOperationalErrorDetected(const Structs::ErrorStateStruct::Type & aError) { - ChipLogDetail(Zcl, "OperationalStateServer: OnOperationalErrorDetect"); - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, OperationalState::Attributes::OperationalState::Id); + ChipLogDetail(Zcl, "OperationalStateServer: OnOperationalErrorDetected"); + MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalState::Id); + GenericErrorEvent event(mClusterId, aError); EventNumber eventNumber; - Events::OperationalError::Type event{ aError }; - EventLogger eventData(event); - ConcreteEventPath path(mEndpointId, mClusterId, event.GetEventId()); - EventManagement & logMgmt = chip::app::EventManagement::GetInstance(); - EventOptions eventOptions; - eventOptions.mPath = path; - eventOptions.mPriority = event.GetPriorityLevel(); - - CHIP_ERROR err = logMgmt.LogEvent(&eventData, eventOptions, eventNumber); - if (err != CHIP_NO_ERROR) + CHIP_ERROR error = app::LogEvent(event, mEndpointId, eventNumber); + + if (error != CHIP_NO_ERROR) { - ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationalError event: %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationalError event: %" CHIP_ERROR_FORMAT, error.Format()); } } -void OperationalStateServer::OnOperationCompletionDetect(const Events::OperationCompletion::Type & aEvent) +void OperationalStateServer::OnOperationCompletionDetected(uint8_t aCompletionErrorCode, + const Optional> & aTotalOperationalTime, + const Optional> & aPausedTime) { - ChipLogDetail(Zcl, "OperationalStateServer: OnOperationCompletionDetect"); - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, OperationalState::Attributes::OperationalState::Id); + ChipLogDetail(Zcl, "OperationalStateServer: OnOperationCompletionDetected"); + GenericOperationCompletionEvent event(mClusterId, aCompletionErrorCode, aTotalOperationalTime, aPausedTime); EventNumber eventNumber; - EventLogger eventData(aEvent); - ConcreteEventPath path(mEndpointId, mClusterId, aEvent.GetEventId()); - EventManagement & logMgmt = chip::app::EventManagement::GetInstance(); - EventOptions eventOptions; - eventOptions.mPath = path; - eventOptions.mPriority = aEvent.GetPriorityLevel(); - - CHIP_ERROR err = logMgmt.LogEvent(&eventData, eventOptions, eventNumber); - if (err != CHIP_NO_ERROR) + CHIP_ERROR error = app::LogEvent(event, mEndpointId, eventNumber); + + if (error != CHIP_NO_ERROR) { - ChipLogError(Zcl, "OperationalStateServer: Failed to record OnOperationCompletionDetect event: %" CHIP_ERROR_FORMAT, - err.Format()); + ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationCompletion event: %" CHIP_ERROR_FORMAT, + error.Format()); } } diff --git a/src/app/clusters/operational-state-server/operational-state-server.h b/src/app/clusters/operational-state-server/operational-state-server.h index 796fa4cc3640e4..5bb50d3b5df6ef 100644 --- a/src/app/clusters/operational-state-server/operational-state-server.h +++ b/src/app/clusters/operational-state-server/operational-state-server.h @@ -64,13 +64,17 @@ class OperationalStateServer : public CommandHandlerInterface, public AttributeA * @brief Called when the Node detects a OperationalError has been raised. * @param aError OperationalError which detects */ - void OnOperationalErrorDetect(const Structs::ErrorStateStruct::Type & aError); + void OnOperationalErrorDetected(const Structs::ErrorStateStruct::Type & aError); /** * @brief Called when the Node detects a OperationCompletion has been raised. - * @param aEvent OperationCompletion event + * @param aCompletionErrorCode CompletionErrorCode + * @param aTotalOperationalTime TotalOperationalTime + * @param aPausedTime PausedTime */ - void OnOperationCompletionDetect(const Events::OperationCompletion::Type & aEvent); + void OnOperationCompletionDetected(uint8_t aCompletionErrorCode, + const Optional> & aTotalOperationalTime = NullOptional, + const Optional> & aPausedTime = NullOptional); /** * Creates an operational state cluster instance. The Init() function needs to be called for this instance to be registered and diff --git a/src/app/tests/TestOperationalStateDelegate.cpp b/src/app/tests/TestOperationalStateDelegate.cpp index a4d5dce822bc8d..e82f80bbdaff84 100644 --- a/src/app/tests/TestOperationalStateDelegate.cpp +++ b/src/app/tests/TestOperationalStateDelegate.cpp @@ -542,42 +542,6 @@ void TestStructGenericOperationalPhaseCopyAssignment(nlTestSuite * inSuite, void memcmp(const_cast(phase.mPhaseName.Value().data()), phaseBuffer2, kOperationalPhaseNameMaxSize) == 0); } -void TestStructGenericOperationalCompletionConstructor(nlTestSuite * inSuite, void * inContext) -{ - using namespace chip::app; - using namespace chip::app::Clusters::OperationalState; - - // completion with only CompletionErrorCode - GenericOperationCompletion genericOperationCompletion(to_underlying(OperationalStateEnum::kError)); - NL_TEST_ASSERT(inSuite, genericOperationCompletion.completionErrorCode == to_underlying(OperationalStateEnum::kError)); - NL_TEST_ASSERT(inSuite, genericOperationCompletion.totalOperationalTime.HasValue() == false); - NL_TEST_ASSERT(inSuite, genericOperationCompletion.pausedTime.HasValue() == false); - - // completion with errorCode and TotalOperationalTime - uint32_t kTotalOperationalTime = 500; - GenericOperationCompletion genericOperationCompletion2( - to_underlying(OperationalStateEnum::kError), - Optional>(DataModel::Nullable(kTotalOperationalTime))); - NL_TEST_ASSERT(inSuite, genericOperationCompletion2.completionErrorCode == to_underlying(OperationalStateEnum::kError)); - - NL_TEST_ASSERT(inSuite, genericOperationCompletion2.totalOperationalTime.HasValue() == true); - NL_TEST_ASSERT(inSuite, genericOperationCompletion2.totalOperationalTime.Value().Value() == kTotalOperationalTime); - NL_TEST_ASSERT(inSuite, genericOperationCompletion2.pausedTime.HasValue() == false); - - // completion with errorCode, TotalOperationalTime and PausedTime - uint32_t kPausedTime = 2000; - GenericOperationCompletion genericOperationCompletion3( - to_underlying(OperationalStateEnum::kError), - Optional>(DataModel::Nullable(kTotalOperationalTime)), - Optional>(DataModel::Nullable(kPausedTime))); - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.completionErrorCode == to_underlying(OperationalStateEnum::kError)); - - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.totalOperationalTime.HasValue() == true); - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.totalOperationalTime.Value().Value() == kTotalOperationalTime); - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.pausedTime.HasValue() == true); - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.pausedTime.Value().Value() == kPausedTime); -} - const nlTest sTests[] = { NL_TEST_DEF("Test struct GenericOperationalState: constructor with only StateID", TestStructGenericOperationalStateConstructorWithOnlyStateID), @@ -598,7 +562,6 @@ const nlTest sTests[] = { NL_TEST_DEF("Test struct GenericOperationalPhase: constructor", TestStructGenericOperationalPhaseConstructor), NL_TEST_DEF("Test struct GenericOperationalPhase: copy constructor", TestStructGenericOperationalPhaseCopyConstructor), NL_TEST_DEF("Test struct GenericOperationalPhase: copy assignment", TestStructGenericOperationalPhaseCopyAssignment), - NL_TEST_DEF("Test struct GenericOperationalCompletion: constructor", TestStructGenericOperationalCompletionConstructor), NL_TEST_SENTINEL() }; From 14bc386e23c8b9c9c837d383abfa95d35fe47b70 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 26 Jul 2023 10:40:11 -0400 Subject: [PATCH 11/16] Factor out secure channel type definitions into a separate static library. (#28248) This allows us to get rid of circular includes. --- src/credentials/BUILD.gn | 1 + src/lib/format/BUILD.gn | 1 + src/messaging/BUILD.gn | 1 + src/protocols/BUILD.gn | 6 +++++ src/protocols/secure_channel/BUILD.gn | 35 +++++++++++++++------------ src/setup_payload/BUILD.gn | 1 + src/transport/BUILD.gn | 1 + 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/credentials/BUILD.gn b/src/credentials/BUILD.gn index da66062ad93dc2..badfeaf6e4e4e7 100644 --- a/src/credentials/BUILD.gn +++ b/src/credentials/BUILD.gn @@ -92,6 +92,7 @@ static_library("credentials") { "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/platform", + "${chip_root}/src/protocols:type_definitions", "${nlassert_root}:nlassert", ] } diff --git a/src/lib/format/BUILD.gn b/src/lib/format/BUILD.gn index c75ecd084e1457..b593d88cf59d7a 100644 --- a/src/lib/format/BUILD.gn +++ b/src/lib/format/BUILD.gn @@ -64,6 +64,7 @@ source_set("protocol-decoder") { ":tlv-metadata-headers", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", + "${chip_root}/src/protocols:type_definitions", ] public_configs = [ "${chip_root}/src:includes" ] diff --git a/src/messaging/BUILD.gn b/src/messaging/BUILD.gn index d5e51fc0f61056..3c64ef64ebd3f1 100644 --- a/src/messaging/BUILD.gn +++ b/src/messaging/BUILD.gn @@ -72,6 +72,7 @@ static_library("messaging") { "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/platform", + "${chip_root}/src/protocols/secure_channel:type_definitions", "${chip_root}/src/transport", "${chip_root}/src/transport/raw", ] diff --git a/src/protocols/BUILD.gn b/src/protocols/BUILD.gn index ed5b9dd94e3cd9..10b48fb7e46cc3 100644 --- a/src/protocols/BUILD.gn +++ b/src/protocols/BUILD.gn @@ -14,6 +14,10 @@ import("//build_overrides/chip.gni") +source_set("type_definitions") { + sources = [ "Protocols.h" ] +} + static_library("protocols") { output_name = "libChipProtocols" @@ -35,6 +39,7 @@ static_library("protocols") { public_deps = [ ":im_status", + ":type_definitions", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/messaging", @@ -52,6 +57,7 @@ static_library("im_status") { cflags = [ "-Wconversion" ] public_deps = [ + ":type_definitions", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", ] diff --git a/src/protocols/secure_channel/BUILD.gn b/src/protocols/secure_channel/BUILD.gn index 8cf46f9d334a1f..93997d0642b37f 100644 --- a/src/protocols/secure_channel/BUILD.gn +++ b/src/protocols/secure_channel/BUILD.gn @@ -1,5 +1,24 @@ import("//build_overrides/chip.gni") +static_library("type_definitions") { + output_name = "libSecureChannelTypes" + + sources = [ + "Constants.h", + "StatusReport.cpp", + "StatusReport.h", + ] + + cflags = [ "-Wconversion" ] + + public_deps = [ + "${chip_root}/src/protocols:type_definitions", + "${chip_root}/src/system", + ] + + deps = [ "${chip_root}/src/lib/support" ] +} + static_library("secure_channel") { output_name = "libSecureChannel" @@ -10,7 +29,6 @@ static_library("secure_channel") { "CASEServer.h", "CASESession.cpp", "CASESession.h", - "Constants.h", "DefaultSessionResumptionStorage.cpp", "DefaultSessionResumptionStorage.h", "PASESession.cpp", @@ -24,8 +42,6 @@ static_library("secure_channel") { "SessionResumptionStorage.h", "SimpleSessionResumptionStorage.cpp", "SimpleSessionResumptionStorage.h", - "StatusReport.cpp", - "StatusReport.h", "UnsolicitedStatusHandler.cpp", "UnsolicitedStatusHandler.h", ] @@ -33,6 +49,7 @@ static_library("secure_channel") { cflags = [ "-Wconversion" ] public_deps = [ + ":type_definitions", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/messaging", @@ -41,16 +58,4 @@ static_library("secure_channel") { "${chip_root}/src/tracing:macros", "${chip_root}/src/transport", ] - - # secure channel requires messaging so it can send messages (e.g. for - # CASE/PASE handshakes). messaging requires secure channel so that it can do - # things like send standalone acks, which are a secure channel concept. - # - # secure channel requires transport so it can deal with sessions. transport - # requires secure channel so it can detect control messages, which are a - # secure channel concept. - allow_circular_includes_from = [ - "${chip_root}/src/messaging", - "${chip_root}/src/transport", - ] } diff --git a/src/setup_payload/BUILD.gn b/src/setup_payload/BUILD.gn index 42fb1c848a0e3b..30b97ceca74349 100644 --- a/src/setup_payload/BUILD.gn +++ b/src/setup_payload/BUILD.gn @@ -42,6 +42,7 @@ source_set("additional_data_payload") { "${chip_root}/src/crypto", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", + "${chip_root}/src/protocols:type_definitions", "${chip_root}/src/setup_payload:additional_data_payload_buildconfig", ] } diff --git a/src/transport/BUILD.gn b/src/transport/BUILD.gn index 66f19b95e223bd..f1f7ef534322a7 100644 --- a/src/transport/BUILD.gn +++ b/src/transport/BUILD.gn @@ -64,6 +64,7 @@ static_library("transport") { "${chip_root}/src/lib/dnssd", "${chip_root}/src/lib/support", "${chip_root}/src/platform", + "${chip_root}/src/protocols/secure_channel:type_definitions", "${chip_root}/src/setup_payload", "${chip_root}/src/tracing", "${chip_root}/src/tracing:macros", From 5268655b66b658d40ed2b4f31307cf0ca0cf7e03 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 26 Jul 2023 10:40:32 -0400 Subject: [PATCH 12/16] Make sure we clean up properly if StartWatchingSocket fails. (#28245) If StartWatchingSocket failed (e.g. due to us being out of socket watch pool space), we would leave the UDPEndPointImplSockets in a bad state where its destructor would try to treat the un-initialized mWatch value as a pointer. The fix is to make sure we clean up properly on StartWatchingSocket failure. --- src/inet/UDPEndPointImplSockets.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/inet/UDPEndPointImplSockets.cpp b/src/inet/UDPEndPointImplSockets.cpp index 5c9748d0cf32fb..b681a56fabe92f 100644 --- a/src/inet/UDPEndPointImplSockets.cpp +++ b/src/inet/UDPEndPointImplSockets.cpp @@ -469,7 +469,14 @@ CHIP_ERROR UDPEndPointImplSockets::GetSocket(IPAddressType addressType) { return CHIP_ERROR_POSIX(errno); } - ReturnErrorOnFailure(static_cast(&GetSystemLayer())->StartWatchingSocket(mSocket, &mWatch)); + CHIP_ERROR err = static_cast(&GetSystemLayer())->StartWatchingSocket(mSocket, &mWatch); + if (err != CHIP_NO_ERROR) + { + // Our mWatch is not valid; make sure we never use it. + close(mSocket); + mSocket = kInvalidSocketFd; + return err; + } mAddrType = addressType; From 3e5c9992ae43be001ab649d778286050fbdedb01 Mon Sep 17 00:00:00 2001 From: Misha Tkachenko <36621698+mishadesh@users.noreply.github.com> Date: Wed, 26 Jul 2023 18:07:59 +0300 Subject: [PATCH 13/16] [Telink]: Replaced manual bootloader configuration by conf file (#28260) Replaced manual definition-based overlays by conf file Signed-off-by: Misha Tkachenko Co-authored-by: Alex Tsitsiura --- config/telink/app/bootloader.conf | 30 ++++++++++++++++++++++++ config/telink/chip-module/CMakeLists.txt | 8 ++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 config/telink/app/bootloader.conf diff --git a/config/telink/app/bootloader.conf b/config/telink/app/bootloader.conf new file mode 100644 index 00000000000000..5fb0182690cdaa --- /dev/null +++ b/config/telink/app/bootloader.conf @@ -0,0 +1,30 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Enable this option in case if restoring the slot0 partition is expected from slot1 +# partition in case if slot0 is not bootable or damaged +CONFIG_BOOT_BOOTSTRAP=n + +# Enable this option in case if SWAP_MOVE logic need to be used +CONFIG_BOOT_SWAP_USING_MOVE=y + +# Enable this option in case if SWAP_MOVE using scratch logic need to be used +# Enabling this option expecting the availability of scratch partition in DTS +CONFIG_BOOT_SWAP_USING_SCRATCH=n + +# Enable this option in case if the whole slot0 image need to be validated +# With disabled option the only image magic is validated +CONFIG_BOOT_VALIDATE_SLOT0=y diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index 8ff944fd1bfba2..26f0d58612abe8 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -143,11 +143,17 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/config/telink/app/bootloader.conf") + set(GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader.conf") +else() + unset(GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE) +endif() + if (CONFIG_CHIP_OTA_IMAGE_BUILD) add_custom_target(build_mcuboot ALL COMMAND west build -b ${BOARD} -d build_mcuboot ${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr - -- -DCONFIG_BOOT_SWAP_USING_MOVE=y -DDTC_OVERLAY_FILE=${GLOBAL_DTC_OVERLAY_FILE} + -- -DOVERLAY_CONFIG=${GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE=${GLOBAL_DTC_OVERLAY_FILE} ) add_custom_target(merge_mcuboot ALL From ba05087325b03525ddad46d7cf815a014e83a85d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 26 Jul 2023 12:35:12 -0400 Subject: [PATCH 14/16] Update more build configs to c++17. (#28296) --- config/telink/app/zephyr.conf | 2 +- examples/all-clusters-app/nrfconnect/prj.conf | 2 +- examples/all-clusters-app/nrfconnect/prj_dfu.conf | 2 +- examples/all-clusters-app/nrfconnect/prj_release.conf | 2 +- examples/all-clusters-minimal-app/nrfconnect/prj.conf | 2 +- examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf | 2 +- examples/all-clusters-minimal-app/nrfconnect/prj_release.conf | 2 +- examples/bridge-app/esp32/main/CMakeLists.txt | 2 +- examples/chef/nrfconnect/prj.conf | 2 +- examples/light-switch-app/nrfconnect/prj.conf | 2 +- examples/light-switch-app/nrfconnect/prj_no_dfu.conf | 2 +- examples/light-switch-app/nrfconnect/prj_release.conf | 2 +- examples/lighting-app/nrfconnect/prj.conf | 2 +- examples/lighting-app/nrfconnect/prj_no_dfu.conf | 2 +- examples/lighting-app/nrfconnect/prj_release.conf | 2 +- examples/lock-app/nrfconnect/prj.conf | 2 +- examples/lock-app/nrfconnect/prj_no_dfu.conf | 2 +- examples/lock-app/nrfconnect/prj_release.conf | 2 +- examples/ota-provider-app/esp32/main/CMakeLists.txt | 2 +- examples/persistent-storage/esp32/main/CMakeLists.txt | 2 +- examples/pump-app/nrfconnect/prj.conf | 2 +- examples/pump-app/nrfconnect/prj_no_dfu.conf | 2 +- examples/pump-app/nrfconnect/prj_release.conf | 2 +- examples/pump-controller-app/nrfconnect/prj.conf | 2 +- examples/pump-controller-app/nrfconnect/prj_no_dfu.conf | 2 +- examples/pump-controller-app/nrfconnect/prj_release.conf | 2 +- examples/shell/nrfconnect/prj.conf | 2 +- examples/window-app/nrfconnect/prj.conf | 2 +- examples/window-app/nrfconnect/prj_no_dfu.conf | 2 +- examples/window-app/nrfconnect/prj_release.conf | 2 +- src/test_driver/nrfconnect/prj.conf | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/config/telink/app/zephyr.conf b/config/telink/app/zephyr.conf index e7a211be69bd70..6948ce36b083d3 100644 --- a/config/telink/app/zephyr.conf +++ b/config/telink/app/zephyr.conf @@ -15,7 +15,7 @@ # CONFIG_CHIP=y -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Logging (set CONFIG_SERIAL to 'y' to enable logging and 'n' to disable logging) CONFIG_SERIAL=y diff --git a/examples/all-clusters-app/nrfconnect/prj.conf b/examples/all-clusters-app/nrfconnect/prj.conf index 51d5dd89c68a5f..527fae10089448 100644 --- a/examples/all-clusters-app/nrfconnect/prj.conf +++ b/examples/all-clusters-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-app/nrfconnect/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/prj_dfu.conf index c0d47e635ed406..e57438bf5c1aa5 100644 --- a/examples/all-clusters-app/nrfconnect/prj_dfu.conf +++ b/examples/all-clusters-app/nrfconnect/prj_dfu.conf @@ -22,7 +22,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-app/nrfconnect/prj_release.conf b/examples/all-clusters-app/nrfconnect/prj_release.conf index b229f68b308b9d..fee661a740cccb 100644 --- a/examples/all-clusters-app/nrfconnect/prj_release.conf +++ b/examples/all-clusters-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj.conf b/examples/all-clusters-minimal-app/nrfconnect/prj.conf index c33baaa8d79761..e1613a896fd6d8 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app-minimal) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf b/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf index 6effabf6914a9b..a96c97d2517580 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-minimal-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf b/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf index 8029f55a1e31f4..7f64115af32736 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app-minimal) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/bridge-app/esp32/main/CMakeLists.txt b/examples/bridge-app/esp32/main/CMakeLists.txt index 432ce5a2dfe6cb..e2250f001799b5 100644 --- a/examples/bridge-app/esp32/main/CMakeLists.txt +++ b/examples/bridge-app/esp32/main/CMakeLists.txt @@ -58,7 +58,7 @@ include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake") chip_app_component_codegen("${CHIP_ROOT}/examples/bridge-app/bridge-common/bridge-app.matter") chip_app_component_zapgen("${CHIP_ROOT}/examples/bridge-app/bridge-common/bridge-app.zap") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" diff --git a/examples/chef/nrfconnect/prj.conf b/examples/chef/nrfconnect/prj.conf index 2f2fc49501d231..03c7e188675c95 100644 --- a/examples/chef/nrfconnect/prj.conf +++ b/examples/chef/nrfconnect/prj.conf @@ -15,7 +15,7 @@ # CONFIG_CHIP=y -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample diff --git a/examples/light-switch-app/nrfconnect/prj.conf b/examples/light-switch-app/nrfconnect/prj.conf index 23fa257975fe64..726846ae48cee5 100644 --- a/examples/light-switch-app/nrfconnect/prj.conf +++ b/examples/light-switch-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32772 == 0x8004 (example light-switch-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf index 145cb9b50f835e..df884ba56d4300 100644 --- a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf +++ b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32772 == 0x8004 (example light-switch-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/light-switch-app/nrfconnect/prj_release.conf b/examples/light-switch-app/nrfconnect/prj_release.conf index 520a280b1e18ab..e033650db1d427 100644 --- a/examples/light-switch-app/nrfconnect/prj_release.conf +++ b/examples/light-switch-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32772 == 0x8004 (example light-switch-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lighting-app/nrfconnect/prj.conf b/examples/lighting-app/nrfconnect/prj.conf index ad67f13edf08e3..3419b5b0fc7087 100644 --- a/examples/lighting-app/nrfconnect/prj.conf +++ b/examples/lighting-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32773 == 0x8005 (example lighting-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Enable CHIP pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/lighting-app/nrfconnect/prj_no_dfu.conf b/examples/lighting-app/nrfconnect/prj_no_dfu.conf index a2d0392c98b5a9..22cdc2b700ee9f 100644 --- a/examples/lighting-app/nrfconnect/prj_no_dfu.conf +++ b/examples/lighting-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32773 == 0x8005 (example lighting-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Enable CHIP pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/lighting-app/nrfconnect/prj_release.conf b/examples/lighting-app/nrfconnect/prj_release.conf index 762b6d44f919c7..1977239abf0d4b 100644 --- a/examples/lighting-app/nrfconnect/prj_release.conf +++ b/examples/lighting-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32773 == 0x8005 (example lighting-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Enable CHIP pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/prj.conf index 6b4864a2a486b7..3216fbc3190af9 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32774 == 0x8006 (example lock-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lock-app/nrfconnect/prj_no_dfu.conf b/examples/lock-app/nrfconnect/prj_no_dfu.conf index a53431aa2dd9d7..68cd0ea04a0923 100644 --- a/examples/lock-app/nrfconnect/prj_no_dfu.conf +++ b/examples/lock-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32774 == 0x8006 (example lock-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lock-app/nrfconnect/prj_release.conf b/examples/lock-app/nrfconnect/prj_release.conf index ba830806523ded..6f0c11ba41dd18 100644 --- a/examples/lock-app/nrfconnect/prj_release.conf +++ b/examples/lock-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32774 == 0x8006 (example lock-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/ota-provider-app/esp32/main/CMakeLists.txt b/examples/ota-provider-app/esp32/main/CMakeLists.txt index 2572149172141a..a63033f017d8b2 100644 --- a/examples/ota-provider-app/esp32/main/CMakeLists.txt +++ b/examples/ota-provider-app/esp32/main/CMakeLists.txt @@ -62,7 +62,7 @@ chip_app_component_codegen("${CHIP_ROOT}/examples/ota-provider-app/ota-provider- chip_app_component_zapgen("${CHIP_ROOT}/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap") spiffs_create_partition_image(img_storage ${CMAKE_SOURCE_DIR}/spiffs_image FLASH_IN_PROJECT) -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" diff --git a/examples/persistent-storage/esp32/main/CMakeLists.txt b/examples/persistent-storage/esp32/main/CMakeLists.txt index 2697a55dd39171..30c85accfbe36d 100644 --- a/examples/persistent-storage/esp32/main/CMakeLists.txt +++ b/examples/persistent-storage/esp32/main/CMakeLists.txt @@ -23,5 +23,5 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/persistent-storage" PRIV_REQUIRES chip nvs_flash) -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/pump-app/nrfconnect/prj.conf b/examples/pump-app/nrfconnect/prj.conf index 3013e7d7aec421..008a66be940be3 100644 --- a/examples/pump-app/nrfconnect/prj.conf +++ b/examples/pump-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example pump-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-app/nrfconnect/prj_no_dfu.conf b/examples/pump-app/nrfconnect/prj_no_dfu.conf index a0d3f8b1a879c2..21cd8222c2c2e2 100644 --- a/examples/pump-app/nrfconnect/prj_no_dfu.conf +++ b/examples/pump-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example pump-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-app/nrfconnect/prj_release.conf b/examples/pump-app/nrfconnect/prj_release.conf index 540c77354fa82f..fbcfe2fe16545e 100644 --- a/examples/pump-app/nrfconnect/prj_release.conf +++ b/examples/pump-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example pump-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-controller-app/nrfconnect/prj.conf b/examples/pump-controller-app/nrfconnect/prj.conf index 5b9c2baff8ee9e..f8774b9f2f0f4b 100644 --- a/examples/pump-controller-app/nrfconnect/prj.conf +++ b/examples/pump-controller-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32785 == 0x8011 (example pump-controller-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf b/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf index d6632fe9172638..f4b60e647953ae 100644 --- a/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf +++ b/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf @@ -24,7 +24,7 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32785 == 0x8011 (example pump-controller-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-controller-app/nrfconnect/prj_release.conf b/examples/pump-controller-app/nrfconnect/prj_release.conf index fc3b092b655c8f..bd9e21dae49b03 100644 --- a/examples/pump-controller-app/nrfconnect/prj_release.conf +++ b/examples/pump-controller-app/nrfconnect/prj_release.conf @@ -24,7 +24,7 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32785 == 0x8011 (example pump-controller-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/shell/nrfconnect/prj.conf b/examples/shell/nrfconnect/prj.conf index c00eacaa34c0ae..4c8a3c2c95c58e 100644 --- a/examples/shell/nrfconnect/prj.conf +++ b/examples/shell/nrfconnect/prj.conf @@ -15,7 +15,7 @@ # CONFIG_CHIP=y -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample diff --git a/examples/window-app/nrfconnect/prj.conf b/examples/window-app/nrfconnect/prj.conf index 0f941b5aa1e6e8..052d3fbe841572 100644 --- a/examples/window-app/nrfconnect/prj.conf +++ b/examples/window-app/nrfconnect/prj.conf @@ -19,7 +19,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example window-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/window-app/nrfconnect/prj_no_dfu.conf b/examples/window-app/nrfconnect/prj_no_dfu.conf index b6caf7b75454e1..3183a0e518ac47 100644 --- a/examples/window-app/nrfconnect/prj_no_dfu.conf +++ b/examples/window-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example window-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/window-app/nrfconnect/prj_release.conf b/examples/window-app/nrfconnect/prj_release.conf index bcf59cd9e35879..f2393649c1fe0c 100644 --- a/examples/window-app/nrfconnect/prj_release.conf +++ b/examples/window-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example window-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/src/test_driver/nrfconnect/prj.conf b/src/test_driver/nrfconnect/prj.conf index f70a0d95063dc9..134b2abe55c7d7 100644 --- a/src/test_driver/nrfconnect/prj.conf +++ b/src/test_driver/nrfconnect/prj.conf @@ -84,7 +84,7 @@ CONFIG_INIT_STACKS=y CONFIG_REBOOT=n # Build as C++14 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # CHIP configuration CONFIG_CHIP=y From a29c1316c4941ac7cfc4c394230de93dc944fe73 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 26 Jul 2023 13:13:45 -0400 Subject: [PATCH 15/16] Do not consider template a real device type for chef (#28303) --- examples/chef/chef.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 977d2775ef0ba3..aa594aef4c39fa 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -37,7 +37,7 @@ _REPO_BASE_PATH = os.path.join(_CHEF_SCRIPT_PATH, "../../") _DEVICE_FOLDER = os.path.join(_CHEF_SCRIPT_PATH, "devices") _DEVICE_LIST = [file[:-4] - for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap")] + for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap") and file != 'template.zap'] _CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_config.json") _CD_STAGING_DIR = os.path.join(_CHEF_SCRIPT_PATH, "staging") From 7ab043c2082e073ed7f1d793ef04f0bee13b03d4 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 26 Jul 2023 13:21:05 -0400 Subject: [PATCH 16/16] [ICD]Move a trace that was being spammed in low active/idle interval. (#28292) * Move a trace that was being spammed in low active/idle interval. Now only reported on ICD mode update calls * add define to enable enforcing the SIT slow polling upper limit * Update src/app/icd/ICDManager.cpp Co-authored-by: Boris Zbarsky --------- Co-authored-by: Boris Zbarsky --- src/app/icd/ICDManager.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index f400a7e5801087..853fd044d36732 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -28,6 +28,11 @@ #include #include +#ifndef ICD_ENFORCE_SIT_SLOW_POLL_LIMIT +// Set to 1 to enforce SIT Slow Polling Max value to 15seconds (spec 9.16.1.5) +#define ICD_ENFORCE_SIT_SLOW_POLL_LIMIT 0 +#endif + namespace chip { namespace app { @@ -93,6 +98,13 @@ void ICDManager::UpdateIcdMode() } } mICDMode = tempMode; + + // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. + if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) + { + ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32 " seconds", + (GetSITPollingThreshold().count() / 1000)); + } } void ICDManager::UpdateOperationState(OperationalState state) @@ -108,14 +120,14 @@ void ICDManager::UpdateOperationState(OperationalState state) DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(idleModeInterval), OnIdleModeDone, this); System::Clock::Milliseconds32 slowPollInterval = GetSlowPollingInterval(); + +#if ICD_ENFORCE_SIT_SLOW_POLL_LIMIT // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. - if (mICDMode == ICDMode::SIT && slowPollInterval > GetSITPollingThreshold()) + if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) { - ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32, - (GetSITPollingThreshold().count() / 1000)); - // TODO Spec to define this conformance as a SHALL - // slowPollInterval = GetSITPollingThreshold(); + slowPollInterval = GetSITPollingThreshold(); } +#endif CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(slowPollInterval); if (err != CHIP_NO_ERROR)