Skip to content

Commit

Permalink
feat(ble/bluedroid): Support setting connection params when creating …
Browse files Browse the repository at this point in the history
…connection
  • Loading branch information
esp-cjh committed Nov 27, 2024
1 parent 4ed3016 commit 02cc012
Show file tree
Hide file tree
Showing 32 changed files with 345 additions and 125 deletions.
7 changes: 6 additions & 1 deletion components/bt/controller/esp32/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@ esp_err_t esp_bredr_sco_datapath_set(esp_sco_data_path_t data_path)
return ESP_OK;
}

esp_err_t esp_ble_scan_dupilcate_list_flush(void)
esp_err_t esp_ble_scan_duplicate_list_flush(void)
{
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
Expand All @@ -1940,6 +1940,11 @@ esp_err_t esp_ble_scan_dupilcate_list_flush(void)
return ESP_OK;
}

esp_err_t esp_ble_scan_dupilcate_list_flush(void)
{
return esp_ble_scan_duplicate_list_flush();
}

/**
* This function re-write controller's function,
* As coredump can not show parameters in function which is in a .a file.
Expand Down
6 changes: 0 additions & 6 deletions components/bt/controller/esp32c3/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ extern int API_vhci_host_register_callback(const vhci_host_callback_t *callback)
extern int ble_txpwr_set(int power_type, uint16_t handle, int power_level);
extern int ble_txpwr_get(int power_type, uint16_t handle);

extern uint16_t l2c_ble_link_get_tx_buf_num(void);
extern void coex_pti_v2(void);

extern bool btdm_deep_sleep_mem_init(void);
Expand Down Expand Up @@ -1877,11 +1876,6 @@ int IRAM_ATTR esp_bt_h4tl_eif_io_event_notify(int event)
return btdm_hci_tl_io_event_post(event);
}

uint16_t esp_bt_get_tx_buf_num(void)
{
return l2c_ble_link_get_tx_buf_num();
}

static void coex_wifi_sleep_set_hook(bool sleep)
{

Expand Down
9 changes: 7 additions & 2 deletions components/bt/esp_ble_mesh/core/bluedroid_host/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,7 @@ uint16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn)

int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid)
{
tBTA_BLE_CONN_PARAMS conn_1m_param = {0};
uint8_t zero[6] = {0};
int i;

Expand Down Expand Up @@ -1251,10 +1252,14 @@ int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid)
* Slave_latency: 0x0
* Supervision_timeout: 1s
*/
BTA_DmSetBlePrefConnParams(bt_mesh_gattc_info[i].addr.val, 0x18, 0x18, 0x00, 0x64);
conn_1m_param.interval_min = 0x18;
conn_1m_param.interval_max = 0x18;
conn_1m_param.latency = 0;
conn_1m_param.supervision_timeout = 0x64;

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);
bt_mesh_gattc_info[i].addr.type, true, BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE,
BTA_BLE_PHY_1M_MASK, &conn_1m_param, NULL, NULL);

return 0;
}
Expand Down
88 changes: 86 additions & 2 deletions components/bt/host/bluedroid/api/esp_gattc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,14 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn
{
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 (!creat_conn_params) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_OPEN;
Expand All @@ -84,32 +89,111 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn
arg.open.is_direct = creat_conn_params->is_direct;
arg.open.is_aux= creat_conn_params->is_aux;
arg.open.own_addr_type = creat_conn_params->own_addr_type;
arg.open.phy_mask = creat_conn_params->phy_mask;

// If not aux open, shouldn't set 2M and coded PHY connection params
if (!creat_conn_params->is_aux &&
((creat_conn_params->phy_mask & ESP_BLE_PHY_2M_PREF_MASK) ||
(creat_conn_params->phy_mask & ESP_BLE_PHY_CODED_PREF_MASK))) {
return ESP_ERR_INVALID_ARG;
}

if (creat_conn_params->phy_mask & ESP_BLE_PHY_1M_PREF_MASK) {
if (!creat_conn_params->phy_1m_conn_params) {
return ESP_ERR_INVALID_ARG;
}

conn_params = creat_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 (creat_conn_params->phy_mask & ESP_BLE_PHY_2M_PREF_MASK) {
if (!creat_conn_params->phy_2m_conn_params) {
return ESP_ERR_INVALID_ARG;
}

conn_params = creat_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 (creat_conn_params->phy_mask & ESP_BLE_PHY_CODED_PREF_MASK) {
if (!creat_conn_params->phy_coded_conn_params) {
return ESP_ERR_INVALID_ARG;
}

conn_params = creat_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);
}

#if (BLE_42_FEATURE_SUPPORT == TRUE)
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct)
{
esp_ble_gatt_creat_conn_params_t creat_conn_params;
esp_ble_gatt_creat_conn_params_t creat_conn_params = {0};
memcpy(creat_conn_params.remote_bda, remote_bda, ESP_BD_ADDR_LEN);
creat_conn_params.remote_addr_type = remote_addr_type;
creat_conn_params.is_direct = is_direct;
creat_conn_params.is_aux = false;
creat_conn_params.own_addr_type = 0xff; //undefined, will use local value
creat_conn_params.phy_mask = 0x0;
return esp_ble_gattc_enh_open(gattc_if, &creat_conn_params);
}
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)

