BLE_GAP_SetExtAdvEnable
C
uint16_t BLE_GAP_SetExtAdvEnable(bool enable, uint8_t numOfSets, BLE_GAP_ExtAdvEnableParams_T *p_advParam);
Description
Enables or disables one or more advertising sets.
Note
If enable is set to false and numOfSets is 0x00, then all advertising sets are disabled. Advertising will be disabled after the maximum number of extended advertising events have been sent, even if the set duration has not expired. For more details, see BLE_GAP_ExtAdvEnableParams_T. This API is part of the extended advertising feature and is incompatible with legacy advertising APIs. See Categories of advertising APIs and events for details on advertising APIs. Initialization with BLE_GAP_AdvInit and BLE_GAP_ExtAdvInit is required before calling this API. Set the advertising parameters with BLE_GAP_SetExtAdvParams before calling this API. Set the advertising and scan response data with BLE_GAP_SetExtAdvData and BLE_GAP_SetExtScanRspData before calling this API.
Events generated
BLE_GAP_EVT_CONNECTED is generated when when connectable advertising starts and a connection is established.
BLE_GAP_EVT_SCAN_REQ_RECEIVED is generated when extended advertising is enabled.
BLE_GAP_EVT_ADV_SET_TERMINATED is generated when extended advertising is enabled and times out.
Parameters
Parameter | Description |
---|---|
[in] enable | Enable (true) or disable (false) one or more advertising sets. |
[in] numOfSets | The number of advertising sets to be enabled or disabled. |
[in] p_advParam | Pointer to a BLE_GAP_ExtAdvEnableParams_T structure containing the enable parameters. |
Return values
Return value | Description |
---|---|
MBA_RES_SUCCESS | Successfully enables or disables the advertising sets. |
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. |
MBA_RES_UNKNOWN_ADV_ID | Unknown advertising identifier. |