Functions

uint16_t ble_gap_disconnect (uint8_t conn_idx)
 Terminate an existing connection. More...
 
uint16_t ble_gap_disconnect_with_reason (uint8_t conn_idx, ble_gap_disconn_reason_t reason)
 Terminate an existing connection with a specified reason. More...
 
uint16_t ble_gap_conn_param_update (uint8_t conn_idx, const ble_gap_conn_update_param_t *p_conn_param)
 Change the Link Layer connection parameters of a connection. More...
 
uint16_t ble_gap_update_conn_param_method_set (uint8_t conn_idx, bool use_l2cap_flag)
 Set the method for updating connection parameter. More...
 
uint16_t ble_gap_latency_set (uint8_t conn_idx, uint16_t latency)
 Set connection's Latency. More...
 
uint16_t ble_gap_latency_get (uint8_t conn_idx, uint16_t *latency)
 Get connection's Latency. More...
 
uint16_t ble_gap_con_plan_consult (uint8_t *p_act_num, ble_gap_con_plan_tag_t **p_conn_plan_arr)
 Consult BLE connection activity plan situation function. More...
 
uint16_t ble_gap_conn_param_update_reply (uint8_t conn_idx, bool accept)
 Connection param update reply to peer device. More...
 
uint16_t ble_gap_data_length_update (uint8_t conn_idx, uint16_t tx_octects, uint16_t tx_time)
 The suggested maximum transmission packet size and maximum packet transmission time to be used for a given connection. More...
 
uint16_t ble_gap_phy_update (uint8_t conn_idx, uint8_t tx_phys, uint8_t rx_phys, uint8_t phy_opt)
 Set the PHY preferences for the connection identified by the connection index. More...
 
uint16_t ble_gap_conn_info_get (uint8_t conn_idx, ble_gap_get_conn_info_op_t opcode)
 Get the information of the connection. More...
 
uint16_t ble_gap_peer_info_get (uint8_t conn_idx, ble_gap_get_peer_info_op_t opcode)
 Get the information of the peer device. More...
 
uint16_t ble_gap_bond_dev_addr_get (uint8_t conn_idx, ble_gap_bdaddr_t *p_peer_addr)
 Get BD address of the bonded device. More...
 
uint16_t ble_gap_per_sync_trans_param_set (uint8_t conn_idx, uint8_t per_sync_idx, ble_gap_per_sync_trans_param_t *p_per_sync_trans_param)
 Set the parameters used for periodic sync transfer. More...
 
uint16_t ble_gap_per_adv_set_info_trans (uint8_t conn_idx, uint8_t per_adv_idx, uint16_t service_data)
 Send synchronization information about the periodic advertising in an advertising set to a connected device. More...
 
uint16_t ble_gap_per_adv_sync_trans (uint8_t conn_idx, uint8_t per_sync_idx, uint16_t service_data)
 Send synchronization information about the periodic advertising identified by the sync_hdl parameter to a connected device. More...
 
uint16_t ble_gap_conn_cte_trans_param_set (uint8_t conn_idx, ble_gap_set_conn_cte_trans_param_t *param)
 Set connection CTE transmit parameters. More...
 
uint16_t ble_gap_conn_cte_recv_param_set (uint8_t conn_idx, ble_gap_set_conn_cte_rcv_param_t *param)
 Set connection CTE receive parameters. More...
 
uint16_t ble_gap_conn_cte_req_enable_set (uint8_t conn_idx, bool enable_flag, ble_gap_set_conn_cte_req_enable_t *param)
 Set connection CTE request enable. More...
 
uint16_t ble_gap_conn_cte_rsp_enable_set (uint8_t conn_idx, bool enable_flag)
 Set connection CTE response enable. More...
 
uint16_t ble_gap_local_tx_pwr_level_read (uint8_t conn_idx, ble_gap_phy_type_t phy)
 Read the local current and maximum transmit power levels for the connection identified by the conn_idx. More...
 
uint16_t ble_gap_remote_tx_pwr_level_read (uint8_t conn_idx, ble_gap_phy_type_t phy)
 Read the remote transmit power levels for the connection identified by the conn_idx. More...
 
