Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] Open basic commissioning window on pb0 press and release #22940

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions examples/platform/efr32/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
}
else
{
// If the button was released before factory reset got initiated, start BLE advertissement in fast mode
// If the button was released before factory reset got initiated, open the commissioning window and start BLE advertissement
// in fast mode
if (mFunctionTimerActive && mFunction == kFunction_StartBleAdv)
{
CancelFunctionTimer();
Expand All @@ -431,9 +432,14 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
if (!ConnectivityMgr().IsThreadProvisioned())
#endif /* !SL_WIFI */
{
// Enable BLE advertisements
ConnectivityMgr().SetBLEAdvertisingEnabled(true);
ConnectivityMgr().SetBLEAdvertisingMode(ConnectivityMgr().kFastAdvertising);
// Open Basic CommissioningWindow. Will start BLE advertisements
chip::DeviceLayer::PlatformMgr().LockChipStack();
CHIP_ERROR err = chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow();
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("Failed to open the Basic Commissioning Window");
}
}
else { EFR32_LOG("Network is already provisioned, Ble advertissement not enabled"); }
}
Expand Down