cli: Add parent priority set cli (#1923)

This commit is contained in:
Shu Chen
2017-06-22 09:03:26 +02:00
committed by Jonathan Hui
parent 38e4ecbbc4
commit 844482a52b
12 changed files with 222 additions and 13 deletions
+24
View File
@@ -165,6 +165,9 @@ const struct Command Interpreter::sCommands[] =
{ "networkname", &Interpreter::ProcessNetworkName },
{ "panid", &Interpreter::ProcessPanId },
{ "parent", &Interpreter::ProcessParent },
#if OPENTHREAD_FTD
{ "parentpriority", &Interpreter::ProcessParentPriority },
#endif
#ifndef OTDLL
{ "ping", &Interpreter::ProcessPing },
#endif
@@ -1552,6 +1555,27 @@ exit:
AppendResult(error);
}
#if OPENTHREAD_FTD
void Interpreter::ProcessParentPriority(int argc, char *argv[])
{
otError error = OT_ERROR_NONE;
long value;
if (argc == 0)
{
mServer->OutputFormat("%d\r\n", otThreadGetParentPriority(mInstance));
}
else
{
SuccessOrExit(error = ParseLong(argv[0], value));
error = otThreadSetParentPriority(mInstance, static_cast<int8_t>(value));
}
exit:
AppendResult(error);
}
#endif
#ifndef OTDLL
void Interpreter::s_HandleIcmpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo,
const otIcmp6Header *aIcmpHeader)