mirror of
https://github.com/espressif/openthread.git
synced 2026-07-27 22:37:45 +00:00
[mle] remember current RLOC16 in a member variable (#8499)
This commit updates `Mle` to store the current RLOC16 in a member variable `mRloc16` (in addition to setting it on `Mac` as device's short address). This allows `Mle::GetRloc16()` to be defined as an inline method instead of using `Get<Mac::Mac>().GetShortAddress()`.
This commit is contained in:
@@ -97,6 +97,7 @@ Mle::Mle(Instance &aInstance)
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
, mCslTimeout(OPENTHREAD_CONFIG_CSL_TIMEOUT)
|
||||
#endif
|
||||
, mRloc16(Mac::kShortAddrInvalid)
|
||||
, mPreviousParentRloc(Mac::kShortAddrInvalid)
|
||||
#if OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
|
||||
, mParentSearch(aInstance)
|
||||
@@ -398,6 +399,7 @@ void Mle::Restore(void)
|
||||
#endif
|
||||
{
|
||||
Get<Mac::Mac>().SetShortAddress(networkInfo.GetRloc16());
|
||||
mRloc16 = networkInfo.GetRloc16();
|
||||
}
|
||||
Get<Mac::Mac>().SetExtAddress(networkInfo.GetExtAddress());
|
||||
|
||||
@@ -984,8 +986,6 @@ exit:
|
||||
Get<Notifier>().Signal(kEventThreadMeshLocalAddrChanged);
|
||||
}
|
||||
|
||||
uint16_t Mle::GetRloc16(void) const { return Get<Mac::Mac>().GetShortAddress(); }
|
||||
|
||||
void Mle::SetRloc16(uint16_t aRloc16)
|
||||
{
|
||||
uint16_t oldRloc16 = GetRloc16();
|
||||
@@ -1003,6 +1003,7 @@ void Mle::SetRloc16(uint16_t aRloc16)
|
||||
}
|
||||
|
||||
Get<Mac::Mac>().SetShortAddress(aRloc16);
|
||||
mRloc16 = aRloc16;
|
||||
|
||||
if (aRloc16 != Mac::kShortAddrInvalid)
|
||||
{
|
||||
|
||||
@@ -495,7 +495,7 @@ public:
|
||||
* @returns The RLOC16 assigned to the Thread interface.
|
||||
*
|
||||
*/
|
||||
uint16_t GetRloc16(void) const;
|
||||
uint16_t GetRloc16(void) const { return mRloc16; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the RLOC assigned to the Thread interface.
|
||||
@@ -2019,6 +2019,7 @@ private:
|
||||
uint32_t mCslTimeout;
|
||||
#endif
|
||||
|
||||
uint16_t mRloc16;
|
||||
uint16_t mPreviousParentRloc;
|
||||
|
||||
#if OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
|
||||
|
||||
Reference in New Issue
Block a user