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

Commit 7fc048ff authored by Rahul Arya's avatar Rahul Arya Committed by Gerrit Code Review
Browse files

Merge "Pass PHY change event up to GATT"

parents bedf324f 6221f7f4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@ init_flags!(
        hci_adapter: i32,
        irk_rotation,
        logging_debug_enabled_for_all,
        pass_phy_update_callback = true,
        sdp_serialization = true,
    }
    // extra_fields are not a 1 to 1 match with "INIT_*" flags
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ mod ffi {
        fn irk_rotation_is_enabled() -> bool;
        fn is_debug_logging_enabled_for_tag(tag: &str) -> bool;
        fn logging_debug_enabled_for_all_is_enabled() -> bool;
        fn pass_phy_update_callback_is_enabled() -> bool;
        fn sdp_serialization_is_enabled() -> bool;
    }
}
+11 −3
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include "device/include/controller.h"
#include "gd/common/bidi_queue.h"
#include "gd/common/bind.h"
#include "gd/common/init_flags.h"
#include "gd/common/strings.h"
#include "gd/common/sync_map_count.h"
#include "gd/hci/acl_manager.h"
@@ -61,6 +62,7 @@
#include "stack/include/bt_hdr.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_status.h"
#include "stack/include/gatt_api.h"
#include "stack/include/pan_api.h"
#include "stack/include/sec_hci_link_interface.h"
#include "stack/l2cap/l2c_int.h"
@@ -753,9 +755,15 @@ class LeShimAclConnection

  void OnPhyUpdate(hci::ErrorCode hci_status, uint8_t tx_phy,
                   uint8_t rx_phy) override {
    TRY_POSTING_ON_MAIN(interface_.on_phy_update,
                        ToLegacyHciErrorCode(hci_status), handle_, tx_phy,
                        rx_phy);
    if (common::init_flags::pass_phy_update_callback_is_enabled()) {
      TRY_POSTING_ON_MAIN(
          interface_.on_phy_update,
          static_cast<tGATT_STATUS>(ToLegacyHciErrorCode(hci_status)), handle_,
          tx_phy, rx_phy);
    } else {
      LOG_WARN("Not posting OnPhyUpdate callback since it is disabled: (tx:%x, rx:%x, status:%s)",
               tx_phy, rx_phy, hci::ErrorCodeText(hci_status).c_str());
    }
  }

  void OnLocalAddressUpdate(hci::AddressWithType address_with_type) override {
+5 −0
Original line number Diff line number Diff line
@@ -15,12 +15,16 @@
 */

#include "main/shim/acl_legacy_interface.h"

#include "stack/include/acl_hci_link_interface.h"
#include "stack/include/ble_acl_interface.h"
#include "stack/include/gatt_api.h"
#include "stack/include/sco_hci_link_interface.h"
#include "stack/include/sec_hci_link_interface.h"

struct tBTM_ESCO_DATA;
void gatt_notify_phy_updated(tGATT_STATUS status, uint16_t handle,
                             uint8_t tx_phy, uint8_t rx_phy);

namespace bluetooth {
namespace shim {
@@ -78,6 +82,7 @@ const acl_interface_t GetAclInterface() {
      .link.le.on_data_length_change = acl_ble_data_length_change_event,
      .link.le.on_read_remote_version_information_complete =
          btm_read_remote_version_complete,
      .link.le.on_phy_update = gatt_notify_phy_updated,
  };
  return acl_interface;
}
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include "stack/include/bt_hdr.h"
#include "stack/include/bt_types.h"
#include "stack/include/gatt_api.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hci_mode.h"
#include "stack/include/hcidefs.h"
@@ -122,7 +123,7 @@ typedef struct {
  void (*on_read_remote_version_information_complete)(
      tHCI_STATUS status, uint16_t handle, uint8_t lmp_version,
      uint16_t manufacturer_name, uint16_t sub_version);
  void (*on_phy_update)(tHCI_STATUS status, uint16_t handle, uint8_t tx_phy,
  void (*on_phy_update)(tGATT_STATUS status, uint16_t handle, uint8_t tx_phy,
                        uint8_t rx_phy);
} acl_le_link_interface_t;