mirror of
https://github.com/espressif/openthread.git
synced 2026-07-09 13:50:28 +00:00
Do not allow a device to become a leader when the router role is disabled. (#439)
This commit is contained in:
@@ -87,6 +87,7 @@ const struct Command Interpreter::sCommands[] =
|
||||
{ "rloc16", &ProcessRloc16 },
|
||||
{ "route", &ProcessRoute },
|
||||
{ "router", &ProcessRouter },
|
||||
{ "routerrole", &ProcessRouterRole },
|
||||
{ "routerupgradethreshold", &ProcessRouterUpgradeThreshold },
|
||||
{ "scan", &ProcessScan },
|
||||
{ "singleton", &ProcessSingleton },
|
||||
@@ -1479,6 +1480,38 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
void Interpreter::ProcessRouterRole(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
if (otIsRouterRoleEnabled())
|
||||
{
|
||||
sServer->OutputFormat("Enabled\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
sServer->OutputFormat("Disabled\r\n");
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[0], "enable") == 0)
|
||||
{
|
||||
otSetRouterRoleEnabled(true);
|
||||
}
|
||||
else if (strcmp(argv[0], "disable") == 0)
|
||||
{
|
||||
otSetRouterRoleEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExitNow(error = kThreadError_Parse);
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
void Interpreter::ProcessRouterUpgradeThreshold(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
Reference in New Issue
Block a user