Skip to content

Commit

Permalink
Make sure the Neighbor Table averageRSSI and LastRSSI are valid. (#23914
Browse files Browse the repository at this point in the history
)

* Make sure the Neighbor Table averageRSSI and LastRSSI are valid value per matter spec

* Thread api restrict the average RSSI  already, don't do it again in the matter code
jmartinez-silabs authored and pull[bot] committed Feb 21, 2024
1 parent bf89fc1 commit 1182003
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1152,8 +1152,24 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_WriteThreadNetw
app::DataModel::Nullable<int8_t> averageRssi;
app::DataModel::Nullable<int8_t> lastRssi;

averageRssi.SetNonNull(neighInfo.mAverageRssi);
lastRssi.SetNonNull(neighInfo.mLastRssi);
if (neighInfo.mAverageRssi == OT_RADIO_RSSI_INVALID)
{
averageRssi.SetNull();
}
else
{
// Thread average calculation already restrict mAverageRssi to be between -128 and 0
averageRssi.SetNonNull(neighInfo.mAverageRssi);
}

if (neighInfo.mAverageRssi == OT_RADIO_RSSI_INVALID)
{
lastRssi.SetNull();
}
else
{
lastRssi.SetNonNull(((neighInfo.mLastRssi > 0) ? 0 : neighInfo.mLastRssi));
}

neighborTable.averageRssi = averageRssi;
neighborTable.lastRssi = lastRssi;

0 comments on commit 1182003

Please sign in to comment.