uint16_t ble_gap_path_loss_report_parameter_set (uint8_t conn_idx, ble_gap_set_path_loss_report_param_t *param)
 Set the path loss threshold reporting parameters for the connection identified by the conn_idx. More...
 
uint16_t ble_gap_path_loss_report_enable_set (uint8_t conn_idx, bool enable_flag)
 Enable or disable path loss reporting for the connection identified by the conn_idx. More...
 
uint16_t ble_gap_tx_pwr_change_report_enable_set (uint8_t conn_idx, bool local_enable_flag, bool remote_enable_flag)
 Enable or disable the reporting of transmit power level changes in the local and remote for the connection identified by the conn_idx. More...
 
int ble_gap_ranging_start (uint8_t con_idx, ble_gap_ranging_param_t *param)
 start ranging procedure. More...
 
void ble_gap_register_ranging_ind_cb (void(*cb)(uint8_t con_idx, const ble_gap_ranging_ind_t *ind))
 Register ranging indication event callback. More...
 
void ble_gap_register_ranging_sample_report_cb (void(*cb)(uint8_t con_idx, const ble_gap_ranging_sample_report_ind_t *ind))
 Register ranging sample report event callback. More...
 
void ble_gap_register_ranging_cmp_ind_cb (void(*cb)(uint8_t con_idx, const ble_gap_ranging_cmp_ind_t *ind))
 Register ranging complete event callback. More...
 
uint16_t ble_subrate_set_host_feature (bool supp_flag)
 Set Subrate feature. More...
 
uint16_t ble_gap_default_subrate_param_set (const ble_gap_dft_subrate_param_t *p_subrate_param)
 Set Default Subrate command. More...
 
uint16_t ble_gap_subrate_request (uint8_t conn_idx, const ble_gap_subrate_req_t *p_subrate_req)
 Subrate Request command. More...
 
void ble_gap_get_local_addr_by_conidx (uint8_t conidx, uint8_t *p_addr)
 Get BD address of the local device by the conidx. More...
 

Detailed Description

Function Documentation

◆ ble_gap_bond_dev_addr_get()

uint16_t ble_gap_bond_dev_addr_get ( uint8_t  conn_idx,
ble_gap_bdaddr_t p_peer_addr 
)

Get BD address of the bonded device.

Parameters
[in]conn_idxThe index of connection.
[in]p_peer_addrPointer to the peer BD addrss
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_POINTER_NULLInvalid pointer supplied.

◆ ble_gap_con_plan_consult()

uint16_t ble_gap_con_plan_consult ( uint8_t *  p_act_num,
ble_gap_con_plan_tag_t **  p_conn_plan_arr 
)

Consult BLE connection activity plan situation function.

Note
This function should be called when connection established and no periodic advertising exists.
Parameters
[out]p_act_numPointer to the number of existing connection activities.
[out]p_conn_plan_arrPointer to the global array that stores planned connection activities.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_POINTER_NULLInvalid pointer supplied.

◆ ble_gap_conn_cte_recv_param_set()

uint16_t ble_gap_conn_cte_recv_param_set ( uint8_t  conn_idx,
ble_gap_set_conn_cte_rcv_param_t param 
)

Set connection CTE receive parameters.

Parameters
[in]conn_idxThe index of connection.
[in]paramSet connection CTE receive parameters info, see ble_gap_set_conn_cte_rcv_param_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_conn_cte_req_enable_set()

uint16_t ble_gap_conn_cte_req_enable_set ( uint8_t  conn_idx,
bool  enable_flag,
ble_gap_set_conn_cte_req_enable_t param 
)

Set connection CTE request enable.

Parameters
[in]conn_idxThe index of connection.
[in]enable_flagWheter to request the cte for the connection. If enable_flag is set to false, the param shall be NULL.
[in]paramSet connection CTE request enable info, see ble_gap_set_conn_cte_req_enable_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_conn_cte_rsp_enable_set()

uint16_t ble_gap_conn_cte_rsp_enable_set ( uint8_t  conn_idx,
bool  enable_flag 
)

