ot::Mle::MleRouter::BecomeLeader() method
Becomes a leader and starts a new partition. If the device is already attached, this method can be used to attempt to take over as the leader, creating a new partition. For this to work, the local leader weight must be greater than the weight of the current leader. The @p aCheckWeight can be used to ensure that this check is performed.
Arguments
aCheckWeight
Check that the local leader weight is larger than the weight of the current leader.
Return value
kErrorNone Successfully become a Leader and started a new partition. kErrorInvalidState Thread is not enabled. kErrorNotCapable Device is not capable of becoming a leader (not router eligible), or @p aCheckWeight is true and cannot override the current leader due to its local leader weight being same or smaller than current leader's weight.
ot::Mle::MleRouter::BecomeLeader() calls 9 functions:
![]()
ot::Mle::MleRouter::BecomeLeader()
ot::Mle::MleRouter::BecomeLeader() reads 10 variables:
![]()
ot::Mle::MleRouter::BecomeLeader()