Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Scanning Procedure APIs

This group includes scanning APIs.

Functions

at_ble_status_t at_ble_scan_start (uint16_t interval, uint16_t window, uint16_t timeout, at_ble_scan_type_t type, at_ble_scan_mode_t mode, bool filter_whitelist, bool filter_dublicates)
 Start scan operation. More...
 
at_ble_status_t at_ble_scan_stop (void)
 Stops an ongoing scan operation. More...
 

at_ble_status_t at_ble_scan_start ( uint16_t  interval,
uint16_t  window,
uint16_t  timeout,
at_ble_scan_type_t  type,
at_ble_scan_mode_t  mode,
bool  filter_whitelist,
bool  filter_dublicates 
)

Start scan operation.

While the scan operation is ongoing, the application will always receive AT_BLE_SCAN_INFO event per found device.
In case of using AT_BLE_SCAN_GEN_DISCOVERY or AT_BLE_SCAN_LIM_DISCOVERY, also AT_BLE_SCAN_REPORT event will be received at the end of scan process or error occurred when trying to start scanning procedure

Parameters
[in]intervalScan interval in 625us units, a value between AT_BLE_ADV_INTERVAL_MIN and AT_BLE_ADV_INTERVAL_MAX
[in]windowScan window in 625us units, value between AT_BLE_SCAN_WINDOW_MIN and AT_BLE_SCAN_INTERVAL_MAX
[in]timeoutScan time-out, between 0x0001 and 0x028F in scale of Seconds, 0x0000 disables time-out.
[in]typeControls the type of scan to perform either Passive or Active at_ble_scan_type_t for more details.
[in]modeEither General, Limited or Observer only, at_ble_scan_mode_t for more details
[in]filter_whitelistIf true, get scan results only from white-listed devices added by at_ble_whitelist_add otherwise scan results will be got from any advertising device. This filter should not be used with AT_BLE_ADV_GEN_DISCOVERABLE and AT_BLE_ADV_LIM_DISCOVERABLE modes ONLY.
[in]filter_dublicatesIf true, scan event will be generated only once per device, if false multiple events will be issued
Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t

While the scan operation is ongoing, the application will always receive AT_BLE_SCAN_INFO event per found device.
In case of using AT_BLE_SCAN_GEN_DISCOVERY or AT_BLE_SCAN_LIM_DISCOVERY, also AT_BLE_SCAN_REPORT event will be received at the end of scan process.

Parameters
[in]intervalScan interval in 625us units
[in]windowScan window in 625us units
[in]timeoutScan time-out, 0x0000 disables time-out.
[in]typeControls the type of scan to perform either Passive or Active at_ble_scan_type_t for more details.
[in]modeEither General, Limited or Observer only, at_ble_scan_mode_t for more details
[in]filter_whitelistIf true, get scan results only from white-listed devices added by at_ble_whitelist_add otherwise scan results will be got from any advertising device.
[in]filter_duplicatesIf true, scan event will be generated only once per device. If false, multiple events per device may be generated. Note that if more than 10 devices are found, filtering only applies to the first 10 found; multiple scan events may be generated for 11th and subsequent devices.
Warning
Scan time-out feature is not supported.
Returns
AT_BLE_SUCCESS Scan operation started successfully
AT_BLE_INVALID_PARAM Invalid parameter supplied
AT_BLE_FAILURE Generic error

References at_ble_addr_t::addr, device_info::addr_auto_gen, at_ble_addr_get(), AT_BLE_INVALID_PARAM, AT_BLE_SCAN_ACTIVE, AT_BLE_SCAN_INTERVAL_MAX, AT_BLE_SCAN_INTERVAL_MIN, AT_BLE_SCAN_OBSERVER_MODE, AT_BLE_SCAN_PASSIVE, AT_BLE_SCAN_WINDOW_MAX, AT_BLE_SCAN_WINDOW_MIN, AT_BLE_SUCCESS, device, gapm_get_device_address_type(), GAPM_SCAN_ACTIVE, gapm_start_scan_cmd_handler(), device_info::renew_dur, SCAN_PASSIVE, status, and at_ble_addr_t::type.

at_ble_status_t at_ble_scan_stop ( void  )

Stops an ongoing scan operation.

Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t
AT_BLE_SUCCESS Scan operation stopped successfully
AT_BLE_FAILURE Generic error

References gapm_cancel_cmd_handler().