Set connection CTE response enable.

Parameters
[in]conn_idxThe index of connection.
[in]enable_flagWheter to response the cte req for the connection.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_conn_cte_trans_param_set()

uint16_t ble_gap_conn_cte_trans_param_set ( uint8_t  conn_idx,
ble_gap_set_conn_cte_trans_param_t param 
)

Set connection CTE transmit parameters.

Parameters
[in]conn_idxThe index of connection.
[in]paramSet connection CTE transmit parameters info, see ble_gap_set_conn_cte_trans_param_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_conn_info_get()

uint16_t ble_gap_conn_info_get ( uint8_t  conn_idx,
ble_gap_get_conn_info_op_t  opcode 
)

Get the information of the connection.

Parameters
[in]conn_idxThe index of connection.
[in]opcodeThe operation code. See ble_gap_get_conn_info_op_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_conn_param_update()

uint16_t ble_gap_conn_param_update ( uint8_t  conn_idx,
const ble_gap_conn_update_param_t p_conn_param 
)

Change the Link Layer connection parameters of a connection.

Parameters
[in]conn_idxThe index of connection.
[in]p_conn_paramThe new connection param.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_POINTER_NULLInvalid pointer supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_conn_param_update_reply()

uint16_t ble_gap_conn_param_update_reply ( uint8_t  conn_idx,
bool  accept 
)

Connection param update reply to peer device.

Parameters
[in]conn_idxThe index of connection.
[in]acceptTrue to accept connection parameters, false to reject.
Return values
SDK_SUCCESSOperation is success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_POINTER_NULLInvalid pointer supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_data_length_update()

uint16_t ble_gap_data_length_update ( uint8_t  conn_idx,
uint16_t  tx_octects,
uint16_t  tx_time 
)

The suggested maximum transmission packet size and maximum packet transmission time to be used for a given connection.

Parameters
[in]conn_idxThe index of connection.
[in]tx_octectsPreferred maximum number of payload octets that the local Controller should include in a single Link Layer packet on this connection. Range 0x001B-0x00FB (all other values reserved for future use).
[in]tx_timePreferred maximum number of microseconds that the local Controller should use to transmit a single Link Layer packet on this connection. Range 0x0148-0x4290 (all other values reserved for future use).
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_default_subrate_param_set()

uint16_t ble_gap_default_subrate_param_set ( const ble_gap_dft_subrate_param_t p_subrate_param)

Set Default Subrate command.

Note
This API is asynchronous.
Once Default Subrate command set completed, the event BLE_GAPC_EVT_DFT_SUBRATE_SET will be called.
Parameters
[in]p_subrate_paramDefault subrate param, see ble_gap_dft_subrate_param_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_POINTER_NULLInvalid pointer supplied.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_disconnect()

uint16_t ble_gap_disconnect ( uint8_t  conn_idx)

Terminate an existing connection.

Parameters
[in]conn_idxThe index of connection.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_disconnect_with_reason()

uint16_t ble_gap_disconnect_with_reason ( uint8_t  conn_idx,
ble_gap_disconn_reason_t  reason 
)

Terminate an existing connection with a specified reason.

Parameters
[in]conn_idxThe index of connection.
[in]reasonThe specified reason.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_get_local_addr_by_conidx()

void ble_gap_get_local_addr_by_conidx ( uint8_t  conidx,
uint8_t *  p_addr 
)

Get BD address of the local device by the conidx.

Parameters
[in]conidxThe index of conncetion.
[in]p_addrPointer to the local BD addrss

◆ ble_gap_latency_get()

uint16_t ble_gap_latency_get ( uint8_t  conn_idx,
uint16_t *  latency 
)

Get connection's Latency.

Note
This function is used to get connection's Latency.
Parameters
[in]conn_idxThe index of connection.
[in]latencyPointer to the latency of connection.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_latency_set()

uint16_t ble_gap_latency_set ( uint8_t  conn_idx,
uint16_t  latency 
)

Set connection's Latency.

