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

Commit 4e0d52e1 authored by Chris Manton's avatar Chris Manton
Browse files

Re-log stack/gatt/gatt_api::GATTC_Discover

Towards loggable code

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

Change-Id: Ib28229c431785d31888cfd8163329f0959fd066b
parent a5ebd5b0
Loading
Loading
Loading
Loading
+16 −6
Original line number Original line Diff line number Diff line
@@ -650,15 +650,14 @@ tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
    return GATT_ILLEGAL_PARAMETER;
    return GATT_ILLEGAL_PARAMETER;
  }
  }


  LOG(INFO) << __func__ << " conn_id=" << loghex(conn_id)
            << ", disc_type=" << +disc_type
            << ", s_handle=" << loghex(start_handle)
            << ", e_handle=" << loghex(end_handle);

  if (!GATT_HANDLE_IS_VALID(start_handle) ||
  if (!GATT_HANDLE_IS_VALID(start_handle) ||
      !GATT_HANDLE_IS_VALID(end_handle) ||
      !GATT_HANDLE_IS_VALID(end_handle) ||
      /* search by type does not have a valid UUID param */
      /* search by type does not have a valid UUID param */
      (disc_type == GATT_DISC_SRVC_BY_UUID && uuid.IsEmpty())) {
      (disc_type == GATT_DISC_SRVC_BY_UUID && uuid.IsEmpty())) {
    LOG(WARNING) << __func__ << " Illegal parameter conn_id=" << loghex(conn_id)
                 << ", disc_type=" << +disc_type
                 << ", s_handle=" << loghex(start_handle)
                 << ", e_handle=" << loghex(end_handle);
    return GATT_ILLEGAL_PARAMETER;
    return GATT_ILLEGAL_PARAMETER;
  }
  }


@@ -668,7 +667,13 @@ tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
  }
  }


  tGATT_CLCB* p_clcb = gatt_clcb_alloc(conn_id);
  tGATT_CLCB* p_clcb = gatt_clcb_alloc(conn_id);
  if (!p_clcb) return GATT_NO_RESOURCES;
  if (!p_clcb) {
    LOG(WARNING) << __func__ << " No resources conn_id=" << loghex(conn_id)
                 << ", disc_type=" << +disc_type
                 << ", s_handle=" << loghex(start_handle)
                 << ", e_handle=" << loghex(end_handle);
    return GATT_NO_RESOURCES;
  }


  p_clcb->operation = GATTC_OPTYPE_DISCOVERY;
  p_clcb->operation = GATTC_OPTYPE_DISCOVERY;
  p_clcb->op_subtype = disc_type;
  p_clcb->op_subtype = disc_type;
@@ -676,6 +681,11 @@ tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
  p_clcb->e_handle = end_handle;
  p_clcb->e_handle = end_handle;
  p_clcb->uuid = uuid;
  p_clcb->uuid = uuid;


  LOG(INFO) << __func__ << " conn_id=" << loghex(conn_id)
            << ", disc_type=" << +disc_type
            << ", s_handle=" << loghex(start_handle)
            << ", e_handle=" << loghex(end_handle);

  gatt_act_discovery(p_clcb);
  gatt_act_discovery(p_clcb);
  return GATT_SUCCESS;
  return GATT_SUCCESS;
}
}