mirror of
https://github.com/espressif/openthread.git
synced 2026-10-15 20:27:40 +00:00
Add otPlatRadioGetReceiveSensitivity() API (#1715)
* Add otPlatRadioGetReceiveSensitivity() API * Add a new otPlatRadioGetReceiveSensitivity() API to get sensitivity value; * Use the receive sensitivity value as the noise floor for link metric computation; * Remove some unused noise floor related functions. * Add SPINEL_PROP_PHY_RX_SENSITIVITY Spinel/NCP property
This commit is contained in:
@@ -814,6 +814,31 @@ void otPlatRadioSetDefaultTxPower(_In_ otInstance *otCtx, int8_t aPower)
|
||||
}
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(_In_ otInstance *otCtx)
|
||||
{
|
||||
NT_ASSERT(otCtx);
|
||||
PMS_FILTER pFilter = otCtxToFilter(otCtx);
|
||||
NTSTATUS status;
|
||||
int8_t receiveSensitivity;
|
||||
|
||||
status =
|
||||
otLwfCmdGetProp(
|
||||
pFilter,
|
||||
NULL,
|
||||
SPINEL_PROP_PHY_RX_SENSITIVITY,
|
||||
SPINEL_DATATYPE_INT8_S,
|
||||
&receiveSensitivity
|
||||
);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
LogError(DRIVER_DEFAULT, "Get SPINEL_PROP_PHY_RX_SENSITIVITY, failed, %!STATUS!", status);
|
||||
return -100; // return default value -100dBm
|
||||
}
|
||||
|
||||
return receiveSensitivity;
|
||||
}
|
||||
|
||||
inline USHORT getDstShortAddress(const UCHAR *frame)
|
||||
{
|
||||
return (((USHORT)frame[IEEE802154_DSTADDR_OFFSET + 1]) << 8) | frame[IEEE802154_DSTADDR_OFFSET];
|
||||
|
||||
Reference in New Issue
Block a user