Add return error case NotFound to otGetChildInfo (#1321)

- The method `otGetChildInfoByIndex()` is changed to return thread
  error `NotFound` when there is no valid child with given index.
- Usage of this method is updated in `NcpBase` and `cli` to iterate
  over all children.
This commit is contained in:
Abtin Keshavarzian
2017-02-15 13:07:11 -08:00
committed by Jonathan Hui
parent f4357978c9
commit d236546304
5 changed files with 87 additions and 68 deletions
+4 -1
View File
@@ -356,6 +356,7 @@ void Interpreter::ProcessChild(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
otChildInfo childInfo;
uint8_t maxChildren;
long value;
bool isTable = false;
@@ -369,7 +370,9 @@ void Interpreter::ProcessChild(int argc, char *argv[])
sServer->OutputFormat("+-----+--------+------------+------------+--------+------+-+-+-+-+------------------+\r\n");
}
for (uint8_t i = 0; ; i++)
maxChildren = otGetMaxAllowedChildren(mInstance);
for (uint8_t i = 0; i < maxChildren ; i++)
{
if (otGetChildInfoByIndex(mInstance, i, &childInfo) != kThreadError_None)
{