BlueToe
an alternative GATT/BLE implementation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize > Class Template Reference

buffer responsible for fragment or defragment L2CAP SDUs More...

#include <bluetoe/link_layer/include/bluetoe/ll_l2cap_sdu_buffer.hpp>

Inheritance diagram for bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >:

Public Types

using layout = typename BufferedRadio::layout
 radio layout assumed by the buffer
 

Public Member Functions

read_buffer allocate_l2cap_transmit_buffer (std::size_t payload_size)
 allocate a L2CAP buffer that is ready to be filled by the L2CAP layer
 
read_buffer allocate_ll_transmit_buffer (std::size_t payload_size)
 allocates a LL buffer that is suitable for the given payload size
 
void commit_l2cap_transmit_buffer (read_buffer buffer)
 schedules the given buffer to be send by the radio
 
void commit_ll_transmit_buffer (read_buffer buffer)
 schedules the given buffer to be send by the radio
 
write_buffer next_ll_l2cap_received ()
 returns the oldest link layer PDU or L2CAP SDU out of the receive buffer.
 
void free_ll_l2cap_received ()
 removes the oldest PDU from the receive buffer.
 

Detailed Description

template<class BufferedRadio, std::size_t MTUSize>
class bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >

buffer responsible for fragment or defragment L2CAP SDUs

If the L2CAP MTU size is 23, this class shall no generate any overhead as SDUs are directly mapped to LL PDUs.

Member Function Documentation

◆ allocate_l2cap_transmit_buffer()

template<class BufferedRadio , std::size_t MTUSize>
read_buffer bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >::allocate_l2cap_transmit_buffer ( std::size_t  payload_size)

allocate a L2CAP buffer that is ready to be filled by the L2CAP layer

If the request can not be fullfilled, the returned buffer will have a zero size. After the buffer was filled by the L2CAP layer, commit_l2cap_transmit_buffer() must be called to transmit the buffer.

Parameters
payload_sizethe payload size of the requested L2CAP buffer, must be >= 0 and <= MTUSize

◆ allocate_ll_transmit_buffer()

template<class BufferedRadio , std::size_t MTUSize>
read_buffer bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >::allocate_ll_transmit_buffer ( std::size_t  payload_size)

allocates a LL buffer that is suitable for the given payload size

If the request can not be fullfilled, the function will return an empty buffer. After the buffer was filled by the link layer, commit_ll_transmit_buffer() must be called to transmit the buffer.

◆ commit_l2cap_transmit_buffer()

template<class BufferedRadio , std::size_t MTUSize>
void bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >::commit_l2cap_transmit_buffer ( read_buffer  buffer)

schedules the given buffer to be send by the radio

buffer must have been obtained by a call to allocate_l2cap_transmit_buffer()

◆ commit_ll_transmit_buffer()

template<class BufferedRadio , std::size_t MTUSize>
void bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >::commit_ll_transmit_buffer ( read_buffer  buffer)

schedules the given buffer to be send by the radio

buffer must have been obtained by a call to allocate_ll_transmit_buffer()

◆ free_ll_l2cap_received()

template<class BufferedRadio , std::size_t MTUSize>
void bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >::free_ll_l2cap_received

removes the oldest PDU from the receive buffer.

Precondition
next_ll_received() was called without free_ll_received() beeing called.
buffer is in running mode

◆ next_ll_l2cap_received()

template<class BufferedRadio , std::size_t MTUSize>
write_buffer bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >::next_ll_l2cap_received

returns the oldest link layer PDU or L2CAP SDU out of the receive buffer.

If there is no oldest received PDU/SDU, an empty PDU will be returned (size == 0 ). The returned PDU is not removed from the buffer. To remove the buffer after it is not used any more, free_ll_l2cap_received() must be called.

If there are pending outgoing PDUs there will be an attempt to write then to the link layer.

Precondition
buffer is in running mode
See also
free_ll_l2cap_received()

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