mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 09:07:47 +00:00
[dataset] use IsActiveDataset()/IsPendingDataset() for type checks (#10040)
This commit is contained in:
@@ -216,8 +216,7 @@ void DatasetManager::HandleDatasetUpdated(void)
|
||||
|
||||
void DatasetManager::SignalDatasetChange(void) const
|
||||
{
|
||||
Get<Notifier>().Signal(mLocal.GetType() == Dataset::kActive ? kEventActiveDatasetChanged
|
||||
: kEventPendingDatasetChanged);
|
||||
Get<Notifier>().Signal(IsActiveDataset() ? kEventActiveDatasetChanged : kEventPendingDatasetChanged);
|
||||
}
|
||||
|
||||
Error DatasetManager::GetChannelMask(Mac::ChannelMask &aChannelMask) const
|
||||
@@ -407,7 +406,7 @@ void DatasetManager::SendGetResponse(const Coap::Message &aRequest,
|
||||
|
||||
SuccessOrExit(error = Get<Tmf::Agent>().SendMessage(*message, aMessageInfo));
|
||||
|
||||
LogInfo("sent %s dataset get response to %s", (GetType() == Dataset::kActive ? "active" : "pending"),
|
||||
LogInfo("sent %s dataset get response to %s", IsActiveDataset() ? "active" : "pending",
|
||||
aMessageInfo.GetPeerAddr().ToString().AsCString());
|
||||
|
||||
exit:
|
||||
|
||||
@@ -104,7 +104,7 @@ Error DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInfo
|
||||
// verify the request includes a timestamp that is ahead of the locally stored value
|
||||
SuccessOrExit(Tlv::Find<ActiveTimestampTlv>(aMessage, activeTimestamp));
|
||||
|
||||
if (GetType() == Dataset::kPending)
|
||||
if (IsPendingDataset())
|
||||
{
|
||||
Timestamp pendingTimestamp;
|
||||
|
||||
@@ -155,7 +155,7 @@ Error DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInfo
|
||||
}
|
||||
|
||||
// check active timestamp rollback
|
||||
if (GetType() == Dataset::kPending && (!hasNetworkKey || !doesAffectNetworkKey))
|
||||
if (IsPendingDataset() && (!hasNetworkKey || !doesAffectNetworkKey))
|
||||
{
|
||||
// no change to network key, active timestamp must be ahead
|
||||
const Timestamp *localActiveTimestamp = Get<ActiveDatasetManager>().GetTimestamp();
|
||||
@@ -175,7 +175,7 @@ Error DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInfo
|
||||
}
|
||||
|
||||
// verify an MGMT_ACTIVE_SET.req from a Commissioner does not affect connectivity
|
||||
VerifyOrExit(!isUpdateFromCommissioner || GetType() == Dataset::kPending || !doesAffectConnectivity);
|
||||
VerifyOrExit(!isUpdateFromCommissioner || IsPendingDataset() || !doesAffectConnectivity);
|
||||
|
||||
if (isUpdateFromCommissioner)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ Error DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInfo
|
||||
IgnoreError(Get<ActiveDatasetManager>().Read(dataset));
|
||||
}
|
||||
|
||||
if (GetType() == Dataset::kPending || !doesAffectConnectivity)
|
||||
if (IsPendingDataset() || !doesAffectConnectivity)
|
||||
{
|
||||
offset = aMessage.GetOffset();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user