From 9b2e0a2a01af06b6c970017d94059e88ae82c238 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Tue, 9 Jan 2024 16:45:49 +0800 Subject: [PATCH] feat(ble/bluedroid): Add getter for BLE GATTC calllback --- components/bt/host/bluedroid/api/esp_gattc_api.c | 7 ++++++- .../bt/host/bluedroid/api/include/api/esp_gattc_api.h | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/bt/host/bluedroid/api/esp_gattc_api.c b/components/bt/host/bluedroid/api/esp_gattc_api.c index 44d932d512..5f078b2809 100644 --- a/components/bt/host/bluedroid/api/esp_gattc_api.c +++ b/components/bt/host/bluedroid/api/esp_gattc_api.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,6 +29,11 @@ esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback) return ESP_OK; } +esp_gattc_cb_t esp_ble_gattc_get_callback(void) +{ + return (esp_gattc_cb_t) btc_profile_cb_get(BTC_PID_GATTC); +} + esp_err_t esp_ble_gattc_app_register(uint16_t app_id) { btc_msg_t msg = {0}; diff --git a/components/bt/host/bluedroid/api/include/api/esp_gattc_api.h b/components/bt/host/bluedroid/api/include/api/esp_gattc_api.h index 9a95577a5e..13bf16a328 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gattc_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gattc_api.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -273,6 +273,15 @@ typedef void (* esp_gattc_cb_t)(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_ */ esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback); +/** + * @brief This function is called to get the current application callbacks + * with BTA GATTC module. + * + * @return + * - esp_gattC_cb_t : current callback + * + */ +esp_gattc_cb_t esp_ble_gattc_get_callback(void); /** * @brief This function is called to register application callbacks