mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 13:20:25 +00:00
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:
committed by
Jonathan Hui
parent
f4357978c9
commit
d236546304
+4
-1
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user