BLE_GAP_SetExtScanningEnable
C
uint16_t BLE_GAP_SetExtScanningEnable(uint8_t mode, BLE_GAP_ExtScanningEnable_T *p_enable);
Description
Enables or disables extended scanning.
Note
If scanning is already enabled and this API is called with 'enable' set to true, the scan duration and period timers are reset to the new values, and a new scan period begins. The scan period duration includes time spent scanning on both primary and secondary advertising channels. When an advertising packet or scan response is received, the BLE_GAP_EVT_EXT_ADV_REPORT event is generated. This API is part of the extended advertising feature and is disallowed if any legacy advertising feature API has been used previously. See Categories of advertising APIs and events for details on advertising APIs. Initialization with BLE_GAP_ScanInit and BLE_GAP_ExtScanInit is required before using this API.
Events generated
BLE_GAP_EVT_EXT_ADV_REPORT is generated when an advertising packet or scan response is received during extended scanning.
BLE_GAP_EVT_SCAN_TIMEOUT is generated when the scan period ends due to reaching the specified duration.
Parameters
Parameter | Description |
---|---|
[in] mode | Scan mode. Refer to Scan modes for possible values. |
[in] p_enable | Pointer to a BLE_GAP_ExtScanningEnable_T structure specifying scan enable parameters. |
Return values
Return value | Description |
---|---|
MBA_RES_SUCCESS | Successfully enables or disables extended scanning. |
MBA_RES_OOM | Internal memory allocation failure occurred. |
MBA_RES_INVALID_PARA | The parameters provided are invalid. |
MBA_RES_COMMAND_DISALLOWED | Command disallowed due to a conflicting operation or state. |