summaryrefslogtreecommitdiff
path: root/stack/gatt
diff options
context:
space:
mode:
Diffstat (limited to 'stack/gatt')
-rw-r--r--stack/gatt/eatt_int.h1
-rw-r--r--stack/gatt/eatt_utils.cc29
-rw-r--r--stack/gatt/gatt_main.cc7
3 files changed, 36 insertions, 1 deletions
diff --git a/stack/gatt/eatt_int.h b/stack/gatt/eatt_int.h
index 593cbb9a9..99cf78384 100644
--- a/stack/gatt/eatt_int.h
+++ b/stack/gatt/eatt_int.h
@@ -79,5 +79,6 @@ extern void eatt_disc_rsp_enq(tGATT_TCB* p_tcb, uint16_t cid, BT_HDR *p_msg);
extern bool eatt_congest_notify_apps(tGATT_TCB* p_tcb, uint16_t cid, bool congested);
extern tGATT_EBCB* gatt_find_eatt_bcb_using_all_cids(uint16_t lcid);
extern void gatt_send_conn_cb_after_enc_failure(tGATT_TCB* p_tcb);
+extern void gatt_move_att_ops_from_eatt_bcb(tGATT_TCB* p_tcb);
#endif
diff --git a/stack/gatt/eatt_utils.cc b/stack/gatt/eatt_utils.cc
index 4a89c0b2f..919d615e9 100644
--- a/stack/gatt/eatt_utils.cc
+++ b/stack/gatt/eatt_utils.cc
@@ -1457,3 +1457,32 @@ void gatt_send_conn_cb_after_enc_failure(tGATT_TCB* p_tcb) {
}
}
}
+
+/*******************************************************************************
+ *
+ * Function gatt_move_att_ops_from_eatt_bcb
+ *
+ * Description The function moves ATT channel ops from EATT bcb to p_tcb
+ *
+ * Returns void
+ *
+ ******************************************************************************/
+void gatt_move_att_ops_from_eatt_bcb(tGATT_TCB* p_tcb) {
+ tGATT_EBCB* p_eatt_bcb = NULL;
+
+ VLOG(1) << __func__;
+ p_eatt_bcb = gatt_find_eatt_bcb_by_cid(p_tcb, L2CAP_ATT_CID);
+ if (!p_eatt_bcb) {
+ VLOG(1) << __func__ << " p_eatt_bcb not available for ATT CID: ";
+ return;
+ }
+
+ p_tcb->payload_size = p_eatt_bcb->payload_size;
+ p_tcb->ind_ack_timer = p_eatt_bcb->ind_ack_timer;
+ p_tcb->conf_timer = p_eatt_bcb->conf_timer;
+ p_tcb->cl_cmd_q = p_eatt_bcb->cl_cmd_q;
+ p_tcb->pending_ind_q = p_eatt_bcb->pending_ind_q;
+ p_tcb->indicate_handle = p_eatt_bcb->indicate_handle;
+ p_tcb->sr_cmd = p_eatt_bcb->sr_cmd;
+ p_tcb->sr_cmd.multi_rsp_q = p_eatt_bcb->sr_cmd.multi_rsp_q;
+}
diff --git a/stack/gatt/gatt_main.cc b/stack/gatt/gatt_main.cc
index 71880b787..0486f9404 100644
--- a/stack/gatt/gatt_main.cc
+++ b/stack/gatt/gatt_main.cc
@@ -1369,6 +1369,8 @@ static void gatt_l2cif_eatt_connect_cfm_cback(RawAddress &p_bd_addr,
gatt_eatt_bcb_in_progress_dealloc(p_bd_addr);
p_tcb->apps_needing_eatt.clear();
p_tcb->is_eatt_supported = false;
+ gatt_move_att_ops_from_eatt_bcb(p_tcb);
+ gatt_eatt_bcb_dealloc(p_tcb, L2CAP_ATT_CID);
gatt_send_conn_cb_after_enc_failure(p_tcb);
return;
@@ -1401,6 +1403,8 @@ static void gatt_l2cif_eatt_connect_cfm_cback(RawAddress &p_bd_addr,
if (gatt_num_eatt_bcbs(p_tcb) == 0) {
VLOG(1) << " First EATT conn attempt rejected, set eatt as not supported";
p_tcb->is_eatt_supported = false;
+ gatt_move_att_ops_from_eatt_bcb(p_tcb);
+ gatt_eatt_bcb_dealloc(p_tcb, L2CAP_ATT_CID);
}
}
@@ -1714,7 +1718,8 @@ void gatt_data_process(tGATT_TCB& tcb, uint16_t lcid, BT_HDR* p_buf) {
STREAM_TO_UINT8(op_code, p);
LOG(INFO) << __func__ << " op_code = " << +op_code
- << ", msg_len = " << +msg_len;
+ << ", msg_len = " << +msg_len
+ << ", lcid = " << +lcid;
/* remove the two MSBs associated with sign write and write cmd */
pseudo_op_code = op_code & (~GATT_WRITE_CMD_MASK);