From f9732cb65f0659080ac3132f34c2952e1a812d5f Mon Sep 17 00:00:00 2001 From: xiongweichao Date: Tue, 9 Aug 2022 14:16:30 +0800 Subject: [PATCH] bt: Fixed memory leak due to not freeing memory if posting a message to a thread fails --- components/bt/common/api/esp_blufi_api.c | 15 +- components/bt/common/btc/core/btc_task.c | 18 ++- .../bt/common/btc/include/btc/btc_task.h | 5 +- .../esp/blufi/bluedroid_host/esp_blufi.c | 10 +- .../common/btc/profile/esp/blufi/blufi_prf.c | 2 +- .../btc/profile/esp/blufi/blufi_protocol.c | 44 +++--- .../profile/esp/blufi/nimble_host/esp_blufi.c | 10 +- components/bt/common/osi/alarm.c | 2 +- .../api/core/esp_ble_mesh_ble_api.c | 8 +- .../api/core/esp_ble_mesh_common_api.c | 4 +- .../esp_ble_mesh_local_data_operation_api.c | 10 +- .../api/core/esp_ble_mesh_low_power_api.c | 6 +- .../api/core/esp_ble_mesh_networking_api.c | 50 +++---- .../api/core/esp_ble_mesh_provisioning_api.c | 40 +++--- .../api/core/esp_ble_mesh_proxy_api.c | 20 +-- .../models/esp_ble_mesh_config_model_api.c | 8 +- .../models/esp_ble_mesh_generic_model_api.c | 8 +- .../models/esp_ble_mesh_health_model_api.c | 10 +- .../models/esp_ble_mesh_lighting_model_api.c | 8 +- .../models/esp_ble_mesh_sensor_model_api.c | 8 +- .../esp_ble_mesh_time_scene_model_api.c | 8 +- .../bt/esp_ble_mesh/btc/btc_ble_mesh_ble.c | 2 +- .../btc/btc_ble_mesh_config_model.c | 6 +- .../btc/btc_ble_mesh_generic_model.c | 6 +- .../btc/btc_ble_mesh_health_model.c | 6 +- .../btc/btc_ble_mesh_lighting_model.c | 6 +- .../bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c | 8 +- .../btc/btc_ble_mesh_sensor_model.c | 4 +- .../btc/btc_ble_mesh_time_scene_model.c | 4 +- .../btc/include/btc_ble_mesh_config_model.h | 2 + .../btc/include/btc_ble_mesh_generic_model.h | 2 + .../btc/include/btc_ble_mesh_health_model.h | 2 + .../btc/include/btc_ble_mesh_lighting_model.h | 2 + .../btc/include/btc_ble_mesh_prov.h | 4 + .../btc/include/btc_ble_mesh_sensor_model.h | 2 + .../bt/host/bluedroid/api/esp_a2dp_api.c | 26 ++-- .../bt/host/bluedroid/api/esp_avrc_api.c | 26 ++-- .../bt/host/bluedroid/api/esp_bt_device.c | 2 +- .../bt/host/bluedroid/api/esp_bt_main.c | 8 +- .../bt/host/bluedroid/api/esp_gap_ble_api.c | 129 +++++++++--------- .../bt/host/bluedroid/api/esp_gap_bt_api.c | 45 +++--- .../host/bluedroid/api/esp_gatt_common_api.c | 2 +- .../bt/host/bluedroid/api/esp_gattc_api.c | 48 ++++--- .../bt/host/bluedroid/api/esp_gatts_api.c | 42 +++--- .../bt/host/bluedroid/api/esp_hf_ag_api.c | 50 ++++--- .../bt/host/bluedroid/api/esp_hf_client_api.c | 48 +++---- .../bt/host/bluedroid/api/esp_hidd_api.c | 19 +-- .../bt/host/bluedroid/api/esp_hidh_api.c | 29 ++-- .../bt/host/bluedroid/api/esp_l2cap_bt_api.c | 12 +- .../bt/host/bluedroid/api/esp_sdp_api.c | 11 +- .../bt/host/bluedroid/api/esp_spp_api.c | 17 +-- .../bt/host/bluedroid/btc/core/btc_dm.c | 3 +- .../bluedroid/btc/core/btc_profile_queue.c | 4 +- .../bluedroid/btc/profile/std/a2dp/btc_av.c | 17 +-- .../bluedroid/btc/profile/std/avrc/btc_avrc.c | 8 +- .../btc/profile/std/gap/bta_gap_bt_co.c | 2 +- .../btc/profile/std/gap/btc_gap_ble.c | 38 +++--- .../btc/profile/std/gap/btc_gap_bt.c | 14 +- .../btc/profile/std/gatt/btc_gattc.c | 3 +- .../btc/profile/std/gatt/btc_gatts.c | 9 +- .../btc/profile/std/hf_ag/btc_hf_ag.c | 2 +- .../btc/profile/std/hf_client/btc_hf_client.c | 2 +- .../bluedroid/btc/profile/std/hid/bta_hh_co.c | 2 +- .../bluedroid/btc/profile/std/hid/btc_hd.c | 4 +- .../bluedroid/btc/profile/std/hid/btc_hh.c | 6 +- .../btc/profile/std/include/btc_avrc.h | 1 + .../btc/profile/std/include/btc_gap_bt.h | 1 + .../btc/profile/std/include/btc_gattc.h | 1 + .../btc/profile/std/include/btc_gatts.h | 1 + .../btc/profile/std/include/btc_hd.h | 1 + .../btc/profile/std/include/btc_hh.h | 2 + .../btc/profile/std/include/btc_spp.h | 1 + .../btc/profile/std/l2cap/btc_l2cap.c | 6 +- .../bluedroid/btc/profile/std/sdp/btc_sdp.c | 4 +- .../bluedroid/btc/profile/std/spp/btc_spp.c | 12 +- .../bt/host/bluedroid/stack/btu/btu_hcif.c | 8 +- 76 files changed, 543 insertions(+), 473 deletions(-) diff --git a/components/bt/common/api/esp_blufi_api.c b/components/bt/common/api/esp_blufi_api.c index 9a58777ab510..b2475537f469 100644 --- a/components/bt/common/api/esp_blufi_api.c +++ b/components/bt/common/api/esp_blufi_api.c @@ -38,7 +38,8 @@ esp_err_t esp_blufi_send_wifi_conn_report(wifi_mode_t opmode, esp_blufi_sta_conn arg.wifi_conn_report.softap_conn_num = softap_conn_num; arg.wifi_conn_report.extra_info = extra_info; - return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy, + btc_blufi_call_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list) @@ -54,7 +55,8 @@ esp_err_t esp_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list arg.wifi_list.apCount = apCount; arg.wifi_list.list = list; - return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy, + btc_blufi_call_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_blufi_profile_init(void) @@ -67,7 +69,7 @@ esp_err_t esp_blufi_profile_init(void) msg.pid = BTC_PID_BLUFI; msg.act = BTC_BLUFI_ACT_INIT; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_blufi_profile_deinit(void) @@ -80,7 +82,7 @@ esp_err_t esp_blufi_profile_deinit(void) msg.pid = BTC_PID_BLUFI; msg.act = BTC_BLUFI_ACT_DEINIT; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } uint16_t esp_blufi_get_version(void) @@ -100,7 +102,7 @@ esp_err_t esp_blufi_send_error_info(esp_blufi_error_state_t state) msg.act = BTC_BLUFI_ACT_SEND_ERR_INFO; arg.blufi_err_infor.state = state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_blufi_send_custom_data(uint8_t *data, uint32_t data_len) @@ -118,6 +120,7 @@ esp_err_t esp_blufi_send_custom_data(uint8_t *data, uint32_t data_len) arg.custom_data.data = data; arg.custom_data.data_len = data_len; - return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy, + btc_blufi_call_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif ///BLUFI_INCLUDED == TRUE diff --git a/components/bt/common/btc/core/btc_task.c b/components/bt/common/btc/core/btc_task.c index b094e045dfad..e439056c0781 100644 --- a/components/bt/common/btc/core/btc_task.c +++ b/components/bt/common/btc/core/btc_task.c @@ -231,13 +231,15 @@ static bt_status_t btc_task_post(btc_msg_t *msg, uint32_t timeout) * @param arg paramter * @param arg_len length of paramter * @param copy_func deep copy function + * @param free_func deep free function * @return BT_STATUS_SUCCESS: success * others: fail */ -bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg_deep_copy_t copy_func) +bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg_deep_copy_t copy_func, + btc_arg_deep_free_t free_func) { btc_msg_t* lmsg; - + bt_status_t ret; // arg XOR arg_len if ((msg == NULL) || ((arg == NULL) == !(arg_len == 0))) { return BT_STATUS_PARM_INVALID; @@ -266,8 +268,18 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg lmsg->arg = NULL; } - return btc_task_post(lmsg, OSI_THREAD_MAX_TIMEOUT); + ret = btc_task_post(lmsg, OSI_THREAD_MAX_TIMEOUT); + if (ret != BT_STATUS_SUCCESS) { + if (copy_func && free_func) { + free_func(lmsg); + } + if (lmsg->arg) { + osi_free(lmsg->arg); + } + osi_free(lmsg); + } + return ret; } /** diff --git a/components/bt/common/btc/include/btc/btc_task.h b/components/bt/common/btc/include/btc/btc_task.h index 17357cf0a503..2ee87303543e 100644 --- a/components/bt/common/btc/include/btc/btc_task.h +++ b/components/bt/common/btc/include/btc/btc_task.h @@ -94,6 +94,7 @@ typedef struct { } btc_func_t; typedef void (* btc_arg_deep_copy_t)(btc_msg_t *msg, void *dst, void *src); +typedef void (* btc_arg_deep_free_t)(btc_msg_t *msg); #ifdef __cplusplus extern "C" { @@ -105,10 +106,12 @@ extern "C" { * @param arg paramter * @param arg_len length of paramter * @param copy_func deep copy function + * @param free_func deep free function * @return BT_STATUS_SUCCESS: success * others: fail */ -bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg_deep_copy_t copy_func); +bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg_deep_copy_t copy_func, + btc_arg_deep_free_t free_func); /** * transfer an message to another module in tha same task. diff --git a/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c index 5fd18b40210e..ea23baee1fec 100644 --- a/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c +++ b/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c @@ -144,7 +144,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) msg.act = ESP_BLUFI_EVENT_DEINIT_FINISH; param.deinit_finish.state = ESP_BLUFI_DEINIT_OK; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; } @@ -283,7 +283,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) msg.act = ESP_BLUFI_EVENT_INIT_FINISH; param.init_finish.state = ESP_BLUFI_INIT_OK; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; } case BTA_GATTS_CONNECT_EVT: { @@ -307,7 +307,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) param.connect.conn_id = BTC_GATT_GET_CONN_ID(p_data->conn.conn_id); conn_id = param.connect.conn_id; server_if = p_data->conn.server_if; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; } case BTA_GATTS_DISCONNECT_EVT: { @@ -335,7 +335,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_BLE_DISCONNECT; memcpy(param.disconnect.remote_bda, p_data->conn.remote_bda, ESP_BLUFI_BD_ADDR_LEN); - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; } case BTA_GATTS_OPEN_EVT: @@ -410,7 +410,7 @@ esp_err_t esp_blufi_close(esp_gatt_if_t gatts_if, uint16_t conn_id) msg.pid = BTC_PID_GATTS; msg.act = BTC_GATTS_ACT_CLOSE; arg.close.conn_id = BTC_GATT_CREATE_CONN_ID(gatts_if, conn_id); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/common/btc/profile/esp/blufi/blufi_prf.c b/components/bt/common/btc/profile/esp/blufi/blufi_prf.c index 1dbef64e871a..29040942dc3e 100644 --- a/components/bt/common/btc/profile/esp/blufi/blufi_prf.c +++ b/components/bt/common/btc/profile/esp/blufi/blufi_prf.c @@ -90,7 +90,7 @@ void btc_blufi_report_error(esp_blufi_error_state_t state) msg.act = ESP_BLUFI_EVENT_REPORT_ERROR; esp_blufi_cb_param_t param; param.report_error.state = state; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); } void btc_blufi_recv_handler(uint8_t *data, int len) diff --git a/components/bt/common/btc/profile/esp/blufi/blufi_protocol.c b/components/bt/common/btc/profile/esp/blufi/blufi_protocol.c index 24f81c5fabd1..1b84253b523a 100644 --- a/components/bt/common/btc/profile/esp/blufi/blufi_protocol.c +++ b/components/bt/common/btc/profile/esp/blufi/blufi_protocol.c @@ -42,35 +42,35 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) msg.act = ESP_BLUFI_EVENT_SET_WIFI_OPMODE; param.wifi_mode.op_mode = data[0]; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; case BLUFI_TYPE_CTRL_SUBTYPE_CONN_TO_AP: msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_REQ_CONNECT_TO_AP; - btc_transfer_context(&msg, NULL, 0, NULL); + btc_transfer_context(&msg, NULL, 0, NULL, NULL); break; case BLUFI_TYPE_CTRL_SUBTYPE_DISCONN_FROM_AP: msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_REQ_DISCONNECT_FROM_AP; - btc_transfer_context(&msg, NULL, 0, NULL); + btc_transfer_context(&msg, NULL, 0, NULL, NULL); break; case BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_STATUS: msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_GET_WIFI_STATUS; - btc_transfer_context(&msg, NULL, 0, NULL); + btc_transfer_context(&msg, NULL, 0, NULL, NULL); break; case BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA: msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_DEAUTHENTICATE_STA; - btc_transfer_context(&msg, NULL, 0, NULL); + btc_transfer_context(&msg, NULL, 0, NULL,NULL); break; case BLUFI_TYPE_CTRL_SUBTYPE_GET_VERSION: { uint8_t type = BLUFI_BUILD_TYPE(BLUFI_TYPE_DATA, BLUFI_TYPE_DATA_SUBTYPE_REPLY_VERSION); @@ -85,13 +85,13 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_RECV_SLAVE_DISCONNECT_BLE; - btc_transfer_context(&msg, NULL, 0, NULL); + btc_transfer_context(&msg, NULL, 0, NULL, NULL); break; case BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_LIST: msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_GET_WIFI_LIST; - btc_transfer_context(&msg, NULL, 0, NULL); + btc_transfer_context(&msg, NULL, 0, NULL, NULL); break; default: BTC_TRACE_ERROR("%s Unkown Ctrl pkt %02x\n", __func__, type); @@ -116,7 +116,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) msg.act = ESP_BLUFI_EVENT_RECV_STA_BSSID; memcpy(param.sta_bssid.bssid, &data[0], 6); - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; case BLUFI_TYPE_DATA_SUBTYPE_STA_SSID: msg.sig = BTC_SIG_API_CB; @@ -125,7 +125,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.sta_ssid.ssid = &data[0]; param.sta_ssid.ssid_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_STA_PASSWD: msg.sig = BTC_SIG_API_CB; @@ -134,7 +134,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.sta_passwd.passwd = &data[0]; param.sta_passwd.passwd_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_SSID: msg.sig = BTC_SIG_API_CB; @@ -143,7 +143,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.softap_ssid.ssid = &data[0]; param.softap_ssid.ssid_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_PASSWD: msg.sig = BTC_SIG_API_CB; @@ -152,7 +152,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.softap_passwd.passwd = &data[0]; param.softap_passwd.passwd_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_MAX_CONN_NUM: msg.sig = BTC_SIG_API_CB; @@ -160,7 +160,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) msg.act = ESP_BLUFI_EVENT_RECV_SOFTAP_MAX_CONN_NUM; param.softap_max_conn_num.max_conn_num = data[0]; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; case BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_AUTH_MODE: msg.sig = BTC_SIG_API_CB; @@ -168,7 +168,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) msg.act = ESP_BLUFI_EVENT_RECV_SOFTAP_AUTH_MODE; param.softap_auth_mode.auth_mode = data[0]; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; case BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_CHANNEL: msg.sig = BTC_SIG_API_CB; @@ -176,7 +176,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) msg.act = ESP_BLUFI_EVENT_RECV_SOFTAP_CHANNEL; param.softap_channel.channel = data[0]; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); break; case BLUFI_TYPE_DATA_SUBTYPE_USERNAME: msg.sig = BTC_SIG_API_CB; @@ -185,7 +185,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.username.name = &data[0]; param.username.name_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_CA: msg.sig = BTC_SIG_API_CB; @@ -194,7 +194,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.ca.cert = &data[0]; param.ca.cert_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_CLIENT_CERT: msg.sig = BTC_SIG_API_CB; @@ -203,7 +203,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.client_cert.cert = &data[0]; param.client_cert.cert_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_SERVER_CERT: msg.sig = BTC_SIG_API_CB; @@ -212,7 +212,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.client_cert.cert = &data[0]; param.client_cert.cert_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_CLIENT_PRIV_KEY: msg.sig = BTC_SIG_API_CB; @@ -221,7 +221,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.client_pkey.pkey = &data[0]; param.client_pkey.pkey_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_SERVER_PRIV_KEY: msg.sig = BTC_SIG_API_CB; @@ -230,7 +230,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) param.client_pkey.pkey = &data[0]; param.client_pkey.pkey_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; case BLUFI_TYPE_DATA_SUBTYPE_CUSTOM_DATA: msg.sig = BTC_SIG_API_CB; @@ -238,7 +238,7 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) msg.act = ESP_BLUFI_EVENT_RECV_CUSTOM_DATA; param.custom_data.data = &data[0]; param.custom_data.data_len = len; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), btc_blufi_cb_deep_copy, btc_blufi_cb_deep_free); break; default: BTC_TRACE_ERROR("%s Unkown Ctrl pkt %02x\n", __func__, type); diff --git a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c index 6c5088975681..09e3db61b856 100644 --- a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c +++ b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c @@ -266,7 +266,7 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg) param.connect.conn_id = event->connect.conn_handle; /* save connection handle */ conn_handle = event->connect.conn_handle; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); } if (event->connect.status != 0) { /* Connection failed; resume advertising. */ @@ -293,7 +293,7 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg) msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_BLE_DISCONNECT; memcpy(param.disconnect.remote_bda, event->disconnect.conn.peer_id_addr.val, ESP_BLUFI_BD_ADDR_LEN); - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); return 0; case BLE_GAP_EVENT_CONN_UPDATE: @@ -424,7 +424,7 @@ void esp_blufi_deinit(void) msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_DEINIT_FINISH; param.deinit_finish.state = ESP_BLUFI_DEINIT_OK; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); } void esp_blufi_send_notify(void *arg) @@ -496,7 +496,7 @@ int esp_blufi_handle_gap_events(struct ble_gap_event *event, void *arg) memcpy(param.connect.remote_bda, desc.peer_id_addr.val, ESP_BLUFI_BD_ADDR_LEN); param.connect.conn_id = event->connect.conn_handle; - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); } return 0; case BLE_GAP_EVENT_DISCONNECT: { @@ -523,7 +523,7 @@ int esp_blufi_handle_gap_events(struct ble_gap_event *event, void *arg) memcpy(param.disconnect.remote_bda, event->disconnect.conn.peer_id_addr.val, ESP_BLUFI_BD_ADDR_LEN); - btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL, NULL); return 0; } diff --git a/components/bt/common/osi/alarm.c b/components/bt/common/osi/alarm.c index b6873a943d9a..464bbc2c8973 100644 --- a/components/bt/common/osi/alarm.c +++ b/components/bt/common/osi/alarm.c @@ -149,7 +149,7 @@ static void alarm_cb_handler(struct alarm_t *alarm) msg.pid = BTC_PID_ALARM; arg.cb = alarm->cb; arg.cb_data = alarm->cb_data; - btc_transfer_context(&msg, &arg, sizeof(btc_alarm_args_t), NULL); + btc_transfer_context(&msg, &arg, sizeof(btc_alarm_args_t), NULL, NULL); } osi_alarm_t *osi_alarm_new(const char *alarm_name, osi_alarm_callback_t callback, void *data, period_ms_t timer_expire) diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c index 9c7db301d416..559528e8adff 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c @@ -43,7 +43,7 @@ esp_err_t esp_ble_mesh_start_ble_advertising(const esp_ble_mesh_ble_adv_param_t memcpy(&arg.start_ble_adv.data, data, sizeof(esp_ble_mesh_ble_adv_data_t)); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -64,7 +64,7 @@ esp_err_t esp_ble_mesh_stop_ble_advertising(uint8_t index) arg.stop_ble_adv.index = index; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */ @@ -81,7 +81,7 @@ esp_err_t esp_ble_mesh_start_ble_scanning(esp_ble_mesh_ble_scan_param_t *param) msg.pid = BTC_PID_BLE_MESH_BLE_COEX; msg.act = BTC_BLE_MESH_ACT_START_BLE_SCAN; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -96,7 +96,7 @@ esp_err_t esp_ble_mesh_stop_ble_scanning(void) msg.pid = BTC_PID_BLE_MESH_BLE_COEX; msg.act = BTC_BLE_MESH_ACT_STOP_BLE_SCAN; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_SUPPORT_BLE_SCAN */ diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c index 7b97262a4a3b..a469452f0033 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c @@ -47,7 +47,7 @@ esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_MESH_INIT; - if (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) != BT_STATUS_SUCCESS) { + if (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) != BT_STATUS_SUCCESS) { vSemaphoreDelete(semaphore); BT_ERR("Failed to start mesh init"); return ESP_FAIL; @@ -79,7 +79,7 @@ esp_err_t esp_ble_mesh_deinit(esp_ble_mesh_deinit_param_t *param) msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_DEINIT_MESH; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_DEINIT */ diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c index 9115a9781bf5..13ce4f534219 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c @@ -92,7 +92,7 @@ esp_err_t esp_ble_mesh_model_subscribe_group_addr(uint16_t element_addr, uint16_ arg.model_sub_group_addr.model_id = model_id; arg.model_sub_group_addr.group_addr = group_addr; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -118,7 +118,7 @@ esp_err_t esp_ble_mesh_model_unsubscribe_group_addr(uint16_t element_addr, uint1 arg.model_unsub_group_addr.model_id = model_id; arg.model_unsub_group_addr.group_addr = group_addr; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -152,7 +152,7 @@ esp_err_t esp_ble_mesh_node_add_local_net_key(const uint8_t net_key[16], uint16_ arg.node_add_local_net_key.net_idx = net_idx; memcpy(arg.node_add_local_net_key.net_key, net_key, 16); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -175,7 +175,7 @@ esp_err_t esp_ble_mesh_node_add_local_app_key(const uint8_t app_key[16], uint16_ arg.node_add_local_app_key.app_idx = app_idx; memcpy(arg.node_add_local_app_key.app_key, app_key, 16); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -200,7 +200,7 @@ esp_err_t esp_ble_mesh_node_bind_app_key_to_local_model(uint16_t element_addr, u arg.node_local_mod_app_bind.company_id = company_id; arg.node_local_mod_app_bind.app_idx = app_idx; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c index 06e171385895..a030b636e3c2 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c @@ -21,7 +21,7 @@ esp_err_t esp_ble_mesh_lpn_enable(void) msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_LPN_ENABLE; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_lpn_disable(bool force) @@ -37,7 +37,7 @@ esp_err_t esp_ble_mesh_lpn_disable(bool force) arg.lpn_disable.force = force; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -51,5 +51,5 @@ esp_err_t esp_ble_mesh_lpn_poll(void) msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_LPN_POLL; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c index 96b1b1496adc..3bc1a60eaeb8 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c @@ -101,8 +101,8 @@ static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model, arg.model_send.msg_timeout = msg_timeout; } - status = (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_model_args_t), btc_ble_mesh_model_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + status = (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_model_args_t), btc_ble_mesh_model_arg_deep_copy, + btc_ble_mesh_model_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); bt_mesh_free(msg_data); @@ -236,8 +236,8 @@ esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model, msg.pid = BTC_PID_MODEL; msg.act = BTC_BLE_MESH_ACT_SERVER_MODEL_UPDATE_STATE; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_model_args_t), btc_ble_mesh_model_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_model_args_t), btc_ble_mesh_model_arg_deep_copy, + btc_ble_mesh_model_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_SERVER_MODEL */ @@ -251,7 +251,7 @@ esp_err_t esp_ble_mesh_node_local_reset(void) msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_NODE_RESET; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #if (CONFIG_BLE_MESH_PROVISIONER) @@ -275,7 +275,7 @@ esp_err_t esp_ble_mesh_provisioner_set_node_name(uint16_t index, const char *nam memset(arg.set_node_name.name, 0, sizeof(arg.set_node_name.name)); strncpy(arg.set_node_name.name, name, ESP_BLE_MESH_NODE_NAME_MAX_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -312,8 +312,8 @@ esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr, arg.store_node_comp_data.unicast_addr = unicast_addr; arg.store_node_comp_data.length = length; arg.store_node_comp_data.data = data; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy, + btc_ble_mesh_prov_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_uuid(const uint8_t uuid[16]) @@ -370,7 +370,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_node_with_uuid(const uint8_t uuid[16]) memcpy(arg.delete_node_with_uuid.uuid, uuid, 16); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -391,7 +391,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr) arg.delete_node_with_addr.unicast_addr = unicast_addr; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -414,7 +414,7 @@ esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16], } else { bzero(arg.add_local_app_key.app_key, 16); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -437,7 +437,7 @@ esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16 memcpy(arg.update_local_app_key.app_key, app_key, 16); arg.update_local_app_key.net_idx = net_idx; arg.update_local_app_key.app_idx = app_idx; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -466,7 +466,7 @@ esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_ arg.local_mod_app_bind.app_idx = app_idx; arg.local_mod_app_bind.model_id = model_id; arg.local_mod_app_bind.cid = company_id; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -491,7 +491,7 @@ esp_err_t esp_ble_mesh_provisioner_add_local_net_key(const uint8_t net_key[16], } else { bzero(arg.add_local_net_key.net_key, 16); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -512,7 +512,7 @@ esp_err_t esp_ble_mesh_provisioner_update_local_net_key(const uint8_t net_key[16 memcpy(arg.update_local_net_key.net_key, net_key, 16); arg.update_local_net_key.net_idx = net_idx; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -535,7 +535,7 @@ esp_err_t esp_ble_mesh_provisioner_recv_heartbeat(bool enable) arg.enable_heartbeat_recv.enable = enable; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -556,7 +556,7 @@ esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_type(uint8_t type) arg.set_heartbeat_filter_type.type = type; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -585,7 +585,7 @@ esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_info(uint8_t op, esp_ble arg.set_heartbeat_filter_info.hb_src = info->hb_src; arg.set_heartbeat_filter_info.hb_dst = info->hb_dst; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_PROVISIONER_RECV_HB */ @@ -602,7 +602,7 @@ esp_err_t esp_ble_mesh_provisioner_direct_erase_settings(void) msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DIRECT_ERASE_SETTINGS; - return (btc_transfer_context(&msg, NULL, 0, NULL) + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_SETTINGS */ @@ -625,7 +625,7 @@ esp_err_t esp_ble_mesh_provisioner_open_settings_with_index(uint8_t index) arg.open_settings_with_index.index = index; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -646,7 +646,7 @@ esp_err_t esp_ble_mesh_provisioner_open_settings_with_uid(const char *uid) strncpy(arg.open_settings_with_uid.uid, uid, ESP_BLE_MESH_SETTINGS_UID_SIZE); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -668,7 +668,7 @@ esp_err_t esp_ble_mesh_provisioner_close_settings_with_index(uint8_t index, bool arg.close_settings_with_index.index = index; arg.close_settings_with_index.erase = erase; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -690,7 +690,7 @@ esp_err_t esp_ble_mesh_provisioner_close_settings_with_uid(const char *uid, bool strncpy(arg.close_settings_with_uid.uid, uid, ESP_BLE_MESH_SETTINGS_UID_SIZE); arg.close_settings_with_uid.erase = erase; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -711,7 +711,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_settings_with_index(uint8_t index) arg.delete_settings_with_index.index = index; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -732,7 +732,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_settings_with_uid(const char *uid) strncpy(arg.delete_settings_with_uid.uid, uid, ESP_BLE_MESH_SETTINGS_UID_SIZE); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c index 172c919dec05..a2fcfd9c72c3 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c @@ -57,7 +57,7 @@ esp_err_t esp_ble_mesh_node_prov_enable(esp_ble_mesh_prov_bearer_t bearers) msg.act = BTC_BLE_MESH_ACT_PROV_ENABLE; arg.node_prov_enable.bearers = bearers; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -77,7 +77,7 @@ esp_err_t esp_ble_mesh_node_prov_disable(esp_ble_mesh_prov_bearer_t bearers) msg.act = BTC_BLE_MESH_ACT_PROV_DISABLE; arg.node_prov_disable.bearers = bearers; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -101,7 +101,7 @@ esp_err_t esp_ble_mesh_node_set_oob_pub_key(uint8_t pub_key_x[32], uint8_t pub_k memcpy(arg.set_oob_pub_key.pub_key_y, pub_key_y, 32); memcpy(arg.set_oob_pub_key.private_key, private_key, 32); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -121,7 +121,7 @@ esp_err_t esp_ble_mesh_node_input_number(uint32_t number) msg.act = BTC_BLE_MESH_ACT_INPUT_NUMBER; arg.input_number.number = number; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -143,7 +143,7 @@ esp_err_t esp_ble_mesh_node_input_string(const char *string) strncpy(arg.input_string.string, string, MIN(strlen(string), sizeof(arg.input_string.string))); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -165,7 +165,7 @@ esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name) memset(arg.set_device_name.name, 0, sizeof(arg.set_device_name.name)); strncpy(arg.set_device_name.name, name, ESP_BLE_MESH_DEVICE_NAME_MAX_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -190,7 +190,7 @@ esp_err_t esp_ble_mesh_provisioner_read_oob_pub_key(uint8_t link_idx, uint8_t pu memcpy(arg.provisioner_read_oob_pub_key.pub_key_x, pub_key_x, 32); memcpy(arg.provisioner_read_oob_pub_key.pub_key_y, pub_key_y, 32); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -215,7 +215,7 @@ esp_err_t esp_ble_mesh_provisioner_input_string(const char *string, uint8_t link MIN(strlen(string), sizeof(arg.provisioner_input_str.string))); arg.provisioner_input_str.link_idx = link_idx; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -237,7 +237,7 @@ esp_err_t esp_ble_mesh_provisioner_input_number(uint32_t number, uint8_t link_id arg.provisioner_input_num.number = number; arg.provisioner_input_num.link_idx = link_idx; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -258,7 +258,7 @@ esp_err_t esp_ble_mesh_provisioner_prov_enable(esp_ble_mesh_prov_bearer_t bearer arg.provisioner_enable.bearers = bearers; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -279,7 +279,7 @@ esp_err_t esp_ble_mesh_provisioner_prov_disable(esp_ble_mesh_prov_bearer_t beare arg.provisioner_disable.bearers = bearers; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -305,7 +305,7 @@ esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t memcpy(arg.provisioner_dev_add.add_dev.addr, add_dev->addr, sizeof(esp_ble_mesh_bd_addr_t)); memcpy(arg.provisioner_dev_add.add_dev.uuid, add_dev->uuid, 16); arg.provisioner_dev_add.flags = flags; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -339,7 +339,7 @@ esp_err_t esp_ble_mesh_provisioner_prov_device_with_addr(const uint8_t uuid[16], arg.provisioner_prov_dev_with_addr.bearer = bearer; arg.provisioner_prov_dev_with_addr.oob_info = oob_info; arg.provisioner_prov_dev_with_addr.unicast_addr = unicast_addr; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -366,7 +366,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_dev(esp_ble_mesh_device_delete_t *del_ } else if (del_dev->flag & DEL_DEV_UUID_FLAG) { memcpy(arg.provisioner_dev_del.del_dev.uuid, del_dev->uuid, 16); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -392,7 +392,7 @@ esp_err_t esp_ble_mesh_provisioner_set_dev_uuid_match(const uint8_t *match_val, arg.set_dev_uuid_match.match_len = match_len; arg.set_dev_uuid_match.offset = offset; arg.set_dev_uuid_match.prov_after_match = prov_after_match; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -420,7 +420,7 @@ esp_err_t esp_ble_mesh_provisioner_set_prov_data_info(esp_ble_mesh_prov_data_inf } else if (prov_data_info->flag & PROV_DATA_IV_INDEX_FLAG) { arg.set_prov_data_info.prov_data.iv_index = prov_data_info->iv_index; } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -441,7 +441,7 @@ esp_err_t esp_ble_mesh_provisioner_set_static_oob_value(const uint8_t *value, ui arg.set_static_oob_val.length = length; memcpy(arg.set_static_oob_val.value, value, length); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -461,7 +461,7 @@ esp_err_t esp_ble_mesh_provisioner_set_primary_elem_addr(uint16_t addr) msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SET_PRIMARY_ELEM_ADDR; arg.set_primary_elem_addr.addr = addr; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -497,7 +497,7 @@ esp_err_t esp_ble_mesh_set_fast_prov_info(esp_ble_mesh_fast_prov_info_t *fast_pr if (fast_prov_info->match_len && fast_prov_info->match_val) { memcpy(arg.set_fast_prov_info.match_val, fast_prov_info->match_val, fast_prov_info->match_len); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -517,7 +517,7 @@ esp_err_t esp_ble_mesh_set_fast_prov_action(esp_ble_mesh_fast_prov_action_t acti msg.act = BTC_BLE_MESH_ACT_SET_FAST_PROV_ACTION; arg.set_fast_prov_action.action = action; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c index e36e7ef8bf52..cce62d63f616 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c @@ -22,7 +22,7 @@ esp_err_t esp_ble_mesh_proxy_identity_enable(void) msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_PROXY_IDENTITY_ENABLE; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_proxy_gatt_enable(void) @@ -35,7 +35,7 @@ esp_err_t esp_ble_mesh_proxy_gatt_enable(void) msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_PROXY_GATT_ENABLE; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_proxy_gatt_disable(void) @@ -48,7 +48,7 @@ esp_err_t esp_ble_mesh_proxy_gatt_disable(void) msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_PROXY_GATT_DISABLE; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_proxy_client_connect(esp_ble_mesh_bd_addr_t addr, @@ -72,7 +72,7 @@ esp_err_t esp_ble_mesh_proxy_client_connect(esp_ble_mesh_bd_addr_t addr, arg.proxy_client_connect.addr_type = addr_type; arg.proxy_client_connect.net_idx = net_idx; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -89,7 +89,7 @@ esp_err_t esp_ble_mesh_proxy_client_disconnect(uint8_t conn_handle) arg.proxy_client_disconnect.conn_handle = conn_handle; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -113,7 +113,7 @@ esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle, uint16_ arg.proxy_client_set_filter_type.net_idx = net_idx; arg.proxy_client_set_filter_type.filter_type = filter_type; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -138,8 +138,8 @@ esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle, uint16_ arg.proxy_client_add_filter_addr.addr_num = addr_num; arg.proxy_client_add_filter_addr.addr = addr; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy, + btc_ble_mesh_prov_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle, uint16_t net_idx, @@ -163,6 +163,6 @@ esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle, uint arg.proxy_client_remove_filter_addr.addr_num = addr_num; arg.proxy_client_remove_filter_addr.addr = addr; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy, + btc_ble_mesh_prov_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c index 526d7e2968dd..98155caf1744 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c @@ -59,8 +59,8 @@ esp_err_t esp_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_ arg.cfg_client_get_state.params = params; arg.cfg_client_get_state.get_state = get_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_config_client_args_t), btc_ble_mesh_config_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_config_client_args_t), btc_ble_mesh_config_client_arg_deep_copy, + btc_ble_mesh_config_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_t *params, @@ -84,8 +84,8 @@ esp_err_t esp_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_ arg.cfg_client_set_state.params = params; arg.cfg_client_set_state.set_state = set_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_config_client_args_t), btc_ble_mesh_config_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_config_client_args_t), btc_ble_mesh_config_client_arg_deep_copy, + btc_ble_mesh_config_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_CFG_CLI */ diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c index 81ddd8226484..e404c6a5bdaf 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c @@ -54,8 +54,8 @@ esp_err_t esp_ble_mesh_generic_client_get_state(esp_ble_mesh_client_common_param arg.generic_client_get_state.params = params; arg.generic_client_get_state.get_state = get_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_generic_client_args_t), btc_ble_mesh_generic_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_generic_client_args_t), btc_ble_mesh_generic_client_arg_deep_copy, + btc_ble_mesh_generic_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_generic_client_set_state(esp_ble_mesh_client_common_param_t *params, @@ -79,8 +79,8 @@ esp_err_t esp_ble_mesh_generic_client_set_state(esp_ble_mesh_client_common_param arg.generic_client_set_state.params = params; arg.generic_client_set_state.set_state = set_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_generic_client_args_t), btc_ble_mesh_generic_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_generic_client_args_t), btc_ble_mesh_generic_client_arg_deep_copy, + btc_ble_mesh_generic_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */ diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c index 742e10c50d15..2bdb35a30aea 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c @@ -41,8 +41,8 @@ esp_err_t esp_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param_ arg.health_client_get_state.params = params; arg.health_client_get_state.get_state = get_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_client_args_t), btc_ble_mesh_health_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_client_args_t), btc_ble_mesh_health_client_arg_deep_copy, + btc_ble_mesh_health_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_t *params, @@ -66,8 +66,8 @@ esp_err_t esp_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_ arg.health_client_set_state.params = params; arg.health_client_set_state.set_state = set_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_client_args_t), btc_ble_mesh_health_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_client_args_t), btc_ble_mesh_health_client_arg_deep_copy, + btc_ble_mesh_health_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_HEALTH_CLI */ @@ -95,7 +95,7 @@ esp_err_t esp_ble_mesh_health_server_fault_update(esp_ble_mesh_elem_t *element) msg.act = BTC_BLE_MESH_ACT_HEALTH_SERVER_FAULT_UPDATE; arg.health_fault_update.element = element; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_server_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_server_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_HEALTH_SRV */ diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c index e31fe30aeded..80bc62f82d04 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c @@ -41,8 +41,8 @@ esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t arg.light_client_get_state.params = params; arg.light_client_get_state.get_state = get_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_lighting_client_args_t), btc_ble_mesh_lighting_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_lighting_client_args_t), btc_ble_mesh_lighting_client_arg_deep_copy, + btc_ble_mesh_lighting_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t *params, @@ -66,8 +66,8 @@ esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t arg.light_client_set_state.params = params; arg.light_client_set_state.set_state = set_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_lighting_client_args_t), btc_ble_mesh_lighting_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_lighting_client_args_t), btc_ble_mesh_lighting_client_arg_deep_copy, + btc_ble_mesh_lighting_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */ diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c index 46f26e746d76..c3c047f12b69 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c @@ -40,8 +40,8 @@ esp_err_t esp_ble_mesh_sensor_client_get_state(esp_ble_mesh_client_common_param_ arg.sensor_client_get_state.params = params; arg.sensor_client_get_state.get_state = get_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_sensor_client_args_t), btc_ble_mesh_sensor_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_sensor_client_args_t), btc_ble_mesh_sensor_client_arg_deep_copy, + btc_ble_mesh_sensor_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_sensor_client_set_state(esp_ble_mesh_client_common_param_t *params, @@ -65,8 +65,8 @@ esp_err_t esp_ble_mesh_sensor_client_set_state(esp_ble_mesh_client_common_param_ arg.sensor_client_set_state.params = params; arg.sensor_client_set_state.set_state = set_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_sensor_client_args_t), btc_ble_mesh_sensor_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_sensor_client_args_t), btc_ble_mesh_sensor_client_arg_deep_copy, + btc_ble_mesh_sensor_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_SENSOR_CLI */ diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c index 6dbe54c29cad..686e3d227860 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c @@ -41,8 +41,8 @@ esp_err_t esp_ble_mesh_time_scene_client_get_state(esp_ble_mesh_client_common_pa arg.time_scene_client_get_state.params = params; arg.time_scene_client_get_state.get_state = get_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_time_scene_client_args_t), btc_ble_mesh_time_scene_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_time_scene_client_args_t), btc_ble_mesh_time_scene_client_arg_deep_copy, + btc_ble_mesh_time_scene_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_mesh_time_scene_client_set_state(esp_ble_mesh_client_common_param_t *params, @@ -66,8 +66,8 @@ esp_err_t esp_ble_mesh_time_scene_client_set_state(esp_ble_mesh_client_common_pa arg.time_scene_client_set_state.params = params; arg.time_scene_client_set_state.set_state = set_state; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_time_scene_client_args_t), btc_ble_mesh_time_scene_client_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_time_scene_client_args_t), btc_ble_mesh_time_scene_client_arg_deep_copy, + btc_ble_mesh_time_scene_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_ble.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_ble.c index 978f701f2e58..8fba9e9fedbe 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_ble.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_ble.c @@ -83,7 +83,7 @@ static void btc_ble_mesh_ble_callback(esp_ble_mesh_ble_cb_param_t *cb_params, ui msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_ble_cb_param_t), - btc_ble_mesh_ble_copy_req_data); + btc_ble_mesh_ble_copy_req_data, btc_ble_mesh_ble_free_req_data); } #if CONFIG_BLE_MESH_SUPPORT_BLE_SCAN diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c index 360b37a44bff..08b2b7a4ddea 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c @@ -83,7 +83,7 @@ void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void } } -static void btc_ble_mesh_config_client_arg_deep_free(btc_msg_t *msg) +void btc_ble_mesh_config_client_arg_deep_free(btc_msg_t *msg) { btc_ble_mesh_config_client_args_t *arg = NULL; @@ -299,7 +299,7 @@ static void btc_ble_mesh_config_client_callback(esp_ble_mesh_cfg_client_cb_param msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_cfg_client_cb_param_t), - btc_ble_mesh_config_client_copy_req_data); + btc_ble_mesh_config_client_copy_req_data, btc_ble_mesh_config_client_free_req_data); } void bt_mesh_config_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type, @@ -702,7 +702,7 @@ static void btc_ble_mesh_config_server_callback(esp_ble_mesh_cfg_server_cb_param msg.pid = BTC_PID_CONFIG_SERVER; msg.act = act; - btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_cfg_server_cb_param_t), NULL); + btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_cfg_server_cb_param_t), NULL, NULL); } void bt_mesh_config_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model, diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c index 2761fa1b06c4..760c6e5c6498 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c @@ -107,7 +107,7 @@ void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, voi } } -static void btc_ble_mesh_generic_client_arg_deep_free(btc_msg_t *msg) +void btc_ble_mesh_generic_client_arg_deep_free(btc_msg_t *msg) { btc_ble_mesh_generic_client_args_t *arg = NULL; @@ -369,7 +369,7 @@ static void btc_ble_mesh_generic_client_callback(esp_ble_mesh_generic_client_cb_ msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_generic_client_cb_param_t), - btc_ble_mesh_generic_client_copy_req_data); + btc_ble_mesh_generic_client_copy_req_data, btc_ble_mesh_generic_client_free_req_data); } void bt_mesh_generic_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type, @@ -686,7 +686,7 @@ static void btc_ble_mesh_generic_server_callback(esp_ble_mesh_generic_server_cb_ msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_generic_server_cb_param_t), - btc_ble_mesh_generic_server_copy_req_data); + btc_ble_mesh_generic_server_copy_req_data, btc_ble_mesh_generic_server_free_req_data); } void bt_mesh_generic_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model, diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c index 867b532ec36a..2a84fea62967 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c @@ -76,7 +76,7 @@ void btc_ble_mesh_health_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void } } -static void btc_ble_mesh_health_client_arg_deep_free(btc_msg_t *msg) +void btc_ble_mesh_health_client_arg_deep_free(btc_msg_t *msg) { btc_ble_mesh_health_client_args_t *arg = NULL; @@ -232,7 +232,7 @@ static void btc_ble_mesh_health_client_callback(esp_ble_mesh_health_client_cb_pa msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_health_client_cb_param_t), - btc_ble_mesh_health_client_copy_req_data); + btc_ble_mesh_health_client_copy_req_data, btc_ble_mesh_health_client_free_req_data); } void bt_mesh_health_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type, @@ -543,7 +543,7 @@ static void btc_ble_mesh_health_server_callback(esp_ble_mesh_health_server_cb_pa msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_health_server_cb_param_t), - btc_ble_mesh_health_server_copy_req_data); + btc_ble_mesh_health_server_copy_req_data, btc_ble_mesh_health_server_free_req_data); } void btc_ble_mesh_health_server_call_handler(btc_msg_t *msg) diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c index ec711c501826..c5412eb802b4 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c @@ -75,7 +75,7 @@ void btc_ble_mesh_lighting_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, vo } } -static void btc_ble_mesh_lighting_client_arg_deep_free(btc_msg_t *msg) +void btc_ble_mesh_lighting_client_arg_deep_free(btc_msg_t *msg) { btc_ble_mesh_lighting_client_args_t *arg = NULL; @@ -213,7 +213,7 @@ static void btc_ble_mesh_lighting_client_callback(esp_ble_mesh_light_client_cb_p msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_light_client_cb_param_t), - btc_ble_mesh_lighting_client_copy_req_data); + btc_ble_mesh_lighting_client_copy_req_data, btc_ble_mesh_lighting_client_free_req_data); } void bt_mesh_lighting_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type, @@ -498,7 +498,7 @@ static void btc_ble_mesh_lighting_server_callback(esp_ble_mesh_lighting_server_c msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_lighting_server_cb_param_t), - btc_ble_mesh_lighting_server_copy_req_data); + btc_ble_mesh_lighting_server_copy_req_data, btc_ble_mesh_lighting_server_free_req_data); } void bt_mesh_lighting_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model, diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c index 12c915ea8b8f..dfeaddb002d6 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c @@ -120,7 +120,7 @@ void btc_ble_mesh_prov_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src) } } -static void btc_ble_mesh_prov_arg_deep_free(btc_msg_t *msg) +void btc_ble_mesh_prov_arg_deep_free(btc_msg_t *msg) { btc_ble_mesh_prov_args_t *arg = NULL; @@ -196,7 +196,7 @@ void btc_ble_mesh_model_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src) } } -static void btc_ble_mesh_model_arg_deep_free(btc_msg_t *msg) +void btc_ble_mesh_model_arg_deep_free(btc_msg_t *msg) { btc_ble_mesh_model_args_t *arg = NULL; @@ -369,7 +369,7 @@ static bt_status_t btc_ble_mesh_model_callback(esp_ble_mesh_model_cb_param_t *pa msg.act = act; ret = btc_transfer_context(&msg, param, param == NULL ? 0 : sizeof(esp_ble_mesh_model_cb_param_t), - btc_ble_mesh_model_copy_req_data); + btc_ble_mesh_model_copy_req_data, btc_ble_mesh_model_free_req_data); if (ret != BT_STATUS_SUCCESS) { BT_ERR("btc_transfer_context failed"); } @@ -528,7 +528,7 @@ static bt_status_t btc_ble_mesh_prov_callback(esp_ble_mesh_prov_cb_param_t *para msg.pid = BTC_PID_PROV; msg.act = act; - ret = btc_transfer_context(&msg, param, param == NULL ? 0 : sizeof(esp_ble_mesh_prov_cb_param_t), NULL); + ret = btc_transfer_context(&msg, param, param == NULL ? 0 : sizeof(esp_ble_mesh_prov_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BT_ERR("btc_transfer_context failed"); } diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c index c33be507c070..4c6007fa6417 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c @@ -451,7 +451,7 @@ static void btc_ble_mesh_sensor_client_callback(esp_ble_mesh_sensor_client_cb_pa msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_sensor_client_cb_param_t), - btc_ble_mesh_sensor_client_copy_req_data); + btc_ble_mesh_sensor_client_copy_req_data, btc_ble_mesh_sensor_client_free_req_data); } void bt_mesh_sensor_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type, @@ -818,7 +818,7 @@ static void btc_ble_mesh_sensor_server_callback(esp_ble_mesh_sensor_server_cb_pa msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_sensor_server_cb_param_t), - btc_ble_mesh_sensor_server_copy_req_data); + btc_ble_mesh_sensor_server_copy_req_data, btc_ble_mesh_sensor_server_free_req_data); } void bt_mesh_sensor_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model, diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c index 67862cb2572c..0c5503ab7d33 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c @@ -215,7 +215,7 @@ static void btc_ble_mesh_time_scene_client_callback(esp_ble_mesh_time_scene_clie msg.act = act; btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_time_scene_client_cb_param_t), - btc_ble_mesh_time_scene_client_copy_req_data); + btc_ble_mesh_time_scene_client_copy_req_data, btc_ble_mesh_time_scene_client_free_req_data); } void bt_mesh_time_scene_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type, @@ -401,7 +401,7 @@ static void btc_ble_mesh_time_scene_server_callback(esp_ble_mesh_time_scene_serv msg.pid = BTC_PID_TIME_SCENE_SERVER; msg.act = act; - btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_time_scene_server_cb_param_t), NULL); + btc_transfer_context(&msg, cb_params, cb_params == NULL ? 0 : sizeof(esp_ble_mesh_time_scene_server_cb_param_t), NULL, NULL); } void bt_mesh_time_scene_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model, diff --git a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_config_model.h b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_config_model.h index 39ed1a5c1a4a..ce81b6c261f8 100644 --- a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_config_model.h +++ b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_config_model.h @@ -45,6 +45,8 @@ void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg); void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_ble_mesh_config_client_arg_deep_free(btc_msg_t *msg); + void btc_ble_mesh_config_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf); diff --git a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_generic_model.h b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_generic_model.h index a5b586d5ab73..d06785094df9 100644 --- a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_generic_model.h +++ b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_generic_model.h @@ -45,6 +45,8 @@ void btc_ble_mesh_generic_client_cb_handler(btc_msg_t *msg); void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_ble_mesh_generic_client_arg_deep_free(btc_msg_t *msg); + void btc_ble_mesh_generic_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf); diff --git a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_health_model.h b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_health_model.h index 331f41c23d60..a04745485bf6 100644 --- a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_health_model.h +++ b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_health_model.h @@ -41,6 +41,8 @@ typedef enum { void btc_ble_mesh_health_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_ble_mesh_health_client_arg_deep_free(btc_msg_t *msg); + void btc_ble_mesh_health_client_call_handler(btc_msg_t *msg); void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg); diff --git a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_lighting_model.h b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_lighting_model.h index 854d65216120..45ca7ee14be4 100644 --- a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_lighting_model.h +++ b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_lighting_model.h @@ -45,6 +45,8 @@ void btc_ble_mesh_lighting_client_cb_handler(btc_msg_t *msg); void btc_ble_mesh_lighting_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_ble_mesh_lighting_client_arg_deep_free(btc_msg_t *msg); + void btc_ble_mesh_lighting_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf); diff --git a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h index ab54cc487b8c..b9cd0156d543 100644 --- a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h +++ b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h @@ -336,8 +336,12 @@ typedef union { void btc_ble_mesh_prov_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_ble_mesh_prov_arg_deep_free(btc_msg_t *msg); + void btc_ble_mesh_model_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_ble_mesh_model_arg_deep_free(btc_msg_t *msg); + const uint8_t *btc_ble_mesh_node_get_local_net_key(uint16_t net_idx); const uint8_t *btc_ble_mesh_node_get_local_app_key(uint16_t app_idx); diff --git a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_sensor_model.h b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_sensor_model.h index a0dc29f37849..3d216c7fa95d 100644 --- a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_sensor_model.h +++ b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_sensor_model.h @@ -45,6 +45,8 @@ void btc_ble_mesh_sensor_client_cb_handler(btc_msg_t *msg); void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_ble_mesh_sensor_client_arg_deep_free(btc_msg_t *msg); + void btc_ble_mesh_sensor_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf); diff --git a/components/bt/host/bluedroid/api/esp_a2dp_api.c b/components/bt/host/bluedroid/api/esp_a2dp_api.c index a5ae32fa42a3..fbf9ecd0495f 100644 --- a/components/bt/host/bluedroid/api/esp_a2dp_api.c +++ b/components/bt/host/bluedroid/api/esp_a2dp_api.c @@ -32,7 +32,7 @@ esp_err_t esp_a2d_sink_init(void) msg.act = BTC_AV_SINK_API_INIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -53,7 +53,7 @@ esp_err_t esp_a2d_sink_deinit(void) msg.act = BTC_AV_SINK_API_DEINIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -77,7 +77,7 @@ esp_err_t esp_a2d_sink_register_data_callback(esp_a2d_sink_data_cb_t callback) arg.data_cb = callback; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -103,7 +103,7 @@ esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda) /* Switch to BTC context */ memcpy(&(arg.connect), remote_bda, sizeof(bt_bdaddr_t)); - stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -127,7 +127,7 @@ esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t remote_bda) /* Switch to BTC context */ memcpy(&(arg.disconn), remote_bda, sizeof(bt_bdaddr_t)); - stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -153,7 +153,7 @@ esp_err_t esp_a2d_sink_set_delay_value(uint16_t delay_value) arg.delay_value = delay_value; /* Switch to BTC context */ - stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -175,7 +175,7 @@ esp_err_t esp_a2d_sink_get_delay_value(void) msg.act = BTC_AV_SINK_API_GET_DELAY_VALUE_EVT; /* Switch to BTC context */ - stat = btc_transfer_context(&msg, NULL, 0, NULL); + stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } #endif /* BTC_AV_SINK_INCLUDED */ @@ -220,7 +220,7 @@ esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl) /* Switch to BTC context */ arg.ctrl = ctrl; - stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -242,7 +242,7 @@ esp_err_t esp_a2d_source_init(void) msg.act = BTC_AV_SRC_API_INIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -263,7 +263,7 @@ esp_err_t esp_a2d_source_deinit(void) msg.act = BTC_AV_SRC_API_DEINIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -289,7 +289,7 @@ esp_err_t esp_a2d_source_connect(esp_bd_addr_t remote_bda) /* Switch to BTC context */ memcpy(&(arg.src_connect), remote_bda, sizeof(bt_bdaddr_t)); - stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -315,7 +315,7 @@ esp_err_t esp_a2d_source_disconnect(esp_bd_addr_t remote_bda) /* Switch to BTC context */ memcpy(&(arg.src_disconn), remote_bda, sizeof(bt_bdaddr_t)); - stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -339,7 +339,7 @@ esp_err_t esp_a2d_source_register_data_callback(esp_a2d_source_data_cb_t callbac arg.src_data_cb = callback; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_avrc_api.c b/components/bt/host/bluedroid/api/esp_avrc_api.c index 1d0cba8b831e..2d3e15325f63 100644 --- a/components/bt/host/bluedroid/api/esp_avrc_api.c +++ b/components/bt/host/bluedroid/api/esp_avrc_api.c @@ -41,7 +41,7 @@ esp_err_t esp_avrc_ct_init(void) msg.act = BTC_AVRC_CT_API_INIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -58,7 +58,7 @@ esp_err_t esp_avrc_ct_deinit(void) msg.act = BTC_AVRC_CT_API_DEINIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -85,7 +85,7 @@ esp_err_t esp_avrc_ct_send_set_player_value_cmd(uint8_t tl, uint8_t attr_id, uin arg.ps_cmd.value_id = value_id; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -110,7 +110,7 @@ esp_err_t esp_avrc_ct_send_get_rn_capabilities_cmd(uint8_t tl) arg.get_caps_cmd.tl = tl; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -141,7 +141,7 @@ esp_err_t esp_avrc_ct_send_register_notification_cmd(uint8_t tl, uint8_t event_i arg.rn_cmd.event_parameter = event_parameter; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -175,7 +175,7 @@ esp_err_t esp_avrc_ct_send_set_absolute_volume_cmd(uint8_t tl, uint8_t volume) arg.set_abs_vol_cmd.volume = volume; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -201,7 +201,7 @@ esp_err_t esp_avrc_ct_send_metadata_cmd(uint8_t tl, uint8_t attr_mask) arg.md_cmd.attr_mask = attr_mask; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -228,7 +228,7 @@ esp_err_t esp_avrc_ct_send_passthrough_cmd(uint8_t tl, uint8_t key_code, uint8_t arg.pt_cmd.key_state = key_state; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -263,7 +263,7 @@ esp_err_t esp_avrc_tg_init(void) msg.act = BTC_AVRC_TG_API_INIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -280,7 +280,7 @@ esp_err_t esp_avrc_tg_deinit(void) msg.act = BTC_AVRC_TG_API_DEINIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -361,7 +361,7 @@ esp_err_t esp_avrc_tg_set_psth_cmd_filter(esp_avrc_psth_filter_t filter, const e /* Switch to BTC context */ bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_tg_args_t), - btc_avrc_tg_arg_deep_copy); + btc_avrc_tg_arg_deep_copy, btc_avrc_tg_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } else { return ESP_FAIL; @@ -414,7 +414,7 @@ esp_err_t esp_avrc_tg_set_rn_evt_cap(const esp_avrc_rn_evt_cap_mask_t *evt_set) arg.set_rn_evt = evt_set->bits; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_tg_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_tg_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -469,7 +469,7 @@ esp_err_t esp_avrc_tg_send_rn_rsp(esp_avrc_rn_event_ids_t event_id, esp_avrc_rn_ memcpy(&arg.rn_rsp.param, param, sizeof(esp_avrc_rn_param_t)); /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_tg_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_avrc_tg_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_bt_device.c b/components/bt/host/bluedroid/api/esp_bt_device.c index 21682e4ebeed..e9369b20fcc6 100644 --- a/components/bt/host/bluedroid/api/esp_bt_device.c +++ b/components/bt/host/bluedroid/api/esp_bt_device.c @@ -45,5 +45,5 @@ esp_err_t esp_bt_dev_set_device_name(const char *name) strcpy(arg.set_dev_name.device_name, name); - return (btc_transfer_context(&msg, &arg, sizeof(btc_dev_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_dev_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/host/bluedroid/api/esp_bt_main.c b/components/bt/host/bluedroid/api/esp_bt_main.c index c58519a4d332..911897a89b40 100644 --- a/components/bt/host/bluedroid/api/esp_bt_main.c +++ b/components/bt/host/bluedroid/api/esp_bt_main.c @@ -54,7 +54,7 @@ esp_err_t esp_bluedroid_enable(void) msg.pid = BTC_PID_MAIN_INIT; msg.act = BTC_MAIN_ACT_ENABLE; - if (btc_transfer_context(&msg, NULL, 0, NULL) != BT_STATUS_SUCCESS) { + if (btc_transfer_context(&msg, NULL, 0, NULL, NULL) != BT_STATUS_SUCCESS) { LOG_ERROR("Bluedroid enable failed\n"); return ESP_FAIL; } @@ -90,7 +90,7 @@ esp_err_t esp_bluedroid_disable(void) msg.pid = BTC_PID_MAIN_INIT; msg.act = BTC_MAIN_ACT_DISABLE; - if (btc_transfer_context(&msg, NULL, 0, NULL) != BT_STATUS_SUCCESS) { + if (btc_transfer_context(&msg, NULL, 0, NULL, NULL) != BT_STATUS_SUCCESS) { LOG_ERROR("Bluedroid disable failed\n"); return ESP_FAIL; } @@ -145,7 +145,7 @@ esp_err_t esp_bluedroid_init(void) msg.pid = BTC_PID_MAIN_INIT; msg.act = BTC_MAIN_ACT_INIT; - if (btc_transfer_context(&msg, NULL, 0, NULL) != BT_STATUS_SUCCESS) { + if (btc_transfer_context(&msg, NULL, 0, NULL, NULL) != BT_STATUS_SUCCESS) { LOG_ERROR("Bluedroid Initialize Fail"); return ESP_FAIL; } @@ -187,7 +187,7 @@ esp_err_t esp_bluedroid_deinit(void) msg.pid = BTC_PID_MAIN_INIT; msg.act = BTC_MAIN_ACT_DEINIT; - if (btc_transfer_context(&msg, NULL, 0, NULL) != BT_STATUS_SUCCESS) { + if (btc_transfer_context(&msg, NULL, 0, NULL, NULL) != BT_STATUS_SUCCESS) { LOG_ERROR("Bluedroid de-initialise failed\n"); return ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_gap_ble_api.c b/components/bt/host/bluedroid/api/esp_gap_ble_api.c index 19526e79553d..e97216266ec9 100644 --- a/components/bt/host/bluedroid/api/esp_gap_ble_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_ble_api.c @@ -43,8 +43,8 @@ esp_err_t esp_ble_gap_config_adv_data(esp_ble_adv_data_t *adv_data) msg.act = BTC_GAP_BLE_ACT_CFG_ADV_DATA; memcpy(&arg.cfg_adv_data.adv_data, adv_data, sizeof(esp_ble_adv_data_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); - + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free)== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -64,7 +64,7 @@ esp_err_t esp_ble_gap_set_scan_params(esp_ble_scan_params_t *scan_params) msg.act = BTC_GAP_BLE_ACT_SET_SCAN_PARAM; memcpy(&arg.set_scan_param.scan_params, scan_params, sizeof(esp_ble_scan_params_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_start_scanning(uint32_t duration) @@ -79,7 +79,7 @@ esp_err_t esp_ble_gap_start_scanning(uint32_t duration) msg.act = BTC_GAP_BLE_ACT_START_SCAN; arg.start_scan.duration = duration; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -92,7 +92,7 @@ esp_err_t esp_ble_gap_stop_scanning(void) msg.sig = BTC_SIG_API_CALL; msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_ACT_STOP_SCAN; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params) @@ -107,7 +107,7 @@ esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params) msg.act = BTC_GAP_BLE_ACT_START_ADV; memcpy(&arg.start_adv.adv_params, adv_params, sizeof(esp_ble_adv_params_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_stop_advertising(void) @@ -120,7 +120,7 @@ esp_err_t esp_ble_gap_stop_advertising(void) msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_ACT_STOP_ADV; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif // #if (BLE_42_FEATURE_SUPPORT == TRUE) @@ -146,7 +146,7 @@ esp_err_t esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params) msg.act = BTC_GAP_BLE_ACT_UPDATE_CONN_PARAM; memcpy(&arg.conn_update_params.conn_params, params, sizeof(esp_ble_conn_update_params_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } else { LOG_ERROR("%s,invalid connection params:min_int = %d, max_int = %d, latency = %d, timeout = %d",\ __func__, params->min_int, params->max_int, params->latency, params->timeout); @@ -167,7 +167,7 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_ arg.set_pkt_data_len.tx_data_length = tx_data_length; memcpy(arg.set_pkt_data_len.remote_device, remote_device, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -183,7 +183,7 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr) msg.act = BTC_GAP_BLE_ACT_SET_RAND_ADDRESS; memcpy(arg.set_rand_addr.rand_addr, rand_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_clear_rand_addr(void) @@ -196,7 +196,7 @@ esp_err_t esp_ble_gap_clear_rand_addr(void) msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_ACT_CLEAR_RAND_ADDRESS; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable) @@ -211,7 +211,7 @@ esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable) msg.act = BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY; arg.cfg_local_privacy.privacy_enable = privacy_enable; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_config_local_icon (uint16_t icon) @@ -285,7 +285,7 @@ esp_err_t esp_ble_gap_config_local_icon (uint16_t icon) msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON; arg.cfg_local_icon.icon = icon; - ret = (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + ret = (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); break; default: ret = ESP_ERR_INVALID_ARG; @@ -312,7 +312,7 @@ esp_err_t esp_ble_gap_update_whitelist(bool add_remove, esp_bd_addr_t remote_bda arg.update_white_list.wl_addr_type = wl_addr_type; memcpy(arg.update_white_list.remote_bda, remote_bda, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -327,8 +327,7 @@ esp_err_t esp_ble_gap_clear_whitelist(void) msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_ACT_CLEAR_WHITE_LIST; - return (btc_transfer_context(&msg, NULL, 0, NULL) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_get_whitelist_size(uint16_t *length) @@ -367,7 +366,7 @@ esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr, arg.set_conn_params.supervision_tout = supervision_tout; memcpy(arg.set_conn_params.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } else { LOG_ERROR("%s,invalid connection params:min_int = %d, max_int = %d, latency = %d, timeout = %d",\ @@ -430,7 +429,8 @@ esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_l arg.cfg_adv_data_raw.raw_adv = raw_data; arg.cfg_adv_data_raw.raw_adv_len = raw_data_len; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif // #if (BLE_42_FEATURE_SUPPORT == TRUE) @@ -448,7 +448,7 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr) msg.act = BTC_GAP_BLE_ACT_READ_RSSI; memcpy(arg.read_rssi.remote_addr, remote_addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #if (BLE_42_FEATURE_SUPPORT == TRUE) esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_data_len) @@ -469,7 +469,8 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d arg.cfg_scan_rsp_data_raw.raw_scan_rsp = raw_data; arg.cfg_scan_rsp_data_raw.raw_scan_rsp_len = raw_data_len; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -493,7 +494,7 @@ esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_ex memcpy(arg.update_duplicate_exceptional_list.device_info, device_info, sizeof(esp_bd_addr_t)); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -517,7 +518,7 @@ esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate memcpy(arg.update_duplicate_exceptional_list.device_info, device_info, sizeof(esp_bd_addr_t)); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -536,7 +537,7 @@ esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_e arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN; arg.update_duplicate_exceptional_list.info_type = list_type; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif // #if (BLE_42_FEATURE_SUPPORT == TRUE) @@ -573,8 +574,8 @@ esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type, arg.set_security_param.len = len; arg.set_security_param.value = value; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_set_encryption(esp_bd_addr_t bd_addr, esp_ble_sec_act_t sec_act) @@ -590,7 +591,7 @@ esp_err_t esp_ble_set_encryption(esp_bd_addr_t bd_addr, esp_ble_sec_act_t sec_ac arg.set_encryption.sec_act = sec_act; memcpy(arg.set_encryption.bd_addr, bd_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -607,7 +608,7 @@ esp_err_t esp_ble_gap_security_rsp(esp_bd_addr_t bd_addr, bool accept) arg.sec_rsp.accept = accept; memcpy(arg.sec_rsp.bd_addr, bd_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -626,7 +627,7 @@ esp_err_t esp_ble_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t pas arg.enc_passkey_replay.passkey = passkey; memcpy(arg.enc_passkey_replay.bd_addr, bd_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -643,7 +644,7 @@ esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept) arg.enc_comfirm_replay.accept = accept; memcpy(arg.enc_comfirm_replay.bd_addr, bd_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -656,7 +657,7 @@ esp_err_t esp_ble_remove_bond_device(esp_bd_addr_t bd_addr) msg.act = BTC_GAP_BLE_REMOVE_BOND_DEV_EVT; memcpy(arg.remove_bond_device.bd_addr, bd_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -708,8 +709,8 @@ esp_err_t esp_ble_oob_req_reply(esp_bd_addr_t bd_addr, uint8_t *TK, uint8_t len) arg.oob_req_reply.len = len; arg.oob_req_reply.p_value = TK; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* #if (SMP_INCLUDED == TRUE) */ @@ -726,7 +727,7 @@ esp_err_t esp_ble_gap_disconnect(esp_bd_addr_t remote_device) msg.act = BTC_GAP_BLE_DISCONNECT_EVT; memcpy(arg.disconnect.remote_device, remote_device, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_get_current_conn_params(esp_bd_addr_t bd_addr, esp_gap_conn_params_t *conn_params) @@ -755,7 +756,7 @@ esp_err_t esp_gap_ble_set_channels(esp_gap_ble_channels channels) memcpy(&arg.set_channels.channels, channels, ESP_GAP_BLE_CHANNELS_LEN); arg.set_channels.channels[ESP_GAP_BLE_CHANNELS_LEN -1] &= 0x1F; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_gap_ble_set_authorization(esp_bd_addr_t bd_addr, bool authorize) @@ -783,7 +784,7 @@ esp_err_t esp_ble_gap_read_phy(esp_bd_addr_t bd_addr) msg.act = BTC_GAP_BLE_READ_PHY; memcpy(arg.read_phy.bd_addr, bd_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -801,7 +802,7 @@ esp_err_t esp_ble_gap_set_preferred_default_phy(esp_ble_gap_phy_mask_t tx_phy_ma arg.set_perf_def_phy.tx_phy_mask = tx_phy_mask; arg.set_perf_def_phy.rx_phy_mask = rx_phy_mask; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -824,7 +825,7 @@ esp_err_t esp_ble_gap_set_preferred_phy(esp_bd_addr_t bd_addr, arg.set_def_phy.tx_phy_mask = tx_phy_mask; arg.set_def_phy.rx_phy_mask = rx_phy_mask; arg.set_def_phy.phy_options = phy_options; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -841,7 +842,7 @@ esp_err_t esp_ble_gap_ext_adv_set_rand_addr(uint8_t instance, esp_bd_addr_t rand arg.ext_adv_set_rand_addr.instance = instance; memcpy(arg.ext_adv_set_rand_addr.rand_addr, rand_addr, BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -875,7 +876,7 @@ esp_err_t esp_ble_gap_ext_adv_set_params(uint8_t instance, arg.ext_adv_set_params.instance = instance; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -895,8 +896,8 @@ esp_err_t esp_ble_gap_config_ext_adv_data_raw(uint8_t instance, uint16_t length, arg.ext_adv_cfg_data.length = length; arg.ext_adv_cfg_data.data = (uint8_t *)data; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_config_ext_scan_rsp_data_raw(uint8_t instance, uint16_t length, @@ -915,8 +916,8 @@ esp_err_t esp_ble_gap_config_ext_scan_rsp_data_raw(uint8_t instance, uint16_t le arg.cfg_scan_rsp.length = length; arg.cfg_scan_rsp.data = (uint8_t *)scan_rsp_data; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_ext_adv_start(uint8_t num_adv, const esp_ble_gap_ext_adv_t *ext_adv) @@ -933,8 +934,8 @@ esp_err_t esp_ble_gap_ext_adv_start(uint8_t num_adv, const esp_ble_gap_ext_adv_t arg.ext_adv_start.num_adv = num_adv; arg.ext_adv_start.ext_adv = (esp_ble_gap_ext_adv_t *)ext_adv; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_ext_adv_stop(uint8_t num_adv, const uint8_t *ext_adv_inst) @@ -950,8 +951,8 @@ esp_err_t esp_ble_gap_ext_adv_stop(uint8_t num_adv, const uint8_t *ext_adv_inst) arg.ext_adv_stop.num_adv = num_adv; arg.ext_adv_stop.ext_adv_inst = (uint8_t *)ext_adv_inst; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -967,7 +968,7 @@ esp_err_t esp_ble_gap_ext_adv_set_remove(uint8_t instance) msg.act = BTC_GAP_BLE_EXT_ADV_SET_REMOVE; arg.ext_adv_set_remove.instance = instance; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -981,7 +982,7 @@ esp_err_t esp_ble_gap_ext_adv_set_clear(void) msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_EXT_ADV_SET_CLEAR; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_periodic_adv_set_params(uint8_t instance, const esp_ble_gap_periodic_adv_params_t *params) @@ -998,7 +999,7 @@ esp_err_t esp_ble_gap_periodic_adv_set_params(uint8_t instance, const esp_ble_ga arg.peridic_adv_set_params.instance = instance; memcpy(&arg.peridic_adv_set_params.params, params, sizeof(esp_ble_gap_periodic_adv_params_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1019,8 +1020,8 @@ esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t le arg.periodic_adv_cfg_data.len = length; arg.periodic_adv_cfg_data.data = (uint8_t *)data; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy, + btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1037,7 +1038,7 @@ esp_err_t esp_ble_gap_periodic_adv_start(uint8_t instance) arg.periodic_adv_start.instance = instance; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1055,7 +1056,7 @@ esp_err_t esp_ble_gap_periodic_adv_stop(uint8_t instance) arg.periodic_adv_stop.instance = instance; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1073,7 +1074,7 @@ esp_err_t esp_ble_gap_periodic_adv_create_sync(const esp_ble_gap_periodic_adv_sy memcpy(&arg.periodic_adv_create_sync.params, params, sizeof(esp_ble_gap_periodic_adv_sync_params_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1088,7 +1089,7 @@ esp_err_t esp_ble_gap_periodic_adv_sync_cancel(void) msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_PERIODIC_ADV_SYNC_CANCEL; - return (btc_transfer_context(&msg, NULL, 0, NULL) + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1106,7 +1107,7 @@ esp_err_t esp_ble_gap_periodic_adv_sync_terminate(uint16_t sync_handle) arg.periodic_adv_sync_term.sync_handle = sync_handle; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1129,7 +1130,7 @@ esp_err_t esp_ble_gap_periodic_adv_add_dev_to_list(esp_ble_addr_type_t addr_type memcpy(arg.periodic_adv_add_dev.addr, addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1153,7 +1154,7 @@ esp_err_t esp_ble_gap_periodic_adv_remove_dev_from_list(esp_ble_addr_type_t addr memcpy(arg.periodic_adv_remove_dev.addr, addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1168,7 +1169,7 @@ esp_err_t esp_ble_gap_periodic_adv_clear_dev(void) msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_PERIODIC_CLEAR_DEV; - return (btc_transfer_context(&msg, NULL, 0, NULL) + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1190,7 +1191,7 @@ esp_err_t esp_ble_gap_set_ext_scan_params(const esp_ble_ext_scan_params_t *param memcpy(&arg.set_ext_scan_params.params, params, sizeof(esp_ble_ext_scan_params_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1208,7 +1209,7 @@ esp_err_t esp_ble_gap_start_ext_scan(uint32_t duration, uint16_t period) arg.start_ext_scan.duration = duration; arg.start_ext_scan.period = period; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -1222,7 +1223,7 @@ esp_err_t esp_ble_gap_stop_ext_scan(void) msg.pid = BTC_PID_GAP_BLE; msg.act = BTC_GAP_BLE_STOP_EXT_SCAN; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gap_prefer_ext_connect_params_set(esp_bd_addr_t addr, @@ -1315,7 +1316,7 @@ esp_err_t esp_ble_gap_prefer_ext_connect_params_set(esp_bd_addr_t addr, memcpy(arg.set_ext_conn_params.addr, addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/host/bluedroid/api/esp_gap_bt_api.c b/components/bt/host/bluedroid/api/esp_gap_bt_api.c index bf9e77c62912..6ff0b08a1725 100644 --- a/components/bt/host/bluedroid/api/esp_gap_bt_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_bt_api.c @@ -45,7 +45,7 @@ esp_err_t esp_bt_gap_set_scan_mode(esp_bt_connection_mode_t c_mode, esp_bt_disco arg.set_scan_mode.c_mode = c_mode; arg.set_scan_mode.d_mode = d_mode; - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_start_discovery(esp_bt_inq_mode_t mode, uint8_t inq_len, uint8_t num_rsps) @@ -75,7 +75,7 @@ esp_err_t esp_bt_gap_start_discovery(esp_bt_inq_mode_t mode, uint8_t inq_len, ui arg.start_disc.inq_len = inq_len; arg.start_disc.num_rsps = num_rsps; - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_cancel_discovery(void) @@ -90,7 +90,7 @@ esp_err_t esp_bt_gap_cancel_discovery(void) msg.pid = BTC_PID_GAP_BT; msg.act = BTC_GAP_BT_ACT_CANCEL_DISCOVERY; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_get_remote_services(esp_bd_addr_t remote_bda) @@ -107,7 +107,7 @@ esp_err_t esp_bt_gap_get_remote_services(esp_bd_addr_t remote_bda) msg.act = BTC_GAP_BT_ACT_GET_REMOTE_SERVICES; memcpy(&arg.bda, remote_bda, sizeof(bt_bdaddr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_get_remote_service_record(esp_bd_addr_t remote_bda, esp_bt_uuid_t *uuid) @@ -125,7 +125,7 @@ esp_err_t esp_bt_gap_get_remote_service_record(esp_bd_addr_t remote_bda, esp_bt_ memcpy(&arg.get_rmt_srv_rcd.bda, remote_bda, sizeof(bt_bdaddr_t)); memcpy(&arg.get_rmt_srv_rcd.uuid, uuid, sizeof(esp_bt_uuid_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } uint8_t *esp_bt_gap_resolve_eir_data(uint8_t *eir, esp_bt_eir_type_t type, uint8_t *length) @@ -166,7 +166,8 @@ esp_err_t esp_bt_gap_config_eir_data(esp_bt_eir_data_t *eir_data) memcpy(&arg.config_eir, eir_data, sizeof(esp_bt_eir_data_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy, + btc_gap_bt_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_set_cod(esp_bt_cod_t cod, esp_bt_cod_mode_t mode) @@ -196,7 +197,7 @@ esp_err_t esp_bt_gap_set_cod(esp_bt_cod_t cod, esp_bt_cod_mode_t mode) arg.set_cod.mode = mode; memcpy(&arg.set_cod.cod, &cod, sizeof(esp_bt_cod_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -215,7 +216,7 @@ esp_err_t esp_bt_gap_read_rssi_delta(esp_bd_addr_t remote_addr) msg.act = BTC_GAP_BT_ACT_READ_RSSI_DELTA; memcpy(arg.read_rssi_delta.bda.address, remote_addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_remove_bond_device(esp_bd_addr_t bd_addr) @@ -232,7 +233,7 @@ esp_err_t esp_bt_gap_remove_bond_device(esp_bd_addr_t bd_addr) msg.act = BTC_GAP_BT_ACT_REMOVE_BOND_DEVICE; memcpy(arg.rm_bond_device.bda.address, bd_addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } int esp_bt_gap_get_bond_device_num(void) @@ -281,8 +282,8 @@ esp_err_t esp_bt_gap_set_pin(esp_bt_pin_type_t pin_type, uint8_t pin_code_len, e memset(arg.set_pin_type.pin_code, 0, ESP_BT_PIN_CODE_LEN); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy, + btc_gap_bt_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_pin_reply(esp_bd_addr_t bd_addr, bool accept, uint8_t pin_code_len, esp_bt_pin_code_t pin_code) @@ -302,8 +303,8 @@ esp_err_t esp_bt_gap_pin_reply(esp_bd_addr_t bd_addr, bool accept, uint8_t pin_c memcpy(arg.pin_reply.bda.address, bd_addr, sizeof(esp_bd_addr_t)); memcpy(arg.pin_reply.pin_code, pin_code, pin_code_len); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy, + btc_gap_bt_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #if (BT_SSP_INCLUDED == TRUE) @@ -324,8 +325,8 @@ esp_err_t esp_bt_gap_set_security_param(esp_bt_sp_param_t param_type, arg.set_security_param.len = len; arg.set_security_param.value = value; - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy, + btc_gap_bt_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_ssp_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t passkey) @@ -343,8 +344,8 @@ esp_err_t esp_bt_gap_ssp_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint3 arg.passkey_reply.accept = accept; arg.passkey_reply.passkey = passkey; memcpy(arg.passkey_reply.bda.address, bd_addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy, + btc_gap_bt_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_ssp_confirm_reply(esp_bd_addr_t bd_addr, bool accept) @@ -361,8 +362,8 @@ esp_err_t esp_bt_gap_ssp_confirm_reply(esp_bd_addr_t bd_addr, bool accept) msg.act = BTC_GAP_BT_ACT_CONFIRM_REPLY; arg.confirm_reply.accept = accept; memcpy(arg.confirm_reply.bda.address, bd_addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy, + btc_gap_bt_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /*(BT_SSP_INCLUDED == TRUE)*/ @@ -382,7 +383,7 @@ esp_err_t esp_bt_gap_set_afh_channels(esp_bt_gap_afh_channels channels) memcpy(&arg.set_afh_channels.channels, channels, ESP_BT_GAP_AFH_CHANNELS_LEN); arg.set_afh_channels.channels[ESP_BT_GAP_AFH_CHANNELS_LEN -1] &= 0x7F; - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_read_remote_name(esp_bd_addr_t remote_bda) @@ -399,7 +400,7 @@ esp_err_t esp_bt_gap_read_remote_name(esp_bd_addr_t remote_bda) msg.act = BTC_GAP_BT_ACT_READ_REMOTE_NAME; memcpy(&arg.rmt_name_bda, remote_bda, sizeof(bt_bdaddr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_gap_set_qos(esp_bd_addr_t remote_bda, uint32_t t_poll) @@ -417,6 +418,6 @@ esp_err_t esp_bt_gap_set_qos(esp_bd_addr_t remote_bda, uint32_t t_poll) memcpy(&arg.set_qos.bda, remote_bda, sizeof(bt_bdaddr_t)); arg.set_qos.t_poll = t_poll; - return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif /* #if BTC_GAP_BT_INCLUDED == TRUE */ diff --git a/components/bt/host/bluedroid/api/esp_gatt_common_api.c b/components/bt/host/bluedroid/api/esp_gatt_common_api.c index 72f6b20ef41f..a6a52bf2e2b4 100644 --- a/components/bt/host/bluedroid/api/esp_gatt_common_api.c +++ b/components/bt/host/bluedroid/api/esp_gatt_common_api.c @@ -37,7 +37,7 @@ esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu) msg.act = BTC_GATT_ACT_SET_LOCAL_MTU; arg.set_mtu.mtu = mtu; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatt_com_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatt_com_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #if (BLE_INCLUDED == TRUE) diff --git a/components/bt/host/bluedroid/api/esp_gattc_api.c b/components/bt/host/bluedroid/api/esp_gattc_api.c index edb48edd569c..40f3d82d6510 100644 --- a/components/bt/host/bluedroid/api/esp_gattc_api.c +++ b/components/bt/host/bluedroid/api/esp_gattc_api.c @@ -45,7 +45,7 @@ esp_err_t esp_ble_gattc_app_register(uint16_t app_id) msg.act = BTC_GATTC_ACT_APP_REGISTER; arg.app_reg.app_id = app_id; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if) @@ -60,7 +60,7 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if) msg.act = BTC_GATTC_ACT_APP_UNREGISTER; arg.app_unreg.gattc_if = gattc_if; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + 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) @@ -79,7 +79,7 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, e arg.open.is_direct = is_direct; arg.open.is_aux = false; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif // #if (BLE_42_FEATURE_SUPPORT == TRUE) @@ -100,7 +100,7 @@ esp_err_t esp_ble_gattc_aux_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bd arg.open.is_direct = is_direct; arg.open.is_aux = true; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) @@ -117,7 +117,7 @@ esp_err_t esp_ble_gattc_close (esp_gatt_if_t gattc_if, uint16_t conn_id) msg.act = BTC_GATTC_ACT_CLOSE; arg.close.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id) @@ -132,7 +132,7 @@ esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id) msg.act = BTC_GATTC_ACT_CFG_MTU; arg.cfg_mtu.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_search_service(esp_gatt_if_t gattc_if, uint16_t conn_id, esp_bt_uuid_t *filter_uuid) @@ -154,7 +154,7 @@ esp_err_t esp_ble_gattc_search_service(esp_gatt_if_t gattc_if, uint16_t conn_id, arg.search_srvc.filter_uuid_enable = false; } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_gatt_status_t esp_ble_gattc_get_service(esp_gatt_if_t gattc_if, uint16_t conn_id, esp_bt_uuid_t *svc_uuid, @@ -369,7 +369,7 @@ esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if, arg.read_char.handle = handle; arg.read_char.auth_req = auth_req; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_read_by_type (esp_gatt_if_t gattc_if, @@ -408,7 +408,7 @@ esp_err_t esp_ble_gattc_read_by_type (esp_gatt_if_t gattc_if, arg.read_by_type.auth_req = auth_req; memcpy(&(arg.read_by_type.uuid), uuid, sizeof(esp_bt_uuid_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_read_multiple(esp_gatt_if_t gattc_if, @@ -444,7 +444,7 @@ esp_err_t esp_ble_gattc_read_multiple(esp_gatt_if_t gattc_if, LOG_ERROR("%s(), the num_attr should not be 0.", __func__); return ESP_FAIL; } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -475,7 +475,7 @@ esp_err_t esp_ble_gattc_read_char_descr (esp_gatt_if_t gattc_if, arg.read_descr.handle = handle; arg.read_descr.auth_req = auth_req; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_write_char(esp_gatt_if_t gattc_if, @@ -513,7 +513,8 @@ esp_err_t esp_ble_gattc_write_char(esp_gatt_if_t gattc_if, if(write_type == ESP_GATT_WRITE_TYPE_NO_RSP){ l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy, + btc_gattc_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if, @@ -551,7 +552,8 @@ esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if, if(write_type == ESP_GATT_WRITE_TYPE_NO_RSP){ l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy, + btc_gattc_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if, @@ -587,7 +589,8 @@ esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if, arg.prep_write.value = value; arg.prep_write.auth_req = auth_req; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy, + btc_gattc_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_prepare_write_char_descr(esp_gatt_if_t gattc_if, @@ -623,7 +626,8 @@ esp_err_t esp_ble_gattc_prepare_write_char_descr(esp_gatt_if_t gattc_if, arg.prep_write_descr.value = value; arg.prep_write_descr.auth_req = auth_req; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy, + btc_gattc_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_execute_write (esp_gatt_if_t gattc_if, uint16_t conn_id, bool is_execute) @@ -639,7 +643,7 @@ esp_err_t esp_ble_gattc_execute_write (esp_gatt_if_t gattc_if, uint16_t conn_id, arg.exec_write.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id); arg.exec_write.is_execute = is_execute; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if, @@ -657,7 +661,7 @@ esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if, memcpy(arg.reg_for_notify.remote_bda, server_bda, sizeof(esp_bd_addr_t)); arg.reg_for_notify.handle = handle; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if, @@ -674,7 +678,7 @@ esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if, arg.unreg_for_notify.gattc_if = gattc_if; arg.unreg_for_notify.handle = handle; memcpy(arg.unreg_for_notify.remote_bda, server_bda, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda) @@ -689,7 +693,7 @@ esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda) msg.act = BTC_GATTC_ACT_CACHE_REFRESH; memcpy(arg.cache_refresh.remote_bda, remote_bda, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_cache_clean(esp_bd_addr_t remote_bda) @@ -704,7 +708,7 @@ esp_err_t esp_ble_gattc_cache_clean(esp_bd_addr_t remote_bda) msg.act = BTC_GATTC_ACT_CACHE_CLEAN; memcpy(arg.cache_clean.remote_bda, remote_bda, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_addr, esp_bd_addr_t assoc_addr, bool is_assoc) @@ -722,7 +726,7 @@ esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_ad memcpy(arg.cache_assoc.src_addr, src_addr, sizeof(esp_bd_addr_t)); memcpy(arg.cache_assoc.assoc_addr, assoc_addr, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gattc_cache_get_addr_list(esp_gatt_if_t gattc_if) @@ -736,7 +740,7 @@ esp_err_t esp_ble_gattc_cache_get_addr_list(esp_gatt_if_t gattc_if) msg.pid = BTC_PID_GATTC; msg.act = BTC_GATTC_ATC_CACHE_GET_ADDR_LIST; arg.get_addr_list.gattc_if = gattc_if; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif ///GATTC_INCLUDED == TRUE diff --git a/components/bt/host/bluedroid/api/esp_gatts_api.c b/components/bt/host/bluedroid/api/esp_gatts_api.c index 10b82a1c7de9..7fb6b58ea92b 100644 --- a/components/bt/host/bluedroid/api/esp_gatts_api.c +++ b/components/bt/host/bluedroid/api/esp_gatts_api.c @@ -46,7 +46,7 @@ esp_err_t esp_ble_gatts_app_register(uint16_t app_id) msg.act = BTC_GATTS_ACT_APP_REGISTER; arg.app_reg.app_id = app_id; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -62,7 +62,7 @@ esp_err_t esp_ble_gatts_app_unregister(esp_gatt_if_t gatts_if) msg.act = BTC_GATTS_ACT_APP_UNREGISTER; arg.app_unreg.gatts_if = gatts_if; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatts_if, @@ -80,7 +80,7 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatts_if, arg.create_srvc.num_handle = num_handle; memcpy(&arg.create_srvc.service_id, service_id, sizeof(esp_gatt_srvc_id_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gatts_create_attr_tab(const esp_gatts_attr_db_t *gatts_attr_db, @@ -106,8 +106,8 @@ esp_err_t esp_ble_gatts_create_attr_tab(const esp_gatts_attr_db_t *gatts_attr_db arg.create_attr_tab.srvc_inst_id = srvc_inst_id; arg.create_attr_tab.gatts_attr_db = (esp_gatts_attr_db_t *)gatts_attr_db; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy, + btc_gatts_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -124,7 +124,7 @@ esp_err_t esp_ble_gatts_add_included_service(uint16_t service_handle, uint16_t i arg.add_incl_srvc.service_handle = service_handle; arg.add_incl_srvc.included_service_handle = included_service_handle; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -162,7 +162,8 @@ esp_err_t esp_ble_gatts_add_char(uint16_t service_handle, esp_bt_uuid_t *char_ } memcpy(&arg.add_char.char_uuid, char_uuid, sizeof(esp_bt_uuid_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy, + btc_gatts_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -201,7 +202,8 @@ esp_err_t esp_ble_gatts_add_char_descr (uint16_t service_handle, } memcpy(&arg.add_descr.descr_uuid, descr_uuid, sizeof(esp_bt_uuid_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy, + btc_gatts_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gatts_delete_service(uint16_t service_handle) @@ -216,7 +218,7 @@ esp_err_t esp_ble_gatts_delete_service(uint16_t service_handle) msg.act = BTC_GATTS_ACT_DELETE_SERVICE; arg.delete_srvc.service_handle = service_handle; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gatts_start_service(uint16_t service_handle) @@ -231,7 +233,7 @@ esp_err_t esp_ble_gatts_start_service(uint16_t service_handle) msg.act = BTC_GATTS_ACT_START_SERVICE; arg.start_srvc.service_handle = service_handle; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gatts_stop_service(uint16_t service_handle) @@ -246,7 +248,7 @@ esp_err_t esp_ble_gatts_stop_service(uint16_t service_handle) msg.act = BTC_GATTS_ACT_STOP_SERVICE; arg.stop_srvc.service_handle = service_handle; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -280,8 +282,8 @@ esp_err_t esp_ble_gatts_send_indicate(esp_gatt_if_t gatts_if, uint16_t conn_id, if(need_confirm == false){ l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL); } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), - btc_gatts_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy, + btc_gatts_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gatts_send_response(esp_gatt_if_t gatts_if, uint16_t conn_id, uint32_t trans_id, @@ -306,8 +308,8 @@ esp_err_t esp_ble_gatts_send_response(esp_gatt_if_t gatts_if, uint16_t conn_id, arg.send_rsp.status = status; arg.send_rsp.rsp = rsp; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), - btc_gatts_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy, + btc_gatts_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_ble_gatts_set_attr_value(uint16_t attr_handle, uint16_t length, const uint8_t *value) @@ -324,8 +326,8 @@ esp_err_t esp_ble_gatts_set_attr_value(uint16_t attr_handle, uint16_t length, co arg.set_attr_val.length = length; arg.set_attr_val.value = (uint8_t *)value; - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), - btc_gatts_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), btc_gatts_arg_deep_copy, + btc_gatts_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_gatt_status_t esp_ble_gatts_get_attr_value(uint16_t attr_handle, uint16_t *length, const uint8_t **value) @@ -354,7 +356,7 @@ esp_err_t esp_ble_gatts_open(esp_gatt_if_t gatts_if, esp_bd_addr_t remote_bda, b arg.open.is_direct = is_direct; memcpy(&arg.open.remote_bda, remote_bda, sizeof(esp_bd_addr_t)); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -370,7 +372,7 @@ esp_err_t esp_ble_gatts_close(esp_gatt_if_t gatts_if, uint16_t conn_id) msg.act = BTC_GATTS_ACT_CLOSE; arg.close.conn_id = BTC_GATT_CREATE_CONN_ID(gatts_if, conn_id); - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -392,7 +394,7 @@ esp_err_t esp_ble_gatts_send_service_change_indication(esp_gatt_if_t gatts_if, e } - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL) + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/host/bluedroid/api/esp_hf_ag_api.c b/components/bt/host/bluedroid/api/esp_hf_ag_api.c index ec02138dda44..7ab3e4b575a4 100644 --- a/components/bt/host/bluedroid/api/esp_hf_ag_api.c +++ b/components/bt/host/bluedroid/api/esp_hf_ag_api.c @@ -51,7 +51,7 @@ esp_err_t esp_hf_ag_init(void) msg.act = BTC_HF_INIT_EVT; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -66,7 +66,7 @@ esp_err_t esp_hf_ag_deinit(void) msg.act = BTC_HF_DEINIT_EVT; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -85,7 +85,7 @@ esp_err_t esp_hf_ag_slc_connect(esp_bd_addr_t remote_addr) memcpy(&(arg.connect), remote_addr, sizeof(esp_bd_addr_t)); /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -104,7 +104,7 @@ esp_err_t esp_hf_ag_slc_disconnect(esp_bd_addr_t remote_addr) memcpy(&(arg.disconnect), remote_addr, sizeof(esp_bd_addr_t)); /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -123,7 +123,7 @@ esp_err_t esp_hf_ag_audio_connect(esp_bd_addr_t remote_addr) memcpy(&(arg.connect_audio), remote_addr, sizeof(esp_bd_addr_t)); /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -142,7 +142,7 @@ esp_err_t esp_hf_ag_audio_disconnect(esp_bd_addr_t remote_addr) memcpy(&(arg.disconnect_audio), remote_addr, sizeof(esp_bd_addr_t)); /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -162,7 +162,7 @@ esp_err_t esp_hf_ag_vra_control(esp_bd_addr_t remote_addr, esp_hf_vr_state_t val memcpy(&(arg.volcon.remote_addr), remote_addr, sizeof(esp_bd_addr_t)); /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -183,7 +183,7 @@ esp_err_t esp_hf_ag_volume_control(esp_bd_addr_t remote_addr, esp_hf_volume_cont memcpy(&(arg.volcon.remote_addr), remote_addr, sizeof(esp_bd_addr_t)); /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -203,7 +203,8 @@ esp_err_t esp_hf_ag_unknown_at_send(esp_bd_addr_t remote_addr, char *unat) memcpy(&(arg.unat_rep.remote_addr), remote_addr, sizeof(esp_bd_addr_t)); /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), + btc_hf_arg_deep_copy, btc_hf_arg_deep_free); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -224,7 +225,7 @@ esp_err_t esp_hf_ag_cmee_send(esp_bd_addr_t remote_addr, esp_hf_at_response_code memcpy(&(arg.ext_at.remote_addr), remote_addr, sizeof(esp_bd_addr_t)); /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -250,7 +251,7 @@ esp_err_t esp_hf_ag_devices_status_indchange(esp_bd_addr_t remote_addr, arg.ind_change.signal = signal; /* Switch to BTC context */ - bt_status_t state = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t state = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (state == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -280,7 +281,7 @@ esp_err_t esp_hf_ag_cind_response(esp_bd_addr_t remote_addr, arg.cind_rep.call_held_state = call_held_status; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -300,7 +301,8 @@ esp_err_t esp_hf_ag_cops_response(esp_bd_addr_t remote_addr, char *name) arg.cops_rep.name = name; //deep_copy /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), + btc_hf_arg_deep_copy, btc_hf_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -330,7 +332,8 @@ esp_err_t esp_hf_ag_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_c arg.clcc_rep.type = type; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), + btc_hf_arg_deep_copy, btc_hf_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -351,7 +354,8 @@ esp_err_t esp_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_h arg.cnum_rep.type = type; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), + btc_hf_arg_deep_copy, btc_hf_arg_deep_free); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -371,7 +375,7 @@ esp_err_t esp_hf_ag_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t arg.bsir.state = state; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -398,7 +402,8 @@ esp_err_t esp_hf_ag_answer_call(esp_bd_addr_t remote_addr, int num_active, int n arg.phone.call_addr_type = call_addr_type; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), + btc_hf_arg_deep_copy, btc_hf_arg_deep_free); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -425,7 +430,8 @@ esp_err_t esp_hf_ag_reject_call(esp_bd_addr_t remote_addr, int num_active, int n arg.phone.call_addr_type = call_addr_type; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), + btc_hf_arg_deep_copy, btc_hf_arg_deep_free); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -452,7 +458,8 @@ esp_err_t esp_hf_ag_end_call(esp_bd_addr_t remote_addr, int num_active, int num_ arg.phone.call_addr_type = call_addr_type; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), + btc_hf_arg_deep_copy, btc_hf_arg_deep_free); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -479,7 +486,8 @@ esp_err_t esp_hf_ag_out_call(esp_bd_addr_t remote_addr, int num_active, int num_ arg.phone.call_addr_type = call_addr_type; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), + btc_hf_arg_deep_copy, btc_hf_arg_deep_free); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -499,7 +507,7 @@ esp_err_t esp_hf_ag_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_h arg.reg_data_cb.send = send; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL); + bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL); return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_hf_client_api.c b/components/bt/host/bluedroid/api/esp_hf_client_api.c index 496327242700..158847e1557f 100644 --- a/components/bt/host/bluedroid/api/esp_hf_client_api.c +++ b/components/bt/host/bluedroid/api/esp_hf_client_api.c @@ -42,7 +42,7 @@ esp_err_t esp_hf_client_init(void) msg.act = BTC_HF_CLIENT_INIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -59,7 +59,7 @@ esp_err_t esp_hf_client_deinit(void) msg.act = BTC_HF_CLIENT_DEINIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -81,7 +81,7 @@ esp_err_t esp_hf_client_connect(esp_bd_addr_t remote_bda) /* Switch to BTC context */ memcpy(&(arg.connect), remote_bda, sizeof(bt_bdaddr_t)); - stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -103,7 +103,7 @@ esp_err_t esp_hf_client_disconnect(esp_bd_addr_t remote_bda) /* Switch to BTC context */ memcpy(&(arg.disconnect), remote_bda, sizeof(bt_bdaddr_t)); - stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -125,7 +125,7 @@ esp_err_t esp_hf_client_connect_audio(esp_bd_addr_t remote_bda) /* Switch to BTC context */ memcpy(&(arg.connect_audio), remote_bda, sizeof(bt_bdaddr_t)); - stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -147,7 +147,7 @@ esp_err_t esp_hf_client_disconnect_audio(esp_bd_addr_t remote_bda) /* Switch to BTC context */ memcpy(&(arg.disconnect_audio), remote_bda, sizeof(bt_bdaddr_t)); - stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -165,7 +165,7 @@ esp_err_t esp_hf_client_start_voice_recognition(void) msg.act = BTC_HF_CLIENT_START_VOICE_RECOGNITION_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -182,7 +182,7 @@ esp_err_t esp_hf_client_stop_voice_recognition(void) msg.act = BTC_HF_CLIENT_STOP_VOICE_RECOGNITION_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -204,7 +204,7 @@ esp_err_t esp_hf_client_volume_update(esp_hf_volume_control_target_t type, int v arg.volume_update.volume = volume; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -233,7 +233,7 @@ esp_err_t esp_hf_client_dial(const char *number) } /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -254,7 +254,7 @@ esp_err_t esp_hf_client_dial_memory(int location) arg.dial_memory.location = location; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -276,7 +276,7 @@ esp_err_t esp_hf_client_send_chld_cmd(esp_hf_chld_type_t chld, int idx) arg.chld.idx = idx; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -297,7 +297,7 @@ esp_err_t esp_hf_client_send_btrh_cmd(esp_hf_btrh_cmd_t btrh) arg.btrh.cmd = btrh; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -314,7 +314,7 @@ esp_err_t esp_hf_client_answer_call(void) msg.act = BTC_HF_CLIENT_ANSWER_CALL_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -331,7 +331,7 @@ esp_err_t esp_hf_client_reject_call(void) msg.act = BTC_HF_CLIENT_REJECT_CALL_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -348,7 +348,7 @@ esp_err_t esp_hf_client_query_current_calls(void) msg.act = BTC_HF_CLIENT_QUERY_CURRENT_CALLS_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -365,7 +365,7 @@ esp_err_t esp_hf_client_query_current_operator_name(void) msg.act = BTC_HF_CLIENT_QUERY_CURRENT_OPERATOR_NAME_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -382,7 +382,7 @@ esp_err_t esp_hf_client_retrieve_subscriber_info(void) msg.act = BTC_HF_CLIENT_RETRIEVE_SUBSCRIBER_INFO_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -403,7 +403,7 @@ esp_err_t esp_hf_client_send_dtmf(char code) arg.send_dtmf.code = code; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -429,7 +429,7 @@ esp_err_t esp_hf_client_send_xapl(char *information, uint32_t features) arg.send_xapl.features = features; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -455,7 +455,7 @@ esp_err_t esp_hf_client_send_iphoneaccev(uint32_t bat_level, bool docked) arg.send_iphoneaccev.docked = docked; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -473,7 +473,7 @@ esp_err_t esp_hf_client_request_last_voice_tag_number(void) msg.act = BTC_HF_CLIENT_REQUEST_LAST_VOICE_TAG_NUMBER_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -489,7 +489,7 @@ esp_err_t esp_hf_client_send_nrec(void) msg.act = BTC_HF_CLIENT_SEND_NREC_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -511,7 +511,7 @@ esp_err_t esp_hf_client_register_data_callback(esp_hf_client_incoming_data_cb_t arg.reg_data_cb.send = send; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_hidd_api.c b/components/bt/host/bluedroid/api/esp_hidd_api.c index 1f886adaa2e4..2906e7a8dcf4 100644 --- a/components/bt/host/bluedroid/api/esp_hidd_api.c +++ b/components/bt/host/bluedroid/api/esp_hidd_api.c @@ -37,7 +37,7 @@ esp_err_t esp_bt_hid_device_init(void) msg.act = BTC_HD_INIT_EVT; /* Switch to BTC context */ - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -50,7 +50,7 @@ esp_err_t esp_bt_hid_device_deinit(void) msg.pid = BTC_PID_HD; msg.act = BTC_HD_DEINIT_EVT; - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -69,7 +69,7 @@ esp_err_t esp_bt_hid_device_register_app(esp_hidd_app_param_t* app_param, esp_hi msg.pid = BTC_PID_HD; msg.act = BTC_HD_REGISTER_APP_EVT; - bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -82,7 +82,7 @@ esp_err_t esp_bt_hid_device_unregister_app(void) msg.pid = BTC_PID_HD; msg.act = BTC_HD_UNREGISTER_APP_EVT; - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -99,7 +99,7 @@ esp_err_t esp_bt_hid_device_connect(esp_bd_addr_t bd_addr) msg.pid = BTC_PID_HD; msg.act = BTC_HD_CONNECT_EVT; - bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -112,7 +112,7 @@ esp_err_t esp_bt_hid_device_disconnect(void) msg.pid = BTC_PID_HD; msg.act = BTC_HD_DISCONNECT_EVT; - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -132,7 +132,8 @@ esp_err_t esp_bt_hid_device_send_report(esp_hidd_report_type_t type, uint8_t id, args.send_report.len = len; args.send_report.data = data; - bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), btc_hd_arg_deep_copy); + bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), + btc_hd_arg_deep_copy, btc_hd_cb_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -149,7 +150,7 @@ esp_err_t esp_bt_hid_device_report_error(esp_hidd_handshake_error_t error) memset(&args, 0, sizeof(btc_hidd_args_t)); args.error = error; - bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -162,7 +163,7 @@ esp_err_t esp_bt_hid_device_virtual_cable_unplug(void) msg.pid = BTC_PID_HD; msg.act = BTC_HD_UNPLUG_EVT; - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_hidh_api.c b/components/bt/host/bluedroid/api/esp_hidh_api.c index 922babc54376..f9959c3919b6 100644 --- a/components/bt/host/bluedroid/api/esp_hidh_api.c +++ b/components/bt/host/bluedroid/api/esp_hidh_api.c @@ -37,7 +37,7 @@ esp_err_t esp_bt_hid_host_init(void) msg.pid = BTC_PID_HH; msg.act = BTC_HH_INIT_EVT; - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -51,7 +51,7 @@ esp_err_t esp_bt_hid_host_deinit(void) msg.pid = BTC_PID_HH; msg.act = BTC_HH_DEINIT_EVT; - bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL); + bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -67,7 +67,7 @@ esp_err_t esp_bt_hid_host_connect(esp_bd_addr_t bd_addr) memcpy(arg.connect.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -83,7 +83,7 @@ esp_err_t esp_bt_hid_host_disconnect(esp_bd_addr_t bd_addr) memcpy(arg.disconnect.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -99,7 +99,7 @@ esp_err_t esp_bt_hid_host_virtual_cable_unplug(esp_bd_addr_t bd_addr) memcpy(arg.unplug.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -116,7 +116,8 @@ esp_err_t esp_bt_hid_host_set_info(esp_bd_addr_t bd_addr, esp_hidh_hid_info_t *h memcpy(arg.set_info.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); arg.set_info.hid_info = hid_info; - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), btc_hh_arg_deep_copy); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), + btc_hh_arg_deep_copy, btc_hh_cb_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -132,7 +133,7 @@ esp_err_t esp_bt_hid_host_get_protocol(esp_bd_addr_t bd_addr) memcpy(arg.get_protocol.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -149,7 +150,7 @@ esp_err_t esp_bt_hid_host_set_protocol(esp_bd_addr_t bd_addr, esp_hidh_protocol_ memcpy(arg.set_protocol.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); arg.set_protocol.protocol_mode = protocol_mode; - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -165,7 +166,7 @@ esp_err_t esp_bt_hid_host_get_idle(esp_bd_addr_t bd_addr) memcpy(arg.get_idle.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -182,7 +183,7 @@ esp_err_t esp_bt_hid_host_set_idle(esp_bd_addr_t bd_addr, uint16_t idle_time) memcpy(arg.set_idle.bd_addr, bd_addr, sizeof(esp_bd_addr_t)); arg.set_idle.idle_time = idle_time; - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -202,7 +203,7 @@ esp_err_t esp_bt_hid_host_get_report(esp_bd_addr_t bd_addr, esp_hidh_report_type arg.get_report.report_id = report_id; arg.get_report.buffer_size = buffer_size; - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -222,7 +223,8 @@ esp_err_t esp_bt_hid_host_set_report(esp_bd_addr_t bd_addr, esp_hidh_report_type arg.set_report.len = len; arg.set_report.report = report; - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), btc_hh_arg_deep_copy); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), + btc_hh_arg_deep_copy, btc_hh_cb_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -240,7 +242,8 @@ esp_err_t esp_bt_hid_host_send_data(esp_bd_addr_t bd_addr, uint8_t *data, size_t arg.send_data.len = len; arg.send_data.data = data; - bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), btc_hh_arg_deep_copy); + bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), + btc_hh_arg_deep_copy, btc_hh_cb_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_l2cap_bt_api.c b/components/bt/host/bluedroid/api/esp_l2cap_bt_api.c index afc6c89a6642..c78d6f8d10d2 100644 --- a/components/bt/host/bluedroid/api/esp_l2cap_bt_api.c +++ b/components/bt/host/bluedroid/api/esp_l2cap_bt_api.c @@ -36,7 +36,7 @@ esp_err_t esp_bt_l2cap_init(void) msg.pid = BTC_PID_L2CAP; msg.act = BTC_L2CAP_ACT_INIT; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_l2cap_deinit(void) @@ -48,7 +48,7 @@ esp_err_t esp_bt_l2cap_deinit(void) msg.pid = BTC_PID_L2CAP; msg.act = BTC_L2CAP_ACT_UNINIT; - return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_l2cap_connect(esp_bt_l2cap_cntl_flags_t cntl_flag, uint16_t remote_psm, esp_bd_addr_t peer_bd_addr) @@ -65,7 +65,7 @@ esp_err_t esp_bt_l2cap_connect(esp_bt_l2cap_cntl_flags_t cntl_flag, uint16_t rem arg.connect.remote_psm = remote_psm; memcpy(arg.connect.peer_bd_addr, peer_bd_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_l2cap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_l2cap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_l2cap_start_srv(esp_bt_l2cap_cntl_flags_t cntl_flag, uint16_t local_psm) @@ -81,7 +81,7 @@ esp_err_t esp_bt_l2cap_start_srv(esp_bt_l2cap_cntl_flags_t cntl_flag, uint16_t l arg.start_srv.sec_mask = (cntl_flag & 0xffff); arg.start_srv.local_psm = local_psm; - return (btc_transfer_context(&msg, &arg, sizeof(btc_l2cap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_l2cap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_l2cap_stop_all_srv(void) @@ -96,7 +96,7 @@ esp_err_t esp_bt_l2cap_stop_all_srv(void) arg.stop_srv.psm = BTC_L2CAP_INVALID_PSM; - return (btc_transfer_context(&msg, &arg, sizeof(btc_l2cap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_l2cap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_l2cap_stop_srv(uint16_t local_psm) @@ -111,7 +111,7 @@ esp_err_t esp_bt_l2cap_stop_srv(uint16_t local_psm) arg.stop_srv.psm = local_psm; - return (btc_transfer_context(&msg, &arg, sizeof(btc_l2cap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_l2cap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_bt_l2cap_vfs_register(void) diff --git a/components/bt/host/bluedroid/api/esp_sdp_api.c b/components/bt/host/bluedroid/api/esp_sdp_api.c index 7831b218adbe..c47c5ba50a8b 100644 --- a/components/bt/host/bluedroid/api/esp_sdp_api.c +++ b/components/bt/host/bluedroid/api/esp_sdp_api.c @@ -39,7 +39,7 @@ esp_err_t esp_sdp_init(void) msg.act = BTC_SDP_ACT_INIT; /* Switch to BTC context */ - stat = btc_transfer_context(&msg, NULL, 0, NULL); + stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -55,7 +55,7 @@ esp_err_t esp_sdp_deinit(void) msg.act = BTC_SDP_ACT_DEINIT; /* Switch to BTC context */ - stat = btc_transfer_context(&msg, NULL, 0, NULL); + stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -77,7 +77,7 @@ esp_err_t esp_sdp_search_record(esp_bd_addr_t bd_addr, esp_bt_uuid_t uuid) memcpy(&arg.search.sdp_uuid.uu, &uuid.uuid, sizeof(uuid.uuid)); /* Switch to BTC context */ - stat = btc_transfer_context(&msg, &arg, sizeof(btc_sdp_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_sdp_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -103,7 +103,8 @@ esp_err_t esp_sdp_create_record(esp_bluetooth_sdp_record_t *record) arg.creat_record.record = (bluetooth_sdp_record *)record; /* Switch to BTC context */ - stat = btc_transfer_context(&msg, &arg, sizeof(btc_sdp_args_t), btc_sdp_arg_deep_copy); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_sdp_args_t), + btc_sdp_arg_deep_copy, btc_sdp_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -122,7 +123,7 @@ esp_err_t esp_sdp_remove_record(int record_handle) arg.remove_record.record_handle = record_handle; /* Switch to BTC context */ - stat = btc_transfer_context(&msg, &arg, sizeof(btc_sdp_args_t), NULL); + stat = btc_transfer_context(&msg, &arg, sizeof(btc_sdp_args_t), NULL, NULL); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_spp_api.c b/components/bt/host/bluedroid/api/esp_spp_api.c index 34585d0decc4..962a20a17756 100644 --- a/components/bt/host/bluedroid/api/esp_spp_api.c +++ b/components/bt/host/bluedroid/api/esp_spp_api.c @@ -64,7 +64,7 @@ esp_err_t esp_spp_enhanced_init(const esp_spp_cfg_t *cfg) arg.init.enable_l2cap_ertm = cfg->enable_l2cap_ertm; arg.init.tx_buffer_size = cfg->tx_buffer_size; - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_spp_deinit(void) @@ -77,7 +77,7 @@ esp_err_t esp_spp_deinit(void) msg.pid = BTC_PID_SPP; msg.act = BTC_SPP_ACT_UNINIT; - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -98,7 +98,8 @@ esp_err_t esp_spp_start_discovery(esp_bd_addr_t bd_addr) arg.start_discovery.num_uuid = 1; arg.start_discovery.p_uuid_list = &sdp_uuid; - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), btc_spp_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), + btc_spp_arg_deep_copy, btc_spp_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_spp_connect(esp_spp_sec_t sec_mask, @@ -121,7 +122,7 @@ esp_err_t esp_spp_connect(esp_spp_sec_t sec_mask, arg.connect.remote_scn = remote_scn; memcpy(arg.connect.peer_bd_addr, peer_bd_addr, ESP_BD_ADDR_LEN); - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_spp_disconnect(uint32_t handle) @@ -136,7 +137,7 @@ esp_err_t esp_spp_disconnect(uint32_t handle) arg.disconnect.handle = handle; - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask, @@ -165,7 +166,7 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask, arg.start_srv.max_session = ESP_SPP_MAX_SESSION; strcpy(arg.start_srv.name, name); - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_spp_stop_srv(void) @@ -179,7 +180,7 @@ esp_err_t esp_spp_stop_srv(void) msg.act = BTC_SPP_ACT_STOP_SRV; arg.stop_srv.scn = BTC_SPP_INVALID_SCN; - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } esp_err_t esp_spp_stop_srv_scn(uint8_t scn) @@ -198,7 +199,7 @@ esp_err_t esp_spp_stop_srv_scn(uint8_t scn) msg.act = BTC_SPP_ACT_STOP_SRV; arg.stop_srv.scn = scn; - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/host/bluedroid/btc/core/btc_dm.c b/components/bt/host/bluedroid/btc/core/btc_dm.c index c80f47cf7798..9c313f25c84e 100644 --- a/components/bt/host/bluedroid/btc/core/btc_dm.c +++ b/components/bt/host/bluedroid/btc/core/btc_dm.c @@ -105,7 +105,8 @@ void btc_dm_sec_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *data) msg.act = event; btc_transfer_context(&msg, (btc_dm_sec_args_t *)data, - data == NULL ? 0 : sizeof(btc_dm_sec_args_t), btc_dm_sec_arg_deep_copy); + data == NULL ? 0 : sizeof(btc_dm_sec_args_t), + btc_dm_sec_arg_deep_copy, btc_dm_sec_arg_deep_free); } static void btc_enable_bluetooth_evt(tBTA_STATUS status) diff --git a/components/bt/host/bluedroid/btc/core/btc_profile_queue.c b/components/bt/host/bluedroid/btc/core/btc_profile_queue.c index b8c772a311eb..4f359030434d 100644 --- a/components/bt/host/bluedroid/btc/core/btc_profile_queue.c +++ b/components/bt/host/bluedroid/btc/core/btc_profile_queue.c @@ -101,7 +101,7 @@ bt_status_t btc_queue_connect(uint16_t uuid, const bt_bdaddr_t *bda, btc_connect arg.connect_node.uuid = uuid; arg.connect_node.connect_cb = connect_cb; - return btc_transfer_context(&msg, &arg, sizeof(btc_prf_que_args_t), NULL); + return btc_transfer_context(&msg, &arg, sizeof(btc_prf_que_args_t), NULL, NULL); } /******************************************************************************* ** @@ -121,7 +121,7 @@ void btc_queue_advance(void) msg.pid = BTC_PID_PRF_QUE; msg.act = BTC_PRF_QUE_ADVANCE; - btc_transfer_context(&msg, NULL, 0, NULL); + btc_transfer_context(&msg, NULL, 0, NULL, NULL); } // This function dispatches the next pending connect request. It is called from diff --git a/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_av.c b/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_av.c index 7ab8c7832034..f274d89cb502 100644 --- a/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_av.c +++ b/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_av.c @@ -160,7 +160,7 @@ static const btc_sm_handler_t btc_av_state_handlers[] = { btc_av_state_closing_handler }; -static void btc_av_event_free_data(btc_sm_event_t event, void *p_data); +static void btc_av_event_free_data(btc_msg_t *msg); /************************************************************************* ** Extern functions @@ -1065,11 +1065,11 @@ void btc_av_event_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src) } } -static void btc_av_event_free_data(btc_sm_event_t event, void *p_data) +static void btc_av_event_free_data(btc_msg_t *msg) { - switch (event) { + switch (msg->act) { case BTA_AV_META_MSG_EVT: { - tBTA_AV *av = (tBTA_AV *)p_data; + tBTA_AV *av = (tBTA_AV *)msg->arg; if (av->meta_msg.p_data) { osi_free(av->meta_msg.p_data); } @@ -1319,7 +1319,7 @@ void btc_dispatch_sm_event(btc_av_sm_event_t event, void *p_data, int len) msg.sig = BTC_SIG_API_CALL; msg.pid = BTC_PID_A2DP; msg.act = event; - btc_transfer_context(&msg, p_data, len, NULL); + btc_transfer_context(&msg, p_data, len, NULL, NULL); } static void bte_av_callback(tBTA_AV_EVT event, tBTA_AV *p_data) @@ -1330,7 +1330,8 @@ static void bte_av_callback(tBTA_AV_EVT event, tBTA_AV *p_data) msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_A2DP; msg.act = (uint8_t) event; - stat = btc_transfer_context(&msg, p_data, sizeof(tBTA_AV), btc_av_event_deep_copy); + stat = btc_transfer_context(&msg, p_data, sizeof(tBTA_AV), + btc_av_event_deep_copy, btc_av_event_free_data); if (stat) { BTC_TRACE_ERROR("%s transfer failed\n", __func__); @@ -1373,7 +1374,7 @@ static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data) memset(&arg, 0, sizeof(btc_av_args_t)); arg.mcc.type = ESP_A2D_MCT_SBC; memcpy(arg.mcc.cie.sbc, (uint8_t *)p_data + 3, ESP_A2D_CIE_LEN_SBC); - btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL); + btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL, NULL); } else { BTC_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status); } @@ -1635,7 +1636,7 @@ void btc_a2dp_call_handler(btc_msg_t *msg) void btc_a2dp_cb_handler(btc_msg_t *msg) { btc_sm_dispatch(btc_av_cb.sm_handle, msg->act, (void *)(msg->arg)); - btc_av_event_free_data(msg->act, msg->arg); + btc_av_event_free_data(msg); } #if BTC_AV_SINK_INCLUDED diff --git a/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c b/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c index b1a54e99031a..25b04d5aba6c 100644 --- a/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c +++ b/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c @@ -203,10 +203,7 @@ void btc_avrc_tg_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src) } } -/***************************************************************************** -** Static functions -******************************************************************************/ -static void btc_avrc_tg_arg_deep_free(btc_msg_t *msg) +void btc_avrc_tg_arg_deep_free(btc_msg_t *msg) { btc_avrc_tg_args_t *arg = (btc_avrc_tg_args_t *)msg->arg; @@ -222,6 +219,9 @@ static void btc_avrc_tg_arg_deep_free(btc_msg_t *msg) } } +/***************************************************************************** +** Static functions +******************************************************************************/ static bool btc_avrc_tg_set_supported_command(const uint16_t *cmd_set) { if (!btc_avrc_tg_init_p()) { diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/bta_gap_bt_co.c b/components/bt/host/bluedroid/btc/profile/std/gap/bta_gap_bt_co.c index 820d14acdf92..e4c8ebd71c60 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/bta_gap_bt_co.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/bta_gap_bt_co.c @@ -23,7 +23,7 @@ void btc_gap_bt_config_eir_cmpl_callback (uint8_t status, uint8_t eir_type_num, memcpy(param.config_eir_data.eir_type, eir_type, eir_type_num); ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_bt_gap_cb_param_t), NULL); + sizeof(esp_bt_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c index 32b82f4e5410..9517dddd9d26 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c @@ -314,7 +314,7 @@ static void btc_adv_data_callback(tBTA_STATUS status) param.adv_data_cmpl.status = status; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -333,7 +333,7 @@ static void btc_scan_rsp_data_callback(tBTA_STATUS status) param.scan_rsp_data_cmpl.status = status; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -352,7 +352,7 @@ static void btc_adv_data_raw_callback(tBTA_STATUS status) param.adv_data_raw_cmpl.status = status; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -371,7 +371,7 @@ static void btc_scan_rsp_data_raw_callback(tBTA_STATUS status) param.scan_rsp_data_raw_cmpl.status = status; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -416,7 +416,7 @@ static void btc_start_adv_callback(uint8_t status) param.adv_start_cmpl.status = btc_hci_to_esp_status(status); ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -435,7 +435,7 @@ static void btc_stop_adv_callback(uint8_t status) param.adv_stop_cmpl.status = btc_hci_to_esp_status(status); ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -458,7 +458,7 @@ void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t } param.update_duplicate_exceptional_list_cmpl.length = length; memcpy(param.update_duplicate_exceptional_list_cmpl.device_info, device_info, length); - ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL); + ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -535,7 +535,7 @@ static void btc_scan_params_callback(tGATT_IF gatt_if, tBTM_STATUS status) param.scan_param_cmpl.status = status; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -677,7 +677,7 @@ static void btc_search_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data BTC_TRACE_ERROR("%s : Unknown event 0x%x\n", __FUNCTION__, event); return; } - btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL); + btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL); } static void btc_start_scan_callback(uint8_t status) @@ -692,7 +692,7 @@ static void btc_start_scan_callback(uint8_t status) param.scan_start_cmpl.status = status; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -711,7 +711,7 @@ static void btc_stop_scan_callback(tBTA_STATUS status) param.scan_stop_cmpl.status = status; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -737,7 +737,7 @@ void btc_update_conn_param_callback (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDA param.update_conn_params.timeout = update_conn_params->supervision_tout; memcpy(param.update_conn_params.bda, bd_addr, sizeof(esp_bd_addr_t)); ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -756,7 +756,7 @@ static void btc_set_pkt_length_callback(UINT8 status, tBTM_LE_SET_PKT_DATA_LENGT param.pkt_data_length_cmpl.params.rx_len = data_len_params->rx_len; param.pkt_data_length_cmpl.params.tx_len = data_len_params->tx_len; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -776,7 +776,7 @@ static void btc_gap_ble_set_channels_cmpl_callback(void *p_data) param.ble_set_channels.stat = btc_btm_status_to_esp_status(result->status); ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -795,7 +795,7 @@ static void btc_add_whitelist_complete_callback(UINT8 status, tBTM_WL_OPERATION param.update_whitelist_cmpl.status = btc_hci_to_esp_status(status); param.update_whitelist_cmpl.wl_operation = wl_opration; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -812,7 +812,7 @@ static void btc_set_rand_addr_callback(UINT8 status) msg.pid = BTC_PID_GAP_BLE; msg.act = ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -830,7 +830,7 @@ static void btc_set_local_privacy_callback(UINT8 status) msg.act = ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT; param.local_privacy_cmpl.status = btc_btm_status_to_esp_status(status); ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -862,7 +862,7 @@ static void btc_read_ble_rssi_cmpl_callback(void *p_data) memcpy(param.read_rssi_cmpl.remote_addr, result->rem_bda, sizeof(BD_ADDR)); ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -1076,7 +1076,7 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event, } ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); + sizeof(esp_ble_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c index 25259b8d08e1..174800e6d521 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c @@ -300,7 +300,7 @@ static void bte_search_devices_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_d msg.pid = BTC_PID_GAP_BT; msg.act = BTC_GAP_BT_SEARCH_DEVICES_EVT; - btc_transfer_context(&msg, &search, sizeof(tBTA_DM_SEARCH_PARAM), search_devices_copy_cb); + btc_transfer_context(&msg, &search, sizeof(tBTA_DM_SEARCH_PARAM), search_devices_copy_cb, NULL); } while (0); } @@ -451,7 +451,7 @@ static void bte_dm_remote_service_record_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_S msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_GAP_BT; msg.act = BTC_GAP_BT_SEARCH_SERVICE_RECORD_EVT; - btc_transfer_context(&msg, &search, sizeof(tBTA_DM_SEARCH_PARAM), search_service_record_copy_cb); + btc_transfer_context(&msg, &search, sizeof(tBTA_DM_SEARCH_PARAM), search_service_record_copy_cb, NULL); } while (0); } @@ -544,7 +544,7 @@ static void bte_dm_search_services_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_GAP_BT; msg.act = BTC_GAP_BT_SEARCH_SERVICES_EVT; - btc_transfer_context(&msg, &search, sizeof(tBTA_DM_SEARCH_PARAM), search_services_copy_cb); + btc_transfer_context(&msg, &search, sizeof(tBTA_DM_SEARCH_PARAM), search_services_copy_cb, NULL); } while (0); } @@ -622,7 +622,7 @@ static void btc_gap_bt_read_rssi_delta_cmpl_callback(void *p_data) param.read_rssi_delta.rssi_delta = result->rssi; ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_bt_gap_cb_param_t), NULL); + sizeof(esp_bt_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -713,7 +713,7 @@ static void btc_gap_bt_set_afh_channels_cmpl_callback(void *p_data) param.set_afh_channels.stat = btc_btm_status_to_esp_status(result->status); ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_bt_gap_cb_param_t), NULL); + sizeof(esp_bt_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -739,7 +739,7 @@ static void btc_gap_bt_read_remote_name_cmpl_callback(void *p_data) param.read_rmt_name.stat = btc_btm_status_to_esp_status(result->status); memcpy(param.read_rmt_name.rmt_name,result->remote_bd_name,ESP_BT_GAP_MAX_BDNAME_LEN); - ret = btc_transfer_context(&msg, ¶m, sizeof(esp_bt_gap_cb_param_t), NULL); + ret = btc_transfer_context(&msg, ¶m, sizeof(esp_bt_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); } @@ -765,7 +765,7 @@ static void btc_gap_bt_set_qos_cmpl_callback(void *p_data) param.qos_cmpl.t_poll = result->flow.latency / 625; memcpy(param.qos_cmpl.bda,result->rem_bda,BD_ADDR_LEN); - ret = btc_transfer_context(&msg, ¶m, sizeof(esp_bt_gap_cb_param_t), NULL); + ret = btc_transfer_context(&msg, ¶m, sizeof(esp_bt_gap_cb_param_t), NULL, NULL); if (ret != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); } diff --git a/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gattc.c b/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gattc.c index cc79e09eb90d..b6ac9a45843b 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gattc.c +++ b/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gattc.c @@ -184,7 +184,8 @@ static void btc_gattc_cback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data) msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_GATTC; msg.act = (uint8_t) event; - ret = btc_transfer_context(&msg, p_data, sizeof(tBTA_GATTC), btc_gattc_copy_req_data); + ret = btc_transfer_context(&msg, p_data, sizeof(tBTA_GATTC), + btc_gattc_copy_req_data, btc_gattc_free_req_data); if (ret) { BTC_TRACE_ERROR("%s transfer failed\n", __func__); diff --git a/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gatts.c b/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gatts.c index dacf03c92a76..9c88081bb83b 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gatts.c +++ b/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gatts.c @@ -533,9 +533,10 @@ static void btc_gatts_cb_param_copy_req(btc_msg_t *msg, void *p_dest, void *p_sr } } -static void btc_gatts_cb_param_copy_free(btc_msg_t *msg, tBTA_GATTS *p_data) +static void btc_gatts_cb_param_copy_free(btc_msg_t *msg) { uint16_t event = msg->act; + tBTA_GATTS *p_data = (tBTA_GATTS *)msg->arg; switch (event) { case BTA_GATTS_READ_EVT: @@ -596,8 +597,8 @@ static void btc_gatts_inter_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) future_ready(btc_creat_tab_env.complete_future, FUTURE_SUCCESS); return; } - status = btc_transfer_context(&msg, p_data, - sizeof(tBTA_GATTS), btc_gatts_cb_param_copy_req); + status = btc_transfer_context(&msg, p_data, sizeof(tBTA_GATTS), + btc_gatts_cb_param_copy_req, btc_gatts_cb_param_copy_free); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -953,7 +954,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg) break; } - btc_gatts_cb_param_copy_free(msg, p_data); + btc_gatts_cb_param_copy_free(msg); } void btc_congest_callback(tBTA_GATTS *param) diff --git a/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c b/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c index 5dc6f56f7a9a..4f254c605f7e 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c +++ b/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c @@ -248,7 +248,7 @@ static void bte_hf_evt(tBTA_AG_EVT event, tBTA_AG *param) msg.act = event; /* Switch to BTC context */ - bt_status_t status = btc_transfer_context(&msg, param, param_len, NULL); + bt_status_t status = btc_transfer_context(&msg, param, param_len, NULL, NULL); /* catch any failed context transfers */ BTC_ASSERTC(status == BT_STATUS_SUCCESS, "context transfer failed", status); } diff --git a/components/bt/host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c b/components/bt/host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c index 41248f8d92c6..e1a0cf8d6852 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c +++ b/components/bt/host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c @@ -697,7 +697,7 @@ static void bte_hf_client_evt(tBTA_HF_CLIENT_EVT event, void *p_data) msg.pid = BTC_PID_HF_CLIENT; msg.act = (uint8_t) event; - stat = btc_transfer_context(&msg, arg, arg_len, NULL); + stat = btc_transfer_context(&msg, arg, arg_len, NULL, NULL); if (stat) { BTC_TRACE_ERROR("%s transfer failed\n", __func__); diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/bta_hh_co.c b/components/bt/host/bluedroid/btc/profile/std/hid/bta_hh_co.c index 5743f8904203..066c70b69d48 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/bta_hh_co.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/bta_hh_co.c @@ -145,7 +145,7 @@ void bta_hh_co_data(UINT8 dev_handle, UINT8 *p_rpt, UINT16 len, tBTA_HH_PROTO_MO p_data.int_data.handle = dev_handle; p_data.int_data.p_data = p_buf; p_data.int_data.proto_mode = mode; - status = btc_transfer_context(&msg, &p_data, sizeof(tBTA_HH), NULL); + status = btc_transfer_context(&msg, &p_data, sizeof(tBTA_HH), NULL, NULL); assert(status == BT_STATUS_SUCCESS); } diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c index b14de4833d70..202f90b0a43d 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c @@ -196,7 +196,7 @@ static void bte_hd_evt(tBTA_HD_EVT event, tBTA_HD *p_data) msg.pid = BTC_PID_HD; msg.act = event; - status = btc_transfer_context(&msg, p_data, param_len, bte_hd_arg_deep_copy); + status = btc_transfer_context(&msg, p_data, param_len, bte_hd_arg_deep_copy, btc_hd_cb_arg_deep_free); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("context transfer failed"); } @@ -654,7 +654,7 @@ void btc_hd_call_handler(btc_msg_t *msg) btc_hd_call_arg_deep_free(msg); } -static void btc_hd_cb_arg_deep_free(btc_msg_t *msg) +void btc_hd_cb_arg_deep_free(btc_msg_t *msg) { tBTA_HD *arg = (tBTA_HD *)msg->arg; diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c index 8595e7704042..7202371e7b14 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c @@ -237,7 +237,7 @@ void btc_hh_timer_timeout(void *data) p_data.dev_status.handle = p_dev->dev_handle; /* switch context to btif task context */ - status = btc_transfer_context(&msg, &p_data, sizeof(tBTA_HH), NULL); + status = btc_transfer_context(&msg, &p_data, sizeof(tBTA_HH), NULL, NULL); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s context transfer failed", __func__); } @@ -433,7 +433,7 @@ static void bte_hh_evt(tBTA_HH_EVT event, tBTA_HH *p_data) msg.pid = BTC_PID_HH; msg.act = event; - status = btc_transfer_context(&msg, p_data, param_len, bte_hh_arg_deep_copy); + status = btc_transfer_context(&msg, p_data, param_len, bte_hh_arg_deep_copy, btc_hh_cb_arg_deep_free); assert(status == BT_STATUS_SUCCESS); } @@ -1161,7 +1161,7 @@ void btc_hh_call_handler(btc_msg_t *msg) btc_hh_call_arg_deep_free(msg); } -static void btc_hh_cb_arg_deep_free(btc_msg_t *msg) +void btc_hh_cb_arg_deep_free(btc_msg_t *msg) { tBTA_HH *arg = (tBTA_HH *)msg->arg; diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_avrc.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_avrc.h index 2ff164b50dc8..83200ae15ed4 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_avrc.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_avrc.h @@ -163,6 +163,7 @@ BOOLEAN btc_rc_get_connected_peer(BD_ADDR peer_addr); void btc_avrc_ct_call_handler(btc_msg_t *msg); void btc_avrc_tg_call_handler(btc_msg_t *msg); void btc_avrc_tg_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_avrc_tg_arg_deep_free(btc_msg_t *msg); bool btc_avrc_tg_init_p(void); bool btc_avrc_ct_init_p(void); diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_bt.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_bt.h index 37ba87c58c7a..3f9c2da09eea 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_bt.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_bt.h @@ -152,6 +152,7 @@ typedef union { void btc_gap_bt_call_handler(btc_msg_t *msg); void btc_gap_bt_cb_handler(btc_msg_t *msg); void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_gap_bt_arg_deep_free(btc_msg_t *msg); void btc_gap_bt_busy_level_updated(uint8_t bl_flags); esp_err_t btc_gap_bt_get_cod(esp_bt_cod_t *cod); diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_gattc.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_gattc.h index b5f074a13f36..48481a8f9aad 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_gattc.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_gattc.h @@ -195,6 +195,7 @@ typedef union { void btc_gattc_call_handler(btc_msg_t *msg); void btc_gattc_cb_handler(btc_msg_t *msg); void btc_gattc_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_gattc_arg_deep_free(btc_msg_t *msg); esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc_uuid, esp_gattc_service_elem_t *result, uint16_t *count, uint16_t offset); diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_gatts.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_gatts.h index 866495646c30..a8de3539a410 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_gatts.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_gatts.h @@ -162,6 +162,7 @@ extern esp_btc_creat_tab_t *btc_creat_tab_env_ptr; void btc_gatts_call_handler(btc_msg_t *msg); void btc_gatts_cb_handler(btc_msg_t *msg); void btc_gatts_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_gatts_arg_deep_free(btc_msg_t *msg); esp_gatt_status_t btc_gatts_get_attr_value(uint16_t attr_handle, uint16_t *length, uint8_t **value); diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_hd.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_hd.h index 4292e648c24d..7fe7460c10d7 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_hd.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_hd.h @@ -94,6 +94,7 @@ void btc_hd_cb_handler(btc_msg_t *msg); // extern void btc_hd_service_registration(); void btc_hd_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_hd_cb_arg_deep_free(btc_msg_t *msg); #ifdef __cplusplus } diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_hh.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_hh.h index c07636ed1c2c..0e0cea8a06db 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_hh.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_hh.h @@ -182,6 +182,8 @@ void btc_hh_cb_handler(btc_msg_t *msg); void btc_hh_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_hh_cb_arg_deep_free(btc_msg_t *msg); + bool btc_hh_add_added_dev(BD_ADDR bd_addr, uint16_t attr_mask); #endif /* BTC_HH_H */ diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_spp.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_spp.h index 94216a2a16c5..4fe0b06607f7 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_spp.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_spp.h @@ -85,6 +85,7 @@ typedef union { void btc_spp_call_handler(btc_msg_t *msg); void btc_spp_cb_handler(btc_msg_t *msg); void btc_spp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); +void btc_spp_arg_deep_free(btc_msg_t *msg); esp_err_t spp_send_data_to_btc(uint32_t handle, int len, uint8_t *p_data, esp_spp_mode_t spp_mode); esp_err_t btc_spp_vfs_register(void); diff --git a/components/bt/host/bluedroid/btc/profile/std/l2cap/btc_l2cap.c b/components/bt/host/bluedroid/btc/profile/std/l2cap/btc_l2cap.c index 9ddb7a7d465e..577e341aa415 100644 --- a/components/bt/host/bluedroid/btc/profile/std/l2cap/btc_l2cap.c +++ b/components/bt/host/bluedroid/btc/profile/std/l2cap/btc_l2cap.c @@ -259,7 +259,7 @@ static void close_timeout_handler(void *arg) msg.pid = BTC_PID_L2CAP; msg.act = BTA_JV_L2CAP_CLOSE_EVT; - status = btc_transfer_context(&msg, arg, sizeof(tBTA_JV), NULL); + status = btc_transfer_context(&msg, arg, sizeof(tBTA_JV), NULL, NULL); if (arg) { free(arg); @@ -350,7 +350,7 @@ static void *btc_l2cap_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_d msg.pid = BTC_PID_L2CAP; msg.act = event; - status = btc_transfer_context(&msg, p_data, sizeof(tBTA_JV), NULL); + status = btc_transfer_context(&msg, p_data, sizeof(tBTA_JV), NULL, NULL); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); } @@ -369,7 +369,7 @@ static void btc_l2cap_dm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user msg.pid = BTC_PID_L2CAP; msg.act = event; - status = btc_transfer_context(&msg, p_data, sizeof(tBTA_JV), NULL); + status = btc_transfer_context(&msg, p_data, sizeof(tBTA_JV), NULL, NULL); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); } diff --git a/components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c b/components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c index 78d7d7f5f379..735e652566c2 100644 --- a/components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c +++ b/components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c @@ -66,7 +66,7 @@ static void sdp_disable_handler(void) msg.pid = BTC_PID_SDP; msg.act = BTA_SDP_DISENABLE_EVT; - status = btc_transfer_context(&msg, NULL, 0, NULL); + status = btc_transfer_context(&msg, NULL, 0, NULL, NULL); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed", __func__); @@ -855,7 +855,7 @@ static void btc_sdp_dm_cback(tBTA_SDP_EVT event, tBTA_SDP* p_data, void* user_da msg.pid = BTC_PID_SDP; msg.act = event; - status = btc_transfer_context(&msg, p_data, sizeof(tBTA_SDP), NULL); + status = btc_transfer_context(&msg, p_data, sizeof(tBTA_SDP), NULL, NULL); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed", __func__); diff --git a/components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c b/components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c index f5515b8ee01c..dc695a94ae67 100644 --- a/components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c +++ b/components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c @@ -254,7 +254,7 @@ static void close_timeout_handler(void *arg) msg.pid = BTC_PID_SPP; msg.act = BTA_JV_RFCOMM_CLOSE_EVT; - status = btc_transfer_context(&msg, arg, sizeof(tBTA_JV), NULL); + status = btc_transfer_context(&msg, arg, sizeof(tBTA_JV), NULL, NULL); if (arg) { osi_free(arg); @@ -439,7 +439,7 @@ static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *u status = btc_transfer_context(&msg, p_data, - sizeof(tBTA_JV), NULL); + sizeof(tBTA_JV), NULL, NULL); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed", __func__); @@ -507,7 +507,7 @@ static void btc_spp_dm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_d msg.pid = BTC_PID_SPP; msg.act = event; - status = btc_transfer_context(&msg, p_data, sizeof(tBTA_JV), NULL); + status = btc_transfer_context(&msg, p_data, sizeof(tBTA_JV), NULL, NULL); if (status != BT_STATUS_SUCCESS) { BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__); @@ -1348,7 +1348,7 @@ int bta_co_rfc_data_incoming(void *user_data, BT_HDR *p_buf) fixed_queue_enqueue(slot->rx.queue, p_buf, FIXED_QUEUE_MAX_TIMEOUT); if (rx_len == 0) { BTC_TRACE_DEBUG("%s data post! %d, %d", __func__, slot->rfc_handle, rx_len); - status = btc_transfer_context(&msg, &p_data, sizeof(tBTA_JV), NULL); + status = btc_transfer_context(&msg, &p_data, sizeof(tBTA_JV), NULL, NULL); assert(status == BT_STATUS_SUCCESS); } } else { @@ -1394,8 +1394,8 @@ esp_err_t spp_send_data_to_btc(uint32_t handle, int len, uint8_t *p_data, esp_sp arg.write.len = len; arg.write.p_data = p_data; - return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), btc_spp_arg_deep_copy) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); + return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), btc_spp_arg_deep_copy, + btc_spp_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } diff --git a/components/bt/host/bluedroid/stack/btu/btu_hcif.c b/components/bt/host/bluedroid/stack/btu/btu_hcif.c index 2ce46ec1bfb7..17d77ca4d180 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/host/bluedroid/stack/btu/btu_hcif.c @@ -1239,7 +1239,9 @@ static void btu_hcif_command_complete_evt(BT_HDR *response, void *context) event->event = BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK; - btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT); + if (btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT) == false) { + osi_free(event); + } } @@ -1469,7 +1471,9 @@ static void btu_hcif_command_status_evt(uint8_t status, BT_HDR *command, void *c event->event = BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK; - btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT); + if (btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT) == false) { + osi_free(event); + } } /*******************************************************************************