Public Member Functions | Protected Member Functions | Private Attributes | List of all members
PacketErrorRateEstimator Class Reference

Thread to periodically estimate packet error rate based on expected packet rate. More...

#include <packeterrorrateestimator.h>

Inheritance diagram for PacketErrorRateEstimator:
Inheritance graph
[legend]

Public Member Functions

uint8_t packetErrorRate (void) const
 Return the currently estimated packet error rate. More...
 
 PacketErrorRateEstimator ()
 Constructor. More...
 
void packetReceived (void)
 Indicate that a packet has been received. More...
 
void setExpectedPacketsPerSecond (int16_t packetsPerSecond)
 Set the expected packet reception rate in packets per second. More...
 
virtual ~PacketErrorRateEstimator ()
 Destructor. More...
 
- Public Member Functions inherited from xsens::StandardThread
XsThreadId getThreadId (void) const
 
bool isAlive (void) volatile const noexcept
 
bool isRunning (void) volatile const noexcept
 Returns whether the thread is currently running. More...
 
bool isTerminating () volatile const noexcept
 Returns whether the thread should (have) terminate(d) More...
 
bool setPriority (XsThreadPriority pri)
 Sets the priority of the thread. More...
 
virtual void signalStopThread (void)
 Tells the thread to stop but does not wait for it to end. More...
 
 StandardThread ()
 
bool startThread (const char *name=NULL)
 Starts the thread. More...
 
void stopThread (void) noexcept
 Tells the thread to stop and waits for it to end. More...
 
virtual ~StandardThread ()
 

Protected Member Functions

virtual void initFunction (void)
 Initializes the estimation parameters. More...
 
virtual int32_t innerFunction (void)
 Updates the packet error rate estimate periodically. More...
 
- Protected Member Functions inherited from xsens::StandardThread
virtual void exitFunction (void)
 Virtual exit function. More...
 
XsThread threadHandle () const
 Return the thread handle. More...
 

Private Attributes

int32_t m_expectedPacketsPerSecond
 
xsens::Mutex m_mutex
 
uint8_t m_packetErrorRate
 
int64_t m_previousUpdateTime
 
uint16_t m_receivedPacketCount
 

Additional Inherited Members

- Protected Attributes inherited from xsens::StandardThread
pthread_attr_t m_attr
 Duplicates m_stop functionality for external dependent classes such as Semaphore. More...
 
bool m_running
 Indicates that the thread is running. More...
 
volatile std::atomic_bool m_stop
 Indicates that the thread should stop. Derived classes should check isTerminating() instead of directly polling this value when checking if the thread should stop. However, there are some cases (tests, SignallingThread) where direct access from within the class is desired, which is why the vlaue is protected instead of private. More...
 
volatile std::atomic_bool m_yieldOnZeroSleep
 When true, a sleep value of 0 returned by innerFunction will trigger a thread yield operation. When false, the next cycle is started immediately. More...
 

Detailed Description

Thread to periodically estimate packet error rate based on expected packet rate.

The Packet Error Rate (PER) is estimated based on the ratio of the number of received packets compared to the number of expected packets within a time window. The estimator operates as a thread that periodically updates the PER estimate.

Definition at line 71 of file packeterrorrateestimator.h.

Constructor & Destructor Documentation

◆ PacketErrorRateEstimator()

PacketErrorRateEstimator::PacketErrorRateEstimator ( )

Constructor.

Definition at line 82 of file packeterrorrateestimator.cpp.

◆ ~PacketErrorRateEstimator()

PacketErrorRateEstimator::~PacketErrorRateEstimator ( )
virtual

Destructor.

Definition at line 91 of file packeterrorrateestimator.cpp.

Member Function Documentation

◆ initFunction()

void PacketErrorRateEstimator::initFunction ( void  )
protectedvirtual

Initializes the estimation parameters.

Reimplemented from xsens::StandardThread.

Definition at line 125 of file packeterrorrateestimator.cpp.

◆ innerFunction()

int32_t PacketErrorRateEstimator::innerFunction ( void  )
protectedvirtual

Updates the packet error rate estimate periodically.

Reimplemented from xsens::StandardThread.

Definition at line 132 of file packeterrorrateestimator.cpp.

◆ packetErrorRate()

uint8_t PacketErrorRateEstimator::packetErrorRate ( void  ) const

Return the currently estimated packet error rate.

Returns
The packet error rate as a percentage

Definition at line 118 of file packeterrorrateestimator.cpp.

◆ packetReceived()

void PacketErrorRateEstimator::packetReceived ( void  )

Indicate that a packet has been received.

Should be called for every in order packet received by the device. Reception of out of order packets, e.g. retransmissions, or late packets, should not trigger a call to this function.

Definition at line 109 of file packeterrorrateestimator.cpp.

◆ setExpectedPacketsPerSecond()

void PacketErrorRateEstimator::setExpectedPacketsPerSecond ( int16_t  packetsPerSecond)

Set the expected packet reception rate in packets per second.

Parameters
packetsPerSecondThe number of packets expected to be received per second

Definition at line 98 of file packeterrorrateestimator.cpp.

Member Data Documentation

◆ m_expectedPacketsPerSecond

int32_t PacketErrorRateEstimator::m_expectedPacketsPerSecond
private

Definition at line 87 of file packeterrorrateestimator.h.

◆ m_mutex

xsens::Mutex PacketErrorRateEstimator::m_mutex
mutableprivate

Definition at line 86 of file packeterrorrateestimator.h.

◆ m_packetErrorRate

uint8_t PacketErrorRateEstimator::m_packetErrorRate
private

Definition at line 89 of file packeterrorrateestimator.h.

◆ m_previousUpdateTime

int64_t PacketErrorRateEstimator::m_previousUpdateTime
private

Definition at line 90 of file packeterrorrateestimator.h.

◆ m_receivedPacketCount

uint16_t PacketErrorRateEstimator::m_receivedPacketCount
private

Definition at line 88 of file packeterrorrateestimator.h.


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


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:22