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

Commit 8d7b8fe2 authored by Chris Manton's avatar Chris Manton
Browse files

log tgatt status properly

Towards readable code

Bug: 163134718
Tag: #refactor
Test: act.py -tc BleCocTest
Test: ble paired 2 phones
Test: classic paired Bose SoundLink

Change-Id: I5e4c526baca73a3c4e5e64a4b4bea4daab31116a
parent 1181547e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ static void write_rpt_ctl_cfg_cb(uint16_t conn_id, tGATT_STATUS status,
                                 uint16_t handle, void* data) {
  if (status != GATT_SUCCESS) {
    LOG(ERROR) << __func__ << ": handle=" << handle << ", conn_id=" << conn_id
               << ", status=" << loghex(status);
               << ", status=" << loghex(static_cast<uint8_t>(status));
  }
}

@@ -482,8 +482,8 @@ class HearingAidImpl : public HearingAid {
        send_state_change_to_other_side(hearingDevice, conn_update);
        send_state_change(hearingDevice, conn_update);
      } else {
        LOG(INFO) << __func__
                  << ": error status=" << loghex(p_data->conn_update.status)
        LOG(INFO) << __func__ << ": error status="
                  << loghex(static_cast<uint8_t>(p_data->conn_update.status))
                  << ", conn_id=" << conn_id
                  << ", device=" << hearingDevice->address
                  << ", connection_update_status="
@@ -928,7 +928,7 @@ class HearingAidImpl : public HearingAid {
    if (register_status != GATT_SUCCESS) {
      LOG(ERROR) << __func__
                 << ": BTA_GATTC_RegisterForNotifications failed, status="
                 << loghex(register_status);
                 << loghex(static_cast<uint8_t>(register_status));
      return;
    }
    std::vector<uint8_t> value(2);
+2 −1
Original line number Diff line number Diff line
@@ -542,7 +542,8 @@ tGATT_STATUS GATTS_SendRsp(uint16_t conn_id, uint32_t trans_id,
  tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx);

  VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id)
          << ", trans_id=" << loghex(trans_id) << ", status=" << loghex(status);
          << ", trans_id=" << loghex(trans_id)
          << ", status=" << loghex(static_cast<uint8_t>(status));

  if ((p_reg == NULL) || (p_tcb == NULL)) {
    LOG(ERROR) << "Unknown  conn_id=" << loghex(conn_id);
+6 −4
Original line number Diff line number Diff line
@@ -500,7 +500,8 @@ static bool gatt_svc_read_cl_supp_feat_req(uint16_t conn_id,

  tGATT_STATUS status = GATTC_Read(conn_id, GATT_READ_BY_TYPE, &param);
  if (status != GATT_SUCCESS) {
    LOG(ERROR) << __func__ << " Read failed. Status: " << loghex(status);
    LOG(ERROR) << __func__ << " Read failed. Status: "
               << loghex(static_cast<uint8_t>(status));
    return false;
  }

@@ -520,7 +521,8 @@ static bool gatt_att_write_cl_supp_feat(uint16_t conn_id, uint16_t handle) {

  tGATT_STATUS status = GATTC_Write(conn_id, GATT_WRITE, &attr);
  if (status != GATT_SUCCESS) {
    LOG(ERROR) << __func__ << " Write failed. Status: " << loghex(status);
    LOG(ERROR) << __func__ << " Write failed. Status: "
               << loghex(static_cast<uint8_t>(status));
    return false;
  }

@@ -541,8 +543,8 @@ static void gatt_cl_op_cmpl_cback(uint16_t conn_id, tGATTC_OPTYPE op,
                                  tGATT_CL_COMPLETE* p_data) {
  auto iter = OngoingOps.find(conn_id);

  VLOG(1) << __func__ << " opcode: " << loghex(op)
          << " status: " << loghex(status) << " conn id: " << loghex(conn_id);
  VLOG(1) << __func__ << " opcode: " << loghex(op) << " status: " << status
          << " conn id: " << loghex(static_cast<uint8_t>(conn_id));

  if (op != GATTC_OPTYPE_READ) return;

+3 −2
Original line number Diff line number Diff line
@@ -535,13 +535,14 @@ void gatt_process_error_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb,
  }

  if (p_clcb->operation == GATTC_OPTYPE_DISCOVERY) {
    gatt_proc_disc_error_rsp(tcb, p_clcb, opcode, handle, reason);
    gatt_proc_disc_error_rsp(tcb, p_clcb, opcode, handle,
                             static_cast<tGATT_STATUS>(reason));
  } else {
    if ((p_clcb->operation == GATTC_OPTYPE_WRITE) &&
        (p_clcb->op_subtype == GATT_WRITE) &&
        (opcode == GATT_REQ_PREPARE_WRITE) && (p_attr) &&
        (handle == p_attr->handle)) {
      p_clcb->status = reason;
      p_clcb->status = static_cast<tGATT_STATUS>(reason);
      gatt_send_queue_write_cancel(tcb, p_clcb, GATT_PREP_WRITE_CANCEL);
    } else if ((p_clcb->operation == GATTC_OPTYPE_READ) &&
               ((p_clcb->op_subtype == GATT_READ_CHAR_VALUE_HDL) ||