Commit b923bde6 authored by Make Shi's avatar Make Shi Committed by Chris Friedt
Browse files

bluetooth: avrcp: provide an API for net buffer allocation



Add bt_avrcp_create_pdu() to allocate net_buf with protocol headroom.

Signed-off-by: default avatarMake Shi <make.shi@nxp.com>
parent 895ba04b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -264,6 +264,19 @@ int bt_avrcp_connect(struct bt_conn *conn);
 */
int bt_avrcp_disconnect(struct bt_conn *conn);

/**
 * @brief Allocate a net_buf for AVRCP PDU transmission, reserving headroom
 *        for AVRCP, AVRCTP, L2CAP, and ACL headers.
 *
 * This function allocates a buffer from the specified pool and reserves
 * sufficient headroom for protocol headers required by AVRCP over Bluetooth.
 *
 * @param pool The buffer pool to allocate from.
 *
 * @return A newly allocated net_buf with reserved headroom.
 */
struct net_buf *bt_avrcp_create_pdu(struct net_buf_pool *pool);

/** @brief Register callback.
 *
 *  Register AVRCP callbacks to monitor the state and interact with the remote device.
+8 −0
Original line number Diff line number Diff line
@@ -814,6 +814,14 @@ int bt_avrcp_disconnect(struct bt_conn *conn)
	return err;
}

struct net_buf *bt_avrcp_create_pdu(struct net_buf_pool *pool)
{
	return bt_conn_create_pdu(pool,
				  sizeof(struct bt_l2cap_hdr) +
				  sizeof(struct bt_avctp_header) +
				  sizeof(struct bt_avrcp_header));
}

int bt_avrcp_ct_get_cap(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t cap_id)
{
	struct net_buf *buf;