1#ifndef BLUETOE_LINK_LAYER_DEFAULT_PDU_LAYOUT_HPP
2#define BLUETOE_LINK_LAYER_DEFAULT_PDU_LAYOUT_HPP
4#include <bluetoe/bits.hpp>
5#include <bluetoe/buffer.hpp>
12 template <
class Base >
15 static std::uint16_t header(
const read_buffer& pdu )
17 assert( pdu.size >= Base::data_channel_pdu_memory_size( 0 ) );
19 return Base::header( pdu.buffer );
22 static std::uint16_t header(
const write_buffer& pdu )
24 assert( pdu.size >= Base::data_channel_pdu_memory_size( 0 ) );
26 return Base::header( pdu.buffer );
29 static void header(
const read_buffer& pdu, std::uint16_t header_value )
31 assert( pdu.size >= Base::data_channel_pdu_memory_size( 0 ) );
33 Base::header( pdu.buffer, header_value );
46 static constexpr std::size_t
header_size =
sizeof( std::uint16_t );
53 static std::uint16_t
header(
const std::uint8_t* pdu )
55 return ::bluetoe::details::read_16bit( pdu );
61 static void header( std::uint8_t* pdu, std::uint16_t header_value )
63 ::bluetoe::details::write_16bit( pdu, header_value );
81 static std::pair< const std::uint8_t*, const std::uint8_t* >
body(
const write_buffer& pdu )
103 template <
typename Radio >
implements a PDU layout, where in memory and over the air layout are equal.
Definition: default_pdu_layout.hpp:42
static std::pair< std::uint8_t *, std::uint8_t * > body(const read_buffer &pdu)
returns a begin and end pointer to the body of a PDU
Definition: default_pdu_layout.hpp:71
static constexpr std::size_t data_channel_pdu_memory_size(std::size_t payload_size)
returns the overall, required buffer size for a PDU with the given payload_size.
Definition: default_pdu_layout.hpp:92
static constexpr std::size_t header_size
fixed 16 bit size of a LL PDU
Definition: default_pdu_layout.hpp:46
static std::pair< const std::uint8_t *, const std::uint8_t * > body(const write_buffer &pdu)
returns a begin and end pointer to the body of a PDU
Definition: default_pdu_layout.hpp:81
static void header(std::uint8_t *pdu, std::uint16_t header_value)
sets the 16 but LL header for the pdu
Definition: default_pdu_layout.hpp:61
static std::uint16_t header(const std::uint8_t *pdu)
retrieves the 16 bit LL header from a PDU.
Definition: default_pdu_layout.hpp:53
type to associate a radio implementation with the corresponding layout
Definition: default_pdu_layout.hpp:104
type suitable to store the location and size of a chunk of memory that can be used to receive from th...
Definition: buffer.hpp:18
std::uint8_t * buffer
Definition: buffer.hpp:24
std::size_t size
Definition: buffer.hpp:30
type suitable to store the location and size of a chunk of memory that can be used to transmit to the...
Definition: buffer.hpp:85
const std::uint8_t * buffer
Definition: buffer.hpp:87
std::size_t size
Definition: buffer.hpp:90