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

Commit 7ae33ce9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "L2CAP: Add call to version info"

parents 048857ec 4f965a96
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -73,6 +73,10 @@ void Link::Authenticate() {
  acl_connection_->AuthenticationRequested();
}

void Link::ReadRemoteVersionInformation() {
  acl_connection_->ReadRemoteVersionInformation();
}

void Link::ReadRemoteSupportedFeatures() {
  acl_connection_->ReadRemoteSupportedFeatures();
}
@@ -81,6 +85,10 @@ void Link::ReadRemoteExtendedFeatures() {
  acl_connection_->ReadRemoteExtendedFeatures();
}

void Link::ReadClockOffset() {
  acl_connection_->ReadClockOffset();
}

std::shared_ptr<FixedChannelImpl> Link::AllocateFixedChannel(Cid cid, SecurityPolicy security_policy) {
  auto channel = fixed_channel_allocator_.AllocateChannel(cid, security_policy);
  data_pipeline_manager_.AttachChannel(cid, channel, l2cap::internal::DataPipelineManager::ChannelMode::BASIC);
+4 −0
Original line number Diff line number Diff line
@@ -69,10 +69,14 @@ class Link : public l2cap::internal::ILink {

  virtual void Authenticate();

  virtual void ReadRemoteVersionInformation();

  virtual void ReadRemoteSupportedFeatures();

  virtual void ReadRemoteExtendedFeatures();

  virtual void ReadClockOffset();

  // FixedChannel methods

  std::shared_ptr<FixedChannelImpl> AllocateFixedChannel(Cid cid, SecurityPolicy security_policy);
+11 −7
Original line number Diff line number Diff line
@@ -53,9 +53,7 @@ void LinkManager::ConnectFixedChannelServices(hci::Address device,
        continue;
      }
      if (fixed_channel_service.first == kClassicPairingTriggerCid) {
        link->Authenticate();
        link->ReadRemoteSupportedFeatures();
        link->ReadRemoteExtendedFeatures();
        this->TriggerPairing(link);
      }
      // Allocate channel for newly registered fixed channels
      auto fixed_channel_impl = link->AllocateFixedChannel(fixed_channel_service.first, SecurityPolicy());
@@ -110,6 +108,13 @@ Link* LinkManager::GetLink(const hci::Address device) {
  return &links_.find(device)->second;
}

void LinkManager::TriggerPairing(Link* link) {
  link->ReadRemoteVersionInformation();
  link->ReadRemoteSupportedFeatures();
  link->ReadRemoteExtendedFeatures();
  link->ReadClockOffset();
}

void LinkManager::OnConnectSuccess(std::unique_ptr<hci::AclConnection> acl_connection) {
  // Same link should not be connected twice
  hci::Address device = acl_connection->GetAddress();
@@ -132,9 +137,7 @@ void LinkManager::OnConnectSuccess(std::unique_ptr<hci::AclConnection> acl_conne
    fixed_channel_service.second->NotifyChannelCreation(
        std::make_unique<FixedChannel>(fixed_channel_impl, l2cap_handler_));
    if (fixed_channel_service.first == kClassicPairingTriggerCid) {
      link->Authenticate();
      link->ReadRemoteSupportedFeatures();
      link->ReadRemoteExtendedFeatures();
      this->TriggerPairing(link);
    }
  }
  if (pending_dynamic_channels_.find(device) != pending_dynamic_channels_.end()) {
@@ -161,7 +164,8 @@ void LinkManager::OnConnectFail(hci::Address device, hci::ErrorCode reason) {
  auto pending_link = pending_links_.find(device);
  if (pending_link == pending_links_.end()) {
    // There is no pending link, exit
    LOG_DEBUG("Connection to %s failed without a pending link", device.ToString().c_str());
    LOG_DEBUG("Connection to %s failed without a pending link; reason: %s", device.ToString().c_str(),
              hci::ErrorCodeText(reason).c_str());
    if (pending_dynamic_channels_callbacks_.find(device) != pending_dynamic_channels_callbacks_.end()) {
      for (Link::PendingDynamicChannelConnection& callbacks : pending_dynamic_channels_callbacks_[device]) {
        callbacks.handler_->Post(common::BindOnce(std::move(callbacks.on_fail_callback_),
+2 −0
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ class LinkManager : public hci::ConnectionCallbacks {
                                     Link::PendingDynamicChannelConnection pending_dynamic_channel_connection, Psm psm);

 private:
  void TriggerPairing(Link* link);

  // Dependencies
  os::Handler* l2cap_handler_;
  hci::AclManager* acl_manager_;