Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Bluetooth Logical Link Control and Adaptation Protocol (L2CAP) for BR/EDR

Bluetooth Logical Link Control and Adaptation Protocol (L2CAP) for BR/EDR. More...

Data Structures

struct  bt_l2cap_br_echo_cb
 ECHO request/response callback structure. More...
struct  bt_l2cap_br_connless_cb
 Connectionless data channel callback structure. More...

Macros

#define BT_L2CAP_BR_ECHO_REQ_RESERVE   BT_L2CAP_BUF_SIZE(4)
 Headroom needed for outgoing L2CAP ECHO REQ PDUs.
#define BT_L2CAP_BR_ECHO_RSP_RESERVE   BT_L2CAP_BUF_SIZE(4)
 Headroom needed for outgoing L2CAP ECHO RSP PDUs.
#define BT_L2CAP_CONNLESS_SDU_HDR_SIZE   2
 L2CAP connectionless SDU header size.
#define BT_L2CAP_CONNLESS_RESERVE   BT_L2CAP_BUF_SIZE(BT_L2CAP_CONNLESS_SDU_HDR_SIZE)
 Headroom needed for outgoing L2CAP PDU format within a connectionless data channel.

Functions

int bt_l2cap_br_echo_cb_register (struct bt_l2cap_br_echo_cb *cb)
 Register ECHO callbacks.
int bt_l2cap_br_echo_cb_unregister (struct bt_l2cap_br_echo_cb *cb)
 Unregister ECHO callbacks.
int bt_l2cap_br_echo_req (struct bt_conn *conn, struct net_buf *buf)
 Send ECHO data through ECHO request.
int bt_l2cap_br_echo_rsp (struct bt_conn *conn, uint8_t identifier, struct net_buf *buf)
 Send ECHO data through ECHO response.
int bt_l2cap_br_connless_register (struct bt_l2cap_br_connless_cb *cb)
 Register connectionless data channel callbacks.
int bt_l2cap_br_connless_unregister (struct bt_l2cap_br_connless_cb *cb)
 Unregister connectionless data channel callbacks.
int bt_l2cap_br_connless_send (struct bt_conn *conn, uint16_t psm, struct net_buf *buf)
 Send data over connectionless data channel.

Detailed Description

Bluetooth Logical Link Control and Adaptation Protocol (L2CAP) for BR/EDR.

Macro Definition Documentation

◆ BT_L2CAP_BR_ECHO_REQ_RESERVE

#define BT_L2CAP_BR_ECHO_REQ_RESERVE   BT_L2CAP_BUF_SIZE(4)

#include <zephyr/bluetooth/classic/l2cap_br.h>

Headroom needed for outgoing L2CAP ECHO REQ PDUs.

◆ BT_L2CAP_BR_ECHO_RSP_RESERVE

#define BT_L2CAP_BR_ECHO_RSP_RESERVE   BT_L2CAP_BUF_SIZE(4)

#include <zephyr/bluetooth/classic/l2cap_br.h>

Headroom needed for outgoing L2CAP ECHO RSP PDUs.

◆ BT_L2CAP_CONNLESS_RESERVE

#define BT_L2CAP_CONNLESS_RESERVE   BT_L2CAP_BUF_SIZE(BT_L2CAP_CONNLESS_SDU_HDR_SIZE)

#include <zephyr/bluetooth/classic/l2cap_br.h>

Headroom needed for outgoing L2CAP PDU format within a connectionless data channel.

◆ BT_L2CAP_CONNLESS_SDU_HDR_SIZE

#define BT_L2CAP_CONNLESS_SDU_HDR_SIZE   2

#include <zephyr/bluetooth/classic/l2cap_br.h>

L2CAP connectionless SDU header size.

Function Documentation

◆ bt_l2cap_br_connless_register()

int bt_l2cap_br_connless_register ( struct bt_l2cap_br_connless_cb * cb)

#include <zephyr/bluetooth/classic/l2cap_br.h>

Register connectionless data channel callbacks.

Register callbacks to monitor and receive connectionless data channel frames. This allows the application to receive data sent to a specific PSM without establishing a connection.

