5 months, 3 weeks ago.
Cordio BLE API: Clarifications regarding using Scan Parameters & startScan API?
In the new Cordio BLE API, it seems like the Scan Parameters is used to set the Scan Interval and Scan Window. However the Cordio BLE startScan API accepts the following parameters:
/** Start scanning. * * @param duration How long to scan for. Special value 0 means scan forever. * @param filtering Filtering policy. * @param period How long to scan for in single period. If the period is 0 and duration * is nonzero the scan will last for single duration. * * @note When the duration and period parameters are non-zero scanning will last for * the duration within the period. After the scan period has expired a new scan period * will begin and scanning. This will repeat until stopScan() is called. * * @return BLE_ERROR_NONE on success. * * @see EventHandler::onAdvertisingReport to collect advertising reports. * @see EventHandler::onScanTimeout when scanning timeout. */ virtual ble_error_t startScan( scan_duration_t duration = scan_duration_t::forever(), duplicates_filter_t filtering = duplicates_filter_t::DISABLE, scan_period_t period = scan_period_t(0) );
So the questions I have are the following.
1) When the ScanParameters are set via the setScanParameters method and in the startScan method mentioned above, are the default parameters ignored and the ScanParameters set previously used? I am assuming duration parameter in startScan method is the same as ScanWindow and the period parameter is the same as the ScanInterval?
2) In the previous versions of mbed-os prior to Cordio BLE API the startScan method accepted a ScanTimout interval and the ScanTimeout event was called once the ScanTimeout interval elapsed. However when is the ScanTimout handler called in the Cordio BLE API. Also is there a way to set a ScanTimeout interval in Cordio BLE API?
5 months, 3 weeks ago.
Those parameters in those two APIs are all having different meanings.
setScanParamters(), we have the two parameters,
scan_window_t scan_interval: This is LE_Scan_Window of HCI LE Set Scan Parameters Command.
scan_interval_t scan_window: This is LE_Scan_Interval of HCI LE Set Scan Parameters Command.
startScan(), we have the two parameters,
scan_duration_t duration: This is the duration of the scan process, 0 means scan process never ends.
scan_period_t period: This is Period of HCI LE Set Extended Scan, if you are doing legacy scan, this should be set as 0.
The detail is described in Mbed OS documentation.[https://os.mbed.com/docs/mbed-os/v5.11/mbed-os-api-doxy/group__gap.html#gac0cd8ca22a69897824561dce98703757]
So for the ScanTimeout configuration, now you should configure
scan_duration_t duration of
startScan() to decide how long the scan process goes.
Hope this answer helps you well.
- Desmond, team Mbed
You need to log in to post a question