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
+11
View File
@@ -1746,6 +1746,10 @@ OTAPI void OTCALL otSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRou
* @param[in] aChildId The Child ID or RLOC16 for the attached child.
* @param[out] aChildInfo A pointer to where the child information is placed.
*
* @retavl kThreadError_None @p aChildInfo was successfully updated with the info for the given ID.
* @retval kThreadError_NotFound No valid child with this Child ID.
* @retavl kThreadError_InvalidArgs If @p aChildInfo is NULL.
*
*/
OTAPI ThreadError OTCALL otGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo);
@@ -1756,6 +1760,13 @@ OTAPI ThreadError OTCALL otGetChildInfoById(otInstance *aInstance, uint16_t aChi
* @param[in] aChildIndex The table index.
* @param[out] aChildInfo A pointer to where the child information is placed.
*
* @retavl kThreadError_None @p aChildInfo was successfully updated with the info for the given index.
* @retval kThreadError_NotFound No valid child at this index.
* @retavl kThreadError_InvalidArgs Either @p aChildInfo is NULL, or @p aChildIndex is out of range (higher
* than max table index).
*
* @sa otGetMaxAllowedChildren
*
*/
OTAPI ThreadError OTCALL otGetChildInfoByIndex(otInstance *aInstance, uint8_t aChildIndex, otChildInfo *aChildInfo);