Bluetooth: host: Added scan support for periodic advertisement

Added the ext adv report interval to bt_le_scan_recv_info which
denotes whether or not there is periodic advertisement data
associated with the advertisement report.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
This commit is contained in:
Emil Gydesen 2020-05-04 16:14:38 +02:00 committed by Carles Cufí
commit 262a0501de
3 changed files with 12 additions and 2 deletions

View file

@ -987,6 +987,13 @@ struct bt_le_scan_recv_info {
/** Advertising packet properties. */
uint16_t adv_props;
/**
* @brief Periodic advertising interval.
*
* If 0 there is no periodic advertisement.
*/
uint16_t interval;
/** Primary advertising channel PHY. */
uint8_t primary_phy;

View file

@ -4916,6 +4916,7 @@ static void le_adv_ext_report(struct net_buf *buf)
adv_info.tx_power = evt->tx_power;
adv_info.rssi = evt->rssi;
adv_info.sid = evt->sid;
adv_info.interval = sys_le16_to_cpu(evt->interval);
adv_info.adv_type = get_adv_type(evt->evt_type);
/* Convert "Legacy" property to Extended property. */

View file

@ -105,14 +105,16 @@ static void scan_recv(const struct bt_le_scan_recv_info *info,
bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr));
shell_print(ctx_shell, "[DEVICE]: %s, AD evt type %u, RSSI %i %s "
"C:%u S:%u D:%d SR:%u E:%u Prim: %s, Secn: %s",
"C:%u S:%u D:%d SR:%u E:%u Prim: %s, Secn: %s, "
"Interval: %u",
le_addr, info->adv_type, info->rssi, name,
(info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) != 0,
(info->adv_props & BT_GAP_ADV_PROP_SCANNABLE) != 0,
(info->adv_props & BT_GAP_ADV_PROP_DIRECTED) != 0,
(info->adv_props & BT_GAP_ADV_PROP_SCAN_RESPONSE) != 0,
(info->adv_props & BT_GAP_ADV_PROP_EXT_ADV) != 0,
phy2str(info->primary_phy), phy2str(info->secondary_phy));
phy2str(info->primary_phy), phy2str(info->secondary_phy),
info->interval);
}
static void scan_timeout(void)