From e4a372ab76d318a5eedb29f41f08fa909744f828 Mon Sep 17 00:00:00 2001 From: chenjianhua Date: Mon, 9 Sep 2024 16:47:23 +0800 Subject: [PATCH] feat(bt/bluedroid): Add BLE connection id param for ESP_GATTS_RESPONSE_EVT --- .../bt/host/bluedroid/api/include/api/esp_gatts_api.h | 1 + .../bt/host/bluedroid/btc/profile/std/gatt/btc_gatts.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/bt/host/bluedroid/api/include/api/esp_gatts_api.h b/components/bt/host/bluedroid/api/include/api/esp_gatts_api.h index 0eb7ddd98b..72ff694e4b 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gatts_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gatts_api.h @@ -242,6 +242,7 @@ typedef union { */ struct gatts_rsp_evt_param { esp_gatt_status_t status; /*!< Operation status */ + uint16_t conn_id; /*!< Connection id */ uint16_t handle; /*!< Attribute handle which send response */ } rsp; /*!< Gatt server callback param of ESP_GATTS_RESPONSE_EVT */ 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 df9a4ceb19..7eab806e2f 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 @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -469,7 +469,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat if(gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_16 && gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_32 && gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_128) { - BTC_TRACE_ERROR("%s, The Charateristic uuid length = %d is invalid", __func__,\ + BTC_TRACE_ERROR("%s, The Characteristic uuid length = %d is invalid", __func__,\ gatts_attr_db[i+1].att_desc.uuid_length); return ESP_GATT_INVALID_ATTR_LEN; } @@ -481,7 +481,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat uuid == ESP_GATT_UUID_CHAR_SRVR_CONFIG || uuid == ESP_GATT_UUID_CHAR_PRESENT_FORMAT || uuid == ESP_GATT_UUID_CHAR_AGG_FORMAT || uuid == ESP_GATT_UUID_CHAR_VALID_RANGE || uuid == ESP_GATT_UUID_EXT_RPT_REF_DESCR || uuid == ESP_GATT_UUID_RPT_REF_DESCR) { - BTC_TRACE_ERROR("%s, The charateristic value uuid = %d is invalid", __func__, uuid); + BTC_TRACE_ERROR("%s, The characteristic value uuid = %d is invalid", __func__, uuid); return ESP_GATT_INVALID_PDU; } } @@ -694,6 +694,7 @@ void btc_gatts_call_handler(btc_msg_t *msg) } param.rsp.status = 0; + param.rsp.conn_id = BTC_GATT_GET_CONN_ID(arg->send_rsp.conn_id); btc_gatts_cb_to_app(ESP_GATTS_RESPONSE_EVT, BTC_GATT_GET_GATT_IF(arg->send_rsp.conn_id), ¶m); break; }