Loading system/gd/l2cap/classic/internal/link.cc +8 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,10 @@ void Link::Authenticate() { acl_connection_->AuthenticationRequested(); } void Link::ReadRemoteVersionInformation() { acl_connection_->ReadRemoteVersionInformation(); } void Link::ReadRemoteSupportedFeatures() { acl_connection_->ReadRemoteSupportedFeatures(); } Loading @@ -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); Loading system/gd/l2cap/classic/internal/link.h +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading system/gd/l2cap/classic/internal/link_manager.cc +11 −7 Original line number Diff line number Diff line Loading @@ -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()); Loading Loading @@ -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(); Loading @@ -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()) { Loading @@ -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_), Loading system/gd/l2cap/classic/internal/link_manager.h +2 −0 Original line number Diff line number Diff line Loading @@ -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_; Loading Loading
system/gd/l2cap/classic/internal/link.cc +8 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,10 @@ void Link::Authenticate() { acl_connection_->AuthenticationRequested(); } void Link::ReadRemoteVersionInformation() { acl_connection_->ReadRemoteVersionInformation(); } void Link::ReadRemoteSupportedFeatures() { acl_connection_->ReadRemoteSupportedFeatures(); } Loading @@ -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); Loading
system/gd/l2cap/classic/internal/link.h +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
system/gd/l2cap/classic/internal/link_manager.cc +11 −7 Original line number Diff line number Diff line Loading @@ -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()); Loading Loading @@ -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(); Loading @@ -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()) { Loading @@ -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_), Loading
system/gd/l2cap/classic/internal/link_manager.h +2 −0 Original line number Diff line number Diff line Loading @@ -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_; Loading