Skip to content

Commit

Permalink
[nrf toup] Clear Thread Network after last fabric is removed
Browse files Browse the repository at this point in the history
Dataset has to be cleared to allow commissioning to different network
when CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_ONLY is used.

Signed-off-by: Adrian Gielniewski <[email protected]>
  • Loading branch information
adigie authored and jukkar committed Dec 10, 2024
1 parent a0d2cc5 commit 20babbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class GenericThreadDriver final : public ThreadDriver
connectNetworkTimeout = connectTimeoutSec;
}

void ClearNetwork() { mStagingNetwork.Clear(); }

// BaseDriver
NetworkIterator * GetNetworks() override { return new ThreadNetworkIterator(this); }
CHIP_ERROR Init(Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ void initNetworkCommissioningThreadDriver()
#endif
}

void resetGenericThreadDriver()
{
#ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_
sGenericThreadDriver.ClearNetwork();
#endif
}

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_DNS_CLIENT
CHIP_ERROR ReadDomainNameComponent(const char *& in, char * out, size_t outSize)
{
Expand Down Expand Up @@ -1257,6 +1264,7 @@ void GenericThreadStackManagerImpl_OpenThread<ImplClass>::_ErasePersistentInfo()
otThreadSetEnabled(mOTInst, false);
otIp6SetEnabled(mOTInst, false);
otInstanceErasePersistentInfo(mOTInst);
resetGenericThreadDriver();
Impl()->UnlockThreadStack();
}

Expand Down

0 comments on commit 20babbe

Please sign in to comment.