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

Commit 2e4b86a9 authored by Chris Manton's avatar Chris Manton
Browse files

stack_manager: Hide implementation of legacy btm layer

Bug: 331287192
Test: m .
Flag: EXEMPT, Mechanical refactor
Change-Id: I3d849977d808b439a85c81e061ba32ec4ab54db6
parent b4c5225d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "hci/vendor_specific_event_manager.h"
#include "main/shim/acl.h"
#include "main/shim/acl_legacy_interface.h"
#include "main/shim/btm.h"
#include "main/shim/distance_measurement_manager.h"
#include "main/shim/entry.h"
#include "main/shim/hci_layer.h"
@@ -60,6 +61,7 @@ using ::bluetooth::common::StringFormat;

struct Stack::impl {
  legacy::Acl* acl_ = nullptr;
  Btm* btm_ = nullptr;
};

Stack::Stack() { pimpl_ = std::make_shared<Stack::impl>(); }
@@ -151,8 +153,8 @@ void Stack::Stop() {
  ASSERT_LOG(is_running_, "%s Gd stack not running", __func__);
  is_running_ = false;

  delete btm_;
  btm_ = nullptr;
  delete pimpl_->btm_;
  pimpl_->btm_ = nullptr;

  stack_handler_->Clear();

@@ -202,7 +204,7 @@ LinkPolicyInterface* Stack::LinkPolicy() {
Btm* Stack::GetBtm() {
  std::lock_guard<std::recursive_mutex> lock(mutex_);
  ASSERT(is_running_);
  return btm_;
  return pimpl_->btm_;
}

os::Handler* Stack::GetHandler() {
+3 −2
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
#include <functional>
#include <mutex>

#include "main/shim/btm.h"
#include "main/shim/link_policy_interface.h"
#include "module.h"
#include "os/handler.h"
@@ -29,6 +28,9 @@
// The shim layer implementation on the Gd stack side.
namespace bluetooth {
namespace shim {

class Btm;

namespace legacy {
class Acl;
};  // namespace legacy
@@ -87,7 +89,6 @@ class Stack {
  bool is_running_ = false;
  os::Thread* stack_thread_ = nullptr;
  os::Handler* stack_handler_ = nullptr;
  Btm* btm_ = nullptr;
  size_t num_modules_{0};
  void Start(ModuleList* modules);
};