[RTOS Message Buffer API]
size_t xMessageBufferSpacesAvailable( MessageBufferHandle_t xMessageBuffer );
Queries a message buffer to see how much free space it contains, which is equal to the amount of data that can be sent to the message buffer before it is full. The returned value is 4 bytes larger than the maximum message size that can be sent to the message buffer.
Message buffer functionality is enabled by including the FreeRTOS/source/stream_buffer.c source file in the build (as message buffers use stream buffers).
xMessageBuffer The handle of the message buffer being queried.
- The number of bytes that can be written to the message buffer before the message buffer would be full. When a message is written to the message buffer an additional sizeof( size_t ) bytes are also written to store the message’s length. sizeof( size_t ) is typically 4 bytes on a 32-bit architecture, so if xMessageBufferSpacesAvailable() returns 10, then the size of the largest message that can be written to the message buffer is 6 bytes.