Note
The latency shall be set to X value by LLCP firstly, then uses this API to change the latency in [0, X].
Parameters
[in]conn_idxThe index of connection.
[in]latencyThe latency of connection.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_local_tx_pwr_level_read()

uint16_t ble_gap_local_tx_pwr_level_read ( uint8_t  conn_idx,
ble_gap_phy_type_t  phy 
)

Read the local current and maximum transmit power levels for the connection identified by the conn_idx.

Note
This API is asynchronous.
Once the local transmit power level has been available, the event BLE_GAPC_EVT_LOCAL_TX_POWER_READ will be called.
Parameters
[in]conn_idxThe index of connection.
[in]phyRead the transmit power levels on which phy, see ble_gap_phy_type_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_path_loss_report_enable_set()

uint16_t ble_gap_path_loss_report_enable_set ( uint8_t  conn_idx,
bool  enable_flag 
)

Enable or disable path loss reporting for the connection identified by the conn_idx.

Note
This API is asynchronous.
Once a path loss threshold crossing, the event BLE_GAPC_EVT_PATH_LOSS_THRESHOLD_REPORT will be called.
Parameters
[in]conn_idxThe index of connection.
[in]enable_flagThe enable flag for reporting path loss.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_path_loss_report_parameter_set()

uint16_t ble_gap_path_loss_report_parameter_set ( uint8_t  conn_idx,
ble_gap_set_path_loss_report_param_t param 
)

Set the path loss threshold reporting parameters for the connection identified by the conn_idx.

Parameters
[in]conn_idxThe index of connection.
[in]paramSet path loss report parameter, see ble_gap_set_path_loss_report_param_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_peer_info_get()

uint16_t ble_gap_peer_info_get ( uint8_t  conn_idx,
ble_gap_get_peer_info_op_t  opcode 
)

Get the information of the peer device.

Parameters
[in]conn_idxThe index of connection.
[in]opcodeThe operation code. See ble_gap_get_peer_info_op_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_per_adv_set_info_trans()

uint16_t ble_gap_per_adv_set_info_trans ( uint8_t  conn_idx,
uint8_t  per_adv_idx,
uint16_t  service_data 
)

Send synchronization information about the periodic advertising in an advertising set to a connected device.

Note
Need to get the feature of peer device before invoke this function.
Parameters
[in]conn_idxThe index of connection.
[in]per_adv_idxThe index of per adv.
[in]service_dataIdentify the periodic advertisement to the peer device.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_per_adv_sync_trans()

uint16_t ble_gap_per_adv_sync_trans ( uint8_t  conn_idx,
uint8_t  per_sync_idx,
uint16_t  service_data 
)

Send synchronization information about the periodic advertising identified by the sync_hdl parameter to a connected device.

Parameters
[in]conn_idxThe index of connection.
[in]per_sync_idxThe index of the periodic syncronization instance.
[in]service_dataIdentify the periodic advertisement to the peer device.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_per_sync_trans_param_set()

uint16_t ble_gap_per_sync_trans_param_set ( uint8_t  conn_idx,
uint8_t  per_sync_idx,
ble_gap_per_sync_trans_param_t p_per_sync_trans_param 
)

Set the parameters used for periodic sync transfer.

Parameters
[in]conn_idxThe index of connection.
[in]per_sync_idxPeriodic synchronization index (range is 0 to 4).
[in]p_per_sync_trans_paramPeriodic synchronization transfer parameters.
Return values
SDK_SUCCESSOperation is successful.
SDK_ERR_POINTER_NULLInvalid pointer supplied.
SDK_ERR_DISALLOWEDOperation is disallowed.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_phy_update()

uint16_t ble_gap_phy_update ( uint8_t  conn_idx,
uint8_t  tx_phys,
uint8_t  rx_phys,
uint8_t  phy_opt 
)

Set the PHY preferences for the connection identified by the connection index.

Parameters
[in]conn_idxThe index of connection.
[in]tx_physA bit field that indicates the transmitter PHYs that the Host prefers the Controller to use (see ble_gap_phy_type_t).
[in]rx_physA bit field that indicates the receiver PHYs that the Host prefers the Controller to use (see ble_gap_phy_type_t).
[in]phy_optA bit field that allows the Host to specify options for PHYs (see ble_gap_phy_options_t).
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_ranging_start()

