mirror of
https://github.com/espressif/openthread.git
synced 2026-08-29 21:39:54 +00:00
[mle] refactor MleRouter and Mle classes into a single Mle class (#11411)
This commit refactors the `Mle` modules and combines the `MleRouter` and `Mle` classes into a single `Mle` class which now handles both FTD and MTD functionalities. The `MleRouter` and `Mle` classes were originally intended as sub-classes, where the base class `Mle` would provide MTD and common behaviors, and `MleRouter` would implement FTD-specific behaviors. However, over the years and as new features were implemented, these two classes became more intertwined, and the `Mle` class began to include many FTD-related functions and interactions with `MleRouter` private variables and methods. This commit simplifies the code by combining the two into a single class. The previous `mle_router.cpp` file is also renamed to `mle_ftd.cpp` to indicate that it implements FTD-specific MLE behaviors.
This commit is contained in:
@@ -40,7 +40,7 @@ void Node::Form(void)
|
||||
Get<MeshCoP::ActiveDatasetManager>().SaveLocal(datasetInfo);
|
||||
|
||||
Get<ThreadNetif>().Up();
|
||||
SuccessOrQuit(Get<Mle::MleRouter>().Start());
|
||||
SuccessOrQuit(Get<Mle::Mle>().Start());
|
||||
}
|
||||
|
||||
void Node::Join(Node &aNode, JoinMode aJoinMode)
|
||||
@@ -51,7 +51,7 @@ void Node::Join(Node &aNode, JoinMode aJoinMode)
|
||||
switch (aJoinMode)
|
||||
{
|
||||
case kAsFed:
|
||||
SuccessOrQuit(Get<Mle::MleRouter>().SetRouterEligible(false));
|
||||
SuccessOrQuit(Get<Mle::Mle>().SetRouterEligible(false));
|
||||
OT_FALL_THROUGH;
|
||||
|
||||
case kAsFtd:
|
||||
@@ -72,7 +72,7 @@ void Node::Join(Node &aNode, JoinMode aJoinMode)
|
||||
Get<MeshCoP::ActiveDatasetManager>().SaveLocal(dataset);
|
||||
|
||||
Get<ThreadNetif>().Up();
|
||||
SuccessOrQuit(Get<Mle::MleRouter>().Start());
|
||||
SuccessOrQuit(Get<Mle::Mle>().Start());
|
||||
}
|
||||
|
||||
void Node::AllowList(Node &aNode)
|
||||
|
||||
Reference in New Issue
Block a user