1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

nimble/scanner: fix scan duration for HS_FOREVER

This commit is contained in:
Hauke Petersen 2021-12-03 14:39:33 +01:00
parent 884f0e7a5b
commit 2f70f17962
2 changed files with 7 additions and 3 deletions

View File

@ -159,7 +159,8 @@ static inline bool nimble_scanner_is_active(void)
*
* If there is an active scanning process, it will be restarted.
*
* @param[in] duration_ms duration of scanning procedure in ms
* @param[in] duration_ms duration of scanning procedure in ms, set to
* BLE_HS_FOREVER to scan without time limit
*/
void nimble_scanner_set_scan_duration(int32_t duration_ms);

View File

@ -103,13 +103,16 @@ int nimble_scanner_start(void)
const struct ble_gap_ext_disc_params *coded =
(_scan_flags & NIMBLE_SCANNER_PHY_CODED) ? &_scan_params : NULL;
int32_t dur = (_scan_duration == BLE_HS_FOREVER) ? 0
: _scan_duration / 10;
int res = ble_gap_ext_disc(nimble_riot_own_addr_type,
_scan_duration / 10, 0, dups,
dur, 0, dups,
BLE_HCI_SCAN_FILT_NO_WL, limited,
uncoded, coded,
_on_scan_evt, NULL);
#else
int res = ble_gap_disc(nimble_riot_own_addr_type, 0,
int res = ble_gap_disc(nimble_riot_own_addr_type, _scan_duration,
&_scan_params, _on_scan_evt, NULL);
#endif
if (res != 0) {