nrfxlib API 3.3.99
Loading...
Searching...
No Matches

◆ sdc_hci_cmd_le_create_conn()

uint8_t sdc_hci_cmd_le_create_conn ( const sdc_hci_cmd_le_create_conn_t * p_params)

#include <softdevice_controller/include/sdc_hci_cmd_le.h>

LE Create Connection.

The description below is extracted from Core_v6.3, Vol 4, Part E, Section 7.8.12

This command is used to create a single ACL connection, with the local device in the Central role, to a connectable advertiser.

If a connection is created with the local device in the Peripheral role while this command is pending, then this command remains pending.

The LE_Scan_Interval and LE_Scan_Window parameters are recommendations from the Host on how long (LE_Scan_Window) and how frequently (LE_Scan_Interval) the Controller should scan. The LE_Scan_Window parameter shall be set to a value smaller or equal to the value set for the LE_Scan_Interval parameter. If both are set to the same value, scanning should run continuously.

The Initiator_Filter_Policy is used to determine whether the Filter Accept List is used. If the Filter Accept List is used, then the device to connect to is the first one that sends an advertisement received successfully by the local device and that is on the list. If the Filter Accept List is not used, then the Peer_Address_Type and the Peer_Address parameters specify the address type and address of the advertising device to connect to.

Peer_Address_Type parameter indicates the type of address used in the connectable advertisement sent by the peer. The Host shall not set Peer_Address_Type to either 0x02 or 0x03 if both the Host and the Controller support the HCI_LE_Set_Privacy_Mode command. If a Controller that supports the HCI_LE_Set_Privacy_Mode command receives the HCI_LE_Create_Connection command with Peer_Address_Type set to either 0x02 or 0x03, it may use either device privacy mode or network privacy mode for that peer device.

Peer_Address parameter indicates the Peer’s Public Device Address, Random (static) Device Address, Non-Resolvable Private Address or Resolvable Private Address depending on the Peer_Address_Type parameter.

Own_Address_Type parameter indicates the type of address being used in the connection request packets.

The Connection_Interval_Min and Connection_Interval_Max parameters define the minimum and maximum allowed connection interval. The Connection_Interval_Min parameter shall not be greater than the Connection_Interval_Max parameter.

The Max_Latency parameter defines the maximum allowed Peripheral latency (see [Vol 6] Part B, Section 4.5.1).

The Supervision_Timeout parameter defines the link supervision timeout for the connection. The Supervision_Timeout in milliseconds shall be larger than (1 + Max_Latency) × Connection_Interval_Max × 2, where Connection_Interval_Max is given in milliseconds. (See [Vol 6] Part B, Section 4.5.2).

The Min_CE_Length and Max_CE_Length parameters provide the Controller with the expected minimum and maximum length of the connection events. The Controller is not required to use these values.

Errors:

See Section 4.5.2 for a list of error types and descriptions.

Type   Condition                                                                    Error code
MC     Another HCI_LE_Create_Connection command is pending in the Controller.       Command
                                                                                    Disallowed
                                                                                    (0x0C)
M      The local device is already connected to the same device address as the      Connection
       advertiser (including two different Resolvable Private Addresses that        Already
       resolve to the same IRK).                                                    Exists
                                                                                    (0x0B)
R      Own_Address_Type is set to 0x00 and the device does not have a public        Invalid HCI
       address.                                                                     Command
                                                                                    Parameters
                                                                                    (0x12)
MC     Own_Address_Type is set to 0x01 and the random address for the device has    Invalid HCI
       not been initialized using the HCI_LE_Set_Random_Address command.            Command
                                                                                    Parameters
                                                                                    (0x12)
R      Own_Address_Type is set to 0x02, Initiator_Filter_Policy is set to 0x00,     Invalid HCI
       the Controller's resolving list does not contain a matching entry, and the   Command
       device does not have a public address.                                       Parameters
                                                                                    (0x12)
R      Own_Address_Type is set to 0x02, Initiator_Filter_Policy is set to 0x01,     Invalid HCI
       and the device does not have a public address.                               Command
                                                                                    Parameters
                                                                                    (0x12)
MC     Own_Address_Type is set to 0x03, Initiator_Filter_Policy is set to 0x00,     Invalid HCI
       the Controller's resolving list does not contain a matching entry, and the   Command
       random address for the device has not been initialized using the             Parameters
       HCI_LE_Set_Random_Address command.                                           (0x12)
MC     Own_Address_Type is set to 0x03, Initiator_Filter_Policy is set to 0x01,     Invalid HCI
       and the random address for the device has not been initialized using the     Command
       HCI_LE_Set_Random_Address command.                                           Parameters
                                                                                    (0x12)
R      Max_CE_Length is less than Min_CE_Length                                     Invalid HCI
                                                                                    Command
                                                                                    Parameters
                                                                                    (0x12)

Event(s) generated (unless masked away):

When the Controller receives the HCI_LE_Create_Connection command, the Controller sends the HCI_Command_Status event to the Host. An HCI_LE_Connection_Complete or HCI_LE_Enhanced_Connection_Complete event shall be generated when a connection is created because of this command or the connection creation procedure is cancelled; until one of these events is generated, the command is considered pending. If a connection is created and the Controller supports the LE Channel Selection Algorithm #2 feature, this event shall be immediately followed by an HCI_LE_Channel_Selection_Algorithm event.

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.