diff --git a/src/app/server/AppDelegate.h b/src/app/server/AppDelegate.h index e722e1b41b8f00..49937c62d7168e 100644 --- a/src/app/server/AppDelegate.h +++ b/src/app/server/AppDelegate.h @@ -28,6 +28,13 @@ class AppDelegate virtual ~AppDelegate() {} virtual void OnCommissioningSessionStarted() {} virtual void OnCommissioningSessionStopped() {} + + /* + * This is called anytime a basic or enhanced commissioning window is opened. + * + * The type of the window can be retrieved by calling + * CommissioningWindowManager::CommissioningWindowStatus() + */ virtual void OnCommissioningWindowOpened() {} virtual void OnCommissioningWindowClosed() {} }; diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 039bf7da5105d3..01ffdc16571847 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();