0.01.00
ot::LinkQualityInfo Class Reference

This class encapsulates/stores all relevant information about quality of a link, including average received signal strength (RSS), last RSS, link margin, and link quality. More...

#include <src/core/thread/link_quality.hpp>

Public Types

enum  { kInfoStringSize = 50 }
 

Public Member Functions

 LinkQualityInfo (void)
 This constructor initializes the object.
 
void Clear (void)
 This method clears the all the data in the object.
 
void AddRss (int8_t aNoiseFloor, int8_t aRss)
 This method adds a new received signal strength (RSS) value to the average. More...
 
int8_t GetAverageRss (void) const
 This method returns the current average signal strength value. More...
 
uint16_t GetAverageRssRaw (void) const
 This method returns an encoded version of current average signal strength value. More...
 
const char * ToInfoString (char *aBuf, uint16_t aSize) const
 This method converts the link quality info to NULL-terminated info/debug human-readable string. More...
 
uint8_t GetLinkMargin (int8_t aNoiseFloor) const
 This method returns the link margin. More...
 
uint8_t GetLinkQuality (void) const
 Returns the current one-way link quality value. More...
 
int8_t GetLastRss (void) const
 Returns the most recent RSS value. More...
 

Static Public Member Functions

static uint8_t ConvertRssToLinkMargin (int8_t aNoiseFloor, int8_t aRss)
 This method converts a received signal strength value to a link margin value. More...
 
static uint8_t ConvertLinkMarginToLinkQuality (uint8_t aLinkMargin)
 This method converts a link margin value to a link quality value. More...
 
static uint8_t ConvertRssToLinkQuality (int8_t aNoiseFloor, int8_t aRss)
 This method converts a received signal strength value to a link quality value. More...
 
static int8_t ConvertLinkQualityToRss (int8_t aNoiseFloor, uint8_t aLinkQuality)
 This method converts a link quality value to a typical received signal strength value . More...
 

Detailed Description

This class encapsulates/stores all relevant information about quality of a link, including average received signal strength (RSS), last RSS, link margin, and link quality.

Member Enumeration Documentation

§ anonymous enum

anonymous enum
Enumerator
kInfoStringSize 

Max chars needed for the info string representation (.

See also
ToInfoString())

Member Function Documentation

§ AddRss()

void ot::LinkQualityInfo::AddRss ( int8_t  aNoiseFloor,
int8_t  aRss 
)

This method adds a new received signal strength (RSS) value to the average.

Parameters
[in]aNoiseFloorThe noise floor value (in dBm).
[in]aRssA new received signal strength value (in dBm) to be added to the average.

§ ConvertLinkMarginToLinkQuality()

uint8_t ot::LinkQualityInfo::ConvertLinkMarginToLinkQuality ( uint8_t  aLinkMargin)
static

This method converts a link margin value to a link quality value.

Parameters
[in]aLinkMarginThe Link Margin in dB.
Returns
The link quality value (0-3).

§ ConvertLinkQualityToRss()

int8_t ot::LinkQualityInfo::ConvertLinkQualityToRss ( int8_t  aNoiseFloor,
uint8_t  aLinkQuality 
)
static

This method converts a link quality value to a typical received signal strength value .

Note
only for test
Parameters
[in]aNoiseFloorThe noise floor value (in dBm).
[in]aLinkQualityThe link quality value in [0, 3].
Returns
The typical platform rssi.

§ ConvertRssToLinkMargin()

uint8_t ot::LinkQualityInfo::ConvertRssToLinkMargin ( int8_t  aNoiseFloor,
int8_t  aRss 
)
static

This method converts a received signal strength value to a link margin value.

Parameters
[in]aNoiseFloorThe noise floor value (in dBm).
[in]aRssThe received signal strength value (in dBm).
Returns
The link margin value.

§ ConvertRssToLinkQuality()

uint8_t ot::LinkQualityInfo::ConvertRssToLinkQuality ( int8_t  aNoiseFloor,
int8_t  aRss 
)
static

This method converts a received signal strength value to a link quality value.

Parameters
[in]aNoiseFloorThe noise floor value (in dBm).
[in]aRssThe received signal strength value (in dBm).
Returns
The link quality value (0-3).

§ GetAverageRss()

int8_t ot::LinkQualityInfo::GetAverageRss ( void  ) const
inline

This method returns the current average signal strength value.

Returns
The current average value or OT_RADIO_RSSI_INVALID if no average is available.

§ GetAverageRssRaw()

uint16_t ot::LinkQualityInfo::GetAverageRssRaw ( void  ) const
inline

This method returns an encoded version of current average signal strength value.

The encoded value is the average multiplied by a precision factor (currently -8).

Returns
The current average multiplied by precision factor or zero if no average is available.

§ GetLastRss()

int8_t ot::LinkQualityInfo::GetLastRss ( void  ) const
inline

Returns the most recent RSS value.

Returns
The most recent RSS

§ GetLinkMargin()

uint8_t ot::LinkQualityInfo::GetLinkMargin ( int8_t  aNoiseFloor) const
inline

This method returns the link margin.

The link margin is calculated using the link's current average received signal strength (RSS) and average noise floor.

Parameters
[in]aNoiseFloorThe noise floor value (in dBm).
Returns
Link margin derived from average received signal strength and average noise floor.

§ GetLinkQuality()

uint8_t ot::LinkQualityInfo::GetLinkQuality ( void  ) const
inline

Returns the current one-way link quality value.

The link quality value is a number 0-3.

The link quality is calculated by comparing the current link margin with a set of thresholds (per Thread spec). More specifically, link margin > 20 dB gives link quality 3, link margin > 10 dB gives link quality 2, link margin > 2 dB gives link quality 1, and link margin below or equal to 2 dB yields link quality of 0.

In order to ensure that a link margin near the boundary of two different link quality values does not cause frequent changes, a hysteresis of 2 dB is applied when determining the link quality. For example, the average link margin must be at least 12 dB to change a quality 1 link to a quality 2 link.

Parameters
[in]aNoiseFloorThe noise floor value (in dBm).
Returns
The current link quality value (value 0-3 as per Thread specification).

§ ToInfoString()

const char * ot::LinkQualityInfo::ToInfoString ( char *  aBuf,
uint16_t  aSize 
) const

This method converts the link quality info to NULL-terminated info/debug human-readable string.

Parameters
[out]aBufA pointer to the string buffer.
[in]aSizeThe maximum size of the string buffer.
Returns
A pointer to the char string buffer.

The documentation for this class was generated from the following files: