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 Jan 17, 2024
1 parent 8e9d54b commit 4159198
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 4159198

Please sign in to comment.