mirror of
https://github.com/espressif/openthread.git
synced 2026-08-05 02:17:47 +00:00
[style] remove static member access through instances (#3705)
This commit is contained in:
committed by
Jonathan Hui
parent
c7cd21f8b7
commit
cadfc6d299
@@ -299,12 +299,12 @@ otError otCommissionerGeneratePSKc(otInstance * aInstance,
|
||||
const otExtendedPanId *aExtPanId,
|
||||
uint8_t * aPSKc)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.GetThreadNetif().GetCommissioner().GeneratePSKc(aPassPhrase, aNetworkName, *aExtPanId, aPSKc);
|
||||
error = MeshCoP::Commissioner::GeneratePSKc(aPassPhrase, aNetworkName, *aExtPanId, aPSKc);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPassPhrase);
|
||||
|
||||
@@ -840,19 +840,18 @@ otError MeshForwarder::SendFragment(Message &aMessage, Mac::Frame &aFrame)
|
||||
|
||||
if (hopsLeft != Mle::kMaxRouteCost)
|
||||
{
|
||||
hopsLeft +=
|
||||
netif.GetMle().GetLinkCost(netif.GetMle().GetRouterId(netif.GetMle().GetNextHop(mMeshDest)));
|
||||
hopsLeft += netif.GetMle().GetLinkCost(Mle::Mle::GetRouterId(netif.GetMle().GetNextHop(mMeshDest)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// In case there is no route to the destination router (only link).
|
||||
hopsLeft = netif.GetMle().GetLinkCost(netif.GetMle().GetRouterId(mMeshDest));
|
||||
hopsLeft = netif.GetMle().GetLinkCost(Mle::Mle::GetRouterId(mMeshDest));
|
||||
}
|
||||
}
|
||||
|
||||
// The hopsLft field MUST be incremented by one if the destination RLOC16
|
||||
// is not that of an active Router.
|
||||
if (!netif.GetMle().IsActiveRouter(mMeshDest))
|
||||
if (!Mle::Mle::IsActiveRouter(mMeshDest))
|
||||
{
|
||||
hopsLeft += 1;
|
||||
}
|
||||
@@ -1036,7 +1035,7 @@ void MeshForwarder::HandleSentFrame(Mac::Frame &aFrame, otError aError)
|
||||
case OT_ERROR_NO_ACK:
|
||||
neighbor->IncrementLinkFailures();
|
||||
|
||||
if (netif.GetMle().IsActiveRouter(neighbor->GetRloc16()))
|
||||
if (Mle::Mle::IsActiveRouter(neighbor->GetRloc16()))
|
||||
{
|
||||
if (neighbor->GetLinkFailures() >= Mle::kFailedRouterTransmissions)
|
||||
{
|
||||
@@ -1593,7 +1592,7 @@ otError MeshForwarder::GetFramePriority(const uint8_t * aFrame,
|
||||
|
||||
SuccessOrExit(error = DecompressIp6Header(aFrame, aFrameLength, aMacSource, aMacDest, ip6Header, headerLength,
|
||||
nextHeaderCompressed));
|
||||
aPriority = GetNetif().GetIp6().DscpToPriority(ip6Header.GetDscp());
|
||||
aPriority = Ip6::Ip6::DscpToPriority(ip6Header.GetDscp());
|
||||
VerifyOrExit(ip6Header.GetNextHeader() == Ip6::kProtoUdp);
|
||||
|
||||
aFrame += headerLength;
|
||||
|
||||
@@ -804,7 +804,7 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header)
|
||||
|
||||
if (aloc16 == Mle::kAloc16Leader)
|
||||
{
|
||||
mMeshDest = netif.GetMle().GetRloc16(netif.GetMle().GetLeaderId());
|
||||
mMeshDest = Mle::Mle::GetRloc16(netif.GetMle().GetLeaderId());
|
||||
}
|
||||
else if ((aloc16 >= Mle::kAloc16CommissionerStart) && (aloc16 <= Mle::kAloc16CommissionerEnd))
|
||||
{
|
||||
@@ -820,18 +820,18 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header)
|
||||
static_cast<uint8_t>(aloc16 & Mle::kAloc16DhcpAgentMask), agentRloc16) == OT_ERROR_NONE),
|
||||
error = OT_ERROR_DROP);
|
||||
|
||||
routerId = netif.GetMle().GetRouterId(agentRloc16);
|
||||
routerId = Mle::Mle::GetRouterId(agentRloc16);
|
||||
|
||||
// if agent is active router or the child of the device
|
||||
if ((netif.GetMle().IsActiveRouter(agentRloc16)) ||
|
||||
(netif.GetMle().GetRloc16(routerId) == netif.GetMle().GetRloc16()))
|
||||
if ((Mle::Mle::IsActiveRouter(agentRloc16)) ||
|
||||
(Mle::Mle::GetRloc16(routerId) == netif.GetMle().GetRloc16()))
|
||||
{
|
||||
mMeshDest = agentRloc16;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the parent of the ED Agent as Dest
|
||||
mMeshDest = netif.GetMle().GetRloc16(routerId);
|
||||
mMeshDest = Mle::Mle::GetRloc16(routerId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1179,7 +1179,7 @@ otError MeshForwarder::GetDestinationRlocByServiceAloc(uint16_t aServiceAloc, ui
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
ThreadNetif & netif = GetNetif();
|
||||
uint8_t serviceId = netif.GetMle().GetServiceIdFromAloc(aServiceAloc);
|
||||
uint8_t serviceId = Mle::Mle::GetServiceIdFromAloc(aServiceAloc);
|
||||
NetworkData::ServiceTlv *serviceTlv = netif.GetNetworkDataLeader().FindServiceById(serviceId);
|
||||
|
||||
if (serviceTlv != NULL)
|
||||
|
||||
@@ -3173,8 +3173,8 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf
|
||||
|
||||
case kAttachBetter:
|
||||
VerifyOrExit(leaderData.GetPartitionId() != mLeaderData.GetPartitionId());
|
||||
VerifyOrExit(netif.GetMle().ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData,
|
||||
netif.GetMle().IsSingleton(), mLeaderData) > 0);
|
||||
VerifyOrExit(MleRouter::ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData,
|
||||
netif.GetMle().IsSingleton(), mLeaderData) > 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3187,8 +3187,8 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf
|
||||
|
||||
if (IsFullThreadDevice())
|
||||
{
|
||||
compare = netif.GetMle().ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData,
|
||||
mParentIsSingleton, mParentLeaderData);
|
||||
compare = MleRouter::ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData, mParentIsSingleton,
|
||||
mParentLeaderData);
|
||||
}
|
||||
|
||||
// only consider partitions that are the same or better
|
||||
|
||||
@@ -250,7 +250,7 @@ otError NetworkDiagnostic::AppendChildTable(Message &aMessage)
|
||||
|
||||
entry.SetReserved(0);
|
||||
entry.SetTimeout(timeout + 4);
|
||||
entry.SetChildId(netif.GetMle().GetChildId(child.GetRloc16()));
|
||||
entry.SetChildId(Mle::Mle::GetChildId(child.GetRloc16()));
|
||||
entry.SetMode(child.GetDeviceMode());
|
||||
|
||||
SuccessOrExit(error = aMessage.Append(&entry, sizeof(ChildTableEntry)));
|
||||
|
||||
Reference in New Issue
Block a user