nrfxlib API 2.7.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_v5.4, Vol 4, Part E, Section 7.8.12

The HCI_LE_Create_Connection command is used to create an 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 recommenda- tions from the Host on how long (LE_Scan_Window) and how frequently (LE_Scan_Interval) the Controller should scan. The LE_Scan_Window param- eter 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 not used, 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 Min_CE_Length parameter shall be less than or equal to the Max_CE_Length parameter. The Controller is not required to use these values. If the Host issues this command when another HCI_LE_Create_Connection command is pending in the Controller, the Controller shall return the error code Command Disallowed (0x0C).

If the 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 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 the Own_Address_Type parameter is set to 0x02, the Initiator_Filter_Policy parameter is set to 0x00, 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 Own_Address_Type parameter is set to 0x02, the Initiator_Filter_Policy parameter is set to 0x01, 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 Own_Address_Type parameter is set to 0x03, the Initiator_Filter_Policy parameter is set to 0x00, 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). If the Own_Address_Type parameter is set to 0x03, the Initiator_Filter_Policy 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).

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.