1.1.2.1.1.4.37 BLE_GAP_SetAdvEnable

C

uint16_t BLE_GAP_SetAdvEnable(bool enable, uint16_t duration);

Description

Start or stop advertising.

Note

The duration is only valid when advertising type is not set to Directed Advertising. The advertising shall be continuous within the duration or until the disable command is issued or until a connection is created or until the Advertising is timed out due to high duty cycle Directed Advertising. In these cases, advertising is then disabled.

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_AdvInit is required for this API.

Parameters

ParameterDescription
[in] enableAdvertising control option.
[in] durationDuration for advertising. (Unit: 10 ms) Set to 0 to continuously advertise.

Return values

Return valueDescription
MBA_RES_SUCCESSSuccessfully start or stop advertising.
MBA_RES_OOMInternal memory allocation failure.
MBA_RES_INVALID_PARAInvalid parameters.
MBA_RES_COMMAND_DISALLOWEDCommand disallowed when extended Adv. feature is in-use.