Dataflow Runtime API  3.0.3.0
Public Member Functions | List of all members
imt::base::os::freertos::Mailbox< MessageType, MailboxSize > Class Template Reference

A Mailbox that can be used in an freertos task to receive fixed size messages. More...

#include <Imt.Base.OS.FreeRTOS/Mailbox.h>

Public Member Functions

 Mailbox (void *const pHandle, void *const pQueueInfo)
 Constructor. More...
 
virtual ~Mailbox (void)
 Destructor. More...
 
void initialize (void)
 Init the mailbox. More...
 
void deinitialize (void)
 Deletes the mailbox. More...
 
void clear (void)
 Removes all messages from the mailbox. More...
 
MessageType getMail (void)
 Gets the next message from the mailbox. More...
 
bool getMailConditional (MessageType *const pMail)
 Gets the next message from the mailbox. More...
 
void putMail (const MessageType message)
 Adds a message to the mailbox. More...
 
bool putMailConditional (const MessageType message)
 Adds a message to the mailbox. More...
 
uint32_t getWaitingMails ()
 Gets the number of mails in this mailbox. More...
 

Detailed Description

template<typename MessageType, const size_t MailboxSize>
class imt::base::os::freertos::Mailbox< MessageType, MailboxSize >

A Mailbox that can be used in an freertos task to receive fixed size messages.

See https://www.freertos.org/Embedded-RTOS-Queues.html for more informations on queues.

This template is used to create a mailbox of the required size in the context of the task.

Constructor & Destructor Documentation

◆ Mailbox()

template<typename MessageType , const size_t MailboxSize>
imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::Mailbox ( void *const  pHandle,
void *const  pQueueInfo 
)

Constructor.

Parameters
pHandleThe OS handle for the mailbox.
pQueueInfoThe internal queue structure to allocate static queues.

◆ ~Mailbox()

template<typename MessageType , const size_t MailboxSize>
imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::~Mailbox ( void  )
virtual

Destructor.

Member Function Documentation

◆ clear()

template<typename MessageType , const size_t MailboxSize>
void imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::clear ( void  )
inline

Removes all messages from the mailbox.

◆ deinitialize()

template<typename MessageType , const size_t MailboxSize>
void imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::deinitialize ( void  )
inline

Deletes the mailbox.

◆ getMail()

template<typename MessageType , const size_t MailboxSize>
MessageType imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::getMail ( void  )
inline

Gets the next message from the mailbox.

This removes the message from the mailbox. If the mailbox is empty the task will be suspended until the mailbox contains a message.

Returns
The received message.

◆ getMailConditional()

template<typename MessageType , const size_t MailboxSize>
bool imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::getMailConditional ( MessageType *const  pMail)
inline

Gets the next message from the mailbox.

This removes the message from the mailbox. If the mailbox is empty the method will return false but not suspend the task.

Parameters
pMailThe return message.
Returns
False if there is no message, true if there is one.

◆ getWaitingMails()

template<typename MessageType , const size_t MailboxSize>
uint32_t imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::getWaitingMails
inline

Gets the number of mails in this mailbox.

Returns
The number of mail

◆ initialize()

template<typename MessageType , const size_t MailboxSize>
void imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::initialize ( void  )
inline

Init the mailbox.

Must be called before using any other method.

◆ putMail()

template<typename MessageType , const size_t MailboxSize>
void imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::putMail ( const MessageType  message)
inline

Adds a message to the mailbox.

This can be used from any task. If the mailbox is full the task will be suspended until the mailbox can hold the new message. The data is copied.

Parameters
messageThe message to put into the mailbox

◆ putMailConditional()

template<typename MessageType , const size_t MailboxSize>
bool imt::base::os::freertos::Mailbox< MessageType, MailboxSize >::putMailConditional ( const MessageType  message)
inline

Adds a message to the mailbox.

This can be used from any task or interrupt handler. If the mailbox is full the mthod returns false but task will not be suspended. The data is copied.

Parameters
messageThe message to put into the mailbox.
Returns
False if there is no space left for the message, true otherwise.

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