nrfxlib API 2.7.99
Loading...
Searching...
No Matches

◆ sdc_hci_cmd_le_set_ext_adv_enable()

uint8_t sdc_hci_cmd_le_set_ext_adv_enable ( const sdc_hci_cmd_le_set_ext_adv_enable_t p_params)

#include <softdevice_controller/include/sdc_hci_cmd_le.h>

LE Set Extended Advertising Enable.

The description below is extracted from Core_v5.4, Vol 4, Part E, Section 7.8.56

The HCI_LE_Set_Extended_Advertising_Enable command is used to request the Controller to enable or disable one or more advertising sets using the advertising sets identified by the Advertising_Handle[i] parameter. The Control- ler manages the timing of advertisements in accordance with the advertising parameters given in the HCI_LE_Set_Extended_Advertising_Parameters command. The Num_Sets parameter is the number of advertising sets contained in the parameter arrays. If Enable and Num_Sets are both set to 0x00, then all advertising sets are disabled.

The Controller shall only start an advertising event when the corresponding advertising set is enabled. The Controller shall continue advertising until all advertising sets have been disabled. An advertising set shall be disabled when the Host issues an HCI_LE_Set_Extended_Advertising_Enable command with the Enable parameter set to 0x00 (Advertising is disabled), a connection is cre- ated using that advertising set, the duration specified in the Duration[i] parame- ter expires, or the number of extended advertising events transmitted for the set exceeds the Max_Extended_Advertising_Events[i] parameter.

The Duration[i] parameter indicates the duration for which that advertising set is enabled. The duration begins at the start of the first advertising event of this advertising set. The Controller should not start an extended advertising event that it cannot complete within the duration.

If the advertising is high duty cycle connectable directed advertising, then Duration[i] shall be less than or equal to 1.28 seconds and shall not be equal to 0.

The Max_Extended_Advertising_Events[i] parameter, if non-zero, indicates the maximum number of extended advertising events that shall be sent prior to disabling the extended advertising set even if the Duration[i] parameter has not expired.

Duration[i] and Max_Extended_Advertising_Events[i] shall be ignored when Enable is set to 0x00.

If the HCI_LE_Set_Extended_Advertising_Enable command is sent again for an advertising set while that set is enabled, the timer used for the duration and the number of events counter are reset and any change to the random address shall take effect.

Disabling the advertising set identified by the Advertising_Handle[i] parameter does not disable any periodic advertising associated with that set.

Disabling an advertising set that is already disabled has no effect.

If the same advertising set is identified by more than one entry in the Advertising_Handle[i] arrayed parameter, then the Controller shall return the error code Invalid HCI Command Parameters (0x12).

If the advertising set corresponding to the Advertising_Handle[i] parameter does not exist, then the Controller shall return the error code Unknown Advertising Identifier (0x42).

The remainder of this section only applies if Enable is set to 0x01.

If Num_Sets is set to 0x00, the Controller shall return the error code Invalid HCI Command Parameters (0x12).

If the advertising set contains partial advertising data or partial scan response data, the Controller shall return the error code Command Disallowed (0x0C).

If the advertising set uses scannable extended advertising PDUs and no scan response data is currently provided, the Controller shall return the error code Command Disallowed (0x0C).

If the advertising set uses connectable extended advertising PDUs and the advertising data in the advertising set will not fit in the AUX_ADV_IND PDU, the Controller shall return the error code Invalid HCI Command Parameters (0x12).

Note: The maximum amount of data that will fit in the PDU depends on which options are selected and on the maximum length of PDU that the Controller is able to transmit.

If extended advertising is being used and the length of any advertising data or of any scan response data is greater than the maximum that the Controller can transmit within the longest possible auxiliary advertising segment consistent with the chosen advertising interval, the Controller shall return the error code Packet Too Long (0x45). If advertising on the LE Coded PHY, the S=8 coding shall be assumed unless the current advertising parameters require the use of S=2 for an advertising physical channel, in which case the S=2 coding shall be assumed for that advertising physical channel.

If the advertising set's Own_Address_Type parameter is set to 0x00 and the device does not have a public address, the Controller should return an error code which should be Invalid HCI Command Parameters (0x12). If the advertising set's Own_Address_Type parameter is set to 0x01 and the random address for the advertising set has not been initialized using the HCI_LE_Set_Advertising_Set_Random_Address command, the Controller shall return the error code Invalid HCI Command Parameters (0x12).

If the advertising set's Own_Address_Type parameter is set to 0x02, the Controller's resolving list did not contain a matching entry, and the device does not have a public address, the Controller should return an error code which should be Invalid HCI Command Parameters (0x12).

If the advertising set's Own_Address_Type parameter is set to 0x03, the Controller's resolving list did not contain a matching entry, and the random address for the advertising set has not been initialized using the HCI_LE_Set_Advertising_Set_Random_Address command, the Controller shall return the error code Invalid HCI Command Parameters (0x12).

Event(s) generated (unless masked away): When the HCI_LE_Set_Extended_Advertising_Enable command has completed, an HCI_Command_Complete event shall be generated.

If the Duration[i] parameter is set to a value other than 0x0000, an HCI_LE_- Advertising_Set_Terminated event shall be generated when the duration spec- ified in the Duration[i] parameter expires. However, if the advertising set is for high duty cycle connectable directed advertising and no connection is created before the duration expires, an HCI_LE_Connection_Complete or HCI_LE_- Enhanced_Connection_Complete event with the Status parameter set to the error code Advertising Timeout (0x3C) may be generated instead of or in addi- tion to the HCI_LE_Advertising_Set_Terminated event. If the Controller gener- ates both events, they may be in either order.

If the Max_Extended_Advertising_Events[i] parameter is set to a value other than 0x00, an HCI_LE_Advertising_Set_Terminated event shall be generated when the maximum number of extended advertising events has been transmitted by the Controller. If the advertising set is connectable and a connection gets created, an HCI_LE_Connection_Complete or HCI_LE_Enhanced_Connection_Complete event shall be generated followed by an HCI_LE_Advertising_Set_Terminated event with the Status parameter set to 0x00. The Controller should not send any other events in between these two events. If the Controller supports the LE Channel Selection Algorithm #2 feature, then the HCI_LE_Advertising_Set_- Terminated event may be immediately preceded or followed by an HCI_LE_- Channel_Selection_Algorithm event.

Note: If this command is used to disable advertising at about the same time that a connection is established or the advertising duration expires, there is a possible race condition in that it is possible to receive both an HCI_LE_- Connection_Complete, HCI_LE_Enhanced_Connection_Complete, or HCI_LE_Advertising_Set_Terminated event and the HCI_Command_- Complete event for this command.

Parameters
[in]p_paramsInput parameters.
Return values
0if success.
Returns
Returns value between 0x01-0xFF in case of error. See Vol 2, Part D, Error for a list of error codes and descriptions.