1.2.2.1.1.4.64 BLE_GAP_SetScanningEnable
C
uint16_t BLE_GAP_SetScanningEnable(bool enable, uint8_t filterDuplicate, uint8_t mode, uint16_t duration);
Description
Start or stop scanning.
Note
Scanning is used to discover advertising devices nearby. If the enable parameter is set to true and scanning is already enabled, any change to the filterDuplicate setting shall take effect.
This API belongs to legacy advertising feature. It will be disallowed if any one API belongs extended advertising feature is issued before. Categories of advertising APIs and events for details of advertising APIs.
BLE_GAP_ScanInit is required for this API.
Events generated
BLE_GAP_EVT_ADV_REPORT Generated when scan enabled.
BLE_GAP_EVT_DIRECT_ADV_REPORT Generated when scan enabled and direct adv. received.
BLE_GAP_EVT_SCAN_TIMEOUT Generated when scan enabled and timeout (by duration).
Parameters
Parameter | Description |
---|---|
[in] enable | Start or stop scanning. Set true to start scanning. |
[in] filterDuplicate | Duplicate Filter policy, see Scan filter duplicate option. Only BLE_GAP_SCAN_FD_DISABLE /BLE_GAP_SCAN_FD_ENABLE are valid. |
[in] mode | Scan mode. See Scan modes. |
[in] duration | Scan duration (unit :100 ms). |
Return values
Return value | Description |
---|---|
MBA_RES_SUCCESS | Successfully enable or disable scanning. |
MBA_RES_OOM | Internal memory allocation failure. |
MBA_RES_INVALID_PARA | Invalid parameters, if any of the parameters are out of range. |
MBA_RES_COMMAND_DISALLOWED | Command disallowed when extended Adv. feature is in-use. |