Loading system/gd/hci/acl_manager.cc +65 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,12 @@ struct AclManager::impl { Bind(&impl::on_flow_specification_complete, common::Unretained(this)), handler_); hci_layer_->RegisterEventHandler(EventCode::FLUSH_OCCURRED, Bind(&impl::on_flush_occurred, common::Unretained(this)), handler_); hci_layer_->RegisterEventHandler(EventCode::READ_REMOTE_SUPPORTED_FEATURES_COMPLETE, Bind(&impl::on_read_remote_supported_features_complete, common::Unretained(this)), handler_); hci_layer_->RegisterEventHandler(EventCode::READ_REMOTE_EXTENDED_FEATURES_COMPLETE, Bind(&impl::on_read_remote_extended_features_complete, common::Unretained(this)), handler_); hci_mtu_ = controller_->GetControllerAclPacketLength(); } Loading @@ -206,6 +212,8 @@ struct AclManager::impl { hci_layer_->UnregisterEventHandler(EventCode::CONNECTION_COMPLETE); hci_layer_->UnregisterEventHandler(EventCode::CONNECTION_REQUEST); hci_layer_->UnregisterEventHandler(EventCode::AUTHENTICATION_COMPLETE); hci_layer_->UnregisterEventHandler(EventCode::READ_REMOTE_SUPPORTED_FEATURES_COMPLETE); hci_layer_->UnregisterEventHandler(EventCode::READ_REMOTE_EXTENDED_FEATURES_COMPLETE); hci_queue_end_->UnregisterDequeue(); unregister_all_connections(); acl_connections_.clear(); Loading Loading @@ -726,6 +734,14 @@ struct AclManager::impl { } } void on_read_remote_supported_features_complete(EventPacketView packet) { LOG_INFO("called"); } void on_read_remote_extended_features_complete(EventPacketView packet) { LOG_INFO("called"); } void on_role_discovery_complete(CommandCompleteView view) { auto complete_view = RoleDiscoveryCompleteView::Create(view); if (!complete_view.IsValid()) { Loading Loading @@ -935,6 +951,14 @@ struct AclManager::impl { } } void on_read_remote_supported_features_status(CommandStatusView view) { LOG_INFO("called"); } void on_read_remote_extended_features_status(CommandStatusView view) { LOG_INFO("called"); } void on_read_clock_complete(CommandCompleteView view) { auto complete_view = ReadClockCompleteView::Create(view); if (!complete_view.IsValid()) { Loading Loading @@ -1329,6 +1353,19 @@ struct AclManager::impl { common::BindOnce(&impl::on_read_rssi_complete, common::Unretained(this)), handler_); } void handle_read_remote_supported_features(uint16_t handle) { hci_layer_->EnqueueCommand( ReadRemoteSupportedFeaturesBuilder::Create(handle), common::BindOnce(&impl::on_read_remote_supported_features_status, common::Unretained(this)), handler_); } void handle_read_remote_extended_features(uint16_t handle) { // TODO(optedoblivion): Read the other pages until max pages hci_layer_->EnqueueCommand( ReadRemoteExtendedFeaturesBuilder::Create(handle, 1), common::BindOnce(&impl::on_read_remote_extended_features_status, common::Unretained(this)), handler_); } void handle_read_clock(uint16_t handle, WhichClock which_clock) { std::unique_ptr<ReadClockBuilder> packet = ReadClockBuilder::Create(handle, which_clock); hci_layer_->EnqueueCommand(std::move(packet), Loading Loading @@ -1729,6 +1766,26 @@ struct AclManager::impl { return true; } bool ReadRemoteSupportedFeatures(uint16_t handle) { auto& connection = check_and_get_connection(handle); if (connection.is_disconnected_) { LOG_INFO("Already disconnected"); return false; } handler_->Post(BindOnce(&impl::handle_read_remote_supported_features, common::Unretained(this), handle)); return true; } bool ReadRemoteExtendedFeatures(uint16_t handle) { auto& connection = check_and_get_connection(handle); if (connection.is_disconnected_) { LOG_INFO("Already disconnected"); return false; } handler_->Post(BindOnce(&impl::handle_read_remote_extended_features, common::Unretained(this), handle)); return true; } bool ReadClock(uint16_t handle, WhichClock which_clock) { auto& connection = check_and_get_connection(handle); if (connection.is_disconnected_) { Loading Loading @@ -1923,6 +1980,14 @@ bool AclConnection::ReadRssi() { return manager_->pimpl_->ReadRssi(handle_); } bool AclConnection::ReadRemoteSupportedFeatures() { return manager_->pimpl_->ReadRemoteSupportedFeatures(handle_); } bool AclConnection::ReadRemoteExtendedFeatures() { return manager_->pimpl_->ReadRemoteExtendedFeatures(handle_); } bool AclConnection::ReadClock(WhichClock which_clock) { return manager_->pimpl_->ReadClock(handle_, which_clock); } Loading system/gd/hci/acl_manager.h +2 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,8 @@ class AclConnection { virtual bool ReadAfhChannelMap(); virtual bool ReadRssi(); virtual bool ReadClock(WhichClock which_clock); virtual bool ReadRemoteSupportedFeatures(); virtual bool ReadRemoteExtendedFeatures(); // LE ACL Method virtual bool LeConnectionUpdate(uint16_t conn_interval_min, uint16_t conn_interval_max, uint16_t conn_latency, Loading system/gd/l2cap/classic/internal/link.cc +8 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,14 @@ void Link::Authenticate() { acl_connection_->AuthenticationRequested(); } void Link::ReadRemoteSupportedFeatures() { acl_connection_->ReadRemoteSupportedFeatures(); } void Link::ReadRemoteExtendedFeatures() { acl_connection_->ReadRemoteExtendedFeatures(); } 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,6 +69,10 @@ class Link : public l2cap::internal::ILink { virtual void Authenticate(); virtual void ReadRemoteSupportedFeatures(); virtual void ReadRemoteExtendedFeatures(); // FixedChannel methods std::shared_ptr<FixedChannelImpl> AllocateFixedChannel(Cid cid, SecurityPolicy security_policy); Loading system/gd/l2cap/classic/internal/link_manager.cc +7 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,11 @@ void LinkManager::ConnectFixedChannelServices(hci::Address device, // This channel is already allocated for this link, do not allocated twice continue; } if (fixed_channel_service.first == kClassicPairingTriggerCid) { link->Authenticate(); link->ReadRemoteSupportedFeatures(); link->ReadRemoteExtendedFeatures(); } // Allocate channel for newly registered fixed channels auto fixed_channel_impl = link->AllocateFixedChannel(fixed_channel_service.first, SecurityPolicy()); fixed_channel_service.second->NotifyChannelCreation( Loading Loading @@ -128,6 +133,8 @@ void LinkManager::OnConnectSuccess(std::unique_ptr<hci::AclConnection> acl_conne std::make_unique<FixedChannel>(fixed_channel_impl, l2cap_handler_)); if (fixed_channel_service.first == kClassicPairingTriggerCid) { link->Authenticate(); link->ReadRemoteSupportedFeatures(); link->ReadRemoteExtendedFeatures(); } } if (pending_dynamic_channels_.find(device) != pending_dynamic_channels_.end()) { Loading Loading
system/gd/hci/acl_manager.cc +65 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,12 @@ struct AclManager::impl { Bind(&impl::on_flow_specification_complete, common::Unretained(this)), handler_); hci_layer_->RegisterEventHandler(EventCode::FLUSH_OCCURRED, Bind(&impl::on_flush_occurred, common::Unretained(this)), handler_); hci_layer_->RegisterEventHandler(EventCode::READ_REMOTE_SUPPORTED_FEATURES_COMPLETE, Bind(&impl::on_read_remote_supported_features_complete, common::Unretained(this)), handler_); hci_layer_->RegisterEventHandler(EventCode::READ_REMOTE_EXTENDED_FEATURES_COMPLETE, Bind(&impl::on_read_remote_extended_features_complete, common::Unretained(this)), handler_); hci_mtu_ = controller_->GetControllerAclPacketLength(); } Loading @@ -206,6 +212,8 @@ struct AclManager::impl { hci_layer_->UnregisterEventHandler(EventCode::CONNECTION_COMPLETE); hci_layer_->UnregisterEventHandler(EventCode::CONNECTION_REQUEST); hci_layer_->UnregisterEventHandler(EventCode::AUTHENTICATION_COMPLETE); hci_layer_->UnregisterEventHandler(EventCode::READ_REMOTE_SUPPORTED_FEATURES_COMPLETE); hci_layer_->UnregisterEventHandler(EventCode::READ_REMOTE_EXTENDED_FEATURES_COMPLETE); hci_queue_end_->UnregisterDequeue(); unregister_all_connections(); acl_connections_.clear(); Loading Loading @@ -726,6 +734,14 @@ struct AclManager::impl { } } void on_read_remote_supported_features_complete(EventPacketView packet) { LOG_INFO("called"); } void on_read_remote_extended_features_complete(EventPacketView packet) { LOG_INFO("called"); } void on_role_discovery_complete(CommandCompleteView view) { auto complete_view = RoleDiscoveryCompleteView::Create(view); if (!complete_view.IsValid()) { Loading Loading @@ -935,6 +951,14 @@ struct AclManager::impl { } } void on_read_remote_supported_features_status(CommandStatusView view) { LOG_INFO("called"); } void on_read_remote_extended_features_status(CommandStatusView view) { LOG_INFO("called"); } void on_read_clock_complete(CommandCompleteView view) { auto complete_view = ReadClockCompleteView::Create(view); if (!complete_view.IsValid()) { Loading Loading @@ -1329,6 +1353,19 @@ struct AclManager::impl { common::BindOnce(&impl::on_read_rssi_complete, common::Unretained(this)), handler_); } void handle_read_remote_supported_features(uint16_t handle) { hci_layer_->EnqueueCommand( ReadRemoteSupportedFeaturesBuilder::Create(handle), common::BindOnce(&impl::on_read_remote_supported_features_status, common::Unretained(this)), handler_); } void handle_read_remote_extended_features(uint16_t handle) { // TODO(optedoblivion): Read the other pages until max pages hci_layer_->EnqueueCommand( ReadRemoteExtendedFeaturesBuilder::Create(handle, 1), common::BindOnce(&impl::on_read_remote_extended_features_status, common::Unretained(this)), handler_); } void handle_read_clock(uint16_t handle, WhichClock which_clock) { std::unique_ptr<ReadClockBuilder> packet = ReadClockBuilder::Create(handle, which_clock); hci_layer_->EnqueueCommand(std::move(packet), Loading Loading @@ -1729,6 +1766,26 @@ struct AclManager::impl { return true; } bool ReadRemoteSupportedFeatures(uint16_t handle) { auto& connection = check_and_get_connection(handle); if (connection.is_disconnected_) { LOG_INFO("Already disconnected"); return false; } handler_->Post(BindOnce(&impl::handle_read_remote_supported_features, common::Unretained(this), handle)); return true; } bool ReadRemoteExtendedFeatures(uint16_t handle) { auto& connection = check_and_get_connection(handle); if (connection.is_disconnected_) { LOG_INFO("Already disconnected"); return false; } handler_->Post(BindOnce(&impl::handle_read_remote_extended_features, common::Unretained(this), handle)); return true; } bool ReadClock(uint16_t handle, WhichClock which_clock) { auto& connection = check_and_get_connection(handle); if (connection.is_disconnected_) { Loading Loading @@ -1923,6 +1980,14 @@ bool AclConnection::ReadRssi() { return manager_->pimpl_->ReadRssi(handle_); } bool AclConnection::ReadRemoteSupportedFeatures() { return manager_->pimpl_->ReadRemoteSupportedFeatures(handle_); } bool AclConnection::ReadRemoteExtendedFeatures() { return manager_->pimpl_->ReadRemoteExtendedFeatures(handle_); } bool AclConnection::ReadClock(WhichClock which_clock) { return manager_->pimpl_->ReadClock(handle_, which_clock); } Loading
system/gd/hci/acl_manager.h +2 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,8 @@ class AclConnection { virtual bool ReadAfhChannelMap(); virtual bool ReadRssi(); virtual bool ReadClock(WhichClock which_clock); virtual bool ReadRemoteSupportedFeatures(); virtual bool ReadRemoteExtendedFeatures(); // LE ACL Method virtual bool LeConnectionUpdate(uint16_t conn_interval_min, uint16_t conn_interval_max, uint16_t conn_latency, Loading
system/gd/l2cap/classic/internal/link.cc +8 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,14 @@ void Link::Authenticate() { acl_connection_->AuthenticationRequested(); } void Link::ReadRemoteSupportedFeatures() { acl_connection_->ReadRemoteSupportedFeatures(); } void Link::ReadRemoteExtendedFeatures() { acl_connection_->ReadRemoteExtendedFeatures(); } 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,6 +69,10 @@ class Link : public l2cap::internal::ILink { virtual void Authenticate(); virtual void ReadRemoteSupportedFeatures(); virtual void ReadRemoteExtendedFeatures(); // FixedChannel methods std::shared_ptr<FixedChannelImpl> AllocateFixedChannel(Cid cid, SecurityPolicy security_policy); Loading
system/gd/l2cap/classic/internal/link_manager.cc +7 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,11 @@ void LinkManager::ConnectFixedChannelServices(hci::Address device, // This channel is already allocated for this link, do not allocated twice continue; } if (fixed_channel_service.first == kClassicPairingTriggerCid) { link->Authenticate(); link->ReadRemoteSupportedFeatures(); link->ReadRemoteExtendedFeatures(); } // Allocate channel for newly registered fixed channels auto fixed_channel_impl = link->AllocateFixedChannel(fixed_channel_service.first, SecurityPolicy()); fixed_channel_service.second->NotifyChannelCreation( Loading Loading @@ -128,6 +133,8 @@ void LinkManager::OnConnectSuccess(std::unique_ptr<hci::AclConnection> acl_conne std::make_unique<FixedChannel>(fixed_channel_impl, l2cap_handler_)); if (fixed_channel_service.first == kClassicPairingTriggerCid) { link->Authenticate(); link->ReadRemoteSupportedFeatures(); link->ReadRemoteExtendedFeatures(); } } if (pending_dynamic_channels_.find(device) != pending_dynamic_channels_.end()) { Loading