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

Commit f8102f40 authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Gerrit Code Review
Browse files

Merge changes I6f4ee6c0,I74a212c9,I55dbf5b2 into main

* changes:
  Search end event to callback
  BTA_DM_GATT_OVER_(LE|SDP)_RES_EVT -> callback
  btif_on_name_read - flip condition to reduce indentation
parents e7b262de 0f2fa146
Loading
Loading
Loading
Loading
+24 −21
Original line number Diff line number Diff line
@@ -664,14 +664,12 @@ static void bta_dm_sdp_result(tBTA_DM_MSG* p_data) {
          log::info("GATT services discovered using SDP");

          // send all result back to app
          tBTA_DM_SEARCH result;
          result.disc_ble_res.bd_addr = bta_dm_search_cb.peer_bdaddr;
          bd_name_from_char_pointer(result.disc_ble_res.bd_name,
                                    bta_dm_get_remname());
          BD_NAME bd_name;
          strlcpy((char*)bd_name, bta_dm_get_remname(), BD_NAME_LEN + 1);

          result.disc_ble_res.services = &gatt_uuids;
          bta_dm_search_cb.service_search_cbacks.legacy(
              BTA_DM_GATT_OVER_SDP_RES_EVT, &result);
          bta_dm_search_cb.service_search_cbacks.on_gatt_results(
              bta_dm_search_cb.peer_bdaddr, bd_name, gatt_uuids,
              /* transport_le */ false);
        }
      } else {
        /* SDP_DB_FULL means some records with the
@@ -862,11 +860,7 @@ static void bta_dm_search_cmpl() {

  uint16_t conn_id = bta_dm_search_cb.conn_id;

  tBTA_DM_SEARCH result;
  std::vector<Uuid> gatt_services;
  result.disc_ble_res.services = &gatt_services;
  result.disc_ble_res.bd_addr = bta_dm_search_cb.peer_bdaddr;
  bd_name_from_char_pointer(result.disc_ble_res.bd_name, bta_dm_get_remname());

  bool send_gatt_results =
      bluetooth::common::init_flags::
@@ -907,10 +901,14 @@ static void bta_dm_search_cmpl() {

  // send all result back to app
  if (send_gatt_results) {
    if (bta_dm_search_cb.service_search_cbacks.legacy) {
    if (bta_dm_search_cb.service_search_cbacks.on_gatt_results) {
      log::info("Sending GATT results to upper layer");
      bta_dm_search_cb.service_search_cbacks.legacy(BTA_DM_GATT_OVER_LE_RES_EVT,
                                                    &result);

      BD_NAME bd_name;
      strlcpy((char*)bd_name, bta_dm_get_remname(), BD_NAME_LEN + 1);
      bta_dm_search_cb.service_search_cbacks.on_gatt_results(
          bta_dm_search_cb.peer_bdaddr, bd_name, gatt_services,
          /* transport_le */ true);
    }
  }

@@ -951,9 +949,12 @@ static void bta_dm_disc_result(tBTA_DM_MSG* p_data) {
  /* if any BR/EDR service discovery has been done, report the event */
  if (!is_gatt_over_ble && (bta_dm_search_cb.services &
                            ((BTA_ALL_SERVICE_MASK | BTA_USER_SERVICE_MASK) &
                             ~BTA_BLE_SERVICE_MASK)))
    bta_dm_search_cb.service_search_cbacks.legacy(BTA_DM_DISC_RES_EVT,
                                                  &p_data->disc_result.result);
                             ~BTA_BLE_SERVICE_MASK))) {
    auto& r = p_data->disc_result.result.disc_res;
    bta_dm_search_cb.service_search_cbacks.on_service_discovery_results(
        r.bd_addr, r.bd_name, r.services, r.device_type, r.num_uuids,
        r.p_uuid_list, r.result, r.hci_status);
  }

  get_gatt_interface().BTA_GATTC_CancelOpen(0, bta_dm_search_cb.peer_bdaddr,
                                            true);
