13#include "../include/mesh/mesh.h"
15#define BT_MESH_ADV(om) (*(struct bt_mesh_adv **) OS_MBUF_USRHDR(om))
17#define BT_MESH_ADV_SCAN_UNIT(_ms) ((_ms) * 8 / 5)
18#define BT_MESH_SCAN_INTERVAL_MS 30
19#define BT_MESH_SCAN_WINDOW_MS 30
21#define BT_MESH_ADV_DATA_SIZE 31
24#define BT_MESH_ADV_USER_DATA_SIZE 4
26#define BT_MESH_MBUF_HEADER_SIZE (sizeof(struct os_mbuf_pkthdr) + \
27 BT_MESH_ADV_USER_DATA_SIZE +\
28 sizeof(struct os_mbuf))
32extern struct ble_npl_eventq bt_mesh_adv_queue;
34extern os_membuf_t adv_buf_mem[];
46typedef void (*bt_mesh_adv_func_t)(
struct os_mbuf *buf, uint16_t duration,
47 int err,
void *user_data);
50static inline void adv_send_start(uint16_t duration,
int err,
51 const struct bt_mesh_send_cb *cb,
54 if (cb && cb->start) {
55 cb->start(duration, err, cb_data);
63 const struct bt_mesh_send_cb *cb;
75 struct ble_npl_event ev;
78typedef struct bt_mesh_adv *(*bt_mesh_adv_alloc_t)(
int id);
81struct os_mbuf *bt_mesh_adv_create(
enum bt_mesh_adv_type type, uint8_t xmit,
85 bt_mesh_adv_alloc_t get_id,
86 enum bt_mesh_adv_type type,
87 uint8_t xmit, int32_t timeout);
89void bt_mesh_adv_send(
struct os_mbuf *buf,
const struct bt_mesh_send_cb *cb,
92void bt_mesh_adv_update(
void);
94void bt_mesh_adv_init(
void);
96int bt_mesh_scan_enable(
void);
98int bt_mesh_scan_disable(
void);
99int bt_mesh_adv_enable(
void);
101void bt_mesh_adv_buf_ready(
void);
104 const struct bt_data *ad,
size_t ad_len,
105 const struct bt_data *sd,
size_t sd_len);
107static inline void bt_mesh_adv_send_start(uint16_t duration,
int err,
108 struct bt_mesh_adv *adv)
113 if (adv->cb && adv->cb->start) {
114 adv->cb->start(duration, err, adv->cb_data);
123static inline void bt_mesh_adv_send_end(
124 int err,
struct bt_mesh_adv
const *adv)
126 if (adv->started && adv->cb && adv->cb->end) {
127 adv->cb->end(err, adv->cb_data);
130int ble_adv_gap_mesh_cb(
struct ble_gap_event *event,
void *arg);
Definition os_mempool.h:57