int ble_gap_ranging_start ( uint8_t  con_idx,
ble_gap_ranging_param_t param 
)

start ranging procedure.

Parameters
[in]con_idxThe index of connection.
[in]paramRanging parameter, see ble_gap_ranging_param_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_register_ranging_cmp_ind_cb()

void ble_gap_register_ranging_cmp_ind_cb ( void(*)(uint8_t con_idx, const ble_gap_ranging_cmp_ind_t *ind)  cb)

Register ranging complete event callback.

Parameters
[in]cbThe callback function.
Return values
:void.

◆ ble_gap_register_ranging_ind_cb()

void ble_gap_register_ranging_ind_cb ( void(*)(uint8_t con_idx, const ble_gap_ranging_ind_t *ind)  cb)

Register ranging indication event callback.

Parameters
[in]cbThe callback function.
Return values
:void.

◆ ble_gap_register_ranging_sample_report_cb()

void ble_gap_register_ranging_sample_report_cb ( void(*)(uint8_t con_idx, const ble_gap_ranging_sample_report_ind_t *ind)  cb)

Register ranging sample report event callback.

Parameters
[in]cbThe callback function.
Return values
:void.

◆ ble_gap_remote_tx_pwr_level_read()

uint16_t ble_gap_remote_tx_pwr_level_read ( uint8_t  conn_idx,
ble_gap_phy_type_t  phy 
)

Read the remote transmit power levels for the connection identified by the conn_idx.

Note
This API is asynchronous.
Once the remote transmit power level has been available, the event BLE_GAPC_EVT_REMOTE_TX_POWER_READ will be called.
Parameters
[in]conn_idxThe index of connection.
[in]phyRead the transmit power levels on which phy, see ble_gap_phy_type_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_subrate_request()

uint16_t ble_gap_subrate_request ( uint8_t  conn_idx,
const ble_gap_subrate_req_t p_subrate_req 
)

Subrate Request command.

Note
This API is asynchronous.
Once Subrate Request completed, the event BLE_GAPC_EVT_SUBRATE_CHANGE_IND will be called.
Parameters
[in]conn_idxThe index of conncetion.
[in]p_subrate_reqSubrate request param, see ble_gap_subrate_req_t.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.
SDK_ERR_POINTER_NULLInvalid pointer supplied.
SDK_ERR_INVALID_PARAMInvalid parameter supplied.
SDK_ERR_NO_RESOURCESNot enough resources.

◆ ble_gap_tx_pwr_change_report_enable_set()

uint16_t ble_gap_tx_pwr_change_report_enable_set ( uint8_t  conn_idx,
bool  local_enable_flag,
bool  remote_enable_flag 
)

Enable or disable the reporting of transmit power level changes in the local and remote for the connection identified by the conn_idx.

Note
This API is asynchronous.
Once the transmit power changes, the event BLE_GAPC_EVT_TX_POWER_CHANGE_REPORT will be called.
Parameters
[in]conn_idxThe index of connection.
[in]local_enable_flagThe enable flag for reporting transmit power level changes in the local.
[in]remote_enable_flagThe enable flag for reporting transmit power level changes in the remote.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_gap_update_conn_param_method_set()

uint16_t ble_gap_update_conn_param_method_set ( uint8_t  conn_idx,
bool  use_l2cap_flag 
)

Set the method for updating connection parameter.

Parameters
[in]conn_idxConnection index.
[in]use_l2cap_flagPreferred to use l2cap to update connection parameter.
Return values
SDK_SUCCESSOperation is Success.
SDK_ERR_INVALID_CONN_IDXInvalid connection index supplied.

◆ ble_subrate_set_host_feature()

uint16_t ble_subrate_set_host_feature ( bool  supp_flag)

Set Subrate feature.

Note
shall set Subrate feature before subrate request.
Parameters
[in]supp_flagsupport flag.
Return values
SDK_SUCCESSOperation is Success.