zephyr/subsys/bluetooth/host/mesh/adv.h
Johan Hedberg 1d86ef0955 Bluetooth: Mesh: Use more accurate timing for LPN functions
Update the advertising callback to include the exact duration that we
will be sending out the packet. This is useful since sometimes we want
to use the end point of the advertising as the reference time to count
when some other action should take place.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-10 22:17:43 +03:00

62 lines
1.3 KiB
C

/* Bluetooth Mesh */
/*
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Maximum advertising data payload for a single data type */
#define BT_MESH_ADV_DATA_SIZE 29
#define BT_MESH_ADV(buf) ((struct bt_mesh_adv *)net_buf_user_data(buf))
enum bt_mesh_adv_type {
BT_MESH_ADV_PROV,
BT_MESH_ADV_DATA,
BT_MESH_ADV_BEACON,
};
typedef void (*bt_mesh_adv_func_t)(struct net_buf *buf, u16_t duration,
int err);
struct bt_mesh_adv {
bt_mesh_adv_func_t sent;
u8_t type:2,
busy:1;
u8_t count:3,
adv_int:5;
union {
/* 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 {
u8_t tx_id;
u8_t attempts;
} seg;
};
};
/* xmit_count: Number of retransmissions, i.e. 0 == 1 transmission */
struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type, u8_t xmit_count,
u8_t xmit_int, s32_t timeout);
struct net_buf *bt_mesh_adv_create_from_pool(struct net_buf_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 net_buf *buf, bt_mesh_adv_func_t sent);
void bt_mesh_adv_update(void);
void bt_mesh_adv_init(void);
int bt_mesh_scan_enable(void);
int bt_mesh_scan_disable(void);