OSDN Git Service

DO NOT MERGE ANYWHERE implement wakelocks on bt adapter init am: ef1f356866 -s ours
[android-x86/system-bt.git] / stack / gatt / gatt_attr.c
index 659a864..130ed3f 100644 (file)
@@ -235,26 +235,24 @@ static void gatt_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
 {
     UNUSED(gatt_if);
 
-    GATT_TRACE_EVENT ("%s: from %08x%04x connected:%d conn_id=%d reason = 0x%04x", __FUNCTION__,
-                       (bda[0]<<24)+(bda[1]<<16)+(bda[2]<<8)+bda[3],
-                       (bda[4]<<8)+bda[5], connected, conn_id, reason);
+    GATT_TRACE_EVENT("%s: from %08x%04x connected:%d conn_id=%d reason = 0x%04x", __func__,
+                      (bda[0]<<24)+(bda[1]<<16)+(bda[2]<<8)+bda[3],
+                      (bda[4]<<8)+bda[5], connected, conn_id, reason);
 
     tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_bd_addr(bda, transport);
-    if (p_clcb == NULL)
-        return;
+    if (connected) {
+        if (p_clcb == NULL)
+            p_clcb = gatt_profile_clcb_alloc(conn_id, bda, transport);
 
-    if (connected)
-    {
-        p_clcb->conn_id = conn_id;
-        p_clcb->connected = TRUE;
+        if (p_clcb == NULL)
+            return;
 
-        if (p_clcb->ccc_stage == GATT_SVC_CHANGED_CONNECTING)
-        {
-            p_clcb->ccc_stage ++;
-            gatt_cl_start_config_ccc(p_clcb);
-        }
+        p_clcb->connected = TRUE;
+        p_clcb->ccc_stage = GATT_SVC_CHANGED_SERVICE;
+        gatt_cl_start_config_ccc(p_clcb);
     } else {
-        gatt_profile_clcb_dealloc(p_clcb);
+        if (p_clcb != NULL)
+            gatt_profile_clcb_dealloc(p_clcb);
     }
 }
 
@@ -390,20 +388,12 @@ static void gatt_disc_cmpl_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGA
 **
 *******************************************************************************/
 static void gatt_cl_op_cmpl_cback (UINT16 conn_id, tGATTC_OPTYPE op,
-                                           tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
+                                   tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
 {
-    tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_conn_id(conn_id);
-
-    if (p_clcb == NULL)
-        return;
-
-    if (op == GATTC_OPTYPE_WRITE)
-    {
-        GATT_TRACE_DEBUG("%s() - ccc write status : %d", __FUNCTION__, status);
-    }
-
-    /* free the connection */
-    gatt_config_ccc_complete (p_clcb);
+    UNUSED(conn_id);
+    UNUSED(op);
+    UNUSED(status);
+    UNUSED(p_data);
 }
 
 /*******************************************************************************