nrfxlib API 2.8.99
Loading...
Searching...
No Matches

◆ sdc_hci_cmd_le_set_adv_enable()

uint8_t sdc_hci_cmd_le_set_adv_enable ( const sdc_hci_cmd_le_set_adv_enable_t * p_params)

#include <softdevice_controller/include/sdc_hci_cmd_le.h>

LE Set Advertising Enable.

The description below is extracted from Core_v6.0, Vol 4, Part E, Section 7.8.9

The HCI_LE_Set_Advertising_Enable command is used to request the Controller to start or stop advertising. The Controller manages the timing of advertisements as per the advertising parameters given in the HCI_LE_Set_Advertising_Parameters command.

The Controller shall continue advertising until the Host issues an HCI_LE_Set_Advertising_Enable command with Advertising_Enable set to 0x00 (Advertising is disabled). a connection is created using the advertising, or the Advertising is timed out due to high duty cycle Directed Advertising. In these cases, advertising is then disabled.

If Advertising_Enable is set to 0x01, the advertising parameters' 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 Advertising_Enable is set to 0x01, the advertising parameters' Own_Address_Type parameter is set to 0x01, and the random address for the device has not been initialized using the HCI_LE_Set_Random_Address command, the Controller shall return the error code Invalid HCI Command Parameters (0x12).

If Advertising_Enable is set to 0x01, the advertising parameters' 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 Advertising_Enable is set to 0x01, the advertising parameters' 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 device has not been initialized using the HCI_LE_Set_Random_Address command, the Controller shall return the error code Invalid HCI Command Parameters.(0x12).

Enabling advertising when it is already enabled can cause the random address to change. Disabling advertising when it is already disabled has no effect.

1This command was formerly called “LE Set Advertise Enable”.

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

If the Advertising_Type parameter is 0x01 (ADV_DIRECT_IND, high duty cycle) and the directed advertising fails to create a connection, an HCI_LE_Connection_Complete or HCI_LE_Enhanced_Connection_Complete event shall be generated with the Status code set to Advertising Timeout (0x3C).

If the Advertising_Type parameter is 0x00 (ADV_IND), 0x01 (ADV_DIRECT_IND, high duty cycle), or 0x04 (ADV_DIRECT_IND, low duty cycle) and a connection is created, an HCI_LE_Connection_Complete or HCI_LE_Enhanced_Connection_Complete event shall be generated.

Note: There is a possible race condition if the Advertising_Enable parameter is set to 0x00 (Disable) and the Advertising_Type parameter is 0x00, 0x01, or 0x04. The advertisements might not be stopped before a connection is created, and therefore both the HCI_Command_Complete event and either an HCI_LE_Connection_Complete event or an HCI_LE_Enhanced_Connection_Complete event could be generated. This can also occur when high duty cycle directed advertising is timed out and this command disables advertising.

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.