BLE_GAP_SetAdvEnable

C

uint16_t BLE_GAP_SetAdvEnable(bool enable, uint16_t duration);

Description

Starts or stop advertising.

Note

The duration parameter is only applicable when the advertising type is not set to Directed Advertising. Advertising will continue for the specified duration, until stopped by a command, until a connection is established, or until it times out due to high duty cycle Directed Advertising. This API is part of the legacy advertising feature and will be disallowed if any extended advertising feature API has been used. See Categories of advertising APIs and events for details on advertising APIs. The BLE_GAP_AdvInit function must be called prior to using this API. The BLE_GAP_SetAdvParams function should be called before this API to set the advertising parameters. The BLE_GAP_SetAdvData or BLE_GAP_SetScanRspData function should be called before this API to set the advertising or scan response data.

Parameters

ParameterDescription
[in] enableControl flag to start or stop advertising.
[in] durationDuration for advertising in 10 ms units. Set to 0 for continuous advertising.
*

Return values

Return valueDescription
MBA_RES_SUCCESSSuccessfully starts or stops advertising.
MBA_RES_OOMInternal memory allocation failure occurred.
MBA_RES_INVALID_PARAThe parameters provided are invalid.
MBA_RES_COMMAND_DISALLOWEDCommand disallowed when extended advertising feature is in use.