nimble/host: Add support for ext scan duration

If only duration is set for extended scan host will be notified when
scan is finished and GAP procedure should be terminated at this event.
This commit is contained in:
Szymon Janc
2018-04-17 13:55:53 +02:00
parent d8c3ba85ad
commit d9f706a93a
3 changed files with 24 additions and 0 deletions
+8
View File
@@ -1257,6 +1257,14 @@ ble_gap_rx_adv_report(struct ble_gap_disc_desc *desc)
ble_gap_disc_report(desc);
}
#if MYNEWT_VAL(BLE_EXT_ADV) && NIMBLE_BLE_SCAN
void
ble_gap_rx_le_scan_timeout(void)
{
ble_gap_disc_complete();
}
#endif
#if MYNEWT_VAL(BLE_EXT_ADV)
void
ble_gap_rx_ext_adv_report(struct ble_gap_ext_disc_desc *desc)
+4
View File
@@ -75,6 +75,10 @@ extern STATS_SECT_DECL(ble_gap_stats) ble_gap_stats;
#define BLE_GAP_CONN_MODE_MAX 3
#define BLE_GAP_DISC_MODE_MAX 3
#if MYNEWT_VAL(BLE_EXT_ADV) && NIMBLE_BLE_SCAN
void ble_gap_rx_le_scan_timeout(void);
#endif
#if MYNEWT_VAL(BLE_EXT_ADV)
void ble_gap_rx_ext_adv_report(struct ble_gap_ext_disc_desc *desc);
void ble_gap_rx_adv_set_terminated(struct hci_le_adv_set_terminated *evt);
+12
View File
@@ -50,6 +50,7 @@ static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_dir_adv_rpt;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_phy_update_complete;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_ext_adv_rpt;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_rd_rem_used_feat_complete;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_scan_timeout;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_adv_set_terminated;
/* Statistics */
@@ -102,6 +103,8 @@ static const struct ble_hs_hci_evt_le_dispatch_entry
{ BLE_HCI_LE_SUBEV_EXT_ADV_RPT, ble_hs_hci_evt_le_ext_adv_rpt },
{ BLE_HCI_LE_SUBEV_RD_REM_USED_FEAT,
ble_hs_hci_evt_le_rd_rem_used_feat_complete },
{ BLE_HCI_LE_SUBEV_SCAN_TIMEOUT,
ble_hs_hci_evt_le_scan_timeout },
{ BLE_HCI_LE_SUBEV_ADV_SET_TERMINATED,
ble_hs_hci_evt_le_adv_set_terminated },
};
@@ -604,6 +607,15 @@ ble_hs_hci_evt_le_ext_adv_rpt(uint8_t subevent, uint8_t *data, int len)
return 0;
}
static int
ble_hs_hci_evt_le_scan_timeout(uint8_t subevent, uint8_t *data, int len)
{
#if MYNEWT_VAL(BLE_EXT_ADV) && NIMBLE_BLE_SCAN
ble_gap_rx_le_scan_timeout();
#endif
return 0;
}
static int
ble_hs_hci_evt_le_adv_set_terminated(uint8_t subevent, uint8_t *data, int len)
{