[child-info] add mIsStateRestoring to otChildInfo and filter restoring child in NcpBase (#2355)

This commit adds a new field `mIsStateRestoring` to `otChildInfo`
struct to inform the if the child is being restored. This field is
used in `NcpBase` to filter child entries in restoring state.
This commit is contained in:
Abtin Keshavarzian
2017-11-18 14:26:36 +00:00
committed by Jonathan Hui
parent aa3a72796a
commit ab648c6c55
3 changed files with 6 additions and 1 deletions
+1
View File
@@ -963,6 +963,7 @@ typedef struct
bool mSecureDataRequest : 1; ///< Secure Data Requests
bool mFullFunction : 1; ///< Full Function Device
bool mFullNetworkData : 1; ///< Full Network Data
bool mIsStateRestoring : 1; ///< Is in restoring state
uint8_t mIp6AddressesLength; ///< Number of entries in IPv6 address array.
const otIp6Address *mIp6Addresses; ///< Array of IPv6 addresses (unused entries contain unspecified address).
} otChildInfo;
+1
View File
@@ -3766,6 +3766,7 @@ otError MleRouter::GetChildInfo(Child &aChild, otChildInfo &aChildInfo)
aChildInfo.mSecureDataRequest = aChild.IsSecureDataRequest();
aChildInfo.mFullFunction = aChild.IsFullThreadDevice();
aChildInfo.mFullNetworkData = aChild.IsFullNetworkData();
aChildInfo.mIsStateRestoring = aChild.IsStateRestoring();
aChildInfo.mIp6AddressesLength = Child::kMaxIp6AddressPerChild;
aChildInfo.mIp6Addresses = aChild.GetIp6Addresses();
+4 -1
View File
@@ -100,6 +100,8 @@ void NcpBase::HandleChildTableChanged(otThreadChildTableEvent aEvent, const otCh
VerifyOrExit(!mChangedPropsSet.IsPropertyFiltered(SPINEL_PROP_THREAD_CHILD_TABLE));
VerifyOrExit(!aChildInfo.mIsStateRestoring);
switch (aEvent)
{
case OT_THREAD_CHILD_TABLE_EVENT_CHILD_ADDED:
@@ -159,7 +161,8 @@ otError NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE(void)
for (uint8_t index = 0; index < maxChildren; index++)
{
if (otThreadGetChildInfoByIndex(mInstance, index, &childInfo) != OT_ERROR_NONE)
if ((otThreadGetChildInfoByIndex(mInstance, index, &childInfo) != OT_ERROR_NONE) ||
childInfo.mIsStateRestoring)
{
continue;
}