mesh: Extend advertising API with helpers for Friend support

These extensions prepare the way of implementing full Friend support.

X-Original-Commit: a811e5d30d1322e32c6387de31991ed363c2f4d2
This commit is contained in:
Michał Narajowski
2017-11-09 11:48:06 +01:00
parent eb0eb5978b
commit f57ec1c1a1
2 changed files with 21 additions and 3 deletions
+13 -3
View File
@@ -175,13 +175,15 @@ void bt_mesh_adv_update(void)
os_eventq_put(&adv_queue, &ev);
}
struct os_mbuf *bt_mesh_adv_create(enum bt_mesh_adv_type type, u8_t xmit_count,
u8_t xmit_int, s32_t timeout)
struct os_mbuf *bt_mesh_adv_create_from_pool(struct os_mbuf_pool *pool,
enum bt_mesh_adv_type type,
u8_t xmit_count, u8_t xmit_int,
s32_t timeout)
{
struct os_mbuf *adv_data;
struct bt_mesh_adv *adv;
adv_data = os_mbuf_get_pkthdr(&adv_os_mbuf_pool, sizeof(struct bt_mesh_adv));
adv_data = os_mbuf_get_pkthdr(pool, sizeof(struct bt_mesh_adv));
if (!adv_data) {
return NULL;
}
@@ -197,6 +199,14 @@ struct os_mbuf *bt_mesh_adv_create(enum bt_mesh_adv_type type, u8_t xmit_count,
return adv_data;
}
struct os_mbuf *bt_mesh_adv_create(enum bt_mesh_adv_type type, u8_t xmit_count,
u8_t xmit_int, s32_t timeout)
{
return bt_mesh_adv_create_from_pool(&adv_os_mbuf_pool,
type, xmit_count,
xmit_int, timeout);
}
void bt_mesh_adv_send(struct os_mbuf *buf, bt_mesh_adv_func_t sent)
{
BT_DBG("buf %p, type 0x%02x len %u: %s", buf, BT_MESH_ADV(buf)->type, buf->om_len,
+8
View File
@@ -37,6 +37,9 @@ struct bt_mesh_adv
/* Generic User Data */
u8_t user_data[2];
/* Address, used e.g. for Friend Queue messages */
u16_t addr;
/* For transport layer segment sending */
struct
{
@@ -53,6 +56,11 @@ struct bt_mesh_adv
struct os_mbuf * bt_mesh_adv_create(enum bt_mesh_adv_type type, u8_t xmit_count,
u8_t xmit_int, s32_t timeout);
struct os_mbuf *bt_mesh_adv_create_from_pool(struct os_mbuf_pool *pool,
enum bt_mesh_adv_type type,
u8_t xmit_count, u8_t xmit_int,
s32_t timeout);
void bt_mesh_adv_send(struct os_mbuf *buf, bt_mesh_adv_func_t sent);
void bt_mesh_adv_update(void);