From 44353fd691f94008c4efaefed9ead6663f630368 Mon Sep 17 00:00:00 2001 From: Cliff Rawlings Date: Tue, 26 Jul 2022 13:08:26 -0700 Subject: [PATCH] Move UseECM check for StartAdvertisement Moved UseECM check above AppDelegate to ensure status is set before Commissioning Window is activated. --- src/app/server/AppDelegate.h | 3 +++ src/app/server/CommissioningWindowManager.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/server/AppDelegate.h b/src/app/server/AppDelegate.h index e722e1b41b8f00..a1705227cf2db6 100644 --- a/src/app/server/AppDelegate.h +++ b/src/app/server/AppDelegate.h @@ -28,6 +28,9 @@ class AppDelegate virtual ~AppDelegate() {} virtual void OnCommissioningSessionStarted() {} virtual void OnCommissioningSessionStopped() {} + + // Use the helper function CommissioningWindowStatus + // to get which commissioning window has opened. virtual void OnCommissioningWindowOpened() {} virtual void OnCommissioningWindowClosed() {} }; diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 5d1e574fe97c34..eaea53d90ec00d 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -374,11 +374,6 @@ CHIP_ERROR CommissioningWindowManager::StartAdvertisement() } #endif // CONFIG_NETWORK_LAYER_BLE - if (mAppDelegate != nullptr) - { - mAppDelegate->OnCommissioningWindowOpened(); - } - if (mUseECM) { mWindowStatus = AdministratorCommissioning::CommissioningWindowStatus::kEnhancedWindowOpen; @@ -388,6 +383,11 @@ CHIP_ERROR CommissioningWindowManager::StartAdvertisement() mWindowStatus = AdministratorCommissioning::CommissioningWindowStatus::kBasicWindowOpen; } + if (mAppDelegate != nullptr) + { + mAppDelegate->OnCommissioningWindowOpened(); + } + // reset all advertising, switching to our new commissioning mode. app::DnssdServer::Instance().StartServer();