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

Commit 000b522a authored by Chris Manton's avatar Chris Manton
Browse files

Add name component to GATT client API

Bug: 183374320
Test: gd/cert/run
Tag: #refactor
No-Typo-Check: Legacy code mocks

Change-Id: If6f3bd253391ff41cfcdde2d67325b06bfa58993
parent 059f3625
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -176,7 +176,8 @@ void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback,
  for (uint8_t i = 0; i < BTA_GATTC_CL_MAX; i++) {
    if (!bta_gattc_cb.cl_rcb[i].in_use) {
      if ((bta_gattc_cb.cl_rcb[i].client_if = GATT_Register(
               app_uuid, &bta_gattc_cl_cback, eatt_suppport)) == 0) {
               app_uuid, "GattClient", &bta_gattc_cl_cback, eatt_suppport)) ==
          0) {
        LOG(ERROR) << "Register with GATT stack failed.";
        status = GATT_ERROR;
      } else {
+1 −1
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ void bta_gatts_register(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) {
      p_cb->rcb[first_unuse].p_cback = p_msg->api_reg.p_cback;
      p_cb->rcb[first_unuse].app_uuid = p_msg->api_reg.app_uuid;
      cb_data.reg_oper.server_if = p_cb->rcb[first_unuse].gatt_if =
          GATT_Register(p_msg->api_reg.app_uuid, &bta_gatts_cback,
          GATT_Register(p_msg->api_reg.app_uuid, "GattServer", &bta_gatts_cback,
                        p_msg->api_reg.eatt_support);
      if (!p_cb->rcb[first_unuse].gatt_if) {
        status = GATT_NO_RESOURCES;
+3 −2
Original line number Diff line number Diff line
@@ -180,8 +180,9 @@ bt_status_t btif_gattc_test_command_impl(int command,
      if (params->u1) {
        std::array<uint8_t, Uuid::kNumBytes128> tmp;
        tmp.fill(0xAE);
        test_cb.gatt_if = GATT_Register(bluetooth::Uuid::From128BitBE(tmp),
                                        &btif_test_callbacks, false);
        test_cb.gatt_if =
            GATT_Register(bluetooth::Uuid::From128BitBE(tmp),
                          std::string("GattTest"), &btif_test_callbacks, false);
        GATT_StartIf(test_cb.gatt_if);
      } else {
        GATT_Deregister(test_cb.gatt_if);
+1 −1
Original line number Diff line number Diff line
@@ -412,7 +412,7 @@ void gap_attr_db_init(void) {
  Uuid app_uuid = Uuid::From128BitBE(tmp);
  gatt_attr.fill({});

  gatt_if = GATT_Register(app_uuid, &gap_cback, false);
  gatt_if = GATT_Register(app_uuid, "Gap", &gap_cback, false);

  GATT_StartIf(gatt_if);

+8 −5
Original line number Diff line number Diff line
@@ -23,9 +23,10 @@
 ******************************************************************************/
#include "bt_target.h"

#include <string>

#include <base/strings/string_number_conversions.h>
#include <stdio.h>
#include <string.h>
#include "bt_common.h"
#include "device/include/controller.h"
#include "gatt_api.h"
@@ -986,7 +987,8 @@ void GATT_SetIdleTimeout(const RawAddress& bd_addr, uint16_t idle_tout,
 *                  with GATT
 *
 ******************************************************************************/
tGATT_IF GATT_Register(const Uuid& app_uuid128, tGATT_CBACK* p_cb_info, bool eatt_support) {
tGATT_IF GATT_Register(const Uuid& app_uuid128, std::string name,
                       tGATT_CBACK* p_cb_info, bool eatt_support) {
  tGATT_REG* p_reg;
  uint8_t i_gatt_if = 0;
  tGATT_IF gatt_if = 0;
@@ -1010,9 +1012,10 @@ tGATT_IF GATT_Register(const Uuid& app_uuid128, tGATT_CBACK* p_cb_info, bool eat
      p_reg->app_cb = *p_cb_info;
      p_reg->in_use = true;
      p_reg->eatt_support = eatt_support;
      LOG(INFO) << __func__ << ": Allocated gatt_if=" << +gatt_if
                << " eatt_support=" << std::boolalpha << eatt_support
                << std::noboolalpha << " " << app_uuid128;
      p_reg->name = name;
      LOG_INFO("Allocated name:%s uuid:%s gatt_if:%hhu eatt_support:%u",
               name.c_str(), app_uuid128.ToString().c_str(), gatt_if,
               eatt_support);
      return gatt_if;
    }
  }
Loading