RC5 Demo
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Application Class Reference

Main Application class that aggregates all other components. More...

#include <application.h>

Inheritance diagram for Application:
RC5Receiver::TelegramHandler

Public Member Functions

 Application (Logger *logger, TimerManager *timerManager, InputPin *samplePin, ExternalInterrupt *extInterrupt)
 
void init (void)
 
void deinit (void)
 
void run (void)
 
virtual void onTelegram (const RC5Telegram &telegram) override
 

Private Member Functions

void print (const RC5Telegram &telegram)
 

Private Attributes

Loggerm_logger
 Reference to Logger instance. More...
 
RC5Receiver m_receiver
 Instance of RC5Receiver component. More...
 
SynchronizedRingBuffer< RC5Telegram, 3 > m_inputQueue
 Input queue to decouple ISR context from main context. More...
 
bool m_inputOverflow
 Overflow flag indicating telgram loss in ISR context. More...
 

Detailed Description

Main Application class that aggregates all other components.

This class contains the application specific logic and handles the received RC5 telegrams by writing their content to the Logger. It has an internal buffer for a small number of telegrams. Its main purpose is to decouple the interrupt context from the main context:

Constructor & Destructor Documentation

◆ Application()

Application::Application ( Logger logger,
TimerManager timerManager,
InputPin *  samplePin,
ExternalInterrupt *  extInterrupt 
)
inline

The constructor stores the passed dependencies inside the member variables.

Parameters
[in]loggerLogger instance to use
[in]timerManagerTimerManager instance to use
[in]samplePinSamplePin instance passed to the RC5Receiver
[in]extInterruptExternalInterrupt instance passed to the RC5Receiver

Member Function Documentation

◆ deinit()

void Application::deinit ( void  )
inline

Deinitializes the application and its sub components.

◆ init()

void Application::init ( void  )
inline

Initializes the application and its sub components.

◆ onTelegram()

virtual void Application::onTelegram ( const RC5Telegram telegram)
inlineoverridevirtual

Telegram handler that stores the passed telegram inside the input queue. In case the queue is full the overflow flag is set.

Parameters
[in]telegramTelegram to handle

Implements RC5Receiver::TelegramHandler.

◆ print()

void Application::print ( const RC5Telegram telegram)
inlineprivate

Prints the content of a RC5 telegram using the logger.

Parameters
[in]telegramTelegram to print

◆ run()

void Application::run ( void  )
inline

Method to be called from main context to perform lengthy operations. Here the telegrams are dequeued from the input queue and print using the logger. Input queue overflows are also logged.

Member Data Documentation

◆ m_inputOverflow

bool Application::m_inputOverflow
private

Overflow flag indicating telgram loss in ISR context.

◆ m_inputQueue

SynchronizedRingBuffer<RC5Telegram, 3> Application::m_inputQueue
private

Input queue to decouple ISR context from main context.

◆ m_logger

Logger* Application::m_logger
private

Reference to Logger instance.

◆ m_receiver

RC5Receiver Application::m_receiver
private

Instance of RC5Receiver component.


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