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

Commit 56cf31b5 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

[3/19] get_btm_client_interface().peer.BTM_GetHCIConnHandle am: 6e5f5985

parents 936bed35 6e5f5985
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1019,7 +1019,8 @@ static std::string locationToString(uint32_t location) {
}

void LeAudioDevice::Dump(int fd) {
  uint16_t acl_handle = BTM_GetHCIConnHandle(address_, BT_TRANSPORT_LE);
  uint16_t acl_handle =
          get_btm_client_interface().peer.BTM_GetHCIConnHandle(address_, BT_TRANSPORT_LE);
  std::string snk_location = locationToString(snk_audio_locations_.to_ulong());
  std::string src_location = locationToString(src_audio_locations_.to_ulong());

@@ -1065,7 +1066,7 @@ void LeAudioDevice::DisconnectAcl(void) {
  if (conn_id_ == GATT_INVALID_CONN_ID) return;

  uint16_t acl_handle =
      BTM_GetHCIConnHandle(address_, BT_TRANSPORT_LE);
          get_btm_client_interface().peer.BTM_GetHCIConnHandle(address_, BT_TRANSPORT_LE);
  if (acl_handle != HCI_INVALID_HANDLE) {
    acl_disconnect_from_handle(acl_handle, HCI_ERR_PEER_USER,
                               "bta::bluetooth::le_audio::client disconnect");
+5 −6
Original line number Diff line number Diff line
@@ -30,15 +30,14 @@
#include "common/strings.h"
#include "devices.h"
#include "hci/hci_packets.h"
#include "hcimsgs.h"
#include "internal_include/bt_trace.h"
#include "le_audio_health_status.h"
#include "le_audio_log_history.h"
#include "le_audio_types.h"
#include "os/log.h"
#include "osi/include/alarm.h"
#include "osi/include/osi.h"
#include "osi/include/properties.h"
#include "stack/include/btm_client_interface.h"

// clang-format off
/* ASCS state machine 1.0
@@ -1682,8 +1681,8 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
      if (ases_pair.sink) ases_pair.sink->cis_state = CisState::CONNECTING;
      if (ases_pair.source) ases_pair.source->cis_state = CisState::CONNECTING;

      uint16_t acl_handle =
          BTM_GetHCIConnHandle(leAudioDevice->address_, BT_TRANSPORT_LE);
      uint16_t acl_handle = get_btm_client_interface().peer.BTM_GetHCIConnHandle(
              leAudioDevice->address_, BT_TRANSPORT_LE);
      conn_pairs.push_back({.cis_conn_handle = ase->cis_conn_hdl,
                            .acl_conn_handle = acl_handle});
      log::info("cis handle: 0x{:04x}, acl handle: 0x{:04x}", ase->cis_conn_hdl,
@@ -1732,8 +1731,8 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
        if (ases_pair.source)
          ases_pair.source->cis_state = CisState::CONNECTING;

        uint16_t acl_handle =
            BTM_GetHCIConnHandle(leAudioDevice->address_, BT_TRANSPORT_LE);
        uint16_t acl_handle = get_btm_client_interface().peer.BTM_GetHCIConnHandle(
                leAudioDevice->address_, BT_TRANSPORT_LE);
        conn_pairs.push_back({.cis_conn_handle = ase->cis_conn_hdl,
                              .acl_conn_handle = acl_handle});
        log::debug("cis handle: {} acl handle : 0x{:x}", ase->cis_conn_hdl,
+4 −6
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ void bluetooth::manager::SetMockBtmInterface(
                                                           tBT_TRANSPORT transport) {
    return btm_interface->IsPhy2mSupported(remote_bda, transport);
  };
  mock_btm_client_interface.peer.BTM_GetHCIConnHandle = [](RawAddress const& bd_addr,
                                                           tBT_TRANSPORT transport) -> uint16_t {
    return btm_interface->GetHCIConnHandle(bd_addr, transport);
  };
}

bool BTM_IsLinkKeyKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
@@ -83,12 +87,6 @@ void BTM_RequestPeerSCA(RawAddress const& bd_addr, tBT_TRANSPORT transport) {
  btm_interface->RequestPeerSCA(bd_addr, transport);
}

uint16_t BTM_GetHCIConnHandle(RawAddress const& bd_addr,
                              tBT_TRANSPORT transport) {
  log::assert_that(btm_interface != nullptr, "Mock btm interface not set!");
  return btm_interface->GetHCIConnHandle(bd_addr, transport);
}

void acl_disconnect_from_handle(uint16_t handle, tHCI_STATUS reason,
                                std::string comment) {
  log::assert_that(btm_interface != nullptr, "Mock btm interface not set!");
+1 −0
Original line number Diff line number Diff line
@@ -1073,6 +1073,7 @@ cc_test {
    ],
    srcs: [
        ":TestCommonMainHandler",
        ":TestMockStackBtmInterface",
        "gatt/connection_manager.cc",
        "test/common/mock_btm_api_layer.cc",
        "test/gatt_connection_manager_test.cc",
+13 −6
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include "hci/controller_interface.h"
#include "main/shim/entry.h"
#include "stack/include/bt_types.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/hcimsgs.h"
#include "types/raw_address.h"

@@ -136,7 +137,8 @@ class BleScannerImplBase : public BleScannerHciInterface {
  void PeriodicAdvSyncTransfer(
      const RawAddress& bd_addr, uint16_t service_data, uint16_t sync_handle,
      BleScannerHciInterface::handle_cb command_complete) override {
    uint16_t acl_handle = BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);
    uint16_t acl_handle =
            get_btm_client_interface().peer.BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);

    if (acl_handle == HCI_INVALID_HANDLE) {
      log::error("Wrong mode: no LE link exist or LE not supported");
@@ -151,7 +153,8 @@ class BleScannerImplBase : public BleScannerHciInterface {
  void PeriodicAdvSetInfoTransfer(const RawAddress& bd_addr,
                                  uint16_t service_data, uint8_t adv_handle,
                                  handle_cb command_complete) override {
    uint16_t acl_handle = BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);
    uint16_t acl_handle =
            get_btm_client_interface().peer.BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);

    if (acl_handle == HCI_INVALID_HANDLE) {
      log::error("Wrong mode: no LE link exist or LE not supported");
@@ -167,7 +170,8 @@ class BleScannerImplBase : public BleScannerHciInterface {
                                        uint16_t skip, uint16_t sync_timeout,
                                        uint8_t cte_type, bool set_defaults,
                                        status_cb command_complete) override {
    uint16_t acl_handle = BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);
    uint16_t acl_handle =
            get_btm_client_interface().peer.BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);

    if (acl_handle == HCI_INVALID_HANDLE) {
      log::error("Wrong mode: no LE link exist or LE not supported");
@@ -244,7 +248,8 @@ class BleScannerSyncTransferImpl : public virtual BleScannerImplBase {
  void PeriodicAdvSyncTransfer(
      const RawAddress& bd_addr, uint16_t service_data, uint16_t sync_handle,
      BleScannerHciInterface::handle_cb command_complete) override {
    uint16_t acl_handle = BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);
    uint16_t acl_handle =
            get_btm_client_interface().peer.BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);

    if (acl_handle == HCI_INVALID_HANDLE) {
      log::error("Wrong mode: no LE link exist or LE not supported");
@@ -259,7 +264,8 @@ class BleScannerSyncTransferImpl : public virtual BleScannerImplBase {
  void PeriodicAdvSetInfoTransfer(const RawAddress& bd_addr,
                                  uint16_t service_data, uint8_t adv_handle,
                                  handle_cb command_complete) override {
    uint16_t acl_handle = BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);
    uint16_t acl_handle =
            get_btm_client_interface().peer.BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);

    if (acl_handle == HCI_INVALID_HANDLE) {
      log::error("Wrong mode: no LE link exist or LE not supported");
@@ -275,7 +281,8 @@ class BleScannerSyncTransferImpl : public virtual BleScannerImplBase {
                                        uint16_t skip, uint16_t sync_timeout,
                                        uint8_t cte_type, bool set_defaults,
                                        status_cb command_complete) override {
    uint16_t acl_handle = BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);
    uint16_t acl_handle =
            get_btm_client_interface().peer.BTM_GetHCIConnHandle(bd_addr, BT_TRANSPORT_LE);

    if (acl_handle == HCI_INVALID_HANDLE) {
      log::error("Wrong mode: no LE link exist or LE not supported");
Loading