Skip to content

Commit

Permalink
Move UseECM check for StartAdvertisement (#21249) (#21291)
Browse files Browse the repository at this point in the history
* Move UseECM check for StartAdvertisement

Moved UseECM check above AppDelegate to ensure status is set before
Commissioning Window is activated.

* Fix restyle issue

Co-authored-by: Boris Zbarsky <[email protected]>

Co-authored-by: Clifton Rawlings <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
3 people authored Jul 27, 2022
1 parent 7069064 commit c0c86ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/app/server/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
};
10 changes: 5 additions & 5 deletions src/app/server/CommissioningWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,6 @@ CHIP_ERROR CommissioningWindowManager::StartAdvertisement()
}
#endif // CONFIG_NETWORK_LAYER_BLE

if (mAppDelegate != nullptr)
{
mAppDelegate->OnCommissioningWindowOpened();
}

if (mUseECM)
{
mWindowStatus = AdministratorCommissioning::CommissioningWindowStatus::kEnhancedWindowOpen;
Expand All @@ -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();

Expand Down

0 comments on commit c0c86ac

Please sign in to comment.