This class implements a Received Signal Strength (RSS) averager.
More...
#include <src/core/thread/link_quality.hpp>
|
void | Reset (void) |
| This method reset the averager and clears the average value.
|
|
bool | HasAverage (void) const |
| This method indicates whether the averager contains an average (i.e., at least one RSS value has been added). More...
|
|
otError | Add (int8_t aRss) |
| This method adds a received signal strength (RSS) value to the average. More...
|
|
int8_t | GetAverage (void) const |
| This method returns the current average signal strength value maintained by the averager. More...
|
|
uint16_t | GetRaw (void) const |
| This method returns an raw/encoded version of current average signal strength value. More...
|
|
const char * | ToString (char *aBuf, uint16_t aSize) const |
| This method converts the current average RSS value to a human-readable string (e.g., "-80.375"). More...
|
|
This class implements a Received Signal Strength (RSS) averager.
The average is maintained using an adaptive exponentially weighted moving filter.
§ anonymous enum
Enumerator |
---|
kStringSize | Max chars needed for a string representation of average (.
- See also
- ToString()).
|
§ Add()
otError ot::RssAverager::Add |
( |
int8_t |
aRss | ) |
|
This method adds a received signal strength (RSS) value to the average.
If aRss
is OT_RADIO_RSSI_INVALID, it is ignored and error status OT_ERROR_INVALID_ARGS is returned. The value of RSS is capped at 0dBm (i.e., for any given RSS value higher than 0dBm, 0dBm is used instead).
- Parameters
-
[in] | aRss | Received signal strength value (in dBm) to be added to the average. |
- Return values
-
OT_ERROR_NONE | New RSS value added to average successfully. |
OT_ERROR_INVALID_ARGS | Value of aRss is OT_RADIO_RSSI_INVALID. |
§ GetAverage()
int8_t ot::RssAverager::GetAverage |
( |
void |
| ) |
const |
This method returns the current average signal strength value maintained by the averager.
- Returns
- The current average value (in dBm) or OT_RADIO_RSSI_INVALID if no average is available.
§ GetRaw()
uint16_t ot::RssAverager::GetRaw |
( |
void |
| ) |
const |
|
inline |
This method returns an raw/encoded version of current average signal strength value.
The raw value is the average multiplied by a precision factor (currently set as -8).
- Returns
- The current average multiplied by precision factor or zero if no average is available.
§ HasAverage()
bool ot::RssAverager::HasAverage |
( |
void |
| ) |
const |
|
inline |
This method indicates whether the averager contains an average (i.e., at least one RSS value has been added).
- Return values
-
true | If the average value is available (at least one RSS value has been added). |
false | Averager is empty (no RSS value added yet). |
§ ToString()
const char * ot::RssAverager::ToString |
( |
char * |
aBuf, |
|
|
uint16_t |
aSize |
|
) |
| const |
This method converts the current average RSS value to a human-readable string (e.g., "-80.375").
If the average is unknown, empty string is returned.
- Parameters
-
[out] | aBuf | A pointer to the char buffer. |
[in] | aSize | The maximum size of the buffer. |
- Returns
- A pointer to the char string buffer.
The documentation for this class was generated from the following files: