mirror of
https://github.com/espressif/openthread.git
synced 2026-08-24 19:29:52 +00:00
[dataset] simplify Clear() methods (#10283)
- Update `DatasetManager::Clear()` to stop delay timer if it is Pending Dataset. - Remove `PendingDatasetManager::ClearNetwork()` (use `Clear()` instead).
This commit is contained in:
@@ -257,6 +257,12 @@ void DatasetManager::Clear(void)
|
||||
Get<Settings>().DeleteOperationalDataset(mType);
|
||||
|
||||
mTimer.Stop();
|
||||
|
||||
if (IsPendingDataset())
|
||||
{
|
||||
Get<PendingDatasetManager>().mDelayTimer.Stop();
|
||||
}
|
||||
|
||||
SignalDatasetChange();
|
||||
}
|
||||
|
||||
@@ -863,21 +869,6 @@ PendingDatasetManager::PendingDatasetManager(Instance &aInstance)
|
||||
{
|
||||
}
|
||||
|
||||
void PendingDatasetManager::Clear(void)
|
||||
{
|
||||
DatasetManager::Clear();
|
||||
mDelayTimer.Stop();
|
||||
}
|
||||
|
||||
void PendingDatasetManager::ClearNetwork(void)
|
||||
{
|
||||
Dataset dataset;
|
||||
|
||||
mNetworkTimestamp.Clear();
|
||||
mNetworkTimestampValid = false;
|
||||
IgnoreError(DatasetManager::Save(dataset));
|
||||
}
|
||||
|
||||
void PendingDatasetManager::StartDelayTimer(void)
|
||||
{
|
||||
Dataset dataset;
|
||||
|
||||
@@ -73,6 +73,12 @@ public:
|
||||
*/
|
||||
const Timestamp *GetTimestamp(void) const;
|
||||
|
||||
/**
|
||||
* Clears the Operational Dataset.
|
||||
*
|
||||
*/
|
||||
void Clear(void);
|
||||
|
||||
/**
|
||||
* Restores the Operational Dataset from non-volatile memory.
|
||||
*
|
||||
@@ -299,7 +305,6 @@ private:
|
||||
|
||||
bool IsActiveDataset(void) const { return (mType == Dataset::kActive); }
|
||||
bool IsPendingDataset(void) const { return (mType == Dataset::kPending); }
|
||||
void Clear(void);
|
||||
Error ApplyConfiguration(const Dataset &aDataset) const;
|
||||
void HandleGet(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) const;
|
||||
void HandleTimer(void);
|
||||
@@ -391,12 +396,6 @@ public:
|
||||
*/
|
||||
bool IsCommissioned(void) const;
|
||||
|
||||
/**
|
||||
* Clears the Active Operational Dataset.
|
||||
*
|
||||
*/
|
||||
void Clear(void) { DatasetManager::Clear(); }
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
/**
|
||||
@@ -458,22 +457,6 @@ public:
|
||||
*/
|
||||
explicit PendingDatasetManager(Instance &aInstance);
|
||||
|
||||
/**
|
||||
* Clears the Pending Operational Dataset.
|
||||
*
|
||||
* Also stops the Delay Timer if it was active.
|
||||
*
|
||||
*/
|
||||
void Clear(void);
|
||||
|
||||
/**
|
||||
* Clears the network Pending Operational Dataset.
|
||||
*
|
||||
* Also stops the Delay Timer if it was active.
|
||||
*
|
||||
*/
|
||||
void ClearNetwork(void);
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
/**
|
||||
* Starts the Leader functions for maintaining the Active Operational Dataset.
|
||||
|
||||
@@ -3380,7 +3380,7 @@ void Mle::HandleChildIdResponse(RxInfo &aRxInfo)
|
||||
break;
|
||||
|
||||
case kErrorNotFound:
|
||||
Get<MeshCoP::PendingDatasetManager>().ClearNetwork();
|
||||
Get<MeshCoP::PendingDatasetManager>().Clear();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user