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

Commit d67d1863 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Cleanups after event to callback refactor" into main

parents df5ed683 ebe3befb
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -665,7 +665,7 @@ static void bta_dm_sdp_result(tBTA_DM_MSG* p_data) {

          // send all result back to app
          BD_NAME bd_name;
          strlcpy((char*)bd_name, bta_dm_get_remname(), BD_NAME_LEN + 1);
          bd_name_from_char_pointer(bd_name, bta_dm_get_remname());

          bta_dm_search_cb.service_search_cbacks.on_gatt_results(
              bta_dm_search_cb.peer_bdaddr, bd_name, gatt_uuids,
@@ -901,14 +901,16 @@ static void bta_dm_search_cmpl() {

  // send all result back to app
  if (send_gatt_results) {
    if (bta_dm_search_cb.service_search_cbacks.on_gatt_results) {
    if (bta_dm_search_cb.service_search_cbacks.on_gatt_results != nullptr) {
      log::info("Sending GATT results to upper layer");

      BD_NAME bd_name;
      strlcpy((char*)bd_name, bta_dm_get_remname(), BD_NAME_LEN + 1);
      bd_name_from_char_pointer(bd_name, bta_dm_get_remname());
      bta_dm_search_cb.service_search_cbacks.on_gatt_results(
          bta_dm_search_cb.peer_bdaddr, bd_name, gatt_services,
          /* transport_le */ true);
    } else {
      log::warn("on_gatt_results is nullptr!");
    }
  }

+19 −15
Original line number Diff line number Diff line
@@ -2099,17 +2099,18 @@ void btif_on_name_read(RawAddress bd_addr, tHCI_ERROR_CODE hci_status,
void btif_on_did_received(RawAddress bd_addr, uint8_t vendor_id_src,
                          uint16_t vendor_id, uint16_t product_id,
                          uint16_t version) {
  bt_property_t prop_did;
  bt_vendor_product_info_t vp_info;

  vp_info.vendor_id_src = vendor_id_src;
  vp_info.vendor_id = vendor_id;
  vp_info.product_id = product_id;
  vp_info.version = version;
  bt_vendor_product_info_t vp_info{
      .vendor_id_src = vendor_id_src,
      .vendor_id = vendor_id,
      .product_id = product_id,
      .version = version,
  };

  prop_did.type = BT_PROPERTY_VENDOR_PRODUCT_INFO;
  prop_did.val = &vp_info;
  prop_did.len = sizeof(vp_info);
  bt_property_t prop_did{
      .type = BT_PROPERTY_VENDOR_PRODUCT_INFO,
      .len = sizeof(vp_info),
      .val = &vp_info,
  };

  bt_status_t ret =
      btif_storage_set_remote_device_property(&bd_addr, &prop_did);
@@ -3115,10 +3116,13 @@ void btif_dm_get_remote_services(RawAddress remote_addr, const int transport) {
      kBtmLogTag, remote_addr, "Service discovery",
      base::StringPrintf("transport:%s", bt_transport_text(transport).c_str()));

  BTA_DmDiscover(remote_addr,
  BTA_DmDiscover(
      remote_addr,
      service_discovery_callbacks{
                     btif_on_gatt_results, btif_on_did_received,
                     btif_on_name_read, btif_on_service_discovery_results},
          .on_gatt_results = btif_on_gatt_results,
          .on_did_received = btif_on_did_received,
          .on_name_read = btif_on_name_read,
          .on_service_discovery_results = btif_on_service_discovery_results},
      transport);
}