Skip to content

Commit e307f4a

Browse files
Merge branch 'YAML-Updates-2-23-2024' of github.com:raul-marquez-csa/connectedhomeip into YAML-Updates-2-23-2024
2 parents 090b33f + 4d2f2fb commit e307f4a

File tree

32 files changed

+216
-71
lines changed

32 files changed

+216
-71
lines changed

.github/workflows/lint.yml

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ jobs:
9292
--known-failure controller/ExamplePersistentStorage.h \
9393
--known-failure app/AttributeAccessInterface.h \
9494
--known-failure app/AttributeAccessToken.h \
95-
--known-failure app/att-storage.h \
9695
--known-failure app/CommandHandler.h \
9796
--known-failure app/CommandHandlerInterface.h \
9897
--known-failure app/CommandSenderLegacyCallback.h \

config/esp32/.gn

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import("//build_overrides/build.gni")
16+
import("//build_overrides/pigweed.gni")
1617

1718
# The location of the build configuration file.
1819
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
@@ -24,6 +25,15 @@ default_args = {
2425
target_cpu = "esp32"
2526
target_os = "freertos"
2627

28+
pw_sys_io_BACKEND = dir_pw_sys_io_stdio
29+
pw_assert_BACKEND = dir_pw_assert_log
30+
pw_log_BACKEND = dir_pw_log_basic
31+
32+
pw_build_LINK_DEPS = [
33+
"$dir_pw_assert:impl",
34+
"$dir_pw_log:impl",
35+
]
36+
2737
pw_build_PIP_CONSTRAINTS =
2838
[ "//third_party/connectedhomeip/scripts/setup/constraints.txt" ]
2939
pw_build_PIP_REQUIREMENTS = [

config/esp32/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ group("esp32") {
3636
}
3737

3838
if (chip_build_tests) {
39-
deps += [ "${chip_root}/src:tests" ]
39+
deps += [
40+
"${chip_root}/src:tests",
41+
"${chip_root}/src/lib/support:pw_tests_wrapper",
42+
]
4043
}
4144
}

examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#include "AirQualitySensorAppAttrUpdateDelegate.h"
2020

2121
#include <app-common/zap-generated/attributes/Accessors.h>
22-
#include <app/att-storage.h>
2322
#include <app/clusters/general-diagnostics-server/general-diagnostics-server.h>
2423
#include <app/clusters/software-diagnostics-server/software-diagnostics-server.h>
2524
#include <app/clusters/switch-server/switch-server.h>
2625
#include <app/server/Server.h>
26+
#include <app/util/att-storage.h>
2727
#include <platform/PlatformManager.h>
2828

2929
#include <air-quality-sensor-manager.h>

examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
#include "AllClustersCommandDelegate.h"
2020

2121
#include <app-common/zap-generated/attributes/Accessors.h>
22-
#include <app/att-storage.h>
2322
#include <app/clusters/general-diagnostics-server/general-diagnostics-server.h>
2423
#include <app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h>
2524
#include <app/clusters/software-diagnostics-server/software-diagnostics-server.h>
2625
#include <app/clusters/switch-server/switch-server.h>
2726
#include <app/server/Server.h>
27+
#include <app/util/att-storage.h>
2828
#include <platform/PlatformManager.h>
2929

3030
#include <air-quality-instance.h>

examples/all-clusters-app/linux/main-common.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include <Options.h>
4141
#include <app-common/zap-generated/attributes/Accessors.h>
4242
#include <app/CommandHandler.h>
43-
#include <app/att-storage.h>
4443
#include <app/clusters/diagnostic-logs-server/diagnostic-logs-server.h>
4544
#include <app/clusters/identify-server/identify-server.h>
4645
#include <app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h>
@@ -50,6 +49,7 @@
5049
#include <app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h>
5150
#include <app/server/Server.h>
5251
#include <app/util/af.h>
52+
#include <app/util/att-storage.h>
5353
#include <app/util/attribute-storage.h>
5454
#include <lib/support/CHIPMem.h>
5555
#include <new>

examples/all-clusters-minimal-app/linux/main-common.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
#include "include/tv-callbacks.h"
2020
#include <app-common/zap-generated/attributes/Accessors.h>
2121
#include <app/CommandHandler.h>
22-
#include <app/att-storage.h>
2322
#include <app/clusters/identify-server/identify-server.h>
2423
#include <app/server/Server.h>
2524
#include <app/util/af.h>
25+
#include <app/util/att-storage.h>
2626
#include <lib/support/CHIPMem.h>
2727
#include <new>
2828
#include <platform/PlatformManager.h>

examples/chef/esp32/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040

4141
#include <app-common/zap-generated/callback.h>
4242
#include <app-common/zap-generated/cluster-objects.h>
43-
#include <app/att-storage.h>
4443
#include <app/server/Dnssd.h>
4544
#include <app/util/af.h>
45+
#include <app/util/att-storage.h>
4646
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
4747

4848
#include "Display.h"

examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
#include "LightingManager.h"
2121
#include <app-common/zap-generated/attributes/Accessors.h>
22-
#include <app/att-storage.h>
2322
#include <app/util/af.h>
23+
#include <app/util/att-storage.h>
2424
#include <stdio.h>
2525

2626
using namespace chip;

examples/lighting-app/linux/LightingAppCommandDelegate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#include "LightingAppCommandDelegate.h"
2020

2121
#include <app-common/zap-generated/attributes/Accessors.h>
22-
#include <app/att-storage.h>
2322
#include <app/clusters/general-diagnostics-server/general-diagnostics-server.h>
2423
#include <app/clusters/software-diagnostics-server/software-diagnostics-server.h>
2524
#include <app/clusters/switch-server/switch-server.h>
2625
#include <app/server/Server.h>
26+
#include <app/util/att-storage.h>
2727
#include <platform/PlatformManager.h>
2828

2929
using namespace chip;

src/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ if (chip_build_tests) {
143143
if (chip_monolithic_tests) {
144144
# TODO [PW_MIGRATION] Remove this if after migartion to PW_TEST is completed for all platforms
145145
# TODO [PW_MIGRATION] There will be a list of already migrated platforms
146-
if (false) {
146+
if (chip_device_platform == "esp32") {
147147
deps += [ "${chip_root}/src/lib/support:pw_tests_wrapper" ]
148148
}
149149
build_monolithic_library = true

src/app/AttributePathExpandIterator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <app/ConcreteAttributePath.h>
2323
#include <app/EventManagement.h>
2424
#include <app/GlobalAttributes.h>
25-
#include <app/att-storage.h>
25+
#include <app/util/att-storage.h>
2626
#include <lib/core/CHIPCore.h>
2727
#include <lib/core/TLVDebug.h>
2828
#include <lib/support/CodeUtils.h>

src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include <app/AttributeAccessInterface.h>
2121
#include <app/CommandHandler.h>
2222
#include <app/MessageDef/StatusIB.h>
23-
#include <app/att-storage.h>
2423
#include <app/server/Server.h>
2524
#include <app/util/af.h>
25+
#include <app/util/att-storage.h>
2626
#include <app/util/attribute-storage.h>
2727
#include <credentials/GroupDataProvider.h>
2828
#include <lib/support/CodeUtils.h>

src/app/clusters/groups-server/groups-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include <app-common/zap-generated/cluster-objects.h>
2222
#include <app-common/zap-generated/ids/Clusters.h>
2323
#include <app/CommandHandler.h>
24-
#include <app/att-storage.h>
2524
#include <app/reporting/reporting.h>
2625
#include <app/util/af.h>
26+
#include <app/util/att-storage.h>
2727
#include <app/util/config.h>
2828
#include <credentials/GroupDataProvider.h>
2929
#include <inttypes.h>

src/app/clusters/mode-select-server/mode-select-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#include <app/AttributeAccessInterface.h>
2323
#include <app/CommandHandler.h>
2424
#include <app/ConcreteCommandPath.h>
25-
#include <app/att-storage.h>
2625
#include <app/clusters/mode-select-server/supported-modes-manager.h>
2726
#include <app/util/af.h>
27+
#include <app/util/att-storage.h>
2828
#include <app/util/attribute-storage.h>
2929
#include <app/util/config.h>
3030
#include <app/util/odd-sized-integers.h>

src/app/clusters/time-synchronization-server/time-synchronization-server.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <app/server/Server.h>
3030
#include <app/util/attribute-storage.h>
3131
#include <lib/support/CodeUtils.h>
32-
#include <lib/support/SortUtils.h>
3332
#include <lib/support/logging/CHIPLogging.h>
3433
#include <platform/CHIPDeviceLayer.h>
3534
#include <platform/RuntimeOptionsProvider.h>

src/app/dynamic_server/DynamicDispatcher.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include <app/MessageDef/AttributeReportIBs.h>
3131
#include <app/MessageDef/StatusIB.h>
3232
#include <app/WriteHandler.h>
33-
#include <app/att-storage.h>
3433
#include <app/data-model/Decode.h>
34+
#include <app/util/att-storage.h>
3535
#include <app/util/endpoint-config-api.h>
3636
#include <lib/core/CHIPError.h>
3737
#include <lib/core/DataModelTypes.h>

src/app/util/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import("${chip_root}/src/app/common_flags.gni")
1717

1818
source_set("types") {
1919
sources = [
20+
"att-storage.h",
2021
"attribute-metadata.cpp",
2122
"attribute-metadata.h",
2223
"basic-types.h",
File renamed without changes.

src/app/util/attribute-storage.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <app/util/endpoint-config-api.h>
2626
#include <lib/support/CodeUtils.h>
2727

28-
#include <app/att-storage.h>
28+
#include <app/util/att-storage.h>
2929
#include <zap-generated/endpoint_config.h>
3030

3131
#include <protocols/interaction_model/StatusCode.h>

src/app/util/ember-compatibility-functions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
#include <app/GlobalAttributes.h>
2929
#include <app/InteractionModelEngine.h>
3030
#include <app/RequiredPrivilege.h>
31-
#include <app/att-storage.h>
3231
#include <app/reporting/Engine.h>
3332
#include <app/reporting/reporting.h>
3433
#include <app/util/af.h>
34+
#include <app/util/att-storage.h>
3535
#include <app/util/attribute-storage-null-handling.h>
3636
#include <app/util/attribute-storage.h>
3737
#include <app/util/attribute-table.h>

src/app/util/mock/MockNodeConfig.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#include <app/util/mock/MockNodeConfig.h>
2020

21-
#include <app/att-storage.h>
2221
#include <app/util/af.h>
22+
#include <app/util/att-storage.h>
2323
#include <lib/support/CodeUtils.h>
2424

2525
#include <utility>

src/app/util/mock/attribute-storage.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include <app/MessageDef/AttributeDataIB.h>
3434
#include <app/MessageDef/AttributeReportIB.h>
3535
#include <app/MessageDef/AttributeStatusIB.h>
36-
#include <app/att-storage.h>
3736
#include <app/util/af.h>
37+
#include <app/util/att-storage.h>
3838
#include <app/util/mock/Constants.h>
3939
#include <app/util/mock/MockNodeConfig.h>
4040

src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <app-common/zap-generated/cluster-objects.h>
1919
#include <app/CommandHandler.h>
2020
#include <app/ConcreteCommandPath.h>
21-
#include <app/att-storage.h>
21+
#include <app/util/att-storage.h>
2222

2323
#include <app/util/af-types.h>
2424
#include <app/util/privilege-storage.h>

src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
// TODO: These af-types.h and att-storage.h and attribute-storage.h and
3131
// endpoint-config-api.h and probably CodeUtils.h bits are a hack that should
3232
// eventually go away.
33-
#include <app/att-storage.h>
3433
#include <app/util/af-types.h>
34+
#include <app/util/att-storage.h>
3535
#include <app/util/attribute-storage.h>
3636
#include <app/util/endpoint-config-api.h>
3737
#include <lib/support/CodeUtils.h>

src/lib/dnssd/IPAddressSorter.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace IPAddressSorter {
2424

2525
void Sort(Inet::IPAddress * addresses, size_t count, Inet::InterfaceId interfaceId)
2626
{
27-
Sorting::BubbleSort(addresses, count, [interfaceId](const Inet::IPAddress & a, const Inet::IPAddress & b) -> bool {
27+
Sorting::InsertionSort(addresses, count, [interfaceId](const Inet::IPAddress & a, const Inet::IPAddress & b) -> bool {
2828
auto scoreA = to_underlying(ScoreIpAddress(a, interfaceId));
2929
auto scoreB = to_underlying(ScoreIpAddress(b, interfaceId));
3030
return scoreA > scoreB;
@@ -33,12 +33,12 @@ void Sort(Inet::IPAddress * addresses, size_t count, Inet::InterfaceId interface
3333

3434
void Sort(const Span<Inet::IPAddress> & addresses, Inet::InterfaceId interfaceId)
3535
{
36-
Sorting::BubbleSort(addresses.begin(), addresses.size(),
37-
[interfaceId](const Inet::IPAddress & a, const Inet::IPAddress & b) -> bool {
38-
auto scoreA = to_underlying(ScoreIpAddress(a, interfaceId));
39-
auto scoreB = to_underlying(ScoreIpAddress(b, interfaceId));
40-
return scoreA > scoreB;
41-
});
36+
Sorting::InsertionSort(addresses.data(), addresses.size(),
37+
[interfaceId](const Inet::IPAddress & a, const Inet::IPAddress & b) -> bool {
38+
auto scoreA = to_underlying(ScoreIpAddress(a, interfaceId));
39+
auto scoreB = to_underlying(ScoreIpAddress(b, interfaceId));
40+
return scoreA > scoreB;
41+
});
4242
}
4343

4444
IpScore ScoreIpAddress(const Inet::IPAddress & ip, Inet::InterfaceId interfaceId)

src/lib/support/SortUtils.h

-40
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,6 @@
2626
namespace chip {
2727
namespace Sorting {
2828

29-
/**
30-
*
31-
* Impements the bubble sort algorithm to sort an array
32-
* of items of size 'n'.
33-
*
34-
* T should be swappable using std::swap (i.e implements Swappable).
35-
*
36-
* The provided comparison function SHALL have the following signature:
37-
*
38-
* bool Compare(const T& a, const T& b);
39-
*
40-
* If a is deemed less than (i.e is ordered before) b, return true.
41-
* Else, return false.
42-
*
43-
* This is a stable sort.
44-
*
45-
* NOTE: This has a worst case time complexity of O(n^2). This
46-
* is well-suited for small arrays where the time trade-off is
47-
* acceptable compared to the lower flash cost for the simple sorting
48-
* implementation.
49-
*
50-
*/
51-
template <typename T, typename CompareFunc>
52-
void BubbleSort(T * items, size_t n, CompareFunc f)
53-
{
54-
for (size_t i = 0; i < (n - 1); i++)
55-
{
56-
for (size_t j = 0; j < (n - i - 1); j++)
57-
{
58-
const T & a = items[j + 1];
59-
const T & b = items[j];
60-
61-
if (f(a, b))
62-
{
63-
std::swap(items[j], items[j + 1]);
64-
}
65-
}
66-
}
67-
}
68-
6929
/**
7030
*
7131
* Impements the insertion sort algorithm to sort an array

src/lib/support/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ chip_test_suite_using_nltest("tests") {
4545
"TestSafeString.cpp",
4646
"TestScoped.cpp",
4747
"TestScopedBuffer.cpp",
48+
"TestSorting.cpp",
4849
"TestSpan.cpp",
4950
"TestStateMachine.cpp",
5051
"TestStaticSupportSmartPtr.cpp",

0 commit comments

Comments
 (0)