Hi , I wanted to know how to change the scan interval and scan window to required timings , since only a few options available with using the given macros in gap.h ?
Hi , I wanted to know how to change the scan interval and scan window to required timings , since only a few options available with using the given macros in gap.h ?
using nrf connect 2.1.1 with 52833 dk
using nrf connect 2.1.1 with 52833 dk
Hello,
The scan interval and window can be specified with the struct bt_le_scan_param
(documented here).
When the parameters of the struct is filled, it is used as the value for the .scan_param
parameter in a bt_scan_init_param
struct. Then the bt_scan_init_param
struct is passed to bt_init_scan
.
Below is how this is done in the Bluetooth Throughput sample from nRF Connect SDK v2.1.1.
struct bt_le_scan_param scan_param = { .type = BT_LE_SCAN_TYPE_PASSIVE, .options = BT_LE_SCAN_OPT_FILTER_DUPLICATE, .interval = 0x0010, .window = 0x0010, }; struct bt_scan_init_param scan_init = { .connect_if_match = 1, .scan_param = &scan_param, .conn_param = conn_param }; bt_scan_init(&scan_init);
The values for .interval
and .window
can be changed to meet your requirements.
Kind Regards,
Maria