BLE_GAP_SetScanningEnable

C

uint16_t BLE_GAP_SetScanningEnable(bool enable, uint8_t filterDuplicate, uint8_t mode, uint16_t duration);

Description

Starts or stops scanning for advertising devices.

Note

Scanning is used to discover nearby advertising devices. If scanning is already active, setting the enable parameter to true will update the filterDuplicate setting. This API is part of the legacy advertising feature set and will be disallowed if any API from the extended advertising feature set has been used previously. See Categories of advertising APIs and events for details on advertising APIs. The BLE_GAP_ScanInit function must be called prior to using this API.

Parameters

ParameterDescription
[in] enableStart (true) or stop (false) scanning.
[in] filterDuplicateDuplicate filtering policy, see Scan filter duplicate option. Valid values are BLE_GAP_SCAN_FD_DISABLE and BLE_GAP_SCAN_FD_ENABLE.
[in] modeScan mode, see Scan modes.
[in] durationScan duration in units of 100 ms.

Return values

Return valueDescription
MBA_RES_SUCCESSSuccessfully starts or stop scanning.
MBA_RES_OOMInternal memory allocation failure occurred.
MBA_RES_INVALID_PARAInvalid parameters, such as out-of-range values.
MBA_RES_COMMAND_DISALLOWEDCommand disallowed when the extended advertising feature is in use.