The latest development version of this page may be more current than this released 1.14.0 version.

Data Buffers

API Reference

group bt_buf

Data buffers.

Defines

BT_BUF_USER_DATA_MIN

Minimum amount of user data size for buffers passed to the stack.

BT_BUF_RX_SIZE

Data size neeed for HCI RX buffers

Enums

enum bt_buf_type

Possible types of buffers passed around the Bluetooth stack

Values:

BT_BUF_CMD

HCI command

BT_BUF_EVT

HCI event

BT_BUF_ACL_OUT

Outgoing ACL data

BT_BUF_ACL_IN

Incoming ACL data

Functions

struct net_buf *bt_buf_get_rx(enum bt_buf_type type, s32_t timeout)

Allocate a buffer for incoming data

This will set the buffer type so bt_buf_set_type() does not need to be explicitly called before bt_recv_prio().

Return
A new buffer.
Parameters
  • type: Type of buffer. Only BT_BUF_EVT and BT_BUF_ACL_IN are allowed.
  • timeout: Timeout in milliseconds, or one of the special values K_NO_WAIT and K_FOREVER.

struct net_buf *bt_buf_get_cmd_complete(s32_t timeout)

Allocate a buffer for an HCI Command Complete/Status Event

This will set the buffer type so bt_buf_set_type() does not need to be explicitly called before bt_recv_prio().

Return
A new buffer.
Parameters
  • timeout: Timeout in milliseconds, or one of the special values K_NO_WAIT and K_FOREVER.

static void bt_buf_set_type(struct net_buf *buf, enum bt_buf_type type)

Set the buffer type

Parameters
  • buf: Bluetooth buffer
  • type: The BT_* type to set the buffer to

static enum bt_buf_type bt_buf_get_type(struct net_buf *buf)

Get the buffer type

Return
The BT_* type to of the buffer
Parameters
  • buf: Bluetooth buffer