[posix-app] get real rssi from NCP (#3051)

This commit is contained in:
Yakun Xu
2018-09-10 18:03:42 -10:00
committed by Jonathan Hui
parent 50d0de5792
commit 26fab7399d
2 changed files with 17 additions and 1 deletions
+10 -1
View File
@@ -918,6 +918,15 @@ otError RadioSpinel::GetTransmitPower(int8_t &aPower)
return error;
}
int8_t RadioSpinel::GetRssi(void)
{
int8_t rssi = OT_RADIO_RSSI_INVALID;
otError error = Get(SPINEL_PROP_PHY_RSSI, SPINEL_DATATYPE_INT8_S, &rssi);
LogIfFail(mInstance, "Get RSSI failed", error);
return rssi;
}
otError RadioSpinel::SetTransmitPower(int8_t aPower)
{
otError error = Set(SPINEL_PROP_PHY_TX_POWER, SPINEL_DATATYPE_INT8_S, aPower);
@@ -1532,7 +1541,7 @@ otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return 0;
return sRadioSpinel.GetRssi();
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
+7
View File
@@ -168,6 +168,13 @@ public:
*/
otRadioCaps GetRadioCaps(void) const { return mRadioCaps; }
/**
* This method gets the most recent RSSI measurement.
*
* @returns The RSSI in dBm when it is valid. 127 when RSSI is invalid.
*/
int8_t GetRssi(void);
/**
* This method returns the radio receive sensitivity value.
*