mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
feat(ble/bluedroid): Supported BLE bluedroid host pawr connection
This commit is contained in:
@@ -1874,6 +1874,7 @@ int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid)
|
||||
BTA_GATTC_Enh_Open(bt_mesh_gattc_if, bt_mesh_gattc_info[i].addr.val,
|
||||
bt_mesh_gattc_info[i].addr.type, true,
|
||||
BTA_GATT_TRANSPORT_LE, TRUE, BLE_ADDR_UNKNOWN_TYPE,
|
||||
false, 0xFF, 0xFF,
|
||||
BTA_BLE_PHY_1M_MASK, &conn_1m_param, NULL, NULL);
|
||||
#else /* CONFIG_BLE_MESH_USE_BLE_50 */
|
||||
/* Min_interval: 15ms
|
||||
@@ -1889,6 +1890,7 @@ int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid)
|
||||
BTA_GATTC_Enh_Open(bt_mesh_gattc_if, bt_mesh_gattc_info[i].addr.val,
|
||||
bt_mesh_gattc_info[i].addr.type, true,
|
||||
BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE,
|
||||
false, 0xFF, 0xFF,
|
||||
BTA_BLE_PHY_1M_MASK, &conn_1m_param, NULL, NULL);
|
||||
#endif /* CONFIG_BLE_MESH_USE_BLE_50 */
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -88,6 +88,11 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn
|
||||
arg.open.remote_addr_type = creat_conn_params->remote_addr_type;
|
||||
arg.open.is_direct = creat_conn_params->is_direct;
|
||||
arg.open.is_aux= creat_conn_params->is_aux;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
arg.open.is_pawr_synced = false;
|
||||
arg.open.adv_handle = 0xFF;
|
||||
arg.open.subevent = 0xFF;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
arg.open.own_addr_type = creat_conn_params->own_addr_type;
|
||||
arg.open.phy_mask = creat_conn_params->phy_mask;
|
||||
|
||||
@@ -198,6 +203,106 @@ esp_err_t esp_ble_gattc_aux_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bd
|
||||
}
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
esp_err_t esp_ble_gattc_aux_open_with_pawr_synced(esp_gatt_if_t gattc_if, esp_ble_gatt_pawr_conn_params_t *pawr_conn_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gattc_args_t arg;
|
||||
const esp_ble_conn_params_t *conn_params;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (!pawr_conn_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_OPEN;
|
||||
arg.open.gattc_if = gattc_if;
|
||||
memcpy(arg.open.remote_bda, pawr_conn_params->remote_bda, ESP_BD_ADDR_LEN);
|
||||
arg.open.remote_addr_type = pawr_conn_params->remote_addr_type;
|
||||
arg.open.is_direct = true;
|
||||
arg.open.is_aux = true;
|
||||
arg.open.is_pawr_synced = true;
|
||||
arg.open.adv_handle = pawr_conn_params->adv_handle;
|
||||
arg.open.subevent = pawr_conn_params->subevent;
|
||||
arg.open.own_addr_type = pawr_conn_params->own_addr_type;
|
||||
arg.open.phy_mask = pawr_conn_params->phy_mask;
|
||||
|
||||
if (pawr_conn_params->phy_mask & ESP_BLE_PHY_1M_PREF_MASK) {
|
||||
if (!pawr_conn_params->phy_1m_conn_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
conn_params = pawr_conn_params->phy_1m_conn_params;
|
||||
if (ESP_BLE_IS_VALID_PARAM(conn_params->interval_min, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->interval_max, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->supervision_timeout, ESP_BLE_CONN_SUP_TOUT_MIN, ESP_BLE_CONN_SUP_TOUT_MAX) &&
|
||||
(conn_params->latency <= ESP_BLE_CONN_LATENCY_MAX) &&
|
||||
((conn_params->supervision_timeout * 10) >= ((1 + conn_params->latency) * ((conn_params->interval_max * 5) >> 1))) &&
|
||||
(conn_params->interval_min <= conn_params->interval_max)) {
|
||||
memcpy(&arg.open.phy_1m_conn_params, conn_params, sizeof(esp_ble_conn_params_t));
|
||||
} else {
|
||||
LOG_ERROR("%s, invalid 1M PHY connection params: min_int = %d, max_int = %d, latency = %d, timeout = %d", __func__,
|
||||
conn_params->interval_min,
|
||||
conn_params->interval_max,
|
||||
conn_params->latency,
|
||||
conn_params->supervision_timeout);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
if (pawr_conn_params->phy_mask & ESP_BLE_PHY_2M_PREF_MASK) {
|
||||
if (!pawr_conn_params->phy_2m_conn_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
conn_params = pawr_conn_params->phy_2m_conn_params;
|
||||
if (ESP_BLE_IS_VALID_PARAM(conn_params->interval_min, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->interval_max, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->supervision_timeout, ESP_BLE_CONN_SUP_TOUT_MIN, ESP_BLE_CONN_SUP_TOUT_MAX) &&
|
||||
(conn_params->latency <= ESP_BLE_CONN_LATENCY_MAX) &&
|
||||
((conn_params->supervision_timeout * 10) >= ((1 + conn_params->latency) * ((conn_params->interval_max * 5) >> 1))) &&
|
||||
(conn_params->interval_min <= conn_params->interval_max)) {
|
||||
memcpy(&arg.open.phy_2m_conn_params, conn_params, sizeof(esp_ble_conn_params_t));
|
||||
} else {
|
||||
LOG_ERROR("%s, invalid 2M PHY connection params: min_int = %d, max_int = %d, latency = %d, timeout = %d", __func__,
|
||||
conn_params->interval_min,
|
||||
conn_params->interval_max,
|
||||
conn_params->latency,
|
||||
conn_params->supervision_timeout);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
if (pawr_conn_params->phy_mask & ESP_BLE_PHY_CODED_PREF_MASK) {
|
||||
if (!pawr_conn_params->phy_coded_conn_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
conn_params = pawr_conn_params->phy_coded_conn_params;
|
||||
if (ESP_BLE_IS_VALID_PARAM(conn_params->interval_min, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->interval_max, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->supervision_timeout, ESP_BLE_CONN_SUP_TOUT_MIN, ESP_BLE_CONN_SUP_TOUT_MAX) &&
|
||||
(conn_params->latency <= ESP_BLE_CONN_LATENCY_MAX) &&
|
||||
((conn_params->supervision_timeout * 10) >= ((1 + conn_params->latency) * ((conn_params->interval_max * 5) >> 1))) &&
|
||||
(conn_params->interval_min <= conn_params->interval_max)) {
|
||||
memcpy(&arg.open.phy_coded_conn_params, conn_params, sizeof(esp_ble_conn_params_t));
|
||||
} else {
|
||||
LOG_ERROR("%s, invalid Coded PHY connection params: min_int = %d, max_int = %d, latency = %d, timeout = %d", __func__,
|
||||
conn_params->interval_min,
|
||||
conn_params->interval_max,
|
||||
conn_params->latency,
|
||||
conn_params->supervision_timeout);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gattc_close (esp_gatt_if_t gattc_if, uint16_t conn_id)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -695,6 +695,19 @@ typedef struct {
|
||||
const esp_ble_conn_params_t *phy_coded_conn_params; /*!< Connection parameters for the LE Coded PHY */
|
||||
} esp_ble_gatt_creat_conn_params_t;
|
||||
|
||||
/** @brief Represents a creat connection element. */
|
||||
typedef struct {
|
||||
esp_bd_addr_t remote_bda; /*!< The Bluetooth address of the remote device */
|
||||
esp_ble_addr_type_t remote_addr_type; /*!< Address type of the remote device */
|
||||
esp_ble_addr_type_t own_addr_type; /*!< Specifies the address type used in the connection request. Set to 0xFF if the address type is unknown. */
|
||||
uint8_t adv_handle; /*!< Advertising_Handle identifying the periodic advertising train. Range: 0x00 to 0xEF or 0xFF */
|
||||
uint8_t subevent; /*!< Subevent where the connection request is to be sent. Range: 0x00 to 0x7F or 0xFF */
|
||||
esp_ble_phy_mask_t phy_mask; /*!< Indicates which PHY connection parameters will be used. When is_aux is false, only the connection params for 1M PHY can be specified */
|
||||
const esp_ble_conn_params_t *phy_1m_conn_params; /*!< Connection parameters for the LE 1M PHY */
|
||||
const esp_ble_conn_params_t *phy_2m_conn_params; /*!< Connection parameters for the LE 2M PHY */
|
||||
const esp_ble_conn_params_t *phy_coded_conn_params; /*!< Connection parameters for the LE Coded PHY */
|
||||
} esp_ble_gatt_pawr_conn_params_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6961,7 +6961,7 @@ void btm_dm_start_gatt_discovery (BD_ADDR bd_addr)
|
||||
} else {
|
||||
//TODO need to add addr_type in future
|
||||
BTA_GATTC_Enh_Open(bta_dm_search_cb.client_if, bd_addr, BLE_ADDR_UNKNOWN_TYPE, TRUE,
|
||||
BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE, 0, NULL, NULL, NULL);
|
||||
BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE, false, 0xFF, 0xFF, 0, NULL, NULL, NULL);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,6 +511,10 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
tGATT_TCB *p_tcb;
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
|
||||
|
||||
BOOLEAN is_pawr_synced = FALSE;
|
||||
UINT8 adv_handle = 0xFF;
|
||||
UINT8 subevent = 0xFF;
|
||||
|
||||
if (!p_clcb || !p_data) {
|
||||
return;
|
||||
}
|
||||
@@ -545,10 +549,15 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
APPL_TRACE_ERROR("Unknown Device, setting rejected");
|
||||
}
|
||||
}
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
is_pawr_synced = p_data->api_conn.is_pawr_synced;
|
||||
adv_handle = p_data->api_conn.adv_handle;
|
||||
subevent = p_data->api_conn.subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
/* open/hold a connection */
|
||||
if (!GATT_Connect(p_clcb->p_rcb->client_if, p_data->api_conn.remote_bda, p_data->api_conn.remote_addr_type,
|
||||
TRUE, p_data->api_conn.transport, p_data->api_conn.is_aux)) {
|
||||
TRUE, p_data->api_conn.transport, p_data->api_conn.is_aux, is_pawr_synced,
|
||||
adv_handle, subevent)) {
|
||||
APPL_TRACE_ERROR("Connection open failure");
|
||||
|
||||
bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_OPEN_FAIL_EVT, p_data);
|
||||
@@ -585,7 +594,7 @@ void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg
|
||||
/* always call open to hold a connection */
|
||||
if (!GATT_Connect(p_data->client_if, p_data->remote_bda,
|
||||
p_data->remote_addr_type, FALSE,
|
||||
p_data->transport, p_data->is_aux)) {
|
||||
p_data->transport, p_data->is_aux, FALSE, 0xFF, 0xFF)) {
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
uint8_t *bda = (uint8_t *)p_data->remote_bda;
|
||||
#endif
|
||||
|
||||
@@ -144,6 +144,7 @@ void BTA_GATTC_AppDeregister(tBTA_GATTC_IF client_if)
|
||||
*******************************************************************************/
|
||||
void BTA_GATTC_Enh_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_ADDR_TYPE remote_addr_type,
|
||||
BOOLEAN is_direct, tBTA_GATT_TRANSPORT transport, BOOLEAN is_aux, tBTA_ADDR_TYPE own_addr_type,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent,
|
||||
UINT8 phy_mask, tBTA_BLE_CONN_PARAMS *phy_1m_conn_params, tBTA_BLE_CONN_PARAMS *phy_2m_conn_params,
|
||||
tBTA_BLE_CONN_PARAMS *phy_coded_conn_params)
|
||||
{
|
||||
@@ -156,6 +157,11 @@ void BTA_GATTC_Enh_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_ADDR_T
|
||||
p_buf->is_direct = is_direct;
|
||||
p_buf->transport = transport;
|
||||
p_buf->is_aux = is_aux;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
p_buf->is_pawr_synced = is_pawr_synced;
|
||||
p_buf->adv_handle = adv_handle;
|
||||
p_buf->subevent = subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
p_buf->remote_addr_type = remote_addr_type;
|
||||
p_buf->own_addr_type = own_addr_type;
|
||||
p_buf->phy_mask = phy_mask;
|
||||
|
||||
@@ -757,7 +757,7 @@ void bta_gatts_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
||||
if ((p_rcb = bta_gatts_find_app_rcb_by_app_if(p_msg->api_open.server_if)) != NULL) {
|
||||
/* should always get the connection ID */
|
||||
if (GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda, BLE_ADDR_UNKNOWN_TYPE,
|
||||
p_msg->api_open.is_direct, p_msg->api_open.transport, FALSE)) {
|
||||
p_msg->api_open.is_direct, p_msg->api_open.transport, FALSE, FALSE, 0xFF, 0xFF)) {
|
||||
status = BTA_GATT_OK;
|
||||
|
||||
if (GATT_GetConnIdIfConnected(p_rcb->gatt_if, p_msg->api_open.remote_bda,
|
||||
|
||||
@@ -130,6 +130,11 @@ typedef struct {
|
||||
tBTA_GATTC_IF client_if;
|
||||
BOOLEAN is_direct;
|
||||
BOOLEAN is_aux;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
BOOLEAN is_pawr_synced;
|
||||
UINT8 adv_handle;
|
||||
UINT8 subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
tBTA_TRANSPORT transport;
|
||||
tBTA_ADDR_TYPE own_addr_type;
|
||||
UINT8 phy_mask;
|
||||
|
||||
@@ -2603,7 +2603,7 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB *p_cb, BOOLEAN check_bond)
|
||||
!p_cb->in_bg_conn && to_add) {
|
||||
/* add device into BG connection to accept remote initiated connection */
|
||||
BTA_GATTC_Enh_Open(bta_hh_cb.gatt_if, p_cb->addr, BLE_ADDR_UNKNOWN_TYPE, FALSE,
|
||||
BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE, 0, NULL, NULL);
|
||||
BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE, false, 0xFF, 0xFF, 0, NULL, NULL);
|
||||
p_cb->in_bg_conn = TRUE;
|
||||
|
||||
BTA_DmBleSetBgConnType(BTA_DM_BLE_CONN_AUTO, NULL);
|
||||
|
||||
@@ -819,6 +819,7 @@ extern void BTA_GATTC_AppDeregister (tBTA_GATTC_IF client_if);
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_Enh_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_ADDR_TYPE remote_addr_type,
|
||||
BOOLEAN is_direct, tBTA_GATT_TRANSPORT transport, BOOLEAN is_aux, tBTA_ADDR_TYPE own_addr_type,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent,
|
||||
UINT8 phy_mask, tBTA_BLE_CONN_PARAMS *phy_1m_conn_params, tBTA_BLE_CONN_PARAMS *phy_2m_conn_params,
|
||||
tBTA_BLE_CONN_PARAMS *phy_coded_conn_params);
|
||||
|
||||
|
||||
@@ -2923,7 +2923,7 @@ void bta_jv_l2cap_connect_le(tBTA_JV_MSG *p_data)
|
||||
id = t->id;
|
||||
t->init_called = FALSE;
|
||||
|
||||
if (L2CA_ConnectFixedChnl(t->chan, t->remote_addr, BLE_ADDR_UNKNOWN_TYPE, FALSE)) {
|
||||
if (L2CA_ConnectFixedChnl(t->chan, t->remote_addr, BLE_ADDR_UNKNOWN_TYPE, FALSE, FALSE, 0xFF, 0xFF)) {
|
||||
|
||||
evt.l2c_cl_init.status = BTA_JV_SUCCESS;
|
||||
evt.l2c_cl_init.handle = id;
|
||||
|
||||
@@ -213,12 +213,21 @@ static void btc_gattc_app_unregister(btc_ble_gattc_args_t *arg)
|
||||
static void btc_gattc_open(btc_ble_gattc_args_t *arg)
|
||||
{
|
||||
tBTA_GATT_TRANSPORT transport = BTA_GATT_TRANSPORT_LE;
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
BTA_GATTC_Enh_Open(arg->open.gattc_if, arg->open.remote_bda,
|
||||
arg->open.remote_addr_type, arg->open.is_direct,
|
||||
transport, arg->open.is_aux, arg->open.own_addr_type,
|
||||
arg->open.is_pawr_synced, arg->open.adv_handle, arg->open.subevent,
|
||||
arg->open.phy_mask, (void *)&arg->open.phy_1m_conn_params,
|
||||
(void *)&arg->open.phy_2m_conn_params, (void *)&arg->open.phy_coded_conn_params);
|
||||
#else
|
||||
BTA_GATTC_Enh_Open(arg->open.gattc_if, arg->open.remote_bda,
|
||||
arg->open.remote_addr_type, arg->open.is_direct,
|
||||
transport, arg->open.is_aux, arg->open.own_addr_type,
|
||||
false, 0xff, 0xff,
|
||||
arg->open.phy_mask, (void *)&arg->open.phy_1m_conn_params,
|
||||
(void *)&arg->open.phy_2m_conn_params, (void *)&arg->open.phy_coded_conn_params);
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
}
|
||||
|
||||
static void btc_gattc_close(btc_ble_gattc_args_t *arg)
|
||||
|
||||
@@ -58,6 +58,9 @@ typedef union {
|
||||
bool is_direct;
|
||||
bool is_aux;
|
||||
esp_ble_addr_type_t own_addr_type;
|
||||
bool is_pawr_synced;
|
||||
uint8_t adv_handle;
|
||||
uint8_t subevent;
|
||||
esp_ble_phy_mask_t phy_mask;
|
||||
esp_ble_conn_params_t phy_1m_conn_params;
|
||||
esp_ble_conn_params_t phy_2m_conn_params;
|
||||
|
||||
@@ -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 ++
|
||||
|
||||
@@ -751,7 +751,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
|
||||
|
||||
@@ -600,8 +600,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);
|
||||
|
||||
|
||||
@@ -1703,6 +1703,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__);
|
||||
|
||||
@@ -1012,6 +1012,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;
|
||||
@@ -1033,9 +1037,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