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

Commit 1287de45 authored by Chris Manton's avatar Chris Manton
Browse files

Create swappable hci layer connection

Bug: 140418843
Test: Run sdp query on walleye with Gd disabled
Change-Id: Ifb00e8219cb9e937a27a8f4c2e4de9ac5b12b49a
parent 6ffc946a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -83,6 +83,11 @@ typedef struct hci_t {
  void (*transmit_downward)(uint16_t type, void* data);
} hci_t;

namespace bluetooth {
namespace legacy {
const hci_t* hci_layer_get_interface();
}  // namespace legacy
}  // namespace bluetooth
const hci_t* hci_layer_get_interface();

const hci_t* hci_layer_get_test_interface(
+15 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include "hci_internals.h"
#include "hcidefs.h"
#include "hcimsgs.h"
#include "main/shim/shim.h"
#include "osi/include/alarm.h"
#include "osi/include/list.h"
#include "osi/include/log.h"
@@ -719,7 +720,21 @@ void hci_layer_cleanup_interface() {
  }
}

namespace bluetooth {
namespace shim {
const hci_t* hci_layer_get_interface();
}  // namespace shim
}  // namespace bluetooth

const hci_t* hci_layer_get_interface() {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::hci_layer_get_interface();
  } else {
    return bluetooth::legacy::hci_layer_get_interface();
  }
}

const hci_t* bluetooth::legacy::hci_layer_get_interface() {
  buffer_allocator = buffer_allocator_get_interface();
  btsnoop = btsnoop_get_interface();
  packet_fragmenter = packet_fragmenter_get_interface();