#if (BLE_50_FEATURE_SUPPORT == TRUE)
esp_err_t esp_ble_gattc_aux_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct)
{
esp_ble_gatt_creat_conn_params_t creat_conn_params;
esp_ble_gatt_creat_conn_params_t creat_conn_params = {0};
memcpy(creat_conn_params.remote_bda, remote_bda, ESP_BD_ADDR_LEN);
creat_conn_params.remote_addr_type = remote_addr_type;
creat_conn_params.is_direct = is_direct;
creat_conn_params.is_aux = true;
creat_conn_params.own_addr_type = 0xff; //undefined, will use local value
creat_conn_params.phy_mask = 0x0;
return esp_ble_gattc_enh_open(gattc_if, &creat_conn_params);
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
Expand Down
19 changes: 19 additions & 0 deletions components/bt/host/bluedroid/api/include/api/esp_bt_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,25 @@ typedef uint8_t esp_link_key[ESP_BT_OCTET16_LEN]; /* Link Key */
#define ESP_BLE_CONN_SUP_TOUT_MIN 0x000A /*!< relate to BTM_BLE_CONN_SUP_TOUT_MIN in stack/btm_ble_api.h */
#define ESP_BLE_CONN_SUP_TOUT_MAX 0x0C80 /*!< relate to ESP_BLE_CONN_SUP_TOUT_MAX in stack/btm_ble_api.h */

#define ESP_BLE_PHY_1M_PREF_MASK (1 << 0) /*!< The Host prefers use the LE1M transmitter or receiver PHY */
#define ESP_BLE_PHY_2M_PREF_MASK (1 << 1) /*!< The Host prefers use the LE2M transmitter or receiver PHY */
#define ESP_BLE_PHY_CODED_PREF_MASK (1 << 2) /*!< The Host prefers use the LE CODED transmitter or receiver PHY */
typedef uint8_t esp_ble_phy_mask_t;

/**
* @brief create connection parameters
*/
typedef struct {
uint16_t scan_interval; /*!< Initial scan interval, in units of 0.625ms, the range is 0x0004(2.5ms) to 0xFFFF(10.24s). */
uint16_t scan_window; /*!< Initial scan window, in units of 0.625ms, the range is 0x0004(2.5ms) to 0xFFFF(10.24s). */
uint16_t interval_min; /*!< Minimum connection interval, in units of 1.25ms, the range is 0x0006(7.5ms) to 0x0C80(4s). */
uint16_t interval_max; /*!< Maximum connection interval, in units of 1.25ms, the range is 0x0006(7.5ms) to 0x0C80(4s). */
uint16_t latency; /*!< Connection latency, the range is 0x0000(0) to 0x01F3(499). */
uint16_t supervision_timeout; /*!< Connection supervision timeout, in units of 10ms, the range is from 0x000A(100ms) to 0x0C80(32s). */
uint16_t min_ce_len; /*!< Minimum connection event length, in units of 0.625ms, setting to 0 for no preferred parameters. */
uint16_t max_ce_len; /*!< Maximum connection event length, in units of 0.625ms, setting to 0 for no preferred parameters. */
} esp_ble_conn_params_t;

/// Check the param is valid or not
#define ESP_BLE_IS_VALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)) )

Expand Down
14 changes: 9 additions & 5 deletions components/bt/host/bluedroid/api/include/api/esp_gatt_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,15 @@ typedef struct {

/** @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 */
bool is_direct; /*!< Direct connection or background auto connection(by now, background auto connection is not supported */
bool is_aux; /*!< Set to true for BLE 5.0 or higher to enable auxiliary connections; set to false for BLE 4.2 or lower. */
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. */
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 */
bool is_direct; /*!< Direct connection or background auto connection(by now, background auto connection is not supported */
bool is_aux; /*!< Set to true for BLE 5.0 or higher to enable auxiliary connections; set to false for BLE 4.2 or lower. */
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. */
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_creat_conn_params_t;

#ifdef __cplusplus
Expand Down
5 changes: 3 additions & 2 deletions components/bt/host/bluedroid/bta/dm/bta_dm_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -6049,7 +6049,7 @@ void bta_dm_ble_gap_set_prefer_ext_conn_params(tBTA_DM_MSG *p_data)
sizeof(tBTA_DM_BLE_CONN_PARAMS));
}

