]> granicus.if.org Git - esp-idf/commitdiff
component/bt: Added the bta gattc write ccc judgment.
authorYulong <huangyulong@espressif.com>
Mon, 26 Jun 2017 09:39:14 +0000 (05:39 -0400)
committerYulong <huangyulong@espressif.com>
Mon, 26 Jun 2017 09:39:14 +0000 (05:39 -0400)
components/bt/bluedroid/bta/gatt/bta_gattc_act.c
components/bt/bluedroid/btc/core/btc_ble_storage.c

index 292b3dfaf60e72529d63dcf577cb64f05fc6da29..617aa02cdf277dbfaaa3d78ed6db4d55adbdd060 100644 (file)
@@ -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;
index 5e588012ea4522cbec8e16030077c423bdf4dea2..3bafbc1cea4cf3d6175043ba1df18cc9ad1cf33c 100644 (file)
@@ -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";