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

Commit f1e0559d authored by jruthe's avatar jruthe Committed by android-build-merger
Browse files

Merge "bta: Update APPL_TRACE_* logs and call parameter"

am: 1342281d

Change-Id: I526b4dd5ee192647e5f385ad5247c8e567615081
parents a08f0e69 1342281d
Loading
Loading
Loading
Loading
+29 −30
Original line number Diff line number Diff line
@@ -105,14 +105,14 @@ void bta_gattc_reset_discover_st(tBTA_GATTC_SERV* p_srcb,
 *
 ******************************************************************************/
static void bta_gattc_enable() {
  APPL_TRACE_DEBUG("bta_gattc_enable");
  APPL_TRACE_DEBUG("%s", __func__);

  if (bta_gattc_cb.state == BTA_GATTC_STATE_DISABLED) {
    /* initialize control block */
    memset(&bta_gattc_cb, 0, sizeof(tBTA_GATTC_CB));
    bta_gattc_cb.state = BTA_GATTC_STATE_ENABLED;
  } else {
    APPL_TRACE_DEBUG("GATTC is arelady enabled");
    APPL_TRACE_DEBUG("GATTC is already enabled");
  }
}

@@ -129,10 +129,10 @@ static void bta_gattc_enable() {
void bta_gattc_disable() {
  uint8_t i;

  APPL_TRACE_DEBUG("bta_gattc_disable");
  APPL_TRACE_DEBUG("%s", __func__);

  if (bta_gattc_cb.state != BTA_GATTC_STATE_ENABLED) {
    APPL_TRACE_ERROR("not enabled or disable in pogress");
    APPL_TRACE_ERROR("not enabled, or disabled in progress");
    return;
  }

@@ -173,7 +173,7 @@ void bta_gattc_register(tBT_UUID* p_app_uuid, tBTA_GATTC_CBACK* p_cback,
                        BtaAppRegisterCallback cb) {
  tBTA_GATT_STATUS status = BTA_GATT_NO_RESOURCES;
  uint8_t client_if = 0;
  APPL_TRACE_DEBUG("bta_gattc_register state %d", bta_gattc_cb.state);
  APPL_TRACE_DEBUG("%s: state %d", __func__, bta_gattc_cb.state);

  /* check if  GATTC module is already enabled . Else enable */
  if (bta_gattc_cb.state == BTA_GATTC_STATE_DISABLED) {
@@ -284,7 +284,7 @@ void bta_gattc_process_api_open(tBTA_GATTC_DATA* p_msg) {
      bta_gattc_init_bk_conn(&p_msg->api_conn, p_clreg);
    }
  } else {
    APPL_TRACE_ERROR("bta_gattc_process_api_open Failed, unknown client_if: %d",
    APPL_TRACE_ERROR("%s: Failed, unknown client_if: %d", __func__,
                     p_msg->api_conn.client_if);
  }
}
@@ -496,7 +496,7 @@ void bta_gattc_cancel_bk_conn(tBTA_GATTC_API_CANCEL_OPEN* p_data) {
    if (GATT_CancelConnect(p_data->client_if, p_data->remote_bda, false)) {
      cb_data.status = BTA_GATT_OK;
    } else {
      APPL_TRACE_ERROR("bta_gattc_cancel_bk_conn failed");
      APPL_TRACE_ERROR("%s: failed", __func__);
    }
  }
  p_clreg = bta_gattc_cl_get_regcb(p_data->client_if);
@@ -558,11 +558,11 @@ void bta_gattc_cancel_open(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
 ******************************************************************************/
void bta_gattc_conn(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
  tBTA_GATTC_IF gatt_if;
  APPL_TRACE_DEBUG("bta_gattc_conn server cache state=%d",
  APPL_TRACE_DEBUG("%s: server cache state=%d", __func__,
                   p_clcb->p_srcb->state);

  if (p_data != NULL) {
    APPL_TRACE_DEBUG("bta_gattc_conn conn_id=%d", p_data->hdr.layer_specific);
    APPL_TRACE_DEBUG("%s: conn_id=%d", __func__, p_data->hdr.layer_specific);
    p_clcb->bta_conn_id = p_data->int_conn.hdr.layer_specific;

    GATT_GetConnectionInfor(p_data->hdr.layer_specific, &gatt_if, p_clcb->bda,
@@ -646,7 +646,7 @@ void bta_gattc_close(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
  tBTA_GATTC_RCB* p_clreg = p_clcb->p_rcb;
  tBTA_GATTC cb_data;

  APPL_TRACE_DEBUG("bta_gattc_close conn_id=%d", p_clcb->bta_conn_id);
  APPL_TRACE_DEBUG("%s: conn_id=%d", __func__, p_clcb->bta_conn_id);

  cb_data.close.client_if = p_clcb->p_rcb->client_if;
  cb_data.close.conn_id = p_clcb->bta_conn_id;
@@ -795,8 +795,7 @@ void bta_gattc_cfg_mtu(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
 ******************************************************************************/
void bta_gattc_start_discover(tBTA_GATTC_CLCB* p_clcb,
                              UNUSED_ATTR tBTA_GATTC_DATA* p_data) {
  APPL_TRACE_DEBUG(
      "bta_gattc_start_discover conn_id=%d p_clcb->p_srcb->state = %d ",
  APPL_TRACE_DEBUG("%s: conn_id=%d p_clcb->p_srcb->state = %d ", __func__,
                   p_clcb->bta_conn_id, p_clcb->p_srcb->state);

  if (((p_clcb->p_q_cmd == NULL ||
@@ -854,7 +853,7 @@ void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB* p_clcb,
                         UNUSED_ATTR tBTA_GATTC_DATA* p_data) {
  tBTA_GATTC_DATA* p_q_cmd = p_clcb->p_q_cmd;

  APPL_TRACE_DEBUG("bta_gattc_disc_cmpl conn_id=%d", p_clcb->bta_conn_id);
  APPL_TRACE_DEBUG("%s: conn_id=%d", __func__, p_clcb->bta_conn_id);

  if (p_clcb->transport == BTA_TRANSPORT_LE)
    L2CA_EnableUpdateBleConnParams(p_clcb->p_srcb->server_bda, true);
@@ -1043,7 +1042,7 @@ void bta_gattc_confirm(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {

  if (GATTC_SendHandleValueConfirm(p_data->api_confirm.hdr.layer_specific,
                                   handle) != GATT_SUCCESS) {
    APPL_TRACE_ERROR("bta_gattc_confirm to handle [0x%04x] failed", handle);
    APPL_TRACE_ERROR("%s: to handle [0x%04x] failed", __func__, handle);
  } else {
    /* if over BR_EDR, inform PM for mode change */
    if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
@@ -1065,8 +1064,9 @@ void bta_gattc_read_cmpl(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_OP_CMPL* p_data) {
  GATT_READ_OP_CB cb = p_clcb->p_q_cmd->api_read.read_cb;
  void* my_cb_data = p_clcb->p_q_cmd->api_read.read_cb_data;

  // if it was read by handle, return the handle requested, if read by UUID, use
  // handle returned from remote
  /* if it was read by handle, return the handle requested, if read by UUID, use
   * handle returned from remote
   */
  uint16_t handle = p_clcb->p_q_cmd->api_read.handle;
  if (handle == 0) handle = p_data->p_cmpl->att_value.handle;

@@ -1159,7 +1159,7 @@ void bta_gattc_op_cmpl(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
  uint8_t op = (uint8_t)p_data->op_cmpl.op_code;
  uint8_t mapped_op = 0;

  APPL_TRACE_DEBUG("bta_gattc_op_cmpl op = %d", op);
  APPL_TRACE_DEBUG("%s: op = %d", __func__, op);

  if (op == GATTC_OPTYPE_INDICATION || op == GATTC_OPTYPE_NOTIFICATION) {
    APPL_TRACE_ERROR("unexpected operation, ignored");
@@ -1182,7 +1182,8 @@ void bta_gattc_op_cmpl(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
    }

    /* Except for MTU configuration, discard responses if service change
     * indication is received before operation completed */
     * indication is received before operation completed
     */
    if (p_clcb->auto_update == BTA_GATTC_DISC_WAITING &&
        p_clcb->p_srcb->srvc_hdl_chg && op != GATTC_OPTYPE_CONFIG) {
      APPL_TRACE_DEBUG(
@@ -1222,8 +1223,7 @@ void bta_gattc_ignore_op_cmpl(UNUSED_ATTR tBTA_GATTC_CLCB* p_clcb,
                              tBTA_GATTC_DATA* p_data) {
  /* receive op complete when discovery is started, ignore the response,
      and wait for discovery finish and resent */
  APPL_TRACE_DEBUG("bta_gattc_ignore_op_cmpl op = %d",
                   p_data->hdr.layer_specific);
  APPL_TRACE_DEBUG("%s: op = %d", __func__, p_data->hdr.layer_specific);
}
/*******************************************************************************
 *
@@ -1237,7 +1237,7 @@ void bta_gattc_ignore_op_cmpl(UNUSED_ATTR tBTA_GATTC_CLCB* p_clcb,
void bta_gattc_search(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
  tBTA_GATT_STATUS status = GATT_INTERNAL_ERROR;
  tBTA_GATTC cb_data;
  APPL_TRACE_DEBUG("bta_gattc_search conn_id=%d", p_clcb->bta_conn_id);
  APPL_TRACE_DEBUG("%s: conn_id=%d", __func__, p_clcb->bta_conn_id);
  if (p_clcb->p_srcb && p_clcb->p_srcb->p_srvc_cache) {
    status = BTA_GATT_OK;
    /* search the local cache of a server device */
@@ -1366,8 +1366,9 @@ static void bta_gattc_enc_cmpl_cback(tGATT_IF gattc_if, BD_ADDR bda) {

#if (BTA_HH_LE_INCLUDED == TRUE)
  /* filter this event just for BTA HH LE GATT client,
     In the future, if we want to enable encryption complete event
     for all GATT clients, we can remove this code */
   * In the future, if we want to enable encryption complete event
   * for all GATT clients, we can remove this code
   */
  if (!bta_hh_le_is_hh_gatt_if(gattc_if)) {
    return;
  }
@@ -1510,10 +1511,8 @@ bool bta_gattc_process_srvc_chg_ind(uint16_t conn_id, tBTA_GATTC_RCB* p_clrcb,
void bta_gattc_proc_other_indication(tBTA_GATTC_CLCB* p_clcb, uint8_t op,
                                     tGATT_CL_COMPLETE* p_data,
                                     tBTA_GATTC_NOTIFY* p_notify) {
  APPL_TRACE_DEBUG(
      "bta_gattc_proc_other_indication check \
                       p_data->att_value.handle=%d p_data->handle=%d",
      p_data->att_value.handle, p_data->handle);
  APPL_TRACE_DEBUG("%s: check p_data->att_value.handle=%d p_data->handle=%d",
                   __func__, p_data->att_value.handle, p_data->handle);
  APPL_TRACE_DEBUG("is_notify", p_notify->is_notify);

  p_notify->is_notify = (op == GATTC_OPTYPE_INDICATION) ? false : true;
@@ -1627,8 +1626,8 @@ static void bta_gattc_cmpl_cback(uint16_t conn_id, tGATTC_OPTYPE op,
  else {
    p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
    if (p_clcb == NULL) {
      APPL_TRACE_ERROR(
          "bta_gattc_cmpl_cback unknown conn_id =  %d, ignore data", conn_id);
      APPL_TRACE_ERROR("%s: unknown conn_id =  %d, ignore data", __func__,
                       conn_id);
      return;
    }
  }
+24 −29
Original line number Diff line number Diff line
@@ -182,10 +182,8 @@ static void bta_hh_sdp_cback(uint16_t result, uint16_t attr_mask,
    if (p_cb->sec_mask) attr_mask |= HID_SEC_REQUIRED;

#if (BTA_HH_DEBUG == TRUE)
    APPL_TRACE_EVENT(
        "bta_hh_sdp_cback: p_cb: %d result 0x%02x, \
                            attr_mask 0x%02x, handle %x",
        p_cb, result, attr_mask, p_cb->hid_handle);
    APPL_TRACE_EVENT("%s: p_cb: %d result 0x%02x, attr_mask 0x%02x, handle %x",
                     __func__, p_cb, result, attr_mask, p_cb->hid_handle);
#endif

    /* check to see type of device is supported , and should not been added
@@ -245,17 +243,15 @@ static void bta_hh_di_sdp_cback(uint16_t result) {
  tSDP_DI_GET_RECORD di_rec;
  tHID_STATUS ret;
#if (BTA_HH_DEBUG == TRUE)
  APPL_TRACE_EVENT("bta_hh_di_sdp_cback: p_cb: %d result 0x%02x", p_cb, result);
  APPL_TRACE_EVENT("%s: p_cb: %d result 0x%02x", __func__, p_cb, result);
#endif

  /* if DI record does not exist on remote device, vendor_id in
   * tBTA_HH_DEV_DSCP_INFO will be
       * set to 0xffff and we will allow the connection to go through. Spec
   * mandates that DI
       * record be set, but many HID devices do not set this. So for IOP
   * purposes, we allow the
       * connection to go through and update the DI record to invalid DI
   * entry.*/
   * tBTA_HH_DEV_DSCP_INFO will be set to 0xffff and we will allow the
   * connection to go through. Spec mandates that DI record be set, but many
   * HID devices do not set this. So for IOP purposes, we allow the connection
   * to go through and update the DI record to invalid DI entry.
   */
  if (((result == SDP_SUCCESS) || (result == SDP_NO_RECS_MATCH)) &&
      (p_cb != NULL)) {
    if (result == SDP_SUCCESS &&
@@ -277,9 +273,8 @@ static void bta_hh_di_sdp_cback(uint16_t result) {
      status = BTA_HH_OK;
    } else {
#if (BTA_HH_DEBUG == TRUE)
      APPL_TRACE_DEBUG(
          "bta_hh_di_sdp_cback:  HID_HostGetSDPRecord failed: Status 0x%2x",
          ret);
      APPL_TRACE_DEBUG("%s:  HID_HostGetSDPRecord failed: Status 0x%2x",
                       __func__, ret);
#endif
    }
  }
@@ -323,7 +318,7 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
  if (p_cb->app_id) {
    status = BTA_HH_OK;
#if (BTA_HH_DEBUG == TRUE)
    APPL_TRACE_DEBUG("bta_hh_start_sdp:: skip SDP for known devices");
    APPL_TRACE_DEBUG("%s: skip SDP for known devices", __func__);
#endif
    if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) {
      if (HID_HostAddDev(p_cb->addr, p_cb->attr_mask, &hdl) == HID_SUCCESS) {
@@ -351,9 +346,7 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
                       p_bta_hh_cfg->sdp_db_size,
                       bta_hh_di_sdp_cback) != SDP_SUCCESS) {
#if (BTA_HH_DEBUG == TRUE)
      APPL_TRACE_DEBUG(
          "bta_hh_start_sdp:  SDP_DiDiscover failed: \
                    Status 0x%2X",
      APPL_TRACE_DEBUG("%s:  SDP_DiDiscover failed: Status 0x%2X", __func__,
                       status);
#endif
      status = BTA_HH_ERR_SDP;
@@ -394,7 +387,7 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
  tBTA_HH_STATUS status = p_data->status;

#if (BTA_HH_DEBUG == TRUE)
  APPL_TRACE_DEBUG("bta_hh_sdp_cmpl:  status 0x%2X", p_data->status);
  APPL_TRACE_DEBUG("%s:  status 0x%2X", __func__, p_data->status);
#endif

  /* initialize call back data */
@@ -438,12 +431,13 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {

  if (status != BTA_HH_OK) {
    /* Check if this was incoming connection request  from an unknown device
       **and connection failed due to missing HID Device SDP UUID
       **In above condition, disconnect the link as well as remove the
       **device from list of HID devices*/
     * and connection failed due to missing HID Device SDP UUID
     * In above condition, disconnect the link as well as remove the
     * device from list of HID devices
     */
    if ((status == BTA_HH_ERR_SDP) && (p_cb->incoming_conn) &&
        (p_cb->app_id == 0)) {
      APPL_TRACE_DEBUG("bta_hh_sdp_cmpl:SDP failed for  incoming conn :hndl %d",
      APPL_TRACE_DEBUG("%s: SDP failed for  incoming conn :hndl %d", __func__,
                       p_cb->incoming_hid_handle);
      HID_HostRemoveDev(p_cb->incoming_hid_handle);
    }
@@ -573,7 +567,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
      p_data ? (uint8_t)p_data->hid_cback.hdr.layer_specific : p_cb->hid_handle;

#if (BTA_HH_DEBUG == TRUE)
  APPL_TRACE_EVENT("bta_hh_open_act:  Device[%d] connected", dev_handle);
  APPL_TRACE_EVENT("%s:  Device[%d] connected", __func__, dev_handle);
#endif

  /* SDP has been done */
@@ -581,7 +575,8 @@ void bta_hh_open_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
    bta_hh_sm_execute(p_cb, BTA_HH_OPEN_CMPL_EVT, p_data);
  } else
  /*  app_id == 0 indicates an incoming conenction request arrives without SDP
      performed, do it first */
   *  performed, do it first
   */
  {
    p_cb->incoming_conn = true;
    /* store the handle here in case sdp fails - need to disconnect */
@@ -1060,7 +1055,7 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
        /* currently not expected */
        case HID_TRANS_DATAC:
        default:
          APPL_TRACE_DEBUG("bta_hh_write_dev_act:: cmd type = %d",
          APPL_TRACE_DEBUG("%s: cmd type = %d", __func__,
                           p_data->api_sndcmd.t_type);
          break;
      }
@@ -1099,7 +1094,7 @@ static void bta_hh_cback(uint8_t dev_handle, BD_ADDR addr, uint8_t event,
  uint8_t xx = 0;

#if (BTA_HH_DEBUG == TRUE)
  APPL_TRACE_DEBUG("bta_hh_cback::HID_event [%s]",
  APPL_TRACE_DEBUG("%s::HID_event [%s]", __func__,
                   bta_hh_hid_event_name(event));
#endif