Bluetooth: host: Deprecate BT_LE_ADV defines in hci.h in favour of gap.h
Deprecate BT_LE_ADV defines in hci.h that are expected to be used by the application in the scan received callback to identify the advertising PDU type. These defines are mixing HCI input parameters and advertising PDU types. Internally it is acceptable to mix these, but at the API we should to mix in them. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
be57dfbe2a
commit
f2d7b77e96
10 changed files with 37 additions and 26 deletions
|
@ -609,14 +609,20 @@ struct bt_hci_cp_le_set_random_address {
|
||||||
bt_addr_t bdaddr;
|
bt_addr_t bdaddr;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
/* Advertising types */
|
/* LE Advertising Types (LE Advertising Parameters Set)*/
|
||||||
#define BT_LE_ADV_IND 0x00
|
#define BT_LE_ADV_IND (__DEPRECATED_MACRO 0x00)
|
||||||
#define BT_LE_ADV_DIRECT_IND 0x01
|
#define BT_LE_ADV_DIRECT_IND (__DEPRECATED_MACRO 0x01)
|
||||||
#define BT_LE_ADV_SCAN_IND 0x02
|
#define BT_LE_ADV_SCAN_IND (__DEPRECATED_MACRO 0x02)
|
||||||
#define BT_LE_ADV_NONCONN_IND 0x03
|
#define BT_LE_ADV_NONCONN_IND (__DEPRECATED_MACRO 0x03)
|
||||||
#define BT_LE_ADV_DIRECT_IND_LOW_DUTY 0x04
|
#define BT_LE_ADV_DIRECT_IND_LOW_DUTY (__DEPRECATED_MACRO 0x04)
|
||||||
/* Needed in advertising reports when getting info about */
|
/* LE Advertising PDU Types. */
|
||||||
#define BT_LE_ADV_SCAN_RSP 0x04
|
#define BT_LE_ADV_SCAN_RSP (__DEPRECATED_MACRO 0x04)
|
||||||
|
|
||||||
|
#define BT_HCI_ADV_IND 0x00
|
||||||
|
#define BT_HCI_ADV_DIRECT_IND 0x01
|
||||||
|
#define BT_HCI_ADV_SCAN_IND 0x02
|
||||||
|
#define BT_HCI_ADV_NONCONN_IND 0x03
|
||||||
|
#define BT_HCI_ADV_DIRECT_IND_LOW_DUTY 0x04
|
||||||
|
|
||||||
#define BT_LE_ADV_FP_NO_WHITELIST 0x00
|
#define BT_LE_ADV_FP_NO_WHITELIST 0x00
|
||||||
#define BT_LE_ADV_FP_WHITELIST_SCAN_REQ 0x01
|
#define BT_LE_ADV_FP_WHITELIST_SCAN_REQ 0x01
|
||||||
|
|
|
@ -32,7 +32,8 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t type,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're only interested in connectable events */
|
/* We're only interested in connectable events */
|
||||||
if (type != BT_LE_ADV_IND && type != BT_LE_ADV_DIRECT_IND) {
|
if (type != BT_GAP_ADV_TYPE_ADV_IND &&
|
||||||
|
type != BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,8 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t type,
|
||||||
dev, type, ad->len, rssi);
|
dev, type, ad->len, rssi);
|
||||||
|
|
||||||
/* We're only interested in connectable events */
|
/* We're only interested in connectable events */
|
||||||
if (type == BT_LE_ADV_IND || type == BT_LE_ADV_DIRECT_IND) {
|
if (type == BT_GAP_ADV_TYPE_ADV_IND ||
|
||||||
|
type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {
|
||||||
bt_data_parse(ad, eir_found, (void *)addr);
|
bt_data_parse(ad, eir_found, (void *)addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,7 +360,7 @@ static void create_conn(const bt_addr_le_t *addr)
|
||||||
static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t type,
|
static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t type,
|
||||||
struct net_buf_simple *ad)
|
struct net_buf_simple *ad)
|
||||||
{
|
{
|
||||||
if (type != BT_LE_ADV_IND) {
|
if (type != BT_GAP_ADV_TYPE_ADV_IND) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -940,7 +940,7 @@ static void le_set_adv_param(struct net_buf *buf, struct net_buf **evt)
|
||||||
min_interval = sys_le16_to_cpu(cmd->min_interval);
|
min_interval = sys_le16_to_cpu(cmd->min_interval);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK) &&
|
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK) &&
|
||||||
(cmd->type != BT_LE_ADV_DIRECT_IND)) {
|
(cmd->type != BT_HCI_ADV_DIRECT_IND)) {
|
||||||
u16_t max_interval = sys_le16_to_cpu(cmd->max_interval);
|
u16_t max_interval = sys_le16_to_cpu(cmd->max_interval);
|
||||||
|
|
||||||
if ((min_interval > max_interval) ||
|
if ((min_interval > max_interval) ||
|
||||||
|
@ -2446,7 +2446,7 @@ static inline void le_dir_adv_report(struct pdu_adv *adv, struct net_buf *buf,
|
||||||
dir_info = (void *)(((u8_t *)drp) + sizeof(*drp));
|
dir_info = (void *)(((u8_t *)drp) + sizeof(*drp));
|
||||||
|
|
||||||
/* Directed Advertising */
|
/* Directed Advertising */
|
||||||
dir_info->evt_type = BT_LE_ADV_DIRECT_IND;
|
dir_info->evt_type = BT_HCI_ADV_DIRECT_IND;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||||
if (rl_idx < ll_rl_size_get()) {
|
if (rl_idx < ll_rl_size_get()) {
|
||||||
|
|
|
@ -1771,7 +1771,7 @@ static void check_pending_conn(const bt_addr_le_t *id_addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return if event is not connectable */
|
/* Return if event is not connectable */
|
||||||
if (evtype != BT_LE_ADV_IND && evtype != BT_LE_ADV_DIRECT_IND) {
|
if (evtype != BT_HCI_ADV_IND && evtype != BT_HCI_ADV_DIRECT_IND) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3844,7 +3844,7 @@ static void le_adv_report(struct net_buf *buf)
|
||||||
if (!IS_ENABLED(CONFIG_BT_PRIVACY) &&
|
if (!IS_ENABLED(CONFIG_BT_PRIVACY) &&
|
||||||
!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) &&
|
!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) &&
|
||||||
atomic_test_bit(bt_dev.flags, BT_DEV_EXPLICIT_SCAN) &&
|
atomic_test_bit(bt_dev.flags, BT_DEV_EXPLICIT_SCAN) &&
|
||||||
info->evt_type == BT_LE_ADV_DIRECT_IND) {
|
info->evt_type == BT_HCI_ADV_DIRECT_IND) {
|
||||||
BT_DBG("Dropped direct adv report");
|
BT_DBG("Dropped direct adv report");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -6064,9 +6064,9 @@ int bt_le_adv_start_internal(const struct bt_le_adv_param *param,
|
||||||
|
|
||||||
if (dir_adv) {
|
if (dir_adv) {
|
||||||
if (param->options & BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY) {
|
if (param->options & BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY) {
|
||||||
set_param.type = BT_LE_ADV_DIRECT_IND_LOW_DUTY;
|
set_param.type = BT_HCI_ADV_DIRECT_IND_LOW_DUTY;
|
||||||
} else {
|
} else {
|
||||||
set_param.type = BT_LE_ADV_DIRECT_IND;
|
set_param.type = BT_HCI_ADV_DIRECT_IND;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_addr_le_copy(&set_param.direct_addr, peer);
|
bt_addr_le_copy(&set_param.direct_addr, peer);
|
||||||
|
@ -6082,7 +6082,7 @@ int bt_le_adv_start_internal(const struct bt_le_adv_param *param,
|
||||||
BT_HCI_OWN_ADDR_RPA_MASK;
|
BT_HCI_OWN_ADDR_RPA_MASK;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
set_param.type = BT_LE_ADV_IND;
|
set_param.type = BT_HCI_ADV_IND;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (param->options & BT_LE_ADV_OPT_USE_IDENTITY) {
|
if (param->options & BT_LE_ADV_OPT_USE_IDENTITY) {
|
||||||
|
@ -6119,9 +6119,9 @@ int bt_le_adv_start_internal(const struct bt_le_adv_param *param,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd || (param->options & BT_LE_ADV_OPT_USE_NAME)) {
|
if (sd || (param->options & BT_LE_ADV_OPT_USE_NAME)) {
|
||||||
set_param.type = BT_LE_ADV_SCAN_IND;
|
set_param.type = BT_HCI_ADV_SCAN_IND;
|
||||||
} else {
|
} else {
|
||||||
set_param.type = BT_LE_ADV_NONCONN_IND;
|
set_param.type = BT_HCI_ADV_NONCONN_IND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,
|
||||||
static void bt_mesh_scan_cb(const bt_addr_le_t *addr, s8_t rssi,
|
static void bt_mesh_scan_cb(const bt_addr_le_t *addr, s8_t rssi,
|
||||||
u8_t adv_type, struct net_buf_simple *buf)
|
u8_t adv_type, struct net_buf_simple *buf)
|
||||||
{
|
{
|
||||||
if (adv_type != BT_LE_ADV_NONCONN_IND) {
|
if (adv_type != BT_GAP_ADV_TYPE_ADV_NONCONN_IND) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -473,7 +473,8 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t type,
|
||||||
struct net_buf_simple *ad)
|
struct net_buf_simple *ad)
|
||||||
{
|
{
|
||||||
/* We're only interested in connectable events */
|
/* We're only interested in connectable events */
|
||||||
if (type == BT_LE_ADV_IND || type == BT_LE_ADV_DIRECT_IND) {
|
if (type == BT_GAP_ADV_TYPE_ADV_IND ||
|
||||||
|
type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {
|
||||||
ad_parse(ad, eir_found, (void *)addr);
|
ad_parse(ad, eir_found, (void *)addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,7 +331,8 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t type,
|
||||||
dev, type, ad->len, rssi);
|
dev, type, ad->len, rssi);
|
||||||
|
|
||||||
/* We're only interested in connectable events */
|
/* We're only interested in connectable events */
|
||||||
if (type == BT_LE_ADV_IND || type == BT_LE_ADV_DIRECT_IND) {
|
if (type == BT_GAP_ADV_TYPE_ADV_IND ||
|
||||||
|
type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {
|
||||||
bt_data_parse(ad, eir_found, (void *)addr);
|
bt_data_parse(ad, eir_found, (void *)addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,7 +386,7 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t evtype,
|
||||||
{
|
{
|
||||||
/* if General/Limited Discovery - parse Advertising data to get flags */
|
/* if General/Limited Discovery - parse Advertising data to get flags */
|
||||||
if (!(discovery_flags & GAP_DISCOVERY_FLAG_LE_OBSERVE) &&
|
if (!(discovery_flags & GAP_DISCOVERY_FLAG_LE_OBSERVE) &&
|
||||||
(evtype != BT_LE_ADV_SCAN_RSP)) {
|
(evtype != BT_GAP_ADV_TYPE_SCAN_RSP)) {
|
||||||
u8_t flags = get_ad_flags(ad);
|
u8_t flags = get_ad_flags(ad);
|
||||||
|
|
||||||
/* ignore non-discoverable devices */
|
/* ignore non-discoverable devices */
|
||||||
|
@ -404,7 +404,7 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t evtype,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attach Scan Response data */
|
/* attach Scan Response data */
|
||||||
if (evtype == BT_LE_ADV_SCAN_RSP) {
|
if (evtype == BT_GAP_ADV_TYPE_SCAN_RSP) {
|
||||||
struct gap_device_found_ev *ev;
|
struct gap_device_found_ev *ev;
|
||||||
bt_addr_le_t a;
|
bt_addr_le_t a;
|
||||||
|
|
||||||
|
@ -449,7 +449,8 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t evtype,
|
||||||
|
|
||||||
/* if Active Scan and scannable event - wait for Scan Response */
|
/* if Active Scan and scannable event - wait for Scan Response */
|
||||||
if ((discovery_flags & GAP_DISCOVERY_FLAG_LE_ACTIVE_SCAN) &&
|
if ((discovery_flags & GAP_DISCOVERY_FLAG_LE_ACTIVE_SCAN) &&
|
||||||
(evtype == BT_LE_ADV_IND || evtype == BT_LE_ADV_SCAN_IND)) {
|
(evtype == BT_GAP_ADV_TYPE_ADV_IND ||
|
||||||
|
evtype == BT_GAP_ADV_TYPE_ADV_SCAN_IND)) {
|
||||||
LOG_DBG("Waiting for scan response");
|
LOG_DBG("Waiting for scan response");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue