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

[Telink] Move SetRouterPromotion(false) at the end of OpenCommissioningWindow #25517

Merged
merged 2 commits into from
Mar 9, 2023
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
20 changes: 11 additions & 9 deletions src/app/server/CommissioningWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ CHIP_ERROR CommissioningWindowManager::OpenCommissioningWindow(Seconds16 commiss

mCommissioningTimeoutTimerArmed = true;

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD
// Block device role changing into Router if commissioning window opened and device not yet Router.
// AdvertiseAndListenForPASE fails doesn't matter, because if it does the callers of OpenCommissioningWindow
// will end up calling ResetState, which will reset the boolean.
if (ConnectivityManagerImpl().GetThreadDeviceType() == ConnectivityManager::kThreadDeviceType_Router)
{
ThreadStackMgr().SetRouterPromotion(false);
mRecoverRouterDeviceRole = true;
}
#endif

return AdvertiseAndListenForPASE();
}

Expand Down Expand Up @@ -470,15 +481,6 @@ CHIP_ERROR CommissioningWindowManager::StartAdvertisement()
// reset all advertising, switching to our new commissioning mode.
app::DnssdServer::Instance().StartServer();

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD
// Block device role changing into Router if commissioning window opened and device not yet Router.
if (ConnectivityManagerImpl().GetThreadDeviceType() == ConnectivityManager::kThreadDeviceType_Router)
{
ThreadStackMgr().SetRouterPromotion(false);
mRecoverRouterDeviceRole = true;
}
#endif

return CHIP_NO_ERROR;
}

Expand Down