From 4453cff29b2e14b35e79f14382aee0cb0ca92957 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Mon, 6 Nov 2023 09:51:47 -0500 Subject: [PATCH] address review comments --- src/app/icd/BUILD.gn | 3 ++- src/app/icd/ICDManagementServer.cpp | 6 +++--- src/app/icd/ICDManagementServer.h | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/icd/BUILD.gn b/src/app/icd/BUILD.gn index db40cfff85b3ff..aa0a6ef67bf28b 100644 --- a/src/app/icd/BUILD.gn +++ b/src/app/icd/BUILD.gn @@ -56,8 +56,9 @@ source_set("cluster") { "ICDMonitoringTable.h", ] + deps = [ ":notifier" ] + public_deps = [ - ":notifier", "${chip_root}/src/lib/core", "${chip_root}/src/platform:platform", "${chip_root}/src/protocols:im_status", diff --git a/src/app/icd/ICDManagementServer.cpp b/src/app/icd/ICDManagementServer.cpp index 2e0fe0a00b326d..3ededbcffe7cb4 100644 --- a/src/app/icd/ICDManagementServer.cpp +++ b/src/app/icd/ICDManagementServer.cpp @@ -66,7 +66,7 @@ Status ICDManagementServer::RegisterClient(PersistentStorageDelegate & storage, if (isFirstEntryForFabric) { // Notify subscribers that the first entry for the fabric was successfully added - app::ICDNotifier::GetInstance().BroadcastICDManagementEvent(app::ICDListener::ICDManagementEvents::kTableUpdated); + TriggerICDMTableUpdatedEvent(); } return InteractionModel::Status::Success; @@ -95,7 +95,7 @@ Status ICDManagementServer::UnregisterClient(PersistentStorageDelegate & storage if (table.IsEmpty()) { - TableIsEmptyForFabric(); + TriggerICDMTableUpdatedEvent(); } return InteractionModel::Status::Success; @@ -109,7 +109,7 @@ Status ICDManagementServer::StayActiveRequest(FabricIndex fabric_index) return InteractionModel::Status::UnsupportedCommand; } -void ICDManagementServer::TableIsEmptyForFabric() +void ICDManagementServer::TriggerICDMTableUpdatedEvent() { app::ICDNotifier::GetInstance().BroadcastICDManagementEvent(app::ICDListener::ICDManagementEvents::kTableUpdated); } diff --git a/src/app/icd/ICDManagementServer.h b/src/app/icd/ICDManagementServer.h index 25a4029ebd573f..cf4a1c9cef920b 100644 --- a/src/app/icd/ICDManagementServer.h +++ b/src/app/icd/ICDManagementServer.h @@ -53,7 +53,11 @@ class ICDManagementServer Status UnregisterClient(PersistentStorageDelegate & storage, FabricIndex fabric_index, chip::NodeId node_id, Optional verificationKey, bool is_admin); - void TableIsEmptyForFabric(); + /** + * @brief Triggers table update events to notify subscribers that an entry was added or removed + * from the ICDMonitoringTable. + */ + void TriggerICDMTableUpdatedEvent(); Status StayActiveRequest(FabricIndex fabric_index);