37#ifndef MESSAGEBUFFER_CPP_H
38#define MESSAGEBUFFER_CPP_H
42#include "message_buffer.h"
44#if FREERTOSCPP_USE_NAMESPACE
59 size_t send(
const void* data,
size_t len, TickType_t delay = portMAX_DELAY)
60 {
return xMessageBufferSend(msgHandle, data, len, delay);}
61#if FREERTOSCPP_USE_CHRONO
62 size_t send(
const void* data,
size_t len, Time_ms delay)
63 {
return xMessageBufferSend(msgHandle, data, len, ms2ticks(delay));}
65 size_t send_ISR(
const void* data,
size_t len, BaseType_t &wasWoken)
66 {
return xMessageBufferSendFromISR(msgHandle, data, len, &wasWoken);}
68 size_t read(
void* data,
size_t len, TickType_t delay = portMAX_DELAY)
69 {
return xMessageBufferReceive(msgHandle, data, len, delay);}
70#if FREERTOSCPP_USE_CHRONO
71 size_t read(
void* data,
size_t len, Time_ms delay)
72 {
return xMessageBufferReceive(msgHandle, data, len, ms2ticks(delay));}
74 size_t read_ISR(
void* data,
size_t len, BaseType_t &wasWoken)
75 {
return xMessageBufferReceiveFromISR(msgHandle, data, len, &wasWoken);}
81 size_t available()
const {
return xMessageBufferSpacesAvailable(msgHandle);}
83 bool isEmpty()
const {
return xMessageBufferIsEmpty(msgHandle);}
85 bool isFull()
const {
return xMessageBufferIsFull(msgHandle);}
89 bool reset() {
return xMessageBufferReset(msgHandle);}
103#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
111#if( configSUPPORT_STATIC_ALLOCATION == 1 )
112 xMessageBufferCreateStatic(size, storage, msgBuff)
114 xMessageBufferCreate(size)
120#if configUSE_SB_COMPLETED_CALLBACK
121 MessageBuffer(StreamBufferCallbackFunction_t sendCallback, StreamBufferCallbackFunction_t recvCallback) :
123#if( configSUPPORT_STATIC_ALLOCATION == 1 )
124 xMessageBufferCreateStaticWithCallback(size, storage, msgBuff, sendCallback, recvCallback)
126 xMessageBufferCreateWithCallback(size, sendCallback. recvCallBack)
132#if( configSUPPORT_STATIC_ALLOCATION == 1 )
133 uint8_t storage[size+1];
134 StaticMessageBuffer_t msgBuff;
138#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
148#if configUSE_SB_COMPLETED_CALLBACK
149 MessageBuffer(
size_t size, StreamBufferCallbackFunction_t sendCallback, StreamBufferCallbackFunction_t recvCallback) :
150 MessageBufferBase(xMessageBufferCreateWithCallback(size, sendCallback, recvCallback))
156#if FREERTOSCPP_USE_NAMESPACE
Base Wrapper Class for MessageBuffer.
Definition MessageBufferCPP.h:54
virtual ~MessageBufferBase()
Definition MessageBufferCPP.h:57
size_t read_ISR(void *data, size_t len, BaseType_t &wasWoken)
Definition MessageBufferCPP.h:74
size_t send(const void *data, size_t len, TickType_t delay=portMAX_DELAY)
Definition MessageBufferCPP.h:59
size_t send_ISR(const void *data, size_t len, BaseType_t &wasWoken)
Definition MessageBufferCPP.h:65
size_t available() const
Get the amount of available space open in the MessageBuffer.
Definition MessageBufferCPP.h:81
MessageBufferBase(MessageBufferHandle_t mbHandle)
Definition MessageBufferCPP.h:56
bool isEmpty() const
Definition MessageBufferCPP.h:83
size_t read(void *data, size_t len, TickType_t delay=portMAX_DELAY)
Definition MessageBufferCPP.h:68
bool reset()
Resets the buffer to empty.
Definition MessageBufferCPP.h:89
bool isFull() const
Definition MessageBufferCPP.h:85
MessageBufferHandle_t msgHandle
Definition MessageBufferCPP.h:91
Template to implement a Message Buffer of a given size.
Definition MessageBufferCPP.h:107
MessageBuffer()
Definition MessageBufferCPP.h:109
virtual ~MessageBuffer()
Definition MessageBufferCPP.h:118
Definition FreeRTOScpp.h:74