This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pc-ble-driver (master) scan_start() reports only one device upon every invocation

Hi,

I am trying to use latest pc-ble-driver. The code is based on pc-ble-driver-js. When I call sd_ble_gap_scan_start(), I get only one "device discovered" event. This happens on every invocation of sd_ble_gap_scan_start(). Is there any inherent change in the way sd_ble_gap_scan_start() is used? Do I need to change scan params or pass different size for adv_report_buffer?

My code looks like this:
    
    static uint8_t mp_data[BLE_GAP_ADV_SET_DATA_SIZE_EXTENDED_MAX_SUPPORTED] = { 0 };
    static ble_data_t m_adv_report_buffer;
    void Adapter::GapStartScan(uv_work_t *req)
    {
        auto baton = static_cast<StartScanBaton *>(req->data);
        m_adv_report_buffer.p_data = mp_data;
        m_adv_report_buffer.len = sizeof(mp_data);
        baton->result = sd_ble_gap_scan_start(baton->adapter, baton->scan_params, &m_adv_report_buffer);
    }
start scan, stop scan work fine, they do not return any error. similar code used to report multiple devices with SD 3.1.
Scan params are as follows
active= true
interval = 100
window = 20
timeout =  -1
extended = 0
report_incomplete_evts = 0
filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL
scan_phys = BLE_GAP_PHY_1MBPS
I am using following h/w and s/w config
nRF 52840 dongle
Soft Device 140 6.1.0
pc-ble-driver (master)
Windows 10 64 bit
Node JS 9.4.0
Parents Reply
  • During the time I am scanning, how do I prevent my application from missing out on any advertisements?

    Assume following timeline

    T0 - I called sd_ble_gap_scan_start

    T1 - I got the event BLE_GAP_EVT_ADV_REPORT and it took me X milliseconds to process this

    T1+X - I called sd_ble_gap_scan_start in order to continue the scan

    What happens to the advertisements that were received between T1 and (T1 + X)? 

    Would they be queued and would I get the event BLE_GAP_EVT_ADV_REPORT again immediately after I call sd_ble_gap_scan_start again?

    Is that what is meant by "Scanning still continues in the background"?

Children
No Data
Related