mirror of
https://github.com/espressif/openthread.git
synced 2026-09-24 18:07:36 +00:00
Don't return parent info if the device is not a child (#1868)
* Fix the issue that the previous parent information could be retrieved even after the device is not a child * Print more parent information in CLI
This commit is contained in:
@@ -1534,6 +1534,9 @@ void Interpreter::ProcessParent(int argc, char *argv[])
|
||||
mServer->OutputFormat("\r\n");
|
||||
|
||||
mServer->OutputFormat("Rloc: %x\r\n", parentInfo.mRloc16);
|
||||
mServer->OutputFormat("Link Quality In: %d\r\n", parentInfo.mLinkQualityIn);
|
||||
mServer->OutputFormat("Link Quality Out: %d\r\n", parentInfo.mLinkQualityOut);
|
||||
mServer->OutputFormat("Age: %d\r\n", parentInfo.mAge);
|
||||
|
||||
exit:
|
||||
(void)argc;
|
||||
|
||||
@@ -304,6 +304,9 @@ otError otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
|
||||
otError error = OT_ERROR_NONE;
|
||||
Router *parent;
|
||||
|
||||
VerifyOrExit(aInstance->mThreadNetif.GetMle().GetRole() == OT_DEVICE_ROLE_CHILD,
|
||||
error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
VerifyOrExit(aParentInfo != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
parent = aInstance->mThreadNetif.GetMle().GetParent();
|
||||
|
||||
Reference in New Issue
Block a user