diff --git a/src/posix/platform/radio_spinel.cpp b/src/posix/platform/radio_spinel.cpp index 4428864af..59dc0d223 100644 --- a/src/posix/platform/radio_spinel.cpp +++ b/src/posix/platform/radio_spinel.cpp @@ -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) diff --git a/src/posix/platform/radio_spinel.hpp b/src/posix/platform/radio_spinel.hpp index e5e3a95a5..1832ba2e4 100644 --- a/src/posix/platform/radio_spinel.hpp +++ b/src/posix/platform/radio_spinel.hpp @@ -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. *