BlueToe
an alternative GATT/BLE implementation
|
buffer responsible for fragment or defragment L2CAP SDUs More...
#include <bluetoe/link_layer/include/bluetoe/ll_l2cap_sdu_buffer.hpp>
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. | |
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.
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.
payload_size | the payload size of the requested L2CAP buffer, must be >= 0 and <= 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.
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()
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()
void bluetoe::link_layer::ll_l2cap_sdu_buffer< BufferedRadio, MTUSize >::free_ll_l2cap_received |
removes the oldest PDU from the receive buffer.
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.