]> granicus.if.org Git - esp-idf/commitdiff
component/bt: added the queue to store the gattc commands.
authorYulong <huangyulong@espressif.com>
Thu, 21 Sep 2017 10:17:38 +0000 (06:17 -0400)
committeryulong <huangyulong@espressif.com>
Thu, 9 Nov 2017 06:47:11 +0000 (14:47 +0800)
components/bt/bluedroid/bta/gatt/bta_gattc_act.c
components/bt/bluedroid/bta/gatt/bta_gattc_utils.c
components/bt/bluedroid/bta/include/bta_gattc_int.h

index 1a9306001c30f6ef68f5b0dbb55788aba3c58a58..8d504f6d7f9810a5cb6d8a5236e6f8559e92ddfd 100644 (file)
@@ -1457,6 +1457,11 @@ void bta_gattc_q_cmd(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
     bta_gattc_enqueue(p_clcb, p_data);
 }
 
+void bta_gattc_pop_command_to_send(tBTA_GATTC_CLCB *p_clcb)
+{
+    tBTA_GATTC_DATA *p_data = 
+}
+
 /*******************************************************************************
 **
 ** Function         bta_gattc_fail
index 864a85fe8ec8ee006de8f8c806942cd83268b64c..196acf0495a716967b397f27e16b0652a3e4d9ff 100644 (file)
@@ -230,6 +230,7 @@ tBTA_GATTC_CLCB *bta_gattc_clcb_alloc(tBTA_GATTC_IF client_if, BD_ADDR remote_bd
             bdcpy(p_clcb->bda, remote_bda);
 
             p_clcb->p_rcb = bta_gattc_cl_get_regcb(client_if);
+            p_clcb->p_cmd_list = list_new(osi_free_func);
 
             if ((p_clcb->p_srcb = bta_gattc_find_srcb(remote_bda)) == NULL) {
                 p_clcb->p_srcb      = bta_gattc_srcb_alloc(remote_bda);
@@ -437,10 +438,12 @@ BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
     {
         p_clcb->p_q_cmd = p_data;
         return TRUE;
+    } else if (p_clcb->p_cmd_list) {
+        //store the command to the command list.
+        list_append(p_clcb->p_cmd_list, (void *)p_data);
+        return FALSE;
     }
 
-    APPL_TRACE_ERROR ("%s: already has a pending command!!", __func__);
-    /* skip the callback now. ----- need to send callback ? */
     return FALSE;
 }
 
index f54c0fbee70b4740b320d31b9f6e7e78d4836918..9903a0a053c7f6c62c65209378bc6d407027d02d 100644 (file)
@@ -310,7 +310,7 @@ typedef struct {
     tBTA_GATTC_RCB      *p_rcb;         /* pointer to the registration CB */
     tBTA_GATTC_SERV     *p_srcb;    /* server cache CB */
     tBTA_GATTC_DATA     *p_q_cmd;   /* command in queue waiting for execution */
-
+    list_t              *p_cmd_list; /* The list to store the command to be sent */
 #define BTA_GATTC_NO_SCHEDULE       0
 #define BTA_GATTC_DISC_WAITING      0x01
 #define BTA_GATTC_REQ_WAITING       0x10