diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index b954f739e3c6a0..44e6a4ff3b1827 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -51,6 +51,7 @@ #if CHIP_ENABLE_OPENTHREAD #include #include +#include #include #endif // CHIP_ENABLE_OPENTHREAD @@ -801,11 +802,7 @@ void BaseApplication::DoProvisioningReset() { PlatformMgr().ScheduleWork([](intptr_t) { #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - ThreadStackMgr().ClearAllSrpHostAndServices(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - ChipLogProgress(DeviceLayer, "Clearing Thread provision"); - chip::DeviceLayer::ConnectivityMgr().ErasePersistentInfo(); + ConfigurationManagerImpl::GetDefaultInstance().ClearThreadStack(); ThreadStackMgrImpl().FactoryResetThreadStack(); ThreadStackMgr().InitThreadStack(); #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD diff --git a/src/platform/silabs/ConfigurationManagerImpl.cpp b/src/platform/silabs/ConfigurationManagerImpl.cpp index 9454367d3bf030..48ca5109e616d2 100644 --- a/src/platform/silabs/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/ConfigurationManagerImpl.cpp @@ -260,6 +260,16 @@ void ConfigurationManagerImpl::RunConfigUnitTest(void) #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST } +/// @brief Helper to erase Thread info from device +void ConfigurationManagerImpl::ClearThreadStack() +{ +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT + ThreadStackMgr().ClearAllSrpHostAndServices(); +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT + ChipLogProgress(DeviceLayer, "Clearing Thread provision"); + ThreadStackMgr().ErasePersistentInfo(); +} + void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) { CHIP_ERROR err; @@ -273,11 +283,7 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) } #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - ThreadStackMgr().ClearAllSrpHostAndServices(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - ChipLogProgress(DeviceLayer, "Clearing Thread provision"); - ThreadStackMgr().ErasePersistentInfo(); + GetDefaultInstance().ClearThreadStack(); #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD PersistedStorage::KeyValueStoreMgrImpl().ErasePartition(); diff --git a/src/platform/silabs/ConfigurationManagerImpl.h b/src/platform/silabs/ConfigurationManagerImpl.h index f34e37ed91bb52..262b68053a3214 100644 --- a/src/platform/silabs/ConfigurationManagerImpl.h +++ b/src/platform/silabs/ConfigurationManagerImpl.h @@ -46,6 +46,8 @@ class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImp CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours); CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours); + void ClearThreadStack(); + private: // ===== Members that implement the ConfigurationManager public interface.