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

[nrf toup] Don't advertise when waiting for last fabric removed action #580

Merged
merged 1 commit into from
Mar 24, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,19 @@ class AppFabricTableDelegate : public chip::FabricTable::Delegate
private:
void OnFabricRemoved(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex)
{
k_timer_start(&sFabricRemovedTimer, K_MSEC(CONFIG_CHIP_LAST_FABRIC_REMOVED_ACTION_DELAY), K_NO_WAIT);
#ifndef CONFIG_CHIP_LAST_FABRIC_REMOVED_NONE
auto & server = chip::Server::GetInstance();

if (server.GetFabricTable().FabricCount() == 0)
{
if (chip::DeviceLayer::ConnectivityMgr().IsBLEAdvertisingEnabled())
{
server.GetCommissioningWindowManager().CloseCommissioningWindow();
}

k_timer_start(&sFabricRemovedTimer, K_MSEC(CONFIG_CHIP_LAST_FABRIC_REMOVED_ACTION_DELAY), K_NO_WAIT);
}
#endif // CONFIG_CHIP_LAST_FABRIC_REMOVED_NONE
}

static void OnFabricRemovedTimerCallback(k_timer * timer)
Expand All @@ -59,6 +71,9 @@ class AppFabricTableDelegate : public chip::FabricTable::Delegate
#ifdef CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_AND_REBOOT
chip::Server::GetInstance().ScheduleFactoryReset();
#elif defined(CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_ONLY) || defined(CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_AND_PAIRING_START)
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
chip::DeviceLayer::ThreadStackMgr().ClearAllSrpHostAndServices();
#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
// Erase Matter data
chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().DoFactoryReset();
// Erase Network credentials and disconnect
Expand Down
Loading