Parameters
cbCallback struct. Must point to memory that remains valid. The PSM field must be set to the desired Protocol/Service Multiplexer value, or 0 to receive all connectionless data frames.
Return values
0Success.
-EINVALIf cb is NULL, has invalid PSM value, has invalid recv callback, or has invalid security level.
-EEXISTIf a callback with the same PSM was already registered.

◆ bt_l2cap_br_connless_send()

int bt_l2cap_br_connless_send ( struct bt_conn * conn,
uint16_t psm,
struct net_buf * buf )

#include <zephyr/bluetooth/classic/l2cap_br.h>

Send data over connectionless data channel.

Send data over a connectionless data channel. This function allows sending data to a specific PSM without establishing the L2CAP channel connection.

The application is required to have reserved BT_L2CAP_CONNLESS_RESERVE bytes in the buffer before sending.

Parameters
connConnection object.
psmProtocol/Service Multiplexer identifying the destination service.
bufBuffer containing the data to be sent. The application is required to have reserved enough headroom in the buffer for the L2CAP header.
Return values
0Success.
-EINVALIf conn or buf is NULL, psm is invalid, the reference counter of buf != 1, the head room of buf is less than BT_L2CAP_CONNLESS_RESERVE, or the buf->user_data_size is less than the size of struct closure.
Returns
-ENOTSUP If the connectionless reception feature is unsupported by remote.
-ENOTCONN If the L2CAP channel with connectionless channel is not found.
-EMSGSIZE If the data size exceeds the peer's connectionless channel MTU.
Return values
-ESHUTDOWNIf the L2CAP channel with connectionless channel is NULL in low level.

◆ bt_l2cap_br_connless_unregister()

int bt_l2cap_br_connless_unregister ( struct bt_l2cap_br_connless_cb * cb)

#include <zephyr/bluetooth/classic/l2cap_br.h>

Unregister connectionless data channel callbacks.

Unregister callbacks that are used to monitor and receive connectionless data channel frames.

Parameters
cbRegistered cb.
Return values
0Success.
-EINVALIf cb is NULL.
-ENOENTif cb was not registered.

◆ bt_l2cap_br_echo_cb_register()

int bt_l2cap_br_echo_cb_register ( struct bt_l2cap_br_echo_cb * cb)

#include <zephyr/bluetooth/classic/l2cap_br.h>

Register ECHO callbacks.

Register callbacks to monitor the packets of L2CAP BR echo request/response.

Parameters
cbCallback struct. Must point to memory that remains valid.
Return values
0Success.
-EEXISTif cb was already registered.

◆ bt_l2cap_br_echo_cb_unregister()

int bt_l2cap_br_echo_cb_unregister ( struct bt_l2cap_br_echo_cb * cb)

#include <zephyr/bluetooth/classic/l2cap_br.h>

Unregister ECHO callbacks.

Unregister callbacks that are used to monitor the packets of L2CAP BR echo request/response.

Parameters
cbCallback struct point to memory that remains valid.
Return values
0Success.
-EINVALIf cb is NULL.
-ENOENTif cb was not registered.

◆ bt_l2cap_br_echo_req()

int bt_l2cap_br_echo_req ( struct bt_conn * conn,
struct net_buf * buf )

#include <zephyr/bluetooth/classic/l2cap_br.h>

Send ECHO data through ECHO request.

Send ECHO data through ECHO request. The application is required to have reserved BT_L2CAP_BR_ECHO_REQ_RESERVE bytes in the buffer before sending.

Parameters
connThe ACL connection object.
bufSending ECHO data.
Returns
0 in case of success or negative value in case of error.

◆ bt_l2cap_br_echo_rsp()

int bt_l2cap_br_echo_rsp ( struct bt_conn * conn,
uint8_t identifier,
struct net_buf * buf )

#include <zephyr/bluetooth/classic/l2cap_br.h>

Send ECHO data through ECHO response.

Send ECHO data through ECHO response. The application is required to have reserved BT_L2CAP_BR_ECHO_RSP_RESERVE bytes in the buffer before sending.

Parameters
connThe ACL connection object.
identifierThe identifier of the ECHO request.
bufSending ECHO data.
Returns
0 in case of success or negative value in case of error.