6#include <Settings/NamespaceSettings.hpp>
32template <uint_fast16_t Capacity,
47 constexpr static uint_fast16_t
capacity = Capacity;
49 alignas(SizeT::alignment) uint_fast16_t
read_p = 0;
53 constexpr static uint_fast16_t
ceil_h(uint_fast16_t i) {
71 uint_fast16_t loc_size =
size.load_acquire();
72 uint_fast16_t add_size = 0;
84 uint_fast16_t worst_case_req_size = expected_req_size +
header_size;
88 uint16_t size_1 = std::min<uint_fast16_t>(contig_size, data.
length);
89 Header header {size_1, type};
97 add_size +=
ceil_h(size_1);
101 uint16_t size_2 = data.
length - size_1;
111 add_size +=
ceil_h(size_2);
113 size.add_release(add_size);
128 uint_fast16_t loc_size =
size.load_acquire();
134 std::memcpy(&old_header,
buffer +
read_p,
sizeof(old_header));
Type definitions and callback interfaces for communication between the low-level BLE stacks and highe...
BLEDataType
Describes a byte buffer containing (part of) a BLE packet.
@ None
No buffers available.
@ Continuation
Buffer contains a chunk of a BLE packet.
@ Packet
Buffer contains the start of a BLE packet.
#define BEGIN_CS_NAMESPACE
Circular FIFO buffer for buffering BLE packet data.
static constexpr uint_fast16_t ceil_h(uint_fast16_t i)
unsigned char buffer[capacity]
BLEDataType pop(BLEDataView &data)
Get a view to the next chunk of data.
bool push(BLEDataView data, BLEDataType type=BLEDataType::Packet)
Copy the given data into the buffer.
static constexpr uint_fast16_t header_size
static constexpr uint_fast16_t capacity
Non-owning, std::span-style read-only view of BLE data.
static constexpr size_t alignment
Alignment for size, and read/write pointers to avoid false sharing.