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

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

Add Put[Le]AclConnectionInterface am: aa93b0df

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1900039

Change-Id: I870795493b5328227b337fd92fb686793219b041
parents 74f12bc7 aa93b0df
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -59,9 +59,7 @@ struct classic_impl : public security::ISecurityManagerListener {
  }

  ~classic_impl() {
    for (auto event_code : AclConnectionEvents) {
      hci_layer_->UnregisterEventHandler(event_code);
    }
    hci_layer_->PutAclConnectionInterface();
    acl_connections_.clear();
    security_manager_.reset();
  }
+1 −3
Original line number Diff line number Diff line
@@ -79,13 +79,11 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
  }

  ~le_impl() {
    for (auto subevent_code : LeConnectionManagementEvents) {
      hci_layer_->UnregisterLeEventHandler(subevent_code);
    }
    if (address_manager_registered) {
      le_address_manager_->Unregister(this);
    }
    delete le_address_manager_;
    hci_layer_->PutLeAclConnectionInterface();
    le_acl_connections_.clear();
  }

+2 −0
Original line number Diff line number Diff line
@@ -112,12 +112,14 @@ class FuzzHciLayer : public HciLayer {
      common::ContextualCallback<void(uint16_t, hci::ErrorCode)> on_disconnect,
      common::ContextualCallback<void(hci::ErrorCode hci_status, uint16_t, uint8_t, uint16_t, uint16_t)>
          on_read_remote_version) override;
  void PutAclConnectionInterface() override {}

  hci::LeAclConnectionInterface* GetLeAclConnectionInterface(
      common::ContextualCallback<void(hci::LeMetaEventView)> event_handler,
      common::ContextualCallback<void(uint16_t, hci::ErrorCode)> on_disconnect,
      common::ContextualCallback<void(hci::ErrorCode hci_status, uint16_t, uint8_t, uint16_t, uint16_t)>
          on_read_remote_version) override;
  void PutLeAclConnectionInterface() override {}

  hci::LeAdvertisingInterface* GetLeAdvertisingInterface(
      common::ContextualCallback<void(hci::LeMetaEventView)> event_handler) override;
+20 −4
Original line number Diff line number Diff line
@@ -511,28 +511,44 @@ AclConnectionInterface* HciLayer::GetAclConnectionInterface(
    ContextualCallback<
        void(hci::ErrorCode hci_status, uint16_t, uint8_t version, uint16_t manufacturer_name, uint16_t sub_version)>
        on_read_remote_version) {
  disconnect_handlers_.push_back(on_disconnect);
  read_remote_version_handlers_.push_back(on_read_remote_version);
  for (const auto event : AclConnectionEvents) {
    RegisterEventHandler(event, event_handler);
  }
  disconnect_handlers_.push_back(on_disconnect);
  read_remote_version_handlers_.push_back(on_read_remote_version);
  return &acl_connection_manager_interface_;
}

void HciLayer::PutAclConnectionInterface() {
  for (const auto event : AclConnectionEvents) {
    UnregisterEventHandler(event);
  }
  disconnect_handlers_.clear();
  read_remote_version_handlers_.clear();
}

LeAclConnectionInterface* HciLayer::GetLeAclConnectionInterface(
    ContextualCallback<void(LeMetaEventView)> event_handler,
    ContextualCallback<void(uint16_t, ErrorCode)> on_disconnect,
    ContextualCallback<
        void(hci::ErrorCode hci_status, uint16_t, uint8_t version, uint16_t manufacturer_name, uint16_t sub_version)>
        on_read_remote_version) {
  disconnect_handlers_.push_back(on_disconnect);
  read_remote_version_handlers_.push_back(on_read_remote_version);
  for (const auto event : LeConnectionManagementEvents) {
    RegisterLeEventHandler(event, event_handler);
  }
  disconnect_handlers_.push_back(on_disconnect);
  read_remote_version_handlers_.push_back(on_read_remote_version);
  return &le_acl_connection_manager_interface_;
}

void HciLayer::PutLeAclConnectionInterface() {
  for (const auto event : LeConnectionManagementEvents) {
    UnregisterLeEventHandler(event);
  }
  disconnect_handlers_.clear();
  read_remote_version_handlers_.clear();
}

SecurityInterface* HciLayer::GetSecurityInterface(ContextualCallback<void(EventView)> event_handler) {
  for (const auto event : SecurityEvents) {
    RegisterEventHandler(event, event_handler);
+2 −0
Original line number Diff line number Diff line
@@ -78,12 +78,14 @@ class HciLayer : public Module, public CommandInterface<CommandBuilder> {
      common::ContextualCallback<void(uint16_t, hci::ErrorCode)> on_disconnect,
      common::ContextualCallback<void(hci::ErrorCode, uint16_t, uint8_t, uint16_t, uint16_t)>
          on_read_remote_version_complete);
  virtual void PutAclConnectionInterface();

  virtual LeAclConnectionInterface* GetLeAclConnectionInterface(
      common::ContextualCallback<void(LeMetaEventView)> event_handler,
      common::ContextualCallback<void(uint16_t, hci::ErrorCode)> on_disconnect,
      common::ContextualCallback<void(hci::ErrorCode, uint16_t, uint8_t, uint16_t, uint16_t)>
          on_read_remote_version_complete);
  virtual void PutLeAclConnectionInterface();

  virtual LeAdvertisingInterface* GetLeAdvertisingInterface(
      common::ContextualCallback<void(LeMetaEventView)> event_handler);