Skip to content

Commit

Permalink
[link-metrics] add Subject status check when getting link metrics data (
Browse files Browse the repository at this point in the history
openthread#9665)

This commit adds a check when returning Link Metrics data collected by
the Link Metrics manager so that only subjects in 'active' or 'renew'
state will return the data. This is to avoid showing N/A results for
neighbors that don't support being a Link Metrics Subject. Based on
current implementation, a 'Subject' object is created when the device
is trying to register a Link Metrics probing at its neighbor. If the
neighbor device doesn't support being a Subject, the device won't get
a LinkMetricsManagement response. During this period (before timeout),
the 'Subject' object is in 'kConfiguring' state. So it's unnecessary
to return any value for Subject in such states.
  • Loading branch information
Irving-cl authored Nov 30, 2023
1 parent 41ef807 commit bbc6d0b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/utils/link_metrics_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Error LinkMetricsManager::GetLinkMetricsValueByExtAddr(const Mac::ExtAddress

subject = mSubjectList.FindMatching(aExtAddress);
VerifyOrExit(subject != nullptr, error = kErrorNotFound);
VerifyOrExit(subject->mState == kActive || subject->mState == kRenewing, error = kErrorInvalidState);

aMetricsValues.mLinkMarginValue = subject->mData.mLinkMargin;
aMetricsValues.mRssiValue = subject->mData.mRssi;
Expand Down

0 comments on commit bbc6d0b

Please sign in to comment.