Parent last rssi (#1558)

* Added thread api call to get the last rssi for the parent
This commit is contained in:
Adam Eliot
2017-04-05 19:21:33 -07:00
committed by Jonathan Hui
parent 90eaada3d4
commit 94fab38d4a
2 changed files with 29 additions and 1 deletions
+13 -1
View File
@@ -834,11 +834,23 @@ OTAPI ThreadError OTCALL otThreadGetParentInfo(otInstance *aInstance, otRouterIn
* The function retrieves the average RSSI for the Thread Parent.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aParentInfo A pointer to where the parent rssi should be placed.
* @param[out] aParentRssi A pointer to where the parent rssi should be placed.
*
*/
OTAPI ThreadError OTCALL otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi);
/**
* The function retrieves the RSSI of the last packet from the Thread Parent.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aLastRssi A pointer to where the last rssi should be placed.
*
* @retval kThreadError_None Successfully retrieved the RSSI data.
* @retval kThreadError_Failed Unable to get RSSI data.
* @retval kThreadError_InvalidArgs @p aLastRssi is NULL.
*/
OTAPI ThreadError OTCALL otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi);
/**
* This function pointer is called when Network Diagnostic Get response is received.
*
+16
View File
@@ -511,6 +511,22 @@ exit:
return error;
}
ThreadError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi)
{
ThreadError error = kThreadError_None;
Router *parent;
VerifyOrExit(aLastRssi != NULL, error = kThreadError_InvalidArgs);
parent = aInstance->mThreadNetif.GetMle().GetParent();
*aLastRssi = parent->mLinkInfo.GetLastRss();
VerifyOrExit(*aLastRssi != LinkQualityInfo::kUnknownRss, error = kThreadError_Failed);
exit:
return error;
}
const char *otGetVersionString(void)
{
/**