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

Commit 08f65feb authored by Chris Manton's avatar Chris Manton
Browse files

[11/19] get_btm_client_interface().peer.BTM_IsPhy2mSupported

Bug: 343772702
Test: m .
Flag: EXEMPT, Mechanical Refactor

Change-Id: I8e07ea58606335d7a2d43c5de4a5ec962bed96a1
parent 6655e3c2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -657,6 +657,7 @@ cc_test {
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockStackBtmInterface",
        ":TestStubOsi",
        "gatt/database.cc",
        "gatt/database_builder.cc",
@@ -1239,6 +1240,7 @@ cc_test {
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockStackBtmInterface",
        ":TestStubOsi",
        "gatt/database.cc",
        "gatt/database_builder.cc",
+3 −2
Original line number Diff line number Diff line
@@ -32,8 +32,8 @@
#include "le_audio_log_history.h"
#include "le_audio_utils.h"
#include "main/shim/entry.h"
#include "os/log.h"
#include "osi/include/properties.h"
#include "stack/include/btm_client_interface.h"

using bluetooth::hci::kIsoCigPhy1M;
using bluetooth::hci::kIsoCigPhy2M;
@@ -884,8 +884,9 @@ uint8_t LeAudioDevice::GetSupportedAudioChannelCounts(uint8_t direction) const {
uint8_t LeAudioDevice::GetPhyBitmask(void) const {
  uint8_t phy_bitfield = kIsoCigPhy1M;

  if (BTM_IsPhy2mSupported(address_, BT_TRANSPORT_LE))
  if (get_btm_client_interface().peer.BTM_IsPhy2mSupported(address_, BT_TRANSPORT_LE)) {
    phy_bitfield |= kIsoCigPhy2M;
  }

  return phy_bitfield;
}
+6 −6
Original line number Diff line number Diff line
@@ -22,7 +22,9 @@
#include <optional>

#include "bt_octets.h"
#include "btm_api.h"
#include "stack/include/btm_ble_sec_api.h"
#include "test/mock/mock_stack_btm_interface.h"
#include "types/raw_address.h"

using namespace bluetooth;
@@ -32,6 +34,10 @@ static bluetooth::manager::MockBtmInterface* btm_interface = nullptr;
void bluetooth::manager::SetMockBtmInterface(
    MockBtmInterface* mock_btm_interface) {
  btm_interface = mock_btm_interface;
  mock_btm_client_interface.peer.BTM_IsPhy2mSupported = [](const RawAddress& remote_bda,
                                                           tBT_TRANSPORT transport) {
    return btm_interface->IsPhy2mSupported(remote_bda, transport);
  };
}

bool BTM_IsLinkKeyKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
@@ -51,12 +57,6 @@ tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr,
                                      p_ref_data, sec_act);
}

bool BTM_IsPhy2mSupported(const RawAddress& remote_bda,
                          tBT_TRANSPORT transport) {
  log::assert_that(btm_interface != nullptr, "Mock btm interface not set!");
  return btm_interface->IsPhy2mSupported(remote_bda, transport);
}

uint8_t BTM_GetPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport) {
  log::assert_that(btm_interface != nullptr, "Mock btm interface not set!");
  return btm_interface->GetPeerSCA(remote_bda, transport);