kopia lustrzana https://github.com/espressif/esp-idf
fix(bt/bluedroid): fixed btc_config_lock error
rodzic
73da4fe25d
commit
265b54a015
|
@ -720,6 +720,7 @@ static void btc_dm_acl_link_stat(tBTA_DM_ACL_LINK_STAT *p_acl_link_stat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (SMP_INCLUDED == TRUE)
|
||||||
if (p_acl_link_stat->event == BTA_ACL_LINK_STAT_CONN_CMPL &&
|
if (p_acl_link_stat->event == BTA_ACL_LINK_STAT_CONN_CMPL &&
|
||||||
p_acl_link_stat->link_act.conn_cmpl.status == HCI_SUCCESS) {
|
p_acl_link_stat->link_act.conn_cmpl.status == HCI_SUCCESS) {
|
||||||
memcpy(bt_addr.address, p_acl_link_stat->link_act.conn_cmpl.bd_addr, sizeof(bt_addr.address));
|
memcpy(bt_addr.address, p_acl_link_stat->link_act.conn_cmpl.bd_addr, sizeof(bt_addr.address));
|
||||||
|
@ -730,7 +731,7 @@ static void btc_dm_acl_link_stat(tBTA_DM_ACL_LINK_STAT *p_acl_link_stat)
|
||||||
bt_addr.address[4], bt_addr.address[5]);
|
bt_addr.address[4], bt_addr.address[5]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif ///SMP_INCLUDED == TRUE
|
||||||
esp_bt_gap_cb_t cb = (esp_bt_gap_cb_t)btc_profile_cb_get(BTC_PID_GAP_BT);
|
esp_bt_gap_cb_t cb = (esp_bt_gap_cb_t)btc_profile_cb_get(BTC_PID_GAP_BT);
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb(event, ¶m);
|
cb(event, ¶m);
|
||||||
|
|
|
@ -204,6 +204,32 @@ bt_status_t btc_storage_load_bonded_devices(void)
|
||||||
BTC_TRACE_DEBUG("Storage load rslt %d\n", status);
|
BTC_TRACE_DEBUG("Storage load rslt %d\n", status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function btc_storage_update_active_device
|
||||||
|
**
|
||||||
|
** Description BTC storage API - Once an ACL link is established and remote
|
||||||
|
** bd_addr is already stored in NVRAM, update the config and update
|
||||||
|
** the remote device to be the newest active device, The updates will
|
||||||
|
** not be stored into NVRAM immediately.
|
||||||
|
**
|
||||||
|
** Returns BT_STATUS_SUCCESS if successful, BT_STATUS_FAIL otherwise
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
bool btc_storage_update_active_device(bt_bdaddr_t *remote_bd_addr)
|
||||||
|
{
|
||||||
|
bdstr_t bdstr;
|
||||||
|
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
|
||||||
|
bool ret = false;
|
||||||
|
BTC_TRACE_DEBUG("Update active device: Remote device:%s\n", bdstr);
|
||||||
|
|
||||||
|
btc_config_lock();
|
||||||
|
ret = btc_config_update_newest_section(bdstr);
|
||||||
|
btc_config_unlock();
|
||||||
|
|
||||||
|
return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
|
||||||
|
}
|
||||||
#endif ///SMP_INCLUDED == TRUE
|
#endif ///SMP_INCLUDED == TRUE
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -316,32 +342,6 @@ bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int *d
|
||||||
return BT_STATUS_SUCCESS;
|
return BT_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
**
|
|
||||||
** Function btc_storage_update_active_device
|
|
||||||
**
|
|
||||||
** Description BTC storage API - Once an ACL link is established and remote
|
|
||||||
** bd_addr is already stored in NVRAM, update the config and update
|
|
||||||
** the remote device to be the newest active device, The updates will
|
|
||||||
** not be stored into NVRAM immediately.
|
|
||||||
**
|
|
||||||
** Returns BT_STATUS_SUCCESS if successful, BT_STATUS_FAIL otherwise
|
|
||||||
**
|
|
||||||
*******************************************************************************/
|
|
||||||
bool btc_storage_update_active_device(bt_bdaddr_t *remote_bd_addr)
|
|
||||||
{
|
|
||||||
bdstr_t bdstr;
|
|
||||||
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
|
|
||||||
bool ret = false;
|
|
||||||
BTC_TRACE_DEBUG("Update active device: Remote device:%s\n", bdstr);
|
|
||||||
|
|
||||||
btc_config_lock();
|
|
||||||
ret = btc_config_update_newest_section(bdstr);
|
|
||||||
btc_config_unlock();
|
|
||||||
|
|
||||||
return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (defined BTC_HH_INCLUDED && BTC_HH_INCLUDED == TRUE)
|
#if (defined BTC_HH_INCLUDED && BTC_HH_INCLUDED == TRUE)
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
|
@ -926,6 +926,7 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
|
||||||
}
|
}
|
||||||
case BTA_GATTC_CONNECT_EVT: {
|
case BTA_GATTC_CONNECT_EVT: {
|
||||||
tBTA_GATTC_CONNECT *connect = &arg->connect;
|
tBTA_GATTC_CONNECT *connect = &arg->connect;
|
||||||
|
#if (SMP_INCLUDED == TRUE)
|
||||||
bt_bdaddr_t bt_addr;
|
bt_bdaddr_t bt_addr;
|
||||||
|
|
||||||
memcpy(bt_addr.address, connect->remote_bda, sizeof(bt_addr.address));
|
memcpy(bt_addr.address, connect->remote_bda, sizeof(bt_addr.address));
|
||||||
|
@ -935,7 +936,7 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
|
||||||
bt_addr.address[2], bt_addr.address[3],
|
bt_addr.address[2], bt_addr.address[3],
|
||||||
bt_addr.address[4], bt_addr.address[5]);
|
bt_addr.address[4], bt_addr.address[5]);
|
||||||
}
|
}
|
||||||
|
#endif ///SMP_INCLUDED == TRUE
|
||||||
gattc_if = connect->client_if;
|
gattc_if = connect->client_if;
|
||||||
param.connect.conn_id = BTC_GATT_GET_CONN_ID(connect->conn_id);
|
param.connect.conn_id = BTC_GATT_GET_CONN_ID(connect->conn_id);
|
||||||
param.connect.link_role = connect->link_role;
|
param.connect.link_role = connect->link_role;
|
||||||
|
|
|
@ -901,6 +901,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
|
||||||
btc_gatts_cb_to_app(ESP_GATTS_STOP_EVT, gatts_if, ¶m);
|
btc_gatts_cb_to_app(ESP_GATTS_STOP_EVT, gatts_if, ¶m);
|
||||||
break;
|
break;
|
||||||
case BTA_GATTS_CONNECT_EVT: {
|
case BTA_GATTS_CONNECT_EVT: {
|
||||||
|
#if (SMP_INCLUDED == TRUE)
|
||||||
bt_bdaddr_t bt_addr;
|
bt_bdaddr_t bt_addr;
|
||||||
memcpy(bt_addr.address, p_data->conn.remote_bda, sizeof(bt_addr.address));
|
memcpy(bt_addr.address, p_data->conn.remote_bda, sizeof(bt_addr.address));
|
||||||
if (btc_storage_update_active_device(&bt_addr)) {
|
if (btc_storage_update_active_device(&bt_addr)) {
|
||||||
|
@ -909,7 +910,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
|
||||||
bt_addr.address[2], bt_addr.address[3],
|
bt_addr.address[2], bt_addr.address[3],
|
||||||
bt_addr.address[4], bt_addr.address[5]);
|
bt_addr.address[4], bt_addr.address[5]);
|
||||||
}
|
}
|
||||||
|
#endif ///SMP_INCLUDED == TRUE
|
||||||
gatts_if = p_data->conn.server_if;
|
gatts_if = p_data->conn.server_if;
|
||||||
param.connect.conn_id = BTC_GATT_GET_CONN_ID(p_data->conn.conn_id);
|
param.connect.conn_id = BTC_GATT_GET_CONN_ID(p_data->conn.conn_id);
|
||||||
param.connect.link_role = p_data->conn.link_role;
|
param.connect.link_role = p_data->conn.link_role;
|
||||||
|
|
Ładowanie…
Reference in New Issue