Skip to content

Commit

Permalink
Move UseECM check for StartAdvertisement
Browse files Browse the repository at this point in the history
Moved UseECM check above AppDelegate to ensure status is set before
Commissioning Window is activated.
  • Loading branch information
KrypticCliff committed Jul 26, 2022
1 parent 34a1b5c commit 2b7179d
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 2b7179d

Please sign in to comment.