From b60b58a333089d6e8fe7118b75f8e005de313fe5 Mon Sep 17 00:00:00 2001 From: Yulong Date: Mon, 26 Jun 2017 05:39:14 -0400 Subject: [PATCH] component/bt: Added the bta gattc write ccc judgment. --- components/bt/bluedroid/bta/gatt/bta_gattc_act.c | 8 +++++++- components/bt/bluedroid/btc/core/btc_ble_storage.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/bt/bluedroid/bta/gatt/bta_gattc_act.c b/components/bt/bluedroid/bta/gatt/bta_gattc_act.c index 292b3dfaf..617aa02cd 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gattc_act.c +++ b/components/bt/bluedroid/bta/gatt/bta_gattc_act.c @@ -33,6 +33,7 @@ #include "bta_gattc_int.h" #include "l2c_api.h" #include "l2c_int.h" +#include "gatt_int.h" #if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE) #include "bta_hh_int.h" @@ -2410,7 +2411,12 @@ tBTA_GATTC_FIND_SERVICE_CB bta_gattc_register_service_change_notify(UINT16 conn_ ccc_value.len = 2; ccc_value.value[0] = GATT_CLT_CONFIG_INDICATION; ccc_value.auth_req = GATT_AUTH_REQ_NONE; - write_status = GATTC_Write (conn_id, GATT_WRITE, &ccc_value); + if (gatt_is_clcb_allocated(conn_id)) { + APPL_TRACE_DEBUG("%s, GATTC_Write GATT_BUSY conn_id = %d", __func__, conn_id); + write_status = GATT_BUSY; + } else { + write_status = GATTC_Write (conn_id, GATT_WRITE, &ccc_value); + } if (write_status != GATT_SUCCESS) { start_find_ccc_timer = TRUE; result = SERVICE_CHANGE_WRITE_CCC_FAILED; diff --git a/components/bt/bluedroid/btc/core/btc_ble_storage.c b/components/bt/bluedroid/btc/core/btc_ble_storage.c index 5e588012e..3bafbc1ce 100644 --- a/components/bt/bluedroid/btc/core/btc_ble_storage.c +++ b/components/bt/bluedroid/btc/core/btc_ble_storage.c @@ -238,7 +238,7 @@ bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr, bool btc_storage_compare_address_key_value(uint8_t key_type, void *key_value, int key_length) { - const char *key_type_str; + char *key_type_str; switch (key_type) { case BTM_LE_KEY_PENC: key_type_str = "LE_KEY_PENC";