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

Commit 1a970716 authored by Chris Manton's avatar Chris Manton Committed by android-build-merger
Browse files

Create swappable hci layer connection am: 1287de45

am: 159d7ca4

Change-Id: I775d56ba6a0f1e408a7db60e8a530910b65c1f8d
parents 84e8cc9a 159d7ca4
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();