# SFBRxByteBuffer Class Reference

A specialized SFBByteBuffer that handles asynchronous data reception, i.e., data is added to the buffer at interrupt level (IL), and removed from the buffer in the background process (BG). More...

`#include <SFBByteBuffer.h>`

Inheritance diagram for SFBRxByteBuffer:

[legend]
Collaboration diagram for SFBRxByteBuffer:

[legend]

## Public Types
enum | { BBFLAG_ERRORBITS = PK_OVERRUN|PK_PARITY|PK_FRAMING|PK_BREAK, BBFLAG_OVERFLOW = PK_BUFFER, BBFLAG_ZERO = PK_DELETED|PK_BAD_ESCAPE }
## Public Member Functions
| SFBRxByteBuffer (u8(&buffer)[BYTE_BUFFER_BYTES])
void | resetBG ()
| Called in background to reset an rx buffer.
int | fetchByteBG ()
| Called in background to fetch next byte from old end of rx buf, if any.
void | storeErrorStatusIL (u8 status)
| Called at interrupt level to record some error status that arrived from the hardware.
void | storeByteIL (u8 data)
| Called at interrupt level to store a byte at new end of rx buf, if possible.

## Detailed Description

A specialized SFBByteBuffer that handles asynchronous data reception, i.e., data is added to the buffer at interrupt level (IL), and removed from the buffer in the background process (BG).

An SFBRxByteBuffer promises to BG that its bytesAvailable() will never decrease during IL processing. So if BG observes that bytesAvailable() are large enough to do something (e.g., fetch one byte), BG can then go ahead and perform that action without locking or disabling interrupts.

## Member Enumeration Documentation

anonymous enum

Enumerator:

  BBFLAG_ERRORBITS | Error bits; H/W detected comms problem(s) if non-zero.
  BBFLAG_OVERFLOW | Error bits; S/W detected buffer overrun or reset if non-zero; data may have been lost.
  BBFLAG_ZERO | These bits will be zero in any error code returned from fetchByteBG.

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

- src/include/SFBByteBuffer.h
- src/components/library/SFBByteBuffer.cpp