mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(ble/bluedroid): Supported BLE bluedroid host pawr connection
This commit is contained in:
@@ -671,7 +671,7 @@ void btm_ble_initiate_select_conn(BD_ADDR bda)
|
||||
BTM_TRACE_EVENT ("btm_ble_initiate_select_conn");
|
||||
|
||||
/* use direct connection procedure to initiate connection */
|
||||
if (!L2CA_ConnectFixedChnl(L2CAP_ATT_CID, bda, BLE_ADDR_UNKNOWN_TYPE, FALSE)) {
|
||||
if (!L2CA_ConnectFixedChnl(L2CAP_ATT_CID, bda, BLE_ADDR_UNKNOWN_TYPE, FALSE, FALSE, 0xFF, 0xFF)) {
|
||||
BTM_TRACE_ERROR("btm_ble_initiate_select_conn failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,6 +702,9 @@ struct tBTM_SEC_DEV_REC{
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
tBTM_EXT_CONN_PARAMS ext_conn_params;
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BOOLEAN is_pawr_synced;
|
||||
UINT8 adv_handle;
|
||||
UINT8 subevent;
|
||||
#endif
|
||||
|
||||
// btla-specific ++
|
||||
|
||||
@@ -764,7 +764,7 @@ BOOLEAN gap_ble_accept_cl_operation(BD_ADDR peer_bda, UINT16 uuid, tGAP_BLE_CMPL
|
||||
}
|
||||
|
||||
/* hold the link here */
|
||||
if (!GATT_Connect(gap_cb.gatt_if, p_clcb->bda, BLE_ADDR_UNKNOWN_TYPE, TRUE, BT_TRANSPORT_LE, FALSE)) {
|
||||
if (!GATT_Connect(gap_cb.gatt_if, p_clcb->bda, BLE_ADDR_UNKNOWN_TYPE, TRUE, BT_TRANSPORT_LE, FALSE, FALSE, 0xFF, 0xFF)) {
|
||||
return started;
|
||||
}
|
||||
|
||||
|
||||
@@ -1453,7 +1453,8 @@ void GATT_StartIf (tGATT_IF gatt_if)
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type,
|
||||
BOOLEAN is_direct, tBT_TRANSPORT transport, BOOLEAN is_aux)
|
||||
BOOLEAN is_direct, tBT_TRANSPORT transport, BOOLEAN is_aux,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent)
|
||||
{
|
||||
tGATT_REG *p_reg;
|
||||
BOOLEAN status = FALSE;
|
||||
@@ -1467,7 +1468,7 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_
|
||||
}
|
||||
|
||||
if (is_direct) {
|
||||
status = gatt_act_connect (p_reg, bd_addr, bd_addr_type, transport, is_aux);
|
||||
status = gatt_act_connect (p_reg, bd_addr, bd_addr_type, transport, is_aux, is_pawr_synced, adv_handle, subevent);
|
||||
} else {
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
if (transport == BT_TRANSPORT_LE) {
|
||||
|
||||
@@ -98,7 +98,7 @@ UINT16 gatt_profile_find_conn_id_by_bd_addr(BD_ADDR remote_bda)
|
||||
**
|
||||
** Description find clcb by Connection ID
|
||||
**
|
||||
** Returns Pointer to the found link conenction control block.
|
||||
** Returns Pointer to the found link connection control block.
|
||||
**
|
||||
*******************************************************************************/
|
||||
static tGATT_PROFILE_CLCB *gatt_profile_find_clcb_by_conn_id(UINT16 conn_id)
|
||||
@@ -119,9 +119,9 @@ static tGATT_PROFILE_CLCB *gatt_profile_find_clcb_by_conn_id(UINT16 conn_id)
|
||||
**
|
||||
** Function gatt_profile_find_clcb_by_bd_addr
|
||||
**
|
||||
** Description The function searches all LCBs with macthing bd address.
|
||||
** Description The function searches all LCBs with matching bd address.
|
||||
**
|
||||
** Returns Pointer to the found link conenction control block.
|
||||
** Returns Pointer to the found link connection control block.
|
||||
**
|
||||
*******************************************************************************/
|
||||
static tGATT_PROFILE_CLCB *gatt_profile_find_clcb_by_bd_addr(BD_ADDR bda, tBT_TRANSPORT transport)
|
||||
@@ -148,7 +148,7 @@ static tGATT_PROFILE_CLCB *gatt_profile_find_clcb_by_bd_addr(BD_ADDR bda, tBT_TR
|
||||
** Returns NULL if not found. Otherwise pointer to the connection link block.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_PROFILE_CLCB *gatt_profile_clcb_alloc (UINT16 conn_id, BD_ADDR bda, tBT_TRANSPORT tranport)
|
||||
tGATT_PROFILE_CLCB *gatt_profile_clcb_alloc (UINT16 conn_id, BD_ADDR bda, tBT_TRANSPORT transport)
|
||||
{
|
||||
UINT8 i_clcb = 0;
|
||||
tGATT_PROFILE_CLCB *p_clcb = NULL;
|
||||
@@ -158,7 +158,7 @@ tGATT_PROFILE_CLCB *gatt_profile_clcb_alloc (UINT16 conn_id, BD_ADDR bda, tBT_TR
|
||||
p_clcb->in_use = TRUE;
|
||||
p_clcb->conn_id = conn_id;
|
||||
p_clcb->connected = TRUE;
|
||||
p_clcb->transport = tranport;
|
||||
p_clcb->transport = transport;
|
||||
memcpy (p_clcb->bda, bda, BD_ADDR_LEN);
|
||||
break;
|
||||
}
|
||||
@@ -435,7 +435,7 @@ static void gatt_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
|
||||
**
|
||||
** Function gatt_profile_db_init
|
||||
**
|
||||
** Description Initializa the GATT profile attribute database.
|
||||
** Description Initialize the GATT profile attribute database.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void gatt_profile_db_init (void)
|
||||
@@ -684,7 +684,7 @@ void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, BOOLEAN enable, tBT_TRANSP
|
||||
p_clcb->connected = TRUE;
|
||||
}
|
||||
/* hold the link here */
|
||||
GATT_Connect(gatt_cb.gatt_if, remote_bda, BLE_ADDR_UNKNOWN_TYPE, TRUE, transport, FALSE);
|
||||
GATT_Connect(gatt_cb.gatt_if, remote_bda, BLE_ADDR_UNKNOWN_TYPE, TRUE, transport, FALSE, FALSE, 0xFF, 0xFF);
|
||||
p_clcb->ccc_stage = GATT_SVC_CHANGED_CONNECTING;
|
||||
|
||||
if (!p_clcb->connected) {
|
||||
|
||||
@@ -220,7 +220,8 @@ void gatt_free(void)
|
||||
** Returns TRUE if connection is started, otherwise return FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN gatt_connect (BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, tGATT_TCB *p_tcb, tBT_TRANSPORT transport, BOOLEAN is_aux)
|
||||
BOOLEAN gatt_connect (BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, tGATT_TCB *p_tcb, tBT_TRANSPORT transport, BOOLEAN is_aux,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent)
|
||||
{
|
||||
BOOLEAN gatt_ret = FALSE;
|
||||
|
||||
@@ -230,7 +231,7 @@ BOOLEAN gatt_connect (BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, tGATT_TCB *p
|
||||
|
||||
if (transport == BT_TRANSPORT_LE) {
|
||||
p_tcb->att_lcid = L2CAP_ATT_CID;
|
||||
gatt_ret = L2CA_ConnectFixedChnl (L2CAP_ATT_CID, rem_bda, bd_addr_type, is_aux);
|
||||
gatt_ret = L2CA_ConnectFixedChnl (L2CAP_ATT_CID, rem_bda, bd_addr_type, is_aux, is_pawr_synced, adv_handle, subevent);
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
} else {
|
||||
if ((p_tcb->att_lcid = L2CA_ConnectReq(BT_PSM_ATT, rem_bda)) != 0) {
|
||||
@@ -376,7 +377,8 @@ void gatt_update_app_use_link_flag (tGATT_IF gatt_if, tGATT_TCB *p_tcb, BOOLEAN
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr,
|
||||
tBLE_ADDR_TYPE bd_addr_type, tBT_TRANSPORT transport, BOOLEAN is_aux)
|
||||
tBLE_ADDR_TYPE bd_addr_type, tBT_TRANSPORT transport, BOOLEAN is_aux,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent)
|
||||
{
|
||||
BOOLEAN ret = FALSE;
|
||||
tGATT_TCB *p_tcb;
|
||||
@@ -389,7 +391,7 @@ BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr,
|
||||
/* before link down, another app try to open a GATT connection */
|
||||
if (st == GATT_CH_OPEN && gatt_num_apps_hold_link(p_tcb) == 0 &&
|
||||
transport == BT_TRANSPORT_LE ) {
|
||||
if (!gatt_connect(bd_addr, bd_addr_type, p_tcb, transport, is_aux)) {
|
||||
if (!gatt_connect(bd_addr, bd_addr_type, p_tcb, transport, is_aux, is_pawr_synced, adv_handle, subevent)) {
|
||||
ret = FALSE;
|
||||
}
|
||||
} else if (st == GATT_CH_CLOSING) {
|
||||
@@ -400,7 +402,7 @@ BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr,
|
||||
}
|
||||
} else {
|
||||
if ((p_tcb = gatt_allocate_tcb_by_bdaddr(bd_addr, transport)) != NULL) {
|
||||
if (!gatt_connect(bd_addr, bd_addr_type, p_tcb, transport, is_aux)) {
|
||||
if (!gatt_connect(bd_addr, bd_addr_type, p_tcb, transport, is_aux, is_pawr_synced, adv_handle, subevent)) {
|
||||
GATT_TRACE_ERROR("gatt_connect failed");
|
||||
|
||||
// code enter here if create connection failed. if disconnect after connection, code will not enter here
|
||||
|
||||
@@ -597,8 +597,8 @@ extern void gatt_free(void);
|
||||
|
||||
/* from gatt_main.c */
|
||||
extern BOOLEAN gatt_disconnect (tGATT_TCB *p_tcb);
|
||||
extern BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type, tBT_TRANSPORT transport, BOOLEAN is_aux);
|
||||
extern BOOLEAN gatt_connect (BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, tGATT_TCB *p_tcb, tBT_TRANSPORT transport, BOOLEAN is_aux);
|
||||
extern BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type, tBT_TRANSPORT transport, BOOLEAN is_aux, BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent);
|
||||
extern BOOLEAN gatt_connect (BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, tGATT_TCB *p_tcb, tBT_TRANSPORT transport, BOOLEAN is_aux, BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent);
|
||||
extern void gatt_data_process (tGATT_TCB *p_tcb, BT_HDR *p_buf);
|
||||
extern void gatt_update_app_use_link_flag ( tGATT_IF gatt_if, tGATT_TCB *p_tcb, BOOLEAN is_add, BOOLEAN check_acl_link);
|
||||
|
||||
|
||||
@@ -1697,6 +1697,82 @@ BOOLEAN btsnd_hcic_ble_create_ext_conn(tHCI_CreatExtConn *p_conn)
|
||||
|
||||
}
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
BOOLEAN btsnd_hcic_ble_create_ext_conn_v2(tHCI_CreatExtConn *p_conn)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
tHCI_ExtConnParams *params;
|
||||
HCI_TRACE_EVENT("%s", __func__);
|
||||
uint8_t size = HCIC_PARAM_SIZE_EXT_CONN_CREATE_BASE + 2;
|
||||
|
||||
if (p_conn->init_phy_mask & 0x01) {
|
||||
size += sizeof(tHCI_ExtConnParams);
|
||||
}
|
||||
|
||||
if (p_conn->init_phy_mask & 0x02) {
|
||||
size += sizeof(tHCI_ExtConnParams);
|
||||
}
|
||||
|
||||
if (p_conn->init_phy_mask & 0x04) {
|
||||
size += sizeof(tHCI_ExtConnParams);
|
||||
}
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, size);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_EXT_CREATE_CONN_V2);
|
||||
UINT8_TO_STREAM(pp, size);
|
||||
UINT8_TO_STREAM(pp, p_conn->adv_handle);
|
||||
UINT8_TO_STREAM(pp, p_conn->subevent);
|
||||
UINT8_TO_STREAM(pp, p_conn->filter_policy);
|
||||
UINT8_TO_STREAM(pp, p_conn->filter_policy);
|
||||
UINT8_TO_STREAM(pp, p_conn->own_addr_type);
|
||||
UINT8_TO_STREAM(pp, p_conn->peer_addr_type);
|
||||
BDADDR_TO_STREAM(pp, p_conn->peer_addr);
|
||||
UINT8_TO_STREAM(pp, p_conn->init_phy_mask);
|
||||
|
||||
if (p_conn->init_phy_mask & 0x01) {
|
||||
params = &p_conn->params[0];
|
||||
UINT16_TO_STREAM(pp, params->scan_interval);
|
||||
UINT16_TO_STREAM(pp, params->scan_window);
|
||||
UINT16_TO_STREAM(pp, params->conn_interval_min);
|
||||
UINT16_TO_STREAM(pp, params->conn_interval_max);
|
||||
UINT16_TO_STREAM(pp, params->conn_latency);
|
||||
UINT16_TO_STREAM(pp, params->sup_timeout);
|
||||
UINT16_TO_STREAM(pp, params->min_ce_len ? params->min_ce_len : BLE_CE_LEN_MIN);
|
||||
UINT16_TO_STREAM(pp, params->max_ce_len ? params->max_ce_len : BLE_CE_LEN_MIN);
|
||||
}
|
||||
|
||||
if (p_conn->init_phy_mask & 0x02) {
|
||||
params = &p_conn->params[1];
|
||||
UINT16_TO_STREAM(pp, params->scan_interval);
|
||||
UINT16_TO_STREAM(pp, params->scan_window);
|
||||
UINT16_TO_STREAM(pp, params->conn_interval_min);
|
||||
UINT16_TO_STREAM(pp, params->conn_interval_max);
|
||||
UINT16_TO_STREAM(pp, params->conn_latency);
|
||||
UINT16_TO_STREAM(pp, params->sup_timeout);
|
||||
UINT16_TO_STREAM(pp, params->min_ce_len ? params->min_ce_len : BLE_CE_LEN_MIN);
|
||||
UINT16_TO_STREAM(pp, params->max_ce_len ? params->max_ce_len : BLE_CE_LEN_MIN);
|
||||
}
|
||||
|
||||
if (p_conn->init_phy_mask & 0x04) {
|
||||
params = &p_conn->params[2];
|
||||
UINT16_TO_STREAM(pp, params->scan_interval);
|
||||
UINT16_TO_STREAM(pp, params->scan_window);
|
||||
UINT16_TO_STREAM(pp, params->conn_interval_min);
|
||||
UINT16_TO_STREAM(pp, params->conn_interval_max);
|
||||
UINT16_TO_STREAM(pp, params->conn_latency);
|
||||
UINT16_TO_STREAM(pp, params->sup_timeout);
|
||||
UINT16_TO_STREAM(pp, params->min_ce_len ? params->min_ce_len : BLE_CE_LEN_MIN);
|
||||
UINT16_TO_STREAM(pp, params->max_ce_len ? params->max_ce_len : BLE_CE_LEN_MIN);
|
||||
}
|
||||
|
||||
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
BOOLEAN btsnd_hcic_ble_periodic_adv_create_sync(UINT8 option, UINT8 adv_sid,
|
||||
UINT8 adv_addr_type, BD_ADDR adv_addr,
|
||||
|
||||
@@ -1140,7 +1140,8 @@ extern void GATT_StartIf (tGATT_IF gatt_if);
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type,
|
||||
BOOLEAN is_direct, tBT_TRANSPORT transport, BOOLEAN is_aux);
|
||||
BOOLEAN is_direct, tBT_TRANSPORT transport, BOOLEAN is_aux,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -451,6 +451,7 @@
|
||||
#define HCI_BLE_SET_PERIOD_ADV_SUBEVT_DATA (0x0082 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_SET_PERIOD_ADV_RSP_DATA (0x0083 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_SET_PERIOD_SYNC_SUBEVT (0x0084 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_EXT_CREATE_CONN_V2 (0x0085 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_SET_PERIOD_ADV_PARAMS_V2 (0x0086 | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
|
||||
@@ -947,6 +947,10 @@ typedef struct {
|
||||
} tHCI_ExtConnParams;
|
||||
|
||||
typedef struct {
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT8 adv_handle;
|
||||
UINT8 subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT8 filter_policy;
|
||||
UINT8 own_addr_type;
|
||||
UINT8 peer_addr_type;
|
||||
@@ -1032,6 +1036,10 @@ UINT8 btsnd_hcic_ble_ext_scan_enable(UINT8 enable, UINT8 filter_dups,
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_create_ext_conn(tHCI_CreatExtConn *p_conn);
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
BOOLEAN btsnd_hcic_ble_create_ext_conn_v2(tHCI_CreatExtConn *p_conn);
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_periodic_adv_create_sync(UINT8 filter_policy, UINT8 adv_sid,
|
||||
UINT8 adv_addr_type, BD_ADDR adv_addr,
|
||||
UINT16 sync_timeout, UINT8 sync_cte_type);
|
||||
|
||||
@@ -121,7 +121,7 @@ typedef UINT8 tL2CAP_CHNL_DATA_RATE;
|
||||
#define L2CAP_FCR_CHAN_OPT_ALL_MASK (L2CAP_FCR_CHAN_OPT_BASIC | L2CAP_FCR_CHAN_OPT_ERTM | L2CAP_FCR_CHAN_OPT_STREAM)
|
||||
|
||||
/* Validity check for PSM. PSM values must be odd. Also, all PSM values must
|
||||
** be assigned such that the least significant bit of the most sigificant
|
||||
** be assigned such that the least significant bit of the most significant
|
||||
** octet equals zero.
|
||||
*/
|
||||
#define L2C_INVALID_PSM(psm) (((psm) & 0x0101) != 0x0001)
|
||||
@@ -938,7 +938,7 @@ typedef struct {
|
||||
**
|
||||
** Parameters: tL2CAP_UCD_CB_INFO
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info );
|
||||
@@ -951,7 +951,7 @@ extern BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info );
|
||||
**
|
||||
** Parameters: PSM
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN L2CA_UcdDeregister ( UINT16 psm );
|
||||
@@ -968,7 +968,7 @@ extern BOOLEAN L2CA_UcdDeregister ( UINT16 psm );
|
||||
** L2CAP_UCD_INFO_TYPE_MTU
|
||||
**
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type );
|
||||
@@ -1001,7 +1001,7 @@ extern UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UIN
|
||||
** Parameters: BD Addr
|
||||
** Timeout in second
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout );
|
||||
@@ -1089,7 +1089,8 @@ extern BOOLEAN L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_R
|
||||
** Return value: TRUE if connection started
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type, BOOLEAN is_aux);
|
||||
extern BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type, BOOLEAN is_aux,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
||||
@@ -379,6 +379,11 @@ typedef struct t_l2c_linkcb {
|
||||
BOOLEAN in_use; /* TRUE when in use, FALSE when not */
|
||||
tL2C_LINK_STATE link_state;
|
||||
BOOLEAN is_aux; /* This variable used for BLE 5.0 or higher version when do auxiliary connection */
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
BOOLEAN is_pawr_synced;
|
||||
UINT8 adv_handle;
|
||||
UINT8 subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
TIMER_LIST_ENT timer_entry; /* Timer list entry for timeout evt */
|
||||
UINT16 handle; /* The handle used with LM */
|
||||
|
||||
|
||||
@@ -1649,7 +1649,8 @@ BOOLEAN L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_REG *p_f
|
||||
** Return value: TRUE if connection started
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, BOOLEAN is_aux)
|
||||
BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, BOOLEAN is_aux,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent)
|
||||
{
|
||||
tL2C_LCB *p_lcb;
|
||||
tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
|
||||
@@ -1738,6 +1739,11 @@ BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda, tBLE_ADDR_TYPE
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
p_lcb->is_aux = is_aux;
|
||||
p_lcb->open_addr_type = bd_addr_type;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
p_lcb->is_pawr_synced = is_pawr_synced;
|
||||
p_lcb->adv_handle = adv_handle;
|
||||
p_lcb->subevent = subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#endif
|
||||
if (!l2cu_create_conn(p_lcb, transport)) {
|
||||
L2CAP_TRACE_WARNING ("%s() - create_conn failed", __func__);
|
||||
|
||||
@@ -1020,6 +1020,10 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
}
|
||||
|
||||
tHCI_CreatExtConn aux_conn = {0};
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
aux_conn.adv_handle = p_lcb->adv_handle;
|
||||
aux_conn.subevent = p_lcb->subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
aux_conn.filter_policy = FALSE;
|
||||
aux_conn.own_addr_type = own_addr_type;
|
||||
aux_conn.peer_addr_type = peer_addr_type;
|
||||
@@ -1041,9 +1045,19 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
memcpy (l2cb.ble_connecting_bda, p_lcb->remote_bd_addr, BD_ADDR_LEN);
|
||||
btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK, link_timeout);
|
||||
btm_ble_set_conn_st (BLE_DIR_CONN);
|
||||
if(!btsnd_hcic_ble_create_ext_conn(&aux_conn)) {
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initiate Aux connection failed, no resources");
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
if (p_lcb->is_pawr_synced) {
|
||||
if(!btsnd_hcic_ble_create_ext_conn_v2(&aux_conn)) {
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initiate pawr sync connection failed, no resources");
|
||||
}
|
||||
} else
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
{
|
||||
if(!btsnd_hcic_ble_create_ext_conn(&aux_conn)) {
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initiate Aux connection failed, no resources");
|
||||
}
|
||||
}
|
||||
#else
|
||||
L2CAP_TRACE_ERROR("BLE 5.0 not support!\n");
|
||||
|
||||
@@ -161,7 +161,7 @@ tSMP_STATUS SMP_Pair (BD_ADDR bd_addr)
|
||||
|
||||
memcpy (p_cb->pairing_bda, bd_addr, BD_ADDR_LEN);
|
||||
|
||||
if (!L2CA_ConnectFixedChnl (L2CAP_SMP_CID, bd_addr, BLE_ADDR_UNKNOWN_TYPE, FALSE)) {
|
||||
if (!L2CA_ConnectFixedChnl (L2CAP_SMP_CID, bd_addr, BLE_ADDR_UNKNOWN_TYPE, FALSE, FALSE, 0xFF, 0xFF)) {
|
||||
SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.\n", __FUNCTION__);
|
||||
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
|
||||
return status;
|
||||
@@ -205,7 +205,7 @@ tSMP_STATUS SMP_BR_PairWith (BD_ADDR bd_addr)
|
||||
|
||||
memcpy (p_cb->pairing_bda, bd_addr, BD_ADDR_LEN);
|
||||
|
||||
if (!L2CA_ConnectFixedChnl (L2CAP_SMP_BR_CID, bd_addr, BLE_ADDR_UNKNOWN_TYPE, FALSE)) {
|
||||
if (!L2CA_ConnectFixedChnl (L2CAP_SMP_BR_CID, bd_addr, BLE_ADDR_UNKNOWN_TYPE, FALSE, FALSE, 0xFF, 0xFF)) {
|
||||
SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.", __FUNCTION__);
|
||||
smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &status);
|
||||
return status;
|
||||
|
||||
Reference in New Issue
Block a user