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

Commit 64ed1016 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Reduce spammy error log in gatt_attr.cc, plus minor logging improvements

Test: compilation, observe colored log output on startup
Change-Id: I6671f5a900f15a57cc9b38b01aaec296002ad233
parent c12f1dc6
Loading
Loading
Loading
Loading
+15 −17
Original line number Diff line number Diff line
@@ -213,17 +213,16 @@ static void gatt_request_cback(uint16_t conn_id, uint32_t trans_id,
    case GATTS_REQ_TYPE_WRITE_EXEC:
    case GATT_CMD_WRITE:
      ignore = true;
      VLOG(1) << StringPrintf("Ignore GATT_REQ_EXEC_WRITE/WRITE_CMD");
      VLOG(1) << "Ignore GATT_REQ_EXEC_WRITE/WRITE_CMD";
      break;

    case GATTS_REQ_TYPE_MTU:
      VLOG(1) << StringPrintf("Get MTU exchange new mtu size: %d", p_data->mtu);
      VLOG(1) << "Get MTU exchange new mtu size: " << +p_data->mtu;
      ignore = true;
      break;

    default:
      VLOG(1) << StringPrintf("Unknown/unexpected LE GAP ATT request: 0x%02x",
                              type);
      VLOG(1) << "Unknown/unexpected LE GAP ATT request: " << loghex(type);
      break;
  }

@@ -243,9 +242,8 @@ static void gatt_connect_cback(UNUSED_ATTR tGATT_IF gatt_if,
                               const RawAddress& bda, uint16_t conn_id,
                               bool connected, tGATT_DISCONN_REASON reason,
                               tBT_TRANSPORT transport) {
  VLOG(1) << __func__ << ": from " << bda
          << StringPrintf(" connected:%d conn_id=%d reason = 0x%04x", connected,
                          conn_id, reason);
  VLOG(1) << __func__ << ": from " << bda << " connected: " << connected
          << ", conn_id: " << loghex(conn_id) << "reason: " << loghex(reason);

  tGATT_PROFILE_CLCB* p_clcb =
      gatt_profile_find_clcb_by_bd_addr(bda, transport);
@@ -299,8 +297,7 @@ void gatt_profile_db_init(void) {
  service_handle = service[0].attribute_handle;
  gatt_cb.handle_of_h_r = service[1].attribute_handle;

  LOG(ERROR) << StringPrintf("gatt_profile_db_init:  gatt_if=%d",
                             gatt_cb.gatt_if);
  VLOG(1) << __func__ << ": gatt_if=" << +gatt_cb.gatt_if;
}

/*******************************************************************************
@@ -353,14 +350,15 @@ static void gatt_disc_cmpl_cback(uint16_t conn_id, tGATT_DISC_TYPE disc_type,

  if (p_clcb == NULL) return;

  if (status == GATT_SUCCESS && p_clcb->ccc_result > 0) {
  if (status != GATT_SUCCESS || p_clcb->ccc_result == 0) {
    LOG(WARNING) << __func__
                 << ": Unable to register for service changed indication";
    return;
  }

  p_clcb->ccc_result = 0;
  p_clcb->ccc_stage++;
  gatt_cl_start_config_ccc(p_clcb);
  } else {
    LOG(ERROR) << StringPrintf(
        "%s() - Unable to register for service changed indication", __func__);
  }
}

/*******************************************************************************
@@ -390,7 +388,7 @@ static void gatt_cl_start_config_ccc(tGATT_PROFILE_CLCB* p_clcb) {
  tGATT_DISC_PARAM srvc_disc_param;
  tGATT_VALUE ccc_value;

  VLOG(1) << StringPrintf("%s() - stage: %d", __func__, p_clcb->ccc_stage);
  VLOG(1) << __func__ << ": stage: " << +p_clcb->ccc_stage;

  memset(&srvc_disc_param, 0, sizeof(tGATT_DISC_PARAM));
  memset(&ccc_value, 0, sizeof(tGATT_VALUE));