S145 SoftDevice for nRF54L15/nRF54L10/nRF54L05 API documentation 10.0.0
Loading...
Searching...
No Matches

◆ sd_ble_gap_scan_start()

uint32_t sd_ble_gap_scan_start ( ble_gap_scan_params_t const * p_scan_params,
ble_data_t const * p_adv_report_buffer )

#include <ble_gap.h>

Start or continue scanning (GAP Discovery procedure, Observer Procedure).

Note
A call to this function will require the application to keep the memory pointed by p_adv_report_buffer alive until the buffer is released. The buffer is released when the scanner is stopped or when this function is called with another buffer.
The scanner will automatically stop in the following cases:
If a BLE_GAP_EVT_ADV_REPORT event is received with ble_gap_adv_report_type_t::status set to BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA, the scanner will continue scanning, and the application will receive more reports from this advertising event. The following reports will include the old and new received data.
When the scanner is paused, the application should continue scanning as soon as possible after fetching the BLE_GAP_EVT_ADV_REPORT event.
Events generated
BLE_GAP_EVT_ADV_REPORTAn advertising or scan response packet has been received.
BLE_GAP_EVT_TIMEOUTScanner has timed out.
Relevant Message Sequence Charts
Scanning
Whitelist Sharing
Parameters
[in]p_scan_paramsPointer to scan parameters structure. When this function is used to continue scanning, this parameter must be NULL.
[in]p_adv_report_bufferPointer to buffer used to store incoming advertising data. The memory pointed to should be kept alive until the scanning is stopped. See GAP Minimum scanner buffer size for minimum and maximum buffer size. If the scanner receives advertising data larger than can be stored in the buffer, a BLE_GAP_EVT_ADV_REPORT will be raised with ble_gap_adv_report_type_t::status set to BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_TRUNCATED.
Return values
NRF_SUCCESSSuccessfully initiated scanning procedure.
NRF_ERROR_INVALID_ADDRInvalid pointer supplied.
NRF_ERROR_INVALID_STATEInvalid state to perform operation. Either:
  • Scanning is paused and p_scan_params was not NULL
  • Scanning is not running and p_scan_params was NULL.
  • The scanner has timed out when this function is called to continue scanning.
NRF_ERROR_INVALID_PARAMInvalid parameter(s) supplied. See ble_gap_scan_params_t.
NRF_ERROR_NOT_SUPPORTEDUnsupported parameters supplied. See ble_gap_scan_params_t.
NRF_ERROR_INVALID_LENGTHThe provided buffer length is invalid. See BLE_GAP_SCAN_BUFFER_MIN.
NRF_ERROR_RESOURCESNot enough BLE role slots available. Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again