Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e254b2fb authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

gatt: Improve send queued request from tGATT_TCB

This patch imidiatelly check if there is any outstanding, ready to send
message on the ATT CID 4 and if not, EATT channels are search for such
messages.

Withouth this patch code could end checking, if there is oustanding
request waiting for response.

Bug: 249431973
Test: atest BluetoothInstrumentationTests
Test: manual testes with device supporting EATT
Tag: #feature
Change-Id: I1d3351ebc82c4f1c0bf7bf0941c50c55bd4ec3e8
parent 446748e1
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1132,9 +1132,10 @@ uint8_t gatt_cmd_to_rsp_code(uint8_t cmd_code) {
bool gatt_cl_send_next_cmd_inq(tGATT_TCB& tcb) {
  std::deque<tGATT_CMD_Q>* cl_cmd_q = nullptr;

  while (!tcb.cl_cmd_q.empty() ||
  while (
      gatt_is_outstanding_msg_in_att_send_queue(tcb) ||
      EattExtension::GetInstance()->IsOutstandingMsgInSendQueue(tcb.peer_bda)) {
    if (!tcb.cl_cmd_q.empty()) {
    if (gatt_is_outstanding_msg_in_att_send_queue(tcb)) {
      cl_cmd_q = &tcb.cl_cmd_q;
    } else {
      EattChannel* channel =
+1 −0
Original line number Diff line number Diff line
@@ -646,6 +646,7 @@ extern void gatt_client_handle_server_rsp(tGATT_TCB& tcb, uint16_t cid,
                                          uint8_t* p_data);
extern void gatt_send_queue_write_cancel(tGATT_TCB& tcb, tGATT_CLCB* p_clcb,
                                         tGATT_EXEC_FLAG flag);
extern bool gatt_is_outstanding_msg_in_att_send_queue(const tGATT_TCB& tcb);

/* gatt_auth.cc */
extern bool gatt_security_check_start(tGATT_CLCB* p_clcb);
+12 −0
Original line number Diff line number Diff line
@@ -1525,6 +1525,18 @@ tGATT_STATUS gatt_send_write_msg(tGATT_TCB& tcb, tGATT_CLCB* p_clcb,
  return attp_send_cl_msg(tcb, p_clcb, op_code, &msg);
}

/*******************************************************************************
 *
 * Function         gatt_is_outstanding_msg_in_att_send_queue
 *
 * Description      checks if there is message on the ATT fixed channel to send
 *
 * Returns          true: on success; false otherwise
 *
 ******************************************************************************/
bool gatt_is_outstanding_msg_in_att_send_queue(const tGATT_TCB& tcb) {
  return (!tcb.cl_cmd_q.empty() && (tcb.cl_cmd_q.front()).to_send);
}
/*******************************************************************************
 *
 * Function         gatt_end_operation