ble_mesh: Add net_buf_simple_init_with_data [Zephyr]
This commit is contained in:
parent
d6a247f7e4
commit
8271ae4a1e
2 changed files with 21 additions and 0 deletions
|
@ -152,6 +152,18 @@ static inline void net_buf_simple_init(struct net_buf_simple *buf,
|
||||||
buf->len = 0;
|
buf->len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize a net_buf_simple object with data.
|
||||||
|
*
|
||||||
|
* Initialized buffer object with external data.
|
||||||
|
*
|
||||||
|
* @param buf Buffer to initialize.
|
||||||
|
* @param data External data pointer
|
||||||
|
* @param size Amount of data the pointed data buffer if able to fit.
|
||||||
|
*/
|
||||||
|
void net_buf_simple_init_with_data(struct net_buf_simple *buf,
|
||||||
|
void *data, size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset buffer
|
* @brief Reset buffer
|
||||||
*
|
*
|
||||||
|
|
|
@ -383,6 +383,15 @@ void net_buf_reset(struct net_buf *buf)
|
||||||
net_buf_simple_reset(&buf->b);
|
net_buf_simple_reset(&buf->b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void net_buf_simple_init_with_data(struct net_buf_simple *buf,
|
||||||
|
void *data, size_t size)
|
||||||
|
{
|
||||||
|
buf->__buf = data;
|
||||||
|
buf->data = data;
|
||||||
|
buf->size = size;
|
||||||
|
buf->len = size;
|
||||||
|
}
|
||||||
|
|
||||||
void net_buf_simple_reserve(struct net_buf_simple *buf, size_t reserve)
|
void net_buf_simple_reserve(struct net_buf_simple *buf, size_t reserve)
|
||||||
{
|
{
|
||||||
NET_BUF_ASSERT(buf);
|
NET_BUF_ASSERT(buf);
|
||||||
|
|
Loading…
Reference in a new issue