arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
BLESerialPacketBuffer Class Reference

FIFO for BLE packets: in framed mode the packet boundaries are kept, otherwise the data is handled as a byte stream. All methods are protected by the optional mutex, so that the buffer can be filled and consumed by different tasks. More...

#include <BLESerialStream.h>

Collaboration diagram for BLESerialPacketBuffer:
Collaboration graph
[legend]

Public Member Functions

int available ()
 Number of available bytes: in framed mode the size of the next packet.
 
int availableForWrite ()
 Number of bytes which can be written.
 
void clear ()
 Removes all data.
 
bool isAllocated ()
 
int read (uint8_t *result, int len)
 
void resize (int bytes, int packets, bool framed)
 Allocates the buffer memory (if not already done)
 
void setMutex (MutexBase *mutex)
 
int write (const uint8_t *packet, int len)
 Adds a packet: in framed mode only complete packets are added.
 

Protected Attributes

RingBuffer< uint8_t > data {0}
 
bool is_framed = false
 
MutexBase * p_mutex = nullptr
 
RingBuffer< uint16_t > sizes {0}
 

Detailed Description

FIFO for BLE packets: in framed mode the packet boundaries are kept, otherwise the data is handled as a byte stream. All methods are protected by the optional mutex, so that the buffer can be filled and consumed by different tasks.

Author
Phil Schatzmann

Member Function Documentation

◆ available()

int available ( )
inline

Number of available bytes: in framed mode the size of the next packet.

◆ availableForWrite()

int availableForWrite ( )
inline

Number of bytes which can be written.

◆ clear()

void clear ( )
inline

Removes all data.

◆ isAllocated()

bool isAllocated ( )
inline

◆ read()

int read ( uint8_t *  result,
int  len 
)
inline

Provides the data: in framed mode the next complete packet if it fits into len bytes

◆ resize()

void resize ( int  bytes,
int  packets,
bool  framed 
)
inline

Allocates the buffer memory (if not already done)

◆ setMutex()

void setMutex ( MutexBase *  mutex)
inline

◆ write()

int write ( const uint8_t *  packet,
int  len 
)
inline

Adds a packet: in framed mode only complete packets are added.

Member Data Documentation

◆ data

RingBuffer<uint8_t> data {0}
protected

◆ is_framed

bool is_framed = false
protected

◆ p_mutex

MutexBase* p_mutex = nullptr
protected

◆ sizes

RingBuffer<uint16_t> sizes {0}
protected

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