mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 13:20:25 +00:00
Fix CLI implementation of the child command (#1626)
* CLI fix for printing child list In the previous implementation, if a child was not available at a certain index, all children at greater indexes would not be printed for a child list or child table command, despite still being connected to the node. This change modifies the logic so that if a child does not exist at a given index, only that index is disgarded, and future indexes are checked correctly. * Made pretty * Add ExitNow statement at end of table printing. This prevents printing an error at the end of the table.
This commit is contained in:
committed by
Jonathan Hui
parent
dac96c2c22
commit
0c5850e7ba
+11
-1
@@ -486,8 +486,16 @@ void Interpreter::ProcessChild(int argc, char *argv[])
|
||||
|
||||
for (uint8_t i = 0; i < maxChildren ; i++)
|
||||
{
|
||||
if (otThreadGetChildInfoByIndex(mInstance, i, &childInfo) != kThreadError_None)
|
||||
|
||||
switch (otThreadGetChildInfoByIndex(mInstance, i, &childInfo))
|
||||
{
|
||||
case kThreadError_None:
|
||||
break;
|
||||
|
||||
case kThreadError_NotFound:
|
||||
continue;
|
||||
|
||||
default:
|
||||
sServer->OutputFormat("\r\n");
|
||||
ExitNow();
|
||||
}
|
||||
@@ -521,6 +529,8 @@ void Interpreter::ProcessChild(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
SuccessOrExit(error = ParseLong(argv[0], value));
|
||||
|
||||
Reference in New Issue
Block a user