From 58bf8e1de3c8103167de83214f5253222b6c0129 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Tue, 13 Feb 2024 18:39:56 -0500 Subject: [PATCH] [SDK] Rename EMBER_XXX to MATTER_XXX (#32078) * Rename EMBER_ to MATTER_ * Fix last comments --- .../src/binding-handler.cpp | 4 +- .../ameba/main/BindingHandler.cpp | 10 +-- .../nxp/mw320/binding-handler.cpp | 4 +- .../ameba/main/BindingHandler.cpp | 8 +- .../asr/src/BindingHandler.cpp | 14 ++-- .../esp32/main/BindingHandler.cpp | 8 +- .../genio/src/BindingHandler.cpp | 8 +- .../cyw30739/src/AppShellCommands.cpp | 4 +- .../infineon/cyw30739/src/BindingHandler.cpp | 12 +-- .../nrfconnect/main/BindingHandler.cpp | 12 +-- .../qpg/src/binding-handler.cpp | 2 +- .../silabs/src/BindingHandler.cpp | 4 +- .../silabs/src/ShellCommands.cpp | 4 +- .../telink/src/binding-handler.cpp | 10 +-- .../tv-casting-common/src/CastingServer.cpp | 8 +- .../support/ChipDeviceEventHandler.cpp | 2 +- .../support/EndpointListLoader.cpp | 4 +- src/app/clusters/bindings/BindingManager.cpp | 6 +- .../bindings/PendingNotificationMap.cpp | 12 +-- .../bindings/PendingNotificationMap.h | 2 +- src/app/clusters/bindings/bindings.cpp | 10 +-- src/app/tests/TestBindingTable.cpp | 20 ++--- src/app/tests/TestPendingNotificationMap.cpp | 8 +- src/app/util/attribute-storage.cpp | 4 +- src/app/util/attribute-storage.h | 6 +- src/app/util/binding-table.cpp | 20 ++--- src/app/util/binding-table.h | 4 +- src/app/util/config.h | 6 +- .../mock/include/zap-generated/gen_config.h | 2 +- src/app/util/types_stub.h | 75 ++----------------- src/app/util/util.cpp | 6 +- 31 files changed, 122 insertions(+), 177 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp b/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp index cd16efd4a3f054..95f50acce7c4ef 100644 --- a/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp @@ -73,13 +73,13 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch using namespace chip; using namespace chip::app; - if (binding.type == EMBER_MULTICAST_BINDING) + if (binding.type == MATTER_MULTICAST_BINDING) { ChipLogError(NotSpecified, "Group binding is not supported now"); return; } - if (binding.type == EMBER_UNICAST_BINDING && binding.local == 1 && + if (binding.type == MATTER_UNICAST_BINDING && binding.local == 1 && (!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id)) { auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) { diff --git a/examples/all-clusters-app/ameba/main/BindingHandler.cpp b/examples/all-clusters-app/ameba/main/BindingHandler.cpp index 64ccb619a2edf5..b00322b44e4f0b 100644 --- a/examples/all-clusters-app/ameba/main/BindingHandler.cpp +++ b/examples/all-clusters-app/ameba/main/BindingHandler.cpp @@ -58,7 +58,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation if (data->isReadAttribute) { // It should always enter here if isReadAttribute is true - if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -82,7 +82,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation } else { - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -103,7 +103,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -190,7 +190,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -205,7 +205,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/all-clusters-app/nxp/mw320/binding-handler.cpp b/examples/all-clusters-app/nxp/mw320/binding-handler.cpp index 6ad25c9d46bc34..ace7da026b253a 100644 --- a/examples/all-clusters-app/nxp/mw320/binding-handler.cpp +++ b/examples/all-clusters-app/nxp/mw320/binding-handler.cpp @@ -74,13 +74,13 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch using namespace chip; using namespace chip::app; - if (binding.type == EMBER_MULTICAST_BINDING) + if (binding.type == MATTER_MULTICAST_BINDING) { ChipLogError(NotSpecified, "Group binding is not supported now"); return; } - if (binding.type == EMBER_UNICAST_BINDING && binding.local == 1 && + if (binding.type == MATTER_UNICAST_BINDING && binding.local == 1 && (!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id)) { auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) { diff --git a/examples/light-switch-app/ameba/main/BindingHandler.cpp b/examples/light-switch-app/ameba/main/BindingHandler.cpp index 29acdaae952896..0ffcddc67839eb 100644 --- a/examples/light-switch-app/ameba/main/BindingHandler.cpp +++ b/examples/light-switch-app/ameba/main/BindingHandler.cpp @@ -113,7 +113,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); BindingCommandData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -122,7 +122,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -246,7 +246,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -261,7 +261,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/light-switch-app/asr/src/BindingHandler.cpp b/examples/light-switch-app/asr/src/BindingHandler.cpp index bb2d1d754fc70f..10ee9e2332af30 100644 --- a/examples/light-switch-app/asr/src/BindingHandler.cpp +++ b/examples/light-switch-app/asr/src/BindingHandler.cpp @@ -199,7 +199,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & aB VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); BindingData * data = static_cast(context); - if (aBinding.type == EMBER_MULTICAST_BINDING && data->IsGroup) + if (aBinding.type == MATTER_MULTICAST_BINDING && data->IsGroup) { switch (data->ClusterId) { @@ -214,7 +214,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & aB break; } } - else if (aBinding.type == EMBER_UNICAST_BINDING && !data->IsGroup) + else if (aBinding.type == MATTER_UNICAST_BINDING && !data->IsGroup) { switch (data->ClusterId) { @@ -255,7 +255,7 @@ bool BindingHandler::IsGroupBound() for (auto & entry : bindingTable) { - if (EMBER_MULTICAST_BINDING == entry.type) + if (MATTER_MULTICAST_BINDING == entry.type) { return true; } @@ -273,7 +273,7 @@ void BindingHandler::PrintBindingTable() { switch (entry.type) { - case EMBER_UNICAST_BINDING: + case MATTER_UNICAST_BINDING: ASR_LOG("[%d] UNICAST:", i++); ASR_LOG("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -283,7 +283,7 @@ void BindingHandler::PrintBindingTable() (int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.Value(), (int) entry.remote, (int) entry.nodeId); break; - case EMBER_MULTICAST_BINDING: + case MATTER_MULTICAST_BINDING: ASR_LOG("[%d] GROUP:", i++); ASR_LOG("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -291,10 +291,10 @@ void BindingHandler::PrintBindingTable() \t+ GroupId %d", (int) entry.fabricIndex, (int) entry.local, (int) entry.remote, (int) entry.groupId); break; - case EMBER_UNUSED_BINDING: + case MATTER_UNUSED_BINDING: ASR_LOG("[%d] UNUSED", i++); break; - // case EMBER_MANY_TO_ONE_BINDING: + // case MATTER_MANY_TO_ONE_BINDING: // ASR_LOG("[%d] MANY TO ONE", i++); // break; default: diff --git a/examples/light-switch-app/esp32/main/BindingHandler.cpp b/examples/light-switch-app/esp32/main/BindingHandler.cpp index 5cc520fd2accd0..9602cd1a534414 100644 --- a/examples/light-switch-app/esp32/main/BindingHandler.cpp +++ b/examples/light-switch-app/esp32/main/BindingHandler.cpp @@ -109,7 +109,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); BindingCommandData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -118,7 +118,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -244,7 +244,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -259,7 +259,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/light-switch-app/genio/src/BindingHandler.cpp b/examples/light-switch-app/genio/src/BindingHandler.cpp index c8392f20ac9c4c..e988464b331afe 100644 --- a/examples/light-switch-app/genio/src/BindingHandler.cpp +++ b/examples/light-switch-app/genio/src/BindingHandler.cpp @@ -119,7 +119,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation // Eason+ ChipLogDetail(AppServer, "LightSwitchChangedHandler~~~~~~~"); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -128,7 +128,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -243,7 +243,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -258,7 +258,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/light-switch-app/infineon/cyw30739/src/AppShellCommands.cpp b/examples/light-switch-app/infineon/cyw30739/src/AppShellCommands.cpp index 477ce99fa44c0b..91cc0c74176a53 100644 --- a/examples/light-switch-app/infineon/cyw30739/src/AppShellCommands.cpp +++ b/examples/light-switch-app/infineon/cyw30739/src/AppShellCommands.cpp @@ -361,7 +361,7 @@ CHIP_ERROR GroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->local = 1; // Hardcoded to endpoint 1 for now entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); @@ -379,7 +379,7 @@ CHIP_ERROR UnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 4, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->local = 1; // Hardcoded to endpoint 1 for now entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); diff --git a/examples/light-switch-app/infineon/cyw30739/src/BindingHandler.cpp b/examples/light-switch-app/infineon/cyw30739/src/BindingHandler.cpp index bcf66efb2dd81a..4df68993fddae4 100644 --- a/examples/light-switch-app/infineon/cyw30739/src/BindingHandler.cpp +++ b/examples/light-switch-app/infineon/cyw30739/src/BindingHandler.cpp @@ -213,7 +213,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & bi VerifyOrReturn(context != nullptr, printf("Invalid context for Light switch handler\n");); BindingData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->IsGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->IsGroup) { switch (data->ClusterId) { @@ -228,7 +228,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & bi break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->IsGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->IsGroup) { switch (data->ClusterId) { @@ -281,7 +281,7 @@ bool BindingHandler::IsGroupBound() for (auto & entry : bindingTable) { - if (EMBER_MULTICAST_BINDING == entry.type) + if (MATTER_MULTICAST_BINDING == entry.type) { return true; } @@ -299,7 +299,7 @@ void BindingHandler::PrintBindingTable() { switch (entry.type) { - case EMBER_UNICAST_BINDING: + case MATTER_UNICAST_BINDING: printf("[%d] UNICAST:", i++); printf("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -309,7 +309,7 @@ void BindingHandler::PrintBindingTable() (int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.Value(), (int) entry.remote, (int) entry.nodeId); break; - case EMBER_MULTICAST_BINDING: + case MATTER_MULTICAST_BINDING: printf("[%d] GROUP:", i++); printf("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -317,7 +317,7 @@ void BindingHandler::PrintBindingTable() \t+ GroupId %d \n", (int) entry.fabricIndex, (int) entry.local, (int) entry.remote, (int) entry.groupId); break; - case EMBER_UNUSED_BINDING: + case MATTER_UNUSED_BINDING: printf("[%d] UNUSED", i++); break; default: diff --git a/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp b/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp index 886637fd21018a..0d93428f8dca5e 100644 --- a/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp +++ b/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp @@ -198,7 +198,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & bi VerifyOrReturn(context != nullptr, LOG_ERR("Invalid context for Light switch handler");); BindingData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->IsGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->IsGroup) { switch (data->ClusterId) { @@ -213,7 +213,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & bi break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->IsGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->IsGroup) { switch (data->ClusterId) { @@ -259,7 +259,7 @@ bool BindingHandler::IsGroupBound() for (auto & entry : bindingTable) { - if (EMBER_MULTICAST_BINDING == entry.type) + if (MATTER_MULTICAST_BINDING == entry.type) { return true; } @@ -277,7 +277,7 @@ void BindingHandler::PrintBindingTable() { switch (entry.type) { - case EMBER_UNICAST_BINDING: + case MATTER_UNICAST_BINDING: LOG_INF("[%d] UNICAST:", i++); LOG_INF("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -287,7 +287,7 @@ void BindingHandler::PrintBindingTable() (int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.Value(), (int) entry.remote, (int) entry.nodeId); break; - case EMBER_MULTICAST_BINDING: + case MATTER_MULTICAST_BINDING: LOG_INF("[%d] GROUP:", i++); LOG_INF("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -295,7 +295,7 @@ void BindingHandler::PrintBindingTable() \t+ GroupId %d", (int) entry.fabricIndex, (int) entry.local, (int) entry.remote, (int) entry.groupId); break; - case EMBER_UNUSED_BINDING: + case MATTER_UNUSED_BINDING: LOG_INF("[%d] UNUSED", i++); break; default: diff --git a/examples/light-switch-app/qpg/src/binding-handler.cpp b/examples/light-switch-app/qpg/src/binding-handler.cpp index 6369aa0ab06c25..4dae4e12b44155 100644 --- a/examples/light-switch-app/qpg/src/binding-handler.cpp +++ b/examples/light-switch-app/qpg/src/binding-handler.cpp @@ -73,7 +73,7 @@ static void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Op BindingCommandData * data = static_cast(context); - if (binding.type == EMBER_UNICAST_BINDING) + if (binding.type == MATTER_UNICAST_BINDING) { switch (data->clusterId) { diff --git a/examples/light-switch-app/silabs/src/BindingHandler.cpp b/examples/light-switch-app/silabs/src/BindingHandler.cpp index 3f75f79a60d82c..56f7c306f989d8 100644 --- a/examples/light-switch-app/silabs/src/BindingHandler.cpp +++ b/examples/light-switch-app/silabs/src/BindingHandler.cpp @@ -90,7 +90,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); BindingCommandData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -99,7 +99,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { diff --git a/examples/light-switch-app/silabs/src/ShellCommands.cpp b/examples/light-switch-app/silabs/src/ShellCommands.cpp index daac5078501858..ee5872276efe19 100644 --- a/examples/light-switch-app/silabs/src/ShellCommands.cpp +++ b/examples/light-switch-app/silabs/src/ShellCommands.cpp @@ -139,7 +139,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -154,7 +154,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/light-switch-app/telink/src/binding-handler.cpp b/examples/light-switch-app/telink/src/binding-handler.cpp index f982266828c583..39a8cddc2c60f8 100755 --- a/examples/light-switch-app/telink/src/binding-handler.cpp +++ b/examples/light-switch-app/telink/src/binding-handler.cpp @@ -113,7 +113,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation BindingCommandData * data = static_cast(context); data->isGroup = IsGroupBound(); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -122,7 +122,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -239,7 +239,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -254,7 +254,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -409,7 +409,7 @@ bool IsGroupBound() for (auto & entry : bindingTable) { - if (EMBER_MULTICAST_BINDING == entry.type) + if (MATTER_MULTICAST_BINDING == entry.type) { return true; } diff --git a/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp b/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp index e4bb7647085b40..98f6b197a59e33 100644 --- a/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp +++ b/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp @@ -278,7 +278,7 @@ void CastingServer::ReadServerClustersForNode(NodeId nodeId) " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && nodeId == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && nodeId == binding.nodeId) { if (!mActiveTargetVideoPlayerInfo.HasEndpoint(binding.remote)) { @@ -550,7 +550,7 @@ void CastingServer::DeviceEventCallback(const DeviceLayer::ChipDeviceEvent * eve " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) + if (binding.type == MATTER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) { ChipLogProgress( NotSpecified, @@ -641,7 +641,7 @@ NodeId CastingServer::GetVideoPlayerNodeForFabricIndex(FabricIndex fabricIndex) " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && fabricIndex == binding.fabricIndex) + if (binding.type == MATTER_UNICAST_BINDING && fabricIndex == binding.fabricIndex) { ChipLogProgress(NotSpecified, "GetVideoPlayerNodeForFabricIndex nodeId=0x" ChipLogFormatX64, ChipLogValueX64(binding.nodeId)); @@ -667,7 +667,7 @@ FabricIndex CastingServer::GetVideoPlayerFabricIndexForNode(NodeId nodeId) " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && nodeId == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && nodeId == binding.nodeId) { ChipLogProgress(NotSpecified, "GetVideoPlayerFabricIndexForNode fabricIndex=%d nodeId=0x" ChipLogFormatX64, binding.fabricIndex, ChipLogValueX64(binding.nodeId)); diff --git a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp index bced79be4bc102..20558982ea78ca 100644 --- a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp @@ -156,7 +156,7 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) + if (binding.type == MATTER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) { ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster Matched accessingFabricIndex with " diff --git a/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp b/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp index 478847d15a2eca..60d589c1fc640b 100644 --- a/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp @@ -53,7 +53,7 @@ void EndpointListLoader::Initialize(chip::Messaging::ExchangeManager * exchangeM for (const auto & binding : chip::BindingTable::GetInstance()) { - if (binding.type == EMBER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) { // check to see if we discovered a new endpoint in the bindings chip::EndpointId endpointId = binding.remote; @@ -86,7 +86,7 @@ CHIP_ERROR EndpointListLoader::Load() " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) { // if we discovered a new Endpoint from the bindings, read its EndpointAttributes chip::EndpointId endpointId = binding.remote; diff --git a/src/app/clusters/bindings/BindingManager.cpp b/src/app/clusters/bindings/BindingManager.cpp index 7243fdcfb3b744..b765146ed55153 100644 --- a/src/app/clusters/bindings/BindingManager.cpp +++ b/src/app/clusters/bindings/BindingManager.cpp @@ -88,7 +88,7 @@ CHIP_ERROR BindingManager::Init(const BindingManagerInitParams & params) { for (const EmberBindingTableEntry & entry : BindingTable::GetInstance()) { - if (entry.type == EMBER_UNICAST_BINDING) + if (entry.type == MATTER_UNICAST_BINDING) { // The CASE connection can also fail if the unicast peer is offline. // There is recovery mechanism to retry connection on-demand so ignore error. @@ -187,14 +187,14 @@ CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, Cluste { if (iter->local == endpoint && (!iter->clusterId.HasValue() || iter->clusterId.Value() == cluster)) { - if (iter->type == EMBER_UNICAST_BINDING) + if (iter->type == MATTER_UNICAST_BINDING) { error = mPendingNotificationMap.AddPendingNotification(iter.GetIndex(), bindingContext); SuccessOrExit(error); error = EstablishConnection(ScopedNodeId(iter->nodeId, iter->fabricIndex)); SuccessOrExit(error); } - else if (iter->type == EMBER_MULTICAST_BINDING) + else if (iter->type == MATTER_MULTICAST_BINDING) { mBoundDeviceChangedHandler(*iter, nullptr, bindingContext->GetContext()); } diff --git a/src/app/clusters/bindings/PendingNotificationMap.cpp b/src/app/clusters/bindings/PendingNotificationMap.cpp index 3499bddc090046..a7299b2d1f4663 100644 --- a/src/app/clusters/bindings/PendingNotificationMap.cpp +++ b/src/app/clusters/bindings/PendingNotificationMap.cpp @@ -30,17 +30,17 @@ CHIP_ERROR PendingNotificationMap::FindLRUConnectPeer(ScopedNodeId & nodeId) // to the start of the list than the last entry of any other peer. // First, set up a way to easily track which entries correspond to the same peer. - uint8_t bindingWithSamePeer[EMBER_BINDING_TABLE_SIZE]; + uint8_t bindingWithSamePeer[MATTER_BINDING_TABLE_SIZE]; for (auto iter = BindingTable::GetInstance().begin(); iter != BindingTable::GetInstance().end(); ++iter) { - if (iter->type != EMBER_UNICAST_BINDING) + if (iter->type != MATTER_UNICAST_BINDING) { continue; } for (auto checkIter = BindingTable::GetInstance().begin(); checkIter != BindingTable::GetInstance().end(); ++checkIter) { - if (checkIter->type == EMBER_UNICAST_BINDING && checkIter->fabricIndex == iter->fabricIndex && + if (checkIter->type == MATTER_UNICAST_BINDING && checkIter->fabricIndex == iter->fabricIndex && checkIter->nodeId == iter->nodeId) { bindingWithSamePeer[iter.GetIndex()] = checkIter.GetIndex(); @@ -49,7 +49,7 @@ CHIP_ERROR PendingNotificationMap::FindLRUConnectPeer(ScopedNodeId & nodeId) } } - uint16_t lastAppear[EMBER_BINDING_TABLE_SIZE]; + uint16_t lastAppear[MATTER_BINDING_TABLE_SIZE]; for (uint16_t & value : lastAppear) { value = UINT16_MAX; @@ -62,7 +62,7 @@ CHIP_ERROR PendingNotificationMap::FindLRUConnectPeer(ScopedNodeId & nodeId) } uint8_t lruBindingEntryIndex; uint16_t minLastAppearValue = UINT16_MAX; - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { if (lastAppear[i] < minLastAppearValue) { @@ -82,7 +82,7 @@ CHIP_ERROR PendingNotificationMap::FindLRUConnectPeer(ScopedNodeId & nodeId) CHIP_ERROR PendingNotificationMap::AddPendingNotification(uint8_t bindingEntryId, PendingNotificationContext * context) { RemoveEntry(bindingEntryId); - if (mNumEntries == EMBER_BINDING_TABLE_SIZE) + if (mNumEntries == MATTER_BINDING_TABLE_SIZE) { // We know that the RemoveEntry above did not do anything so we don't need to try restoring it. return CHIP_ERROR_NO_MEMORY; diff --git a/src/app/clusters/bindings/PendingNotificationMap.h b/src/app/clusters/bindings/PendingNotificationMap.h index d0697b0dac32ff..c06a0a426d434c 100644 --- a/src/app/clusters/bindings/PendingNotificationMap.h +++ b/src/app/clusters/bindings/PendingNotificationMap.h @@ -68,7 +68,7 @@ struct PendingNotificationEntry class PendingNotificationMap { public: - static constexpr uint8_t kMaxPendingNotifications = EMBER_BINDING_TABLE_SIZE; + static constexpr uint8_t kMaxPendingNotifications = MATTER_BINDING_TABLE_SIZE; friend class Iterator; diff --git a/src/app/clusters/bindings/bindings.cpp b/src/app/clusters/bindings/bindings.cpp index 22c4fba0be6920..7e0f3ce306da32 100644 --- a/src/app/clusters/bindings/bindings.cpp +++ b/src/app/clusters/bindings/bindings.cpp @@ -114,7 +114,7 @@ CHIP_ERROR CheckValidBindingList(const EndpointId localEndpoint, const Decodable oldListSize++; } } - ReturnErrorCodeIf(BindingTable::GetInstance().Size() - oldListSize + listSize > EMBER_BINDING_TABLE_SIZE, + ReturnErrorCodeIf(BindingTable::GetInstance().Size() - oldListSize + listSize > MATTER_BINDING_TABLE_SIZE, CHIP_IM_GLOBAL_STATUS(ResourceExhausted)); return CHIP_NO_ERROR; } @@ -153,7 +153,7 @@ CHIP_ERROR BindingTableAccess::ReadBindingTable(EndpointId endpoint, AttributeVa return encoder.EncodeList([&](const auto & subEncoder) { for (const EmberBindingTableEntry & entry : BindingTable::GetInstance()) { - if (entry.local == endpoint && entry.type == EMBER_UNICAST_BINDING) + if (entry.local == endpoint && entry.type == MATTER_UNICAST_BINDING) { Binding::Structs::TargetStruct::Type value = { .node = MakeOptional(entry.nodeId), @@ -164,7 +164,7 @@ CHIP_ERROR BindingTableAccess::ReadBindingTable(EndpointId endpoint, AttributeVa }; ReturnErrorOnFailure(subEncoder.Encode(value)); } - else if (entry.local == endpoint && entry.type == EMBER_MULTICAST_BINDING) + else if (entry.local == endpoint && entry.type == MATTER_MULTICAST_BINDING) { Binding::Structs::TargetStruct::Type value = { .node = NullOptional, @@ -214,7 +214,7 @@ CHIP_ERROR BindingTableAccess::WriteBindingTable(const ConcreteDataAttributePath { if (bindingTableIter->local == path.mEndpointId && bindingTableIter->fabricIndex == mAccessingFabricIndex) { - if (bindingTableIter->type == EMBER_UNICAST_BINDING) + if (bindingTableIter->type == MATTER_UNICAST_BINDING) { BindingManager::GetInstance().UnicastBindingRemoved(bindingTableIter.GetIndex()); } @@ -284,7 +284,7 @@ CHIP_ERROR AddBindingEntry(const EmberBindingTableEntry & entry) return err; } - if (entry.type == EMBER_UNICAST_BINDING) + if (entry.type == MATTER_UNICAST_BINDING) { err = BindingManager::GetInstance().UnicastBindingCreated(entry.fabricIndex, entry.nodeId); if (err != CHIP_NO_ERROR) diff --git a/src/app/tests/TestBindingTable.cpp b/src/app/tests/TestBindingTable.cpp index 2bd5ed865502c0..fa314d1c1fd1dc 100644 --- a/src/app/tests/TestBindingTable.cpp +++ b/src/app/tests/TestBindingTable.cpp @@ -42,17 +42,17 @@ void TestAdd(nlTestSuite * aSuite, void * aContext) chip::TestPersistentStorageDelegate testStorage; table.SetPersistentStorage(&testStorage); EmberBindingTableEntry unusedEntry; - unusedEntry.type = EMBER_UNUSED_BINDING; + unusedEntry.type = MATTER_UNUSED_BINDING; NL_TEST_ASSERT(aSuite, table.Add(unusedEntry) == CHIP_ERROR_INVALID_ARGUMENT); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, i, 0, 0, NullOptional)) == CHIP_NO_ERROR); } NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, 0, 0, 0, NullOptional)) == CHIP_ERROR_NO_MEMORY); - NL_TEST_ASSERT(aSuite, table.Size() == EMBER_BINDING_TABLE_SIZE); + NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE); auto iter = table.begin(); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { NL_TEST_ASSERT(aSuite, iter != table.end()); NL_TEST_ASSERT(aSuite, iter->nodeId == i); @@ -73,14 +73,14 @@ void TestRemoveThenAdd(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, iter == table.end()); NL_TEST_ASSERT(aSuite, table.Size() == 0); NL_TEST_ASSERT(aSuite, table.begin() == table.end()); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, i, 0, 0, NullOptional)) == CHIP_NO_ERROR); } iter = table.begin(); ++iter; NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == EMBER_BINDING_TABLE_SIZE - 1); + NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE - 1); NL_TEST_ASSERT(aSuite, iter->nodeId == 2); NL_TEST_ASSERT(aSuite, iter.GetIndex() == 2); auto iterCheck = table.begin(); @@ -88,9 +88,9 @@ void TestRemoveThenAdd(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, iter == iterCheck); NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, 1, 0, 0, NullOptional)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == EMBER_BINDING_TABLE_SIZE); + NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE); iter = table.begin(); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE - 1; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE - 1; i++) { ++iter; } @@ -100,11 +100,11 @@ void TestRemoveThenAdd(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, iter == table.end()); iter = table.begin(); NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == EMBER_BINDING_TABLE_SIZE - 1); + NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE - 1); NL_TEST_ASSERT(aSuite, iter == table.begin()); NL_TEST_ASSERT(aSuite, iter.GetIndex() == 2); NL_TEST_ASSERT(aSuite, iter->nodeId == 2); - NL_TEST_ASSERT(aSuite, table.GetAt(0).type == EMBER_UNUSED_BINDING); + NL_TEST_ASSERT(aSuite, table.GetAt(0).type == MATTER_UNUSED_BINDING); } void VerifyTableSame(nlTestSuite * aSuite, BindingTable & table, const std::vector & expected) diff --git a/src/app/tests/TestPendingNotificationMap.cpp b/src/app/tests/TestPendingNotificationMap.cpp index b635f3a654cc9b..31aa133977d1be 100644 --- a/src/app/tests/TestPendingNotificationMap.cpp +++ b/src/app/tests/TestPendingNotificationMap.cpp @@ -44,7 +44,7 @@ void ClearBindingTable(BindingTable & table) void CreateDefaultFullBindingTable(BindingTable & table) { - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { table.Add(EmberBindingTableEntry::ForNode(i / 10, i % 5, 0, 0, MakeOptional(i))); } @@ -63,15 +63,15 @@ void TestAddRemove(nlTestSuite * aSuite, void * aContext) PendingNotificationMap pendingMap; ClearBindingTable(BindingTable::GetInstance()); CreateDefaultFullBindingTable(BindingTable::GetInstance()); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(i, nullptr) == CHIP_NO_ERROR); } // Confirm adding in one more element fails - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(EMBER_BINDING_TABLE_SIZE, nullptr) == CHIP_ERROR_NO_MEMORY); + NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(MATTER_BINDING_TABLE_SIZE, nullptr) == CHIP_ERROR_NO_MEMORY); auto iter = pendingMap.begin(); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { PendingNotificationEntry entry = *iter; NL_TEST_ASSERT(aSuite, entry.mBindingEntryId == i); diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index d44c598a737b93..bd785c5b9682b1 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -1177,7 +1177,7 @@ void emAfLoadAttributeDefaults(EndpointId endpoint, Optional clusterI for (ep = 0; ep < epCount; ep++) { EmberAfDefinedEndpoint * de; - if (endpoint != EMBER_BROADCAST_ENDPOINT) + if (endpoint != chip::kInvalidEndpointId) { ep = emberAfIndexFromEndpoint(endpoint); if (ep == kEmberInvalidEndpointIndex) @@ -1298,7 +1298,7 @@ void emAfLoadAttributeDefaults(EndpointId endpoint, Optional clusterI } } } - if (endpoint != EMBER_BROADCAST_ENDPOINT) + if (endpoint != chip::kInvalidEndpointId) { break; } diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h index 83a3aeacf8bf0f..7a1ab307dc1202 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -121,7 +121,11 @@ const EmberAfCluster * emberAfFindClusterIncludingDisabledEndpoints(chip::Endpoi // cast it. EmberAfGenericClusterFunction emberAfFindClusterFunction(const EmberAfCluster * cluster, EmberAfClusterMask functionMask); -// Loads attribute defaults and any non-volatile attributes stored +/** + * @brief Loads attribute defaults and any non-volatile attributes stored + * + * @param endpoint EnpointId. Use chip::kInvalidEndpointId to initialize all endpoints + */ void emberAfInitializeAttributes(chip::EndpointId endpoint); // After the RAM value has changed, code should call this function. If this diff --git a/src/app/util/binding-table.cpp b/src/app/util/binding-table.cpp index 87655bdf956c38..b08d41d7f074b4 100644 --- a/src/app/util/binding-table.cpp +++ b/src/app/util/binding-table.cpp @@ -33,12 +33,12 @@ BindingTable::BindingTable() CHIP_ERROR BindingTable::Add(const EmberBindingTableEntry & entry) { - if (entry.type == EMBER_UNUSED_BINDING) + if (entry.type == MATTER_UNUSED_BINDING) { return CHIP_ERROR_INVALID_ARGUMENT; } uint8_t newIndex = GetNextAvaiableIndex(); - if (newIndex >= EMBER_BINDING_TABLE_SIZE) + if (newIndex >= MATTER_BINDING_TABLE_SIZE) { return CHIP_ERROR_NO_MEMORY; } @@ -62,7 +62,7 @@ CHIP_ERROR BindingTable::Add(const EmberBindingTableEntry & entry) if (error != CHIP_NO_ERROR) { // Roll back - mBindingTable[newIndex].type = EMBER_UNUSED_BINDING; + mBindingTable[newIndex].type = MATTER_UNUSED_BINDING; return error; } @@ -101,7 +101,7 @@ CHIP_ERROR BindingTable::SaveEntryToStorage(uint8_t index, uint8_t nextIndex) { ReturnErrorOnFailure(writer.Put(TLV::ContextTag(kTagCluster), entry.clusterId.Value())); } - if (entry.type == EMBER_UNICAST_BINDING) + if (entry.type == MATTER_UNICAST_BINDING) { ReturnErrorOnFailure(writer.Put(TLV::ContextTag(kTagRemoteEndpoint), entry.remote)); ReturnErrorOnFailure(writer.Put(TLV::ContextTag(kTagNodeId), entry.nodeId)); @@ -211,14 +211,14 @@ CHIP_ERROR BindingTable::LoadEntryFromStorage(uint8_t index, uint8_t & nextIndex } if (reader.GetTag() == TLV::ContextTag(kTagRemoteEndpoint)) { - entry.type = EMBER_UNICAST_BINDING; + entry.type = MATTER_UNICAST_BINDING; ReturnErrorOnFailure(reader.Get(entry.remote)); ReturnErrorOnFailure(reader.Next(TLV::ContextTag(kTagNodeId))); ReturnErrorOnFailure(reader.Get(entry.nodeId)); } else { - entry.type = EMBER_MULTICAST_BINDING; + entry.type = MATTER_MULTICAST_BINDING; ReturnErrorCodeIf(reader.GetTag() != TLV::ContextTag(kTagGroupId), CHIP_ERROR_INVALID_TLV_TAG); ReturnErrorOnFailure(reader.Get(entry.groupId)); } @@ -265,7 +265,7 @@ CHIP_ERROR BindingTable::RemoveAt(Iterator & iter) { ChipLogError(AppServer, "Failed to remove binding table entry %u from storage", iter.mIndex); } - mBindingTable[iter.mIndex].type = EMBER_UNUSED_BINDING; + mBindingTable[iter.mIndex].type = MATTER_UNUSED_BINDING; mNextIndex[iter.mIndex] = kNextNullIndex; mSize--; } @@ -292,14 +292,14 @@ BindingTable::Iterator BindingTable::end() uint8_t BindingTable::GetNextAvaiableIndex() { - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { - if (mBindingTable[i].type == EMBER_UNUSED_BINDING) + if (mBindingTable[i].type == MATTER_UNUSED_BINDING) { return i; } } - return EMBER_BINDING_TABLE_SIZE; + return MATTER_BINDING_TABLE_SIZE; } BindingTable::Iterator BindingTable::Iterator::operator++() diff --git a/src/app/util/binding-table.h b/src/app/util/binding-table.h index 9e39313091cd35..4b8cc733410a9d 100644 --- a/src/app/util/binding-table.h +++ b/src/app/util/binding-table.h @@ -110,8 +110,8 @@ class BindingTable CHIP_ERROR LoadEntryFromStorage(uint8_t index, uint8_t & nextIndex); - EmberBindingTableEntry mBindingTable[EMBER_BINDING_TABLE_SIZE]; - uint8_t mNextIndex[EMBER_BINDING_TABLE_SIZE]; + EmberBindingTableEntry mBindingTable[MATTER_BINDING_TABLE_SIZE]; + uint8_t mNextIndex[MATTER_BINDING_TABLE_SIZE]; uint8_t mHead = kNextNullIndex; uint8_t mTail = kNextNullIndex; diff --git a/src/app/util/config.h b/src/app/util/config.h index 288935eee4beae..658626e384c464 100644 --- a/src/app/util/config.h +++ b/src/app/util/config.h @@ -29,6 +29,6 @@ // User options for plugin Binding Table Library // TODO: Make this a CHIP_CONFIG value. -#ifndef EMBER_BINDING_TABLE_SIZE -#define EMBER_BINDING_TABLE_SIZE 10 -#endif // EMBER_BINDING_TABLE_SIZE +#ifndef MATTER_BINDING_TABLE_SIZE +#define MATTER_BINDING_TABLE_SIZE 10 +#endif // MATTER_BINDING_TABLE_SIZE diff --git a/src/app/util/mock/include/zap-generated/gen_config.h b/src/app/util/mock/include/zap-generated/gen_config.h index 8488bc9c8700ca..17f2de013f9597 100644 --- a/src/app/util/mock/include/zap-generated/gen_config.h +++ b/src/app/util/mock/include/zap-generated/gen_config.h @@ -17,5 +17,5 @@ #pragma once -#define EMBER_BINDING_TABLE_SIZE 20 +#define MATTER_BINDING_TABLE_SIZE 20 #define SCENES_MANAGEMENT_TABLE_SIZE 24 diff --git a/src/app/util/types_stub.h b/src/app/util/types_stub.h index e6ebd93f06f384..ac26684f850cd7 100644 --- a/src/app/util/types_stub.h +++ b/src/app/util/types_stub.h @@ -36,13 +36,13 @@ enum #endif { /** A binding that is currently not in use. */ - EMBER_UNUSED_BINDING = 0, + MATTER_UNUSED_BINDING = 0, /** A unicast binding whose 64-bit identifier is the destination EUI64. */ - EMBER_UNICAST_BINDING = 1, + MATTER_UNICAST_BINDING = 1, /** A multicast binding whose 64-bit identifier is the group address. This * binding can be used to send messages to the group and to receive * messages sent to the group. */ - EMBER_MULTICAST_BINDING = 3, + MATTER_MULTICAST_BINDING = 3, }; /** @@ -77,7 +77,7 @@ struct EmberBindingTableEntry chip::EndpointId remoteEndpoint, chip::Optional cluster) { EmberBindingTableEntry entry = { - .type = EMBER_UNICAST_BINDING, + .type = MATTER_UNICAST_BINDING, .fabricIndex = fabric, .local = localEndpoint, .clusterId = cluster, @@ -91,7 +91,7 @@ struct EmberBindingTableEntry chip::Optional cluster) { EmberBindingTableEntry entry = { - .type = EMBER_MULTICAST_BINDING, + .type = MATTER_MULTICAST_BINDING, .fabricIndex = fabric, .local = localEndpoint, .clusterId = cluster, @@ -102,7 +102,7 @@ struct EmberBindingTableEntry } /** The type of binding. */ - EmberBindingType type = EMBER_UNUSED_BINDING; + EmberBindingType type = MATTER_UNUSED_BINDING; chip::FabricIndex fabricIndex; /** The endpoint on the local node. */ @@ -135,12 +135,12 @@ struct EmberBindingTableEntry return false; } - if (type == EMBER_MULTICAST_BINDING && groupId != other.groupId) + if (type == MATTER_MULTICAST_BINDING && groupId != other.groupId) { return false; } - if (type == EMBER_UNICAST_BINDING && (nodeId != other.nodeId || remote != other.remote)) + if (type == MATTER_UNICAST_BINDING && (nodeId != other.nodeId || remote != other.remote)) { return false; } @@ -172,65 +172,6 @@ typedef struct */ #define UNUSED_VAR(x) (void) (x) -/** - * @brief The broadcast endpoint, as defined in the ZigBee spec. - */ -#define EMBER_BROADCAST_ENDPOINT (chip::kInvalidEndpointId) - -/** - * @brief Useful to reference a single bit of a byte. - */ -#define EMBER_BIT(nr) (1UL << (nr)) // Unsigned avoids compiler warnings re EMBER_BIT(15) - -/** - * @brief Returns the low byte of the 16-bit value \c n as an \c uint8_t. - */ -#define EMBER_LOW_BYTE(n) ((uint8_t) ((n) &0xFF)) - -/** - * @brief Returns the high byte of the 16-bit value \c n as an \c uint8_t. - */ -#define EMBER_HIGH_BYTE(n) ((uint8_t) (EMBER_LOW_BYTE((n) >> 8))) -/** - * @brief Returns the low byte of the 32-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_0(n) ((uint8_t) ((n) &0xFF)) - -/** - * @brief Returns the second byte of the 32-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_1(n) EMBER_BYTE_0((n) >> 8) - -/** - * @brief Returns the third byte of the 32-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_2(n) EMBER_BYTE_0((n) >> 16) - -/** - * @brief Returns the high byte of the 32-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_3(n) EMBER_BYTE_0((n) >> 24) - -/** - * @brief Returns the fifth byte of the 64-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_4(n) EMBER_BYTE_0((n) >> 32) - -/** - * @brief Returns the sixth byte of the 64-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_5(n) EMBER_BYTE_0((n) >> 40) - -/** - * @brief Returns the seventh byte of the 64-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_6(n) EMBER_BYTE_0((n) >> 48) - -/** - * @brief Returns the high byte of the 64-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_7(n) EMBER_BYTE_0((n) >> 56) - /** * @brief Returns the value of the bitmask \c bits within * the register or byte \c reg. diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index cdaac8f494a8c7..267da8921574d8 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include // TODO: figure out a clear path for compile-time codegen @@ -107,7 +108,7 @@ EmberAfDifferenceType emberAfGetDifference(uint8_t * pData, EmberAfDifferenceTyp // **************************************** void emberAfInit() { - emberAfInitializeAttributes(EMBER_BROADCAST_ENDPOINT); + emberAfInitializeAttributes(kInvalidEndpointId); MATTER_PLUGINS_INIT @@ -230,8 +231,7 @@ void emberAfCopyLongString(uint8_t * dest, const uint8_t * src, size_t size) length = static_cast(size); } memmove(dest + 2, src + 2, length); - dest[0] = EMBER_LOW_BYTE(length); - dest[1] = EMBER_HIGH_BYTE(length); + Encoding::LittleEndian::Put16(dest, length); } }