Skip to content

Commit 27b4314

Browse files
authored
[mle] rename variables to indicate if they are a TLV (#8465)
1 parent 0337ff3 commit 27b4314

File tree

3 files changed

+84
-84
lines changed

3 files changed

+84
-84
lines changed

src/core/thread/mle.cpp

+35-35
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ void Mle::SendAnnounce(uint8_t aChannel, AnnounceMode aMode)
21682168
void Mle::SendAnnounce(uint8_t aChannel, const Ip6::Address &aDestination, AnnounceMode aMode)
21692169
{
21702170
Error error = kErrorNone;
2171-
ChannelTlv channel;
2171+
ChannelTlv channelTlv;
21722172
MeshCoP::Timestamp activeTimestamp;
21732173
TxMessage * message = nullptr;
21742174

@@ -2177,10 +2177,10 @@ void Mle::SendAnnounce(uint8_t aChannel, const Ip6::Address &aDestination, Annou
21772177
message->SetLinkSecurityEnabled(true);
21782178
message->SetChannel(aChannel);
21792179

2180-
channel.Init();
2181-
channel.SetChannelPage(0);
2182-
channel.SetChannel(Get<Mac::Mac>().GetPanChannel());
2183-
SuccessOrExit(error = channel.AppendTo(*message));
2180+
channelTlv.Init();
2181+
channelTlv.SetChannelPage(0);
2182+
channelTlv.SetChannel(Get<Mac::Mac>().GetPanChannel());
2183+
SuccessOrExit(error = channelTlv.AppendTo(*message));
21842184

21852185
switch (aMode)
21862186
{
@@ -3077,13 +3077,13 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
30773077
uint8_t linkMarginFromTlv;
30783078
uint8_t linkMargin;
30793079
LinkQuality linkQuality;
3080-
ConnectivityTlv connectivity;
3080+
ConnectivityTlv connectivityTlv;
30813081
uint32_t linkFrameCounter;
30823082
uint32_t mleFrameCounter;
30833083
Mac::ExtAddress extAddress;
30843084
Mac::CslAccuracy cslAccuracy;
30853085
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
3086-
TimeParameterTlv timeParameter;
3086+
TimeParameterTlv timeParameterTlv;
30873087
#endif
30883088

30893089
// Source Address
@@ -3122,8 +3122,8 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
31223122
linkQuality = LinkQualityForLinkMargin(linkMargin);
31233123

31243124
// Connectivity
3125-
SuccessOrExit(error = Tlv::FindTlv(aRxInfo.mMessage, connectivity));
3126-
VerifyOrExit(connectivity.IsValid(), error = kErrorParse);
3125+
SuccessOrExit(error = Tlv::FindTlv(aRxInfo.mMessage, connectivityTlv));
3126+
VerifyOrExit(connectivityTlv.IsValid(), error = kErrorParse);
31273127

31283128
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
31293129
// CSL Accuracy
@@ -3149,10 +3149,10 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
31493149
parentinfo.mExtAddr = extAddress;
31503150
parentinfo.mRloc16 = sourceAddress;
31513151
parentinfo.mRssi = linkInfo->GetRss();
3152-
parentinfo.mPriority = connectivity.GetParentPriority();
3153-
parentinfo.mLinkQuality3 = connectivity.GetLinkQuality3();
3154-
parentinfo.mLinkQuality2 = connectivity.GetLinkQuality2();
3155-
parentinfo.mLinkQuality1 = connectivity.GetLinkQuality1();
3152+
parentinfo.mPriority = connectivityTlv.GetParentPriority();
3153+
parentinfo.mLinkQuality3 = connectivityTlv.GetLinkQuality3();
3154+
parentinfo.mLinkQuality2 = connectivityTlv.GetLinkQuality2();
3155+
parentinfo.mLinkQuality1 = connectivityTlv.GetLinkQuality1();
31563156
parentinfo.mIsAttached = IsAttached();
31573157

31583158
mParentResponseCb(&parentinfo, mParentResponseCbContext);
@@ -3164,9 +3164,9 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
31643164
if (IsFullThreadDevice() && !IsDetached())
31653165
{
31663166
bool isPartitionIdSame = (leaderData.GetPartitionId() == mLeaderData.GetPartitionId());
3167-
bool isIdSequenceSame = (connectivity.GetIdSequence() == Get<RouterTable>().GetRouterIdSequence());
3167+
bool isIdSequenceSame = (connectivityTlv.GetIdSequence() == Get<RouterTable>().GetRouterIdSequence());
31683168
bool isIdSequenceGreater =
3169-
SerialNumber::IsGreater(connectivity.GetIdSequence(), Get<RouterTable>().GetRouterIdSequence());
3169+
SerialNumber::IsGreater(connectivityTlv.GetIdSequence(), Get<RouterTable>().GetRouterIdSequence());
31703170

31713171
switch (mAttachMode)
31723172
{
@@ -3187,7 +3187,7 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
31873187
case kBetterPartition:
31883188
VerifyOrExit(!isPartitionIdSame);
31893189

3190-
VerifyOrExit(MleRouter::ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData,
3190+
VerifyOrExit(MleRouter::ComparePartitions(connectivityTlv.GetActiveRouters() <= 1, leaderData,
31913191
Get<MleRouter>().IsSingleton(), mLeaderData) > 0);
31923192
break;
31933193
}
@@ -3206,7 +3206,7 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
32063206
#if OPENTHREAD_FTD
32073207
if (IsFullThreadDevice())
32083208
{
3209-
compare = MleRouter::ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData,
3209+
compare = MleRouter::ComparePartitions(connectivityTlv.GetActiveRouters() <= 1, leaderData,
32103210
mParentCandidate.mIsSingleton, mParentCandidate.mLeaderData);
32113211
}
32123212

@@ -3217,7 +3217,7 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
32173217
// only consider better parents if the partitions are the same
32183218
if (compare == 0)
32193219
{
3220-
VerifyOrExit(IsBetterParent(sourceAddress, linkQuality, linkMargin, connectivity, version, cslAccuracy));
3220+
VerifyOrExit(IsBetterParent(sourceAddress, linkQuality, linkMargin, connectivityTlv, version, cslAccuracy));
32213221
}
32223222
}
32233223

@@ -3227,12 +3227,12 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
32273227
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
32283228

32293229
// Time Parameter
3230-
if (Tlv::FindTlv(aRxInfo.mMessage, timeParameter) == kErrorNone)
3230+
if (Tlv::FindTlv(aRxInfo.mMessage, timeParameterTlv) == kErrorNone)
32313231
{
3232-
VerifyOrExit(timeParameter.IsValid());
3232+
VerifyOrExit(timeParameterTlv.IsValid());
32333233

3234-
Get<TimeSync>().SetTimeSyncPeriod(timeParameter.GetTimeSyncPeriod());
3235-
Get<TimeSync>().SetXtalThreshold(timeParameter.GetXtalThreshold());
3234+
Get<TimeSync>().SetTimeSyncPeriod(timeParameterTlv.GetTimeSyncPeriod());
3235+
Get<TimeSync>().SetXtalThreshold(timeParameterTlv.GetXtalThreshold());
32363236
}
32373237

32383238
#if OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED
@@ -3262,19 +3262,19 @@ void Mle::HandleParentResponse(RxInfo &aRxInfo)
32623262
mParentCandidate.SetLinkQualityOut(LinkQualityForLinkMargin(linkMarginFromTlv));
32633263
mParentCandidate.SetState(Neighbor::kStateParentResponse);
32643264
mParentCandidate.SetKeySequence(aRxInfo.mKeySequence);
3265-
mParentCandidate.SetLeaderCost(connectivity.GetLeaderCost());
3265+
mParentCandidate.SetLeaderCost(connectivityTlv.GetLeaderCost());
32663266
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
32673267
mParentCandidate.SetCslAccuracy(cslAccuracy);
32683268
#endif
32693269

3270-
mParentCandidate.mPriority = connectivity.GetParentPriority();
3271-
mParentCandidate.mLinkQuality3 = connectivity.GetLinkQuality3();
3272-
mParentCandidate.mLinkQuality2 = connectivity.GetLinkQuality2();
3273-
mParentCandidate.mLinkQuality1 = connectivity.GetLinkQuality1();
3274-
mParentCandidate.mSedBufferSize = connectivity.GetSedBufferSize();
3275-
mParentCandidate.mSedDatagramCount = connectivity.GetSedDatagramCount();
3270+
mParentCandidate.mPriority = connectivityTlv.GetParentPriority();
3271+
mParentCandidate.mLinkQuality3 = connectivityTlv.GetLinkQuality3();
3272+
mParentCandidate.mLinkQuality2 = connectivityTlv.GetLinkQuality2();
3273+
mParentCandidate.mLinkQuality1 = connectivityTlv.GetLinkQuality1();
3274+
mParentCandidate.mSedBufferSize = connectivityTlv.GetSedBufferSize();
3275+
mParentCandidate.mSedDatagramCount = connectivityTlv.GetSedDatagramCount();
32763276
mParentCandidate.mLeaderData = leaderData;
3277-
mParentCandidate.mIsSingleton = connectivity.GetActiveRouters() <= 1;
3277+
mParentCandidate.mIsSingleton = connectivityTlv.GetActiveRouters() <= 1;
32783278
mParentCandidate.mLinkMargin = linkMargin;
32793279

32803280
exit:
@@ -4812,13 +4812,13 @@ Error Mle::TxMessage::AppendCslTimeoutTlv(void)
48124812
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
48134813
Error Mle::TxMessage::AppendCslClockAccuracyTlv(void)
48144814
{
4815-
CslClockAccuracyTlv cslClockAccuracy;
4815+
CslClockAccuracyTlv cslClockAccuracyTlv;
48164816

4817-
cslClockAccuracy.Init();
4818-
cslClockAccuracy.SetCslClockAccuracy(Get<Radio>().GetCslAccuracy());
4819-
cslClockAccuracy.SetCslUncertainty(Get<Radio>().GetCslUncertainty());
4817+
cslClockAccuracyTlv.Init();
4818+
cslClockAccuracyTlv.SetCslClockAccuracy(Get<Radio>().GetCslAccuracy());
4819+
cslClockAccuracyTlv.SetCslUncertainty(Get<Radio>().GetCslUncertainty());
48204820

4821-
return Append(cslClockAccuracy);
4821+
return Append(cslClockAccuracyTlv);
48224822
}
48234823
#endif
48244824

0 commit comments

Comments
 (0)