Function nrf_softdevice_s122::sd_ble_gap_scan_start
source · pub unsafe fn sd_ble_gap_scan_start(
p_scan_params: *const ble_gap_scan_params_t,
p_adv_report_buffer: *const ble_data_t
) -> u32
Expand description
@brief 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.
@note The scanner will automatically stop in the following cases: - @ref sd_ble_gap_scan_stop is called. - @ref sd_ble_gap_connect is called. - A @ref BLE_GAP_EVT_TIMEOUT with source set to @ref BLE_GAP_TIMEOUT_SRC_SCAN is received. - When a @ref BLE_GAP_EVT_ADV_REPORT event is received. In this case scanning is only paused to let the application access received data. The application must call this function to continue scanning, or call @ref sd_ble_gap_scan_stop to stop scanning.
@note When the scanner is paused, the application should continue scanning as soon as possible after fetching the @ref BLE_GAP_EVT_ADV_REPORT event.
@events @event{@ref BLE_GAP_EVT_ADV_REPORT, An advertising or scan response packet has been received.} @event{@ref BLE_GAP_EVT_TIMEOUT, Scanner has timed out.} @endevents
@mscs @mmsc{@ref BLE_GAP_SCAN_MSC} @endmscs
@param[in] p_scan_params Pointer to scan parameters structure. When this function is used to continue scanning, this parameter must be NULL. @param[in] p_adv_report_buffer Pointer to buffer used to store incoming advertising data. The memory pointed to should be kept alive until the scanning is stopped. See @ref BLE_GAP_SCAN_BUFFER_SIZE for minimum and maximum buffer size.
@retval ::NRF_SUCCESS Successfully initiated scanning procedure. @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. Either: - Scanning is already ongoing 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. @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. See @ref ble_gap_scan_params_t. @retval ::NRF_ERROR_NOT_SUPPORTED Unsupported parameters supplied. See @ref ble_gap_scan_params_t. @retval ::NRF_ERROR_INVALID_LENGTH The provided buffer length is invalid. See @ref BLE_GAP_SCAN_BUFFER_MIN. @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again @retval ::NRF_ERROR_NOT_SUPPORTED Unsupported PHYs supplied to the call.