if (conn_params.phy_mask & BTAS_PHY_CODED_MASK) {
if (conn_params.phy_mask & BTA_PHY_CODED_MASK) {
memcpy(&conn_params.phy_coded_conn_params, &p_data->ble_set_per_ext_conn_params.phy_coded_conn_params,
sizeof(tBTA_DM_BLE_CONN_PARAMS));
}
Expand Down Expand Up @@ -6673,7 +6673,8 @@ void btm_dm_start_gatt_discovery (BD_ADDR bd_addr)
btm_dm_start_disc_gatt_services(bta_dm_search_cb.conn_id);
} 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);
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);

}
}
Expand Down
2 changes: 1 addition & 1 deletion components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ typedef struct {

#define BTA_PHY_1M_MASK (1 << 0)
#define BTA_PHY_2M_MASK (1 << 1)
#define BTAS_PHY_CODED_MASK (1 << 2)
#define BTA_PHY_CODED_MASK (1 << 2)
typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
Expand Down
27 changes: 24 additions & 3 deletions components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "osi/allocator.h"
#include "osi/mutex.h"
#include "bta_hh_int.h"
#include "btm_int.h"

#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
#include "bta_hh_int.h"
Expand Down Expand Up @@ -508,6 +509,7 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
tBTA_GATTC_DATA gattc_data;
BOOLEAN found_app = FALSE;
tGATT_TCB *p_tcb;
tBTM_SEC_DEV_REC *p_dev_rec = NULL;

if (!p_clcb || !p_data) {
return;
Expand All @@ -517,6 +519,25 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
if(p_tcb) {
found_app = gatt_find_specific_app_in_hold_link(p_tcb, p_clcb->p_rcb->client_if);
}

if (p_data->api_conn.phy_mask) {
p_dev_rec = btm_find_or_alloc_dev(p_data->api_conn.remote_bda);
if (p_dev_rec) {
if (p_data->api_conn.is_aux) {
#if (BLE_50_FEATURE_SUPPORT == TRUE)
p_dev_rec->ext_conn_params.phy_mask = p_data->api_conn.phy_mask;
memcpy(&p_dev_rec->ext_conn_params.phy_1m_conn_params, &p_data->api_conn.phy_1m_conn_params, sizeof(tBTA_BLE_CONN_PARAMS));
memcpy(&p_dev_rec->ext_conn_params.phy_2m_conn_params, &p_data->api_conn.phy_2m_conn_params, sizeof(tBTA_BLE_CONN_PARAMS));
memcpy(&p_dev_rec->ext_conn_params.phy_coded_conn_params, &p_data->api_conn.phy_coded_conn_params, sizeof(tBTA_BLE_CONN_PARAMS));
#endif
} else {
memcpy(&p_dev_rec->conn_params, &p_data->api_conn.phy_1m_conn_params, sizeof(tBTA_BLE_CONN_PARAMS));
}
} else {
APPL_TRACE_ERROR("Unknown Device, setting rejected");
}
}

/* 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)) {
Expand Down Expand Up @@ -1812,8 +1833,8 @@ static void bta_gattc_enc_cmpl_cback(tGATT_IF gattc_if, BD_ADDR bda)
*******************************************************************************/
void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
{
tBTA_GATTC_SERV *p_srvc_cb = bta_gattc_find_srvr_cache(p_msg->api_conn.remote_bda);
tBTA_GATTC_CLCB *p_clcb = &bta_gattc_cb.clcb[0];
tBTA_GATTC_SERV *p_srvc_cb = bta_gattc_find_srvr_cache(p_msg->api_refresh.remote_bda);
tBTA_GATTC_CLCB *p_clcb = &bta_gattc_cb.clcb[0];
BOOLEAN found = FALSE;
UINT8 i;
UNUSED(p_cb);
Expand Down Expand Up @@ -1933,7 +1954,7 @@ void bta_gattc_process_api_cache_get_addr_list(tBTA_GATTC_CB *p_cb, tBTA_GATTC_D
*******************************************************************************/
void bta_gattc_process_api_cache_clean(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
{
tBTA_GATTC_SERV *p_srvc_cb = bta_gattc_find_srvr_cache(p_msg->api_conn.remote_bda);
tBTA_GATTC_SERV *p_srvc_cb = bta_gattc_find_srvr_cache(p_msg->api_clean.remote_bda);
UNUSED(p_cb);

if (p_srvc_cb != NULL && p_srvc_cb->p_srvc_cache != NULL) {
Expand Down
17 changes: 11 additions & 6 deletions components/bt/host/bluedroid/bta/gatt/bta_gattc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ 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_direct, tBTA_GATT_TRANSPORT transport, BOOLEAN is_aux, tBTA_ADDR_TYPE own_addr_type,
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)
{
tBTA_GATTC_API_OPEN *p_buf;

Expand All @@ -156,8 +158,11 @@ void BTA_GATTC_Enh_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_ADDR_T
p_buf->is_aux = is_aux;
p_buf->remote_addr_type = remote_addr_type;
p_buf->own_addr_type = own_addr_type;
p_buf->phy_mask = phy_mask;
memcpy(p_buf->remote_bda, remote_bda, BD_ADDR_LEN);

memcpy(&p_buf->phy_1m_conn_params, phy_1m_conn_params, sizeof(tBTA_BLE_CONN_PARAMS));
memcpy(&p_buf->phy_2m_conn_params, phy_2m_conn_params, sizeof(tBTA_BLE_CONN_PARAMS));
memcpy(&p_buf->phy_coded_conn_params, phy_coded_conn_params, sizeof(tBTA_BLE_CONN_PARAMS));

bta_sys_sendmsg(p_buf);
}
Expand Down Expand Up @@ -1011,9 +1016,9 @@ void BTA_GATTC_Refresh(BD_ADDR remote_bda, bool erase_flash)
if(bta_sys_is_register(BTA_ID_GATTC) == FALSE) {
return;
}
tBTA_GATTC_API_OPEN *p_buf;
tBTA_GATTC_API_CACHE_REFRESH *p_buf;

if ((p_buf = (tBTA_GATTC_API_OPEN *) osi_malloc(sizeof(tBTA_GATTC_API_OPEN))) != NULL) {
if ((p_buf = (tBTA_GATTC_API_CACHE_REFRESH *) osi_malloc(sizeof(tBTA_GATTC_API_CACHE_REFRESH))) != NULL) {
p_buf->hdr.event = BTA_GATTC_API_REFRESH_EVT;
memcpy(p_buf->remote_bda, remote_bda, BD_ADDR_LEN);

Expand Down Expand Up @@ -1069,9 +1074,9 @@ void BTA_GATTC_Clean(BD_ADDR remote_bda)
bta_gattc_cache_reset(remote_bda);
#endif

tBTA_GATTC_API_OPEN *p_buf;
tBTA_GATTC_API_CACHE_CLEAN *p_buf;

if ((p_buf = (tBTA_GATTC_API_OPEN *) osi_malloc(sizeof(tBTA_GATTC_API_OPEN))) != NULL) {
if ((p_buf = (tBTA_GATTC_API_CACHE_CLEAN *) osi_malloc(sizeof(tBTA_GATTC_API_CACHE_CLEAN))) != NULL) {
p_buf->hdr.event = BTA_GATTC_API_CACHE_CLEAN_EVT;
memcpy(p_buf->remote_bda, remote_bda, BD_ADDR_LEN);

Expand Down
Loading

0 comments on commit 02cc012

Please sign in to comment.