NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
Bluetooth Host chained memory buffer (mbuf)

Bluetooth Host chained memory buffer (mbuf) More...

Functions

struct os_mbufble_hs_mbuf_att_pkt (void)
 
struct os_mbufble_hs_mbuf_from_flat (const void *buf, uint16_t len)
 
int ble_hs_mbuf_to_flat (const struct os_mbuf *om, void *flat, uint16_t max_len, uint16_t *out_copy_len)
 

Detailed Description

Bluetooth Host chained memory buffer (mbuf)

Function Documentation

◆ ble_hs_mbuf_att_pkt()

struct os_mbuf * ble_hs_mbuf_att_pkt ( void  )

Allocates an mbuf suitable for an ATT command packet. The resulting packet has sufficient leading space for:

  • ACL data header
  • L2CAP B-frame header
  • Largest ATT command base (prepare write request / response).
Returns
An empty mbuf on success, NULL on error.

◆ ble_hs_mbuf_from_flat()

struct os_mbuf * ble_hs_mbuf_from_flat ( const void *  buf,
uint16_t  len 
)

Allocates an mbuf and fills it with the contents of the specified flat buffer.

Parameters
bufThe flat buffer to copy from.
lenThe length of the flat buffer.
Returns
A newly-allocated mbuf on success, NULL on error.

◆ ble_hs_mbuf_to_flat()

int ble_hs_mbuf_to_flat ( const struct os_mbuf om,
void *  flat,
uint16_t  max_len,
uint16_t *  out_copy_len 
)

Copies the contents of an mbuf into the specified flat buffer. If the flat buffer is too small to contain the mbuf's contents, it is filled to capacity and BLE_HS_EMSGSIZE is returned.

Parameters
omThe mbuf to copy from.
flatThe destination flat buffer.
max_lenThe size of the flat buffer.
out_copy_lenThe number of bytes actually copied gets written here.
Returns
0 on success or BLE host core return code on error.