@@ -979,9 +980,11 @@ static void bta_dm_search_result(tBTA_DM_MSG* p_data) {
  if ((!bta_dm_search_cb.services) ||
      ((bta_dm_search_cb.services) &&
       (p_data->disc_result.result.disc_res.services))) {
    if (bta_dm_search_cb.service_search_cbacks.legacy) {
      bta_dm_search_cb.service_search_cbacks.legacy(
          BTA_DM_DISC_RES_EVT, &p_data->disc_result.result);
    if (bta_dm_search_cb.service_search_cbacks.on_service_discovery_results) {
      auto& r = p_data->disc_result.result.disc_res;
      bta_dm_search_cb.service_search_cbacks.on_service_discovery_results(
          r.bd_addr, r.bd_name, r.services, r.device_type, r.num_uuids,
          r.p_uuid_list, r.result, r.hci_status);
    } else {
      log::warn("Received search result without valid callback");
    }
+17 −24
Original line number Diff line number Diff line
@@ -217,13 +217,10 @@ typedef enum : uint8_t {
  BTA_DM_INQ_RES_EVT = 0,   /* Inquiry result for a peer device. */
  BTA_DM_INQ_CMPL_EVT = 1,  /* Inquiry complete. */
  BTA_DM_DISC_RES_EVT = 2,  /* Service Discovery result for a peer device. */
  BTA_DM_GATT_OVER_LE_RES_EVT =
      3,                    /* GATT services over LE transport discovered */
  BTA_DM_DISC_CMPL_EVT = 4, /* Discovery complete. */
  BTA_DM_SEARCH_CANCEL_CMPL_EVT = 5, /* Search cancelled */
  BTA_DM_GATT_OVER_SDP_RES_EVT = 6,  /* GATT services over SDP discovered */
  BTA_DM_NAME_READ_EVT = 7,          /* Name read complete. */
  BTA_DM_OBSERVE_CMPL_EVT = 8,       /* Observe complete. */
  BTA_DM_DISC_CMPL_EVT = 3, /* Discovery complete. */
  BTA_DM_SEARCH_CANCEL_CMPL_EVT = 4, /* Search cancelled */
  BTA_DM_NAME_READ_EVT = 5,          /* Name read complete. */
  BTA_DM_OBSERVE_CMPL_EVT = 6,       /* Observe complete. */
} tBTA_DM_SEARCH_EVT;

inline std::string bta_dm_search_evt_text(const tBTA_DM_SEARCH_EVT& event) {
@@ -231,10 +228,8 @@ inline std::string bta_dm_search_evt_text(const tBTA_DM_SEARCH_EVT& event) {
    CASE_RETURN_TEXT(BTA_DM_INQ_RES_EVT);
    CASE_RETURN_TEXT(BTA_DM_INQ_CMPL_EVT);
    CASE_RETURN_TEXT(BTA_DM_DISC_RES_EVT);
    CASE_RETURN_TEXT(BTA_DM_GATT_OVER_LE_RES_EVT);
    CASE_RETURN_TEXT(BTA_DM_DISC_CMPL_EVT);
    CASE_RETURN_TEXT(BTA_DM_SEARCH_CANCEL_CMPL_EVT);
    CASE_RETURN_TEXT(BTA_DM_GATT_OVER_SDP_RES_EVT);
    CASE_RETURN_TEXT(BTA_DM_NAME_READ_EVT);
    CASE_RETURN_TEXT(BTA_DM_OBSERVE_CMPL_EVT);
    default:
@@ -287,27 +282,19 @@ typedef struct {
  tHCI_STATUS hci_status;
} tBTA_DM_DISC_RES;

/* Structure associated with tBTA_DM_DISC_BLE_RES */
typedef struct {
  RawAddress bd_addr; /* BD address peer device. */
  BD_NAME bd_name;  /* Name of peer device. */
  std::vector<bluetooth::Uuid>*
      services; /* GATT based Services UUID found on peer device. */
} tBTA_DM_DISC_BLE_RES;

/* Union of all search callback structures */
typedef union {
  tBTA_DM_INQ_RES inq_res;   /* Inquiry result for a peer device. */
  tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
  tBTA_DM_DISC_BLE_RES
      disc_ble_res; /* discovery result for GATT based service */
  tBTA_DM_OBSERVE_CMPL observe_cmpl; /* Observe complete. */
} tBTA_DM_SEARCH;

/* Search callback */
typedef void(tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event,
                                   tBTA_DM_SEARCH* p_data);

typedef void(tBTA_DM_GATT_DISC_CBACK)(RawAddress bd_addr, BD_NAME bd_name,
                                      std::vector<bluetooth::Uuid>& services,
                                      bool transport_le);
typedef void(tBTA_DM_DID_RES_CBACK)(RawAddress bd_addr, uint8_t vendor_id_src,
                                    uint16_t vendor_id, uint16_t product_id,
                                    uint16_t version);
@@ -315,11 +302,17 @@ typedef void(tBTA_DM_DID_RES_CBACK)(RawAddress bd_addr, uint8_t vendor_id_src,
typedef void(tBTA_DM_NAME_READ_CBACK)(RawAddress bd_addr,
                                      tHCI_ERROR_CODE hci_status,
                                      const BD_NAME bd_name);
typedef void(tBTA_DM_DISC_CBACK)(RawAddress bd_addr, BD_NAME bd_name,
                                 tBTA_SERVICE_MASK services,
                                 tBT_DEVICE_TYPE device_type, size_t num_uuids,
                                 bluetooth::Uuid* p_uuid_list,
                                 tBTA_STATUS result, tHCI_STATUS hci_status);
struct service_discovery_callbacks {
  /* legacy callback I'll tear apart and get rid of */
  tBTA_DM_SEARCH_CBACK* legacy;
  tBTA_DM_GATT_DISC_CBACK* on_gatt_results;
  tBTA_DM_DID_RES_CBACK* on_did_received;
  tBTA_DM_NAME_READ_CBACK* on_name_read;
  tBTA_DM_DISC_CBACK* on_service_discovery_results;
};

/* Execute call back */
+9 −6
Original line number Diff line number Diff line
@@ -238,24 +238,27 @@ TEST_F(BtaInitializedTest, bta_dm_disc_stop_device_discovery) {
TEST_F(BtaInitializedTest,
       bta_dm_disc_start_service_discovery__BT_TRANSPORT_AUTO) {
  bta_dm_disc_start_service_discovery(
      {[](tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {}, nullptr,
       nullptr},
      {nullptr, nullptr, nullptr,
       [](RawAddress, BD_NAME, tBTA_SERVICE_MASK, tBT_DEVICE_TYPE, size_t,
          bluetooth::Uuid*, tBTA_STATUS, tHCI_STATUS) {}},
      kRawAddress, BT_TRANSPORT_AUTO);
}

TEST_F(BtaInitializedTest,
       bta_dm_disc_start_service_discovery__BT_TRANSPORT_BR_EDR) {
  bta_dm_disc_start_service_discovery(
      {[](tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {}, nullptr,
       nullptr},
      {nullptr, nullptr, nullptr,
       [](RawAddress, BD_NAME, tBTA_SERVICE_MASK, tBT_DEVICE_TYPE, size_t,
          bluetooth::Uuid*, tBTA_STATUS, tHCI_STATUS) {}},
      kRawAddress, BT_TRANSPORT_BR_EDR);
}

TEST_F(BtaInitializedTest,
       bta_dm_disc_start_service_discovery__BT_TRANSPORT_LE) {
  bta_dm_disc_start_service_discovery(
      {[](tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {}, nullptr,
       nullptr},
      {nullptr, nullptr, nullptr,
       [](RawAddress, BD_NAME, tBTA_SERVICE_MASK, tBT_DEVICE_TYPE, size_t,
          bluetooth::Uuid*, tBTA_STATUS, tHCI_STATUS) {}},
      kRawAddress, BT_TRANSPORT_LE);
}

+0 −5
Original line number Diff line number Diff line
@@ -531,14 +531,9 @@ TEST_F(BtaDmTest, bta_dm_search_evt_text) {
  std::vector<std::pair<tBTA_DM_SEARCH_EVT, std::string>> events = {
      std::make_pair(BTA_DM_INQ_RES_EVT, "BTA_DM_INQ_RES_EVT"),
      std::make_pair(BTA_DM_INQ_CMPL_EVT, "BTA_DM_INQ_CMPL_EVT"),
      std::make_pair(BTA_DM_DISC_RES_EVT, "BTA_DM_DISC_RES_EVT"),
      std::make_pair(BTA_DM_GATT_OVER_LE_RES_EVT,
                     "BTA_DM_GATT_OVER_LE_RES_EVT"),
      std::make_pair(BTA_DM_DISC_CMPL_EVT, "BTA_DM_DISC_CMPL_EVT"),
      std::make_pair(BTA_DM_SEARCH_CANCEL_CMPL_EVT,
                     "BTA_DM_SEARCH_CANCEL_CMPL_EVT"),
      std::make_pair(BTA_DM_GATT_OVER_SDP_RES_EVT,
                     "BTA_DM_GATT_OVER_SDP_RES_EVT"),
      std::make_pair(BTA_DM_NAME_READ_EVT, "BTA_DM_NAME_READ_EVT"),
  };
  for (const auto& event : events) {
+310 −342
Original line number Diff line number Diff line
@@ -1740,31 +1740,17 @@ static bool btif_is_gatt_service_discovery_post_pairing(const RawAddress bd_addr
          btif_dm_pairing_cb_t::ServiceDiscoveryState::SCHEDULED));
}

/*******************************************************************************
 *
 * Function         btif_dm_search_services_evt
 *
 * Description      Executes search services event in btif context
 *
 * Returns          void
 *
 ******************************************************************************/
static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
                                        tBTA_DM_SEARCH* p_data) {
  switch (event) {
    case BTA_DM_DISC_RES_EVT: {
static void btif_on_service_discovery_results(
    RawAddress bd_addr, BD_NAME bd_name, tBTA_SERVICE_MASK services,
    tBT_DEVICE_TYPE device_type, size_t num_uuids, bluetooth::Uuid* p_uuid_list,
    tBTA_STATUS result, tHCI_STATUS hci_status) {
  bt_property_t prop;
      uint32_t i = 0;
  std::vector<uint8_t> property_value;
  std::set<Uuid> uuids;
  bool a2dp_sink_capable = false;

      RawAddress& bd_addr = p_data->disc_res.bd_addr;

      log::verbose("result=0x{:x}, services 0x{:x}", p_data->disc_res.result,
                   p_data->disc_res.services);
      if (p_data->disc_res.result != BTA_SUCCESS &&
          pairing_cb.state == BT_BOND_STATE_BONDED &&
  log::verbose("result=0x{:x}, services 0x{:x}", result, services);
  if (result != BTA_SUCCESS && pairing_cb.state == BT_BOND_STATE_BONDED &&
      pairing_cb.sdp_attempts < BTIF_DM_MAX_SDP_ATTEMPTS_AFTER_PAIRING) {
    if (pairing_cb.sdp_attempts) {
      log::warn("SDP failed after bonding re-attempting for {}",
@@ -1781,8 +1767,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
    return;
  }

      if ((bd_addr == pairing_cb.bd_addr ||
           bd_addr == pairing_cb.static_bdaddr)) {
  if ((bd_addr == pairing_cb.bd_addr || bd_addr == pairing_cb.static_bdaddr)) {
    log::info("SDP finished for {}:", ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
    pairing_cb.sdp_over_classic =
        btif_dm_pairing_cb_t::ServiceDiscoveryState::FINISHED;
@@ -1790,11 +1775,10 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,

  prop.type = BT_PROPERTY_UUIDS;
  prop.len = 0;
      if ((p_data->disc_res.result == BTA_SUCCESS) &&
          (p_data->disc_res.num_uuids > 0)) {
  if ((result == BTA_SUCCESS) && (num_uuids > 0)) {
    log::info("New UUIDs for {}:", ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
        for (i = 0; i < p_data->disc_res.num_uuids; i++) {
          auto uuid = p_data->disc_res.p_uuid_list + i;
    for (size_t i = 0; i < num_uuids; i++) {
      auto uuid = p_uuid_list + i;
      if (btif_should_ignore_uuid(*uuid)) {
        continue;
      }
@@ -1845,14 +1829,13 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
  size_t num_eir_uuids = 0U;
  Uuid uuid = {};
  if (pairing_cb.state == BT_BOND_STATE_BONDED && pairing_cb.sdp_attempts &&
          (p_data->disc_res.bd_addr == pairing_cb.bd_addr ||
           p_data->disc_res.bd_addr == pairing_cb.static_bdaddr)) {
      (bd_addr == pairing_cb.bd_addr || bd_addr == pairing_cb.static_bdaddr)) {
    log::info("SDP search done for {}", ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
    pairing_cb.sdp_attempts = 0;

    // Send UUIDs discovered through EIR to Java to unblock pairing intent
    // when SDP failed
        if (p_data->disc_res.result != BTA_SUCCESS) {
    if (result != BTA_SUCCESS) {
      auto uuids_iter = eir_uuids_cache.find(bd_addr);
      if (uuids_iter != eir_uuids_cache.end()) {
        num_eir_uuids = uuids_iter->second.size();
@@ -1883,19 +1866,17 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
    }
  }

      const tBTA_STATUS bta_status = p_data->disc_res.result;
      BTM_LogHistory(
          kBtmLogTagSdp, bd_addr, "Discovered services",
  const tBTA_STATUS bta_status = result;
  BTM_LogHistory(kBtmLogTagSdp, bd_addr, "Discovered services",
                 base::StringPrintf("bta_status:%s sdp_uuids:%zu eir_uuids:%zu",
                                    bta_status_text(bta_status).c_str(),
                             p_data->disc_res.num_uuids, num_eir_uuids));
                                    num_uuids, num_eir_uuids));

      if (p_data->disc_res.num_uuids != 0 || num_eir_uuids != 0) {
  if (num_uuids != 0 || num_eir_uuids != 0) {
    /* Also write this to the NVRAM */
    const bt_status_t ret =
        btif_storage_set_remote_device_property(&bd_addr, &prop);
        ASSERTC(ret == BT_STATUS_SUCCESS, "storing remote services failed",
                ret);
    ASSERTC(ret == BT_STATUS_SUCCESS, "storing remote services failed", ret);

    if (skip_reporting_wait_for_le) {
      log::info(
@@ -1913,20 +1894,19 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
    GetInterfaceToProfiles()->events->invoke_remote_device_properties_cb(
        BT_STATUS_SUCCESS, bd_addr, 1, &prop);
  }
    } break;
}

    case BTA_DM_GATT_OVER_SDP_RES_EVT:
    case BTA_DM_GATT_OVER_LE_RES_EVT: {
void btif_on_gatt_results(RawAddress bd_addr, BD_NAME bd_name,
                          std::vector<bluetooth::Uuid>& services,
                          bool transport_le) {
  int num_properties = 0;
  bt_property_t prop[2];
  std::vector<uint8_t> property_value;
  std::set<Uuid> uuids;
      RawAddress& bd_addr = p_data->disc_ble_res.bd_addr;
  RawAddress static_addr_copy = pairing_cb.static_bdaddr;
      bool lea_supported =
          is_le_audio_capable_during_service_discovery(bd_addr);
  bool lea_supported = is_le_audio_capable_during_service_discovery(bd_addr);

      if (event == BTA_DM_GATT_OVER_LE_RES_EVT) {
  if (transport_le) {
    log::info("New GATT over LE UUIDs for {}:",
              ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
    BTM_LogHistory(kBtmLogTag, bd_addr,
@@ -1952,8 +1932,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
            FROM_HERE,
            base::BindOnce(
                [](RawAddress bd_addr) {
                      L2CA_LockBleConnParamsForProfileConnection(bd_addr,
                                                                 false);
                  L2CA_LockBleConnParamsForProfileConnection(bd_addr, false);
                },
                bd_addr),
            std::chrono::seconds(15));
@@ -1966,7 +1945,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
                   "Discovered GATT services using SDP transport");
  }

      for (Uuid uuid : *p_data->disc_ble_res.services) {
  for (Uuid uuid : services) {
    if (btif_is_interesting_le_service(uuid)) {
      if (btif_should_ignore_uuid(uuid)) {
        continue;
@@ -1981,9 +1960,10 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
    log::info("No well known GATT services discovered");

    /* If services were returned as part of SDP discovery, we will
         * immediately send them with rest of SDP results in BTA_DM_DISC_RES_EVT
     * immediately send them with rest of SDP results in
     * on_service_discovery_results
     */
        if (event == BTA_DM_GATT_OVER_SDP_RES_EVT) {
    if (!transport_le) {
      return;
    }

@@ -2053,43 +2033,40 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
  prop[0].len = Uuid::kNumBytes128 * uuids.size();

  /* Also write this to the NVRAM */
      bt_status_t ret =
          btif_storage_set_remote_device_property(&bd_addr, &prop[0]);
  bt_status_t ret = btif_storage_set_remote_device_property(&bd_addr, &prop[0]);
  ASSERTC(ret == BT_STATUS_SUCCESS, "storing remote services failed", ret);
  num_properties++;

  /* Remote name update */
      if (strnlen((const char*)p_data->disc_ble_res.bd_name, BD_NAME_LEN)) {
  if (strnlen((const char*)bd_name, BD_NAME_LEN)) {
    prop[1].type = BT_PROPERTY_BDNAME;
        prop[1].val = p_data->disc_ble_res.bd_name;
        prop[1].len = strnlen((char*)p_data->disc_ble_res.bd_name, BD_NAME_LEN);
    prop[1].val = bd_name;
    prop[1].len = strnlen((char*)bd_name, BD_NAME_LEN);

    ret = btif_storage_set_remote_device_property(&bd_addr, &prop[1]);
        ASSERTC(ret == BT_STATUS_SUCCESS,
                "failed to save remote device property", ret);
    ASSERTC(ret == BT_STATUS_SUCCESS, "failed to save remote device property",
            ret);
    num_properties++;
  }

  /* If services were returned as part of SDP discovery, we will immediately
       * send them with rest of SDP results in BTA_DM_DISC_RES_EVT */
      if (event == BTA_DM_GATT_OVER_SDP_RES_EVT) {
   * send them with rest of SDP results in on_service_discovery_results */
  if (!transport_le) {
    return;
  }

  /* Send the event to the BTIF */
  GetInterfaceToProfiles()->events->invoke_remote_device_properties_cb(
      BT_STATUS_SUCCESS, bd_addr, num_properties, prop);
    } break;

    default: {
      ASSERTC(0, "unhandled search services event", event);
    } break;
  }
}

void btif_on_name_read(RawAddress bd_addr, tHCI_ERROR_CODE hci_status,
                       const BD_NAME bd_name) {
  if (IS_FLAG_ENABLED(rnr_present_during_service_discovery)) {
  if (!IS_FLAG_ENABLED(rnr_present_during_service_discovery)) {
    log::info("Skipping name read event - called on bad callback.");
    return;
  }

  if (hci_status != HCI_SUCCESS) {
    log::warn("Received RNR event with bad status addr:{} hci_status:{}",
              ADDRESS_TO_LOGGABLE_CSTR(bd_addr),
@@ -2117,9 +2094,6 @@ void btif_on_name_read(RawAddress bd_addr, tHCI_ERROR_CODE hci_status,
  log::info("Callback for read name event addr:{} name:{}",
            ADDRESS_TO_LOGGABLE_CSTR(bd_addr),
            PRIVATE_NAME(reinterpret_cast<char const*>(bd_name)));
  } else {
    log::info("Skipping name read event - called on bad callback.");
  }
}

void btif_on_did_received(RawAddress bd_addr, uint8_t vendor_id_src,
@@ -3143,10 +3117,8 @@ void btif_dm_get_remote_services(RawAddress remote_addr, const int transport) {

  BTA_DmDiscover(remote_addr,
                 service_discovery_callbacks{
                     btif_dm_search_services_evt,
                     btif_on_did_received,
                     btif_on_name_read,
                 },
                     btif_on_gatt_results, btif_on_did_received,
                     btif_on_name_read, btif_on_service_discovery_results},
                 transport);
}

@@ -4278,15 +4250,11 @@ void bta_energy_info_cb(tBTM_BLE_TX_TIME_MS tx_time,
                       status);
}

void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
                                 tBTA_DM_SEARCH* p_data) {
  ::btif_dm_search_services_evt(event, p_data);
}

void btif_on_name_read(RawAddress bd_addr, tHCI_ERROR_CODE hci_status,
                       const BD_NAME bd_name) {
  ::btif_on_name_read(bd_addr, hci_status, bd_name);
}

}  // namespace testing
}  // namespace legacy
}  // namespace bluetooth
Loading