Skip to content

Commit

Permalink
[NXP] Remove circular dependency with application code in platform fi…
Browse files Browse the repository at this point in the history
…le ConfigurationmanagerImpl.cpp (#30891)
  • Loading branch information
dinabenamar authored and pull[bot] committed May 10, 2024
1 parent 68b856f commit 0c24fd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 3 additions & 1 deletion examples/all-clusters-app/nxp/common/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,5 +473,7 @@ void AppTask::SwitchCommissioningStateHandler(void)

void AppTask::FactoryResetHandler(void)
{
ConfigurationMgr().InitiateFactoryReset();
/* Emit the ShutDown event before factory reset */
chip::Server::GetInstance().GenerateShutDownEvent();
chip::Server::GetInstance().ScheduleFactoryReset();
}
8 changes: 1 addition & 7 deletions src/platform/nxp/common/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <platform/internal/CHIPDeviceLayerInternal.h>

#include "NXPConfig.h"
#include <app/server/Server.h>
#include <platform/ConfigurationManager.h>
#include <platform/DiagnosticDataProvider.h>
#include <platform/internal/GenericConfigurationManagerImpl.ipp>
Expand Down Expand Up @@ -148,12 +147,7 @@ bool ConfigurationManagerImpl::CanFactoryReset()

void ConfigurationManagerImpl::InitiateFactoryReset()
{
PlatformMgr().ScheduleWork([](intptr_t) {
// Emit ShutDown event and delete all fabrics.
PlatformMgr().HandleServerShuttingDown();
Server::GetInstance().GetFabricTable().DeleteAllFabrics();
DoFactoryReset(0);
});
PlatformMgr().ScheduleWork(DoFactoryReset);
}

CHIP_ERROR ConfigurationManagerImpl::ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key persistedStorageKey,
Expand Down

0 comments on commit 0c24fd2

Please sign in to comment.