Loading system/gd/hci/acl_manager.cc +2 −2 Original line number Diff line number Diff line Loading @@ -159,8 +159,8 @@ void AclManager::CreateConnection(Address address) { CallOn(pimpl_->classic_impl_, &classic_impl::create_connection, address); } void AclManager::CreateLeConnection(AddressWithType address_with_type) { CallOn(pimpl_->le_impl_, &le_impl::create_le_connection, address_with_type, true); void AclManager::CreateLeConnection(AddressWithType address_with_type, bool is_direct) { CallOn(pimpl_->le_impl_, &le_impl::create_le_connection, address_with_type, true, is_direct); } void AclManager::SetLeSuggestedDefaultDataParameters(uint16_t octets, uint16_t time) { Loading system/gd/hci/acl_manager.h +1 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public: virtual void CreateConnection(Address address); // Generates OnLeConnectSuccess if connected, or OnLeConnectFail otherwise virtual void CreateLeConnection(AddressWithType address_with_type); virtual void CreateLeConnection(AddressWithType address_with_type, bool is_direct); // Ask the controller for specific data parameters virtual void SetLeSuggestedDefaultDataParameters(uint16_t octets, uint16_t time); Loading system/gd/hci/acl_manager/le_impl.h +19 −5 Original line number Diff line number Diff line Loading @@ -32,6 +32,11 @@ namespace acl_manager { using common::BindOnce; constexpr uint16_t kScanIntervalFast = 0x0060; constexpr uint16_t kScanWindowFast = 0x0030; constexpr uint16_t kScanIntervalSlow = 0x0800; constexpr uint16_t kScanWindowSlow = 0x0030; struct le_acl_connection { le_acl_connection(AddressWithType remote_address, AclConnection::QueueDownEnd* queue_down_end, os::Handler* handler) : assembler_(remote_address, queue_down_end, handler), remote_address_(remote_address) {} Loading Loading @@ -398,11 +403,13 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { } } void create_le_connection(AddressWithType address_with_type, bool add_to_connect_list) { void create_le_connection(AddressWithType address_with_type, bool add_to_connect_list, bool is_direct) { // TODO: Configure default LE connection parameters? if (add_to_connect_list) { add_device_to_connect_list(address_with_type); if (is_direct) { direct_connections_.insert(address_with_type); } } if (!address_manager_registered) { Loading @@ -425,8 +432,13 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { return; } uint16_t le_scan_interval = 0x0060; uint16_t le_scan_window = 0x0030; uint16_t le_scan_interval = kScanIntervalSlow; uint16_t le_scan_window = kScanWindowSlow; // If there is any direct connection in the connection list, use the fast parameter if (!direct_connections_.empty()) { le_scan_interval = kScanIntervalFast; le_scan_window = kScanWindowFast; } InitiatorFilterPolicy initiator_filter_policy = InitiatorFilterPolicy::USE_CONNECT_LIST; OwnAddressType own_address_type = static_cast<OwnAddressType>(le_address_manager_->GetCurrentAddress().GetAddressType()); Loading Loading @@ -487,6 +499,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { void remove_device_from_connect_list(AddressWithType address_with_type) { AddressType address_type = address_with_type.GetAddressType(); direct_connections_.erase(address_with_type); if (!address_manager_registered) { le_address_manager_->Register(this); address_manager_registered = true; Loading Loading @@ -620,7 +633,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { void OnResume() override { pause_connection = false; if (!canceled_connections_.empty()) { create_le_connection(*canceled_connections_.begin(), false); create_le_connection(*canceled_connections_.begin(), false, false); } canceled_connections_.clear(); le_address_manager_->AckResume(this); Loading Loading @@ -659,6 +672,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { std::map<uint16_t, le_acl_connection> le_acl_connections_; std::set<AddressWithType> connecting_le_; std::set<AddressWithType> canceled_connections_; std::set<AddressWithType> direct_connections_; bool address_manager_registered = false; bool ready_to_unregister = false; bool pause_connection = false; Loading system/gd/hci/acl_manager_mock.h +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ class MockAclManager : public AclManager { MOCK_METHOD(void, RegisterCallbacks, (ConnectionCallbacks * callbacks, os::Handler* handler), (override)); MOCK_METHOD(void, RegisterLeCallbacks, (LeConnectionCallbacks * callbacks, os::Handler* handler), (override)); MOCK_METHOD(void, CreateConnection, (Address address), (override)); MOCK_METHOD(void, CreateLeConnection, (AddressWithType address_with_type), (override)); MOCK_METHOD(void, CreateLeConnection, (AddressWithType address_with_type, bool is_direct), (override)); MOCK_METHOD(void, CancelConnect, (Address address), (override)); MOCK_METHOD( void, Loading system/gd/hci/acl_manager_test.cc +75 −7 Original line number Diff line number Diff line Loading @@ -44,6 +44,10 @@ using packet::PacketView; using packet::RawBuilder; constexpr std::chrono::seconds kTimeout = std::chrono::seconds(2); constexpr uint16_t kScanIntervalFast = 0x0060; constexpr uint16_t kScanWindowFast = 0x0030; constexpr uint16_t kScanIntervalSlow = 0x0800; constexpr uint16_t kScanWindowSlow = 0x0030; const AddressWithType empty_address_with_type = hci::AddressWithType(); PacketView<kLittleEndian> GetPacketView(std::unique_ptr<packet::BasePacketBuilder> packet) { Loading Loading @@ -593,7 +597,7 @@ class AclManagerWithLeConnectionTest : public AclManagerTest { remote_with_type_ = AddressWithType(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type_); acl_manager_->CreateLeConnection(remote_with_type_, true); test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); Loading Loading @@ -682,7 +686,7 @@ TEST_F(AclManagerWithLeConnectionTest, invoke_registered_callback_le_connection_ TEST_F(AclManagerTest, invoke_registered_callback_le_connection_complete_fail) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); Loading Loading @@ -724,7 +728,7 @@ TEST_F(AclManagerTest, invoke_registered_callback_le_connection_complete_fail) { TEST_F(AclManagerTest, cancel_le_connection) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); Loading Loading @@ -759,6 +763,70 @@ TEST_F(AclManagerTest, cancel_le_connection) { test_hci_layer_->IncomingEvent(LeRemoveDeviceFromConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); } TEST_F(AclManagerTest, create_connection_with_fast_mode) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); auto packet = test_hci_layer_->GetLastCommand(OpCode::LE_CREATE_CONNECTION); auto command_view = LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(AclCommandView::Create(packet))); ASSERT_TRUE(command_view.IsValid()); ASSERT_EQ(command_view.GetLeScanInterval(), kScanIntervalFast); ASSERT_EQ(command_view.GetLeScanWindow(), kScanWindowFast); test_hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); auto first_connection = GetLeConnectionFuture(); test_hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( ErrorCode::SUCCESS, 0x00, Role::PERIPHERAL, AddressType::PUBLIC_DEVICE_ADDRESS, remote, 0x0100, 0x0010, 0x0C80, ClockAccuracy::PPM_30)); test_hci_layer_->SetCommandFuture(); test_hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeRemoveDeviceFromConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); auto first_connection_status = first_connection.wait_for(kTimeout); ASSERT_EQ(first_connection_status, std::future_status::ready); } TEST_F(AclManagerTest, create_connection_with_slow_mode) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type, false); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); auto packet = test_hci_layer_->GetLastCommand(OpCode::LE_CREATE_CONNECTION); auto command_view = LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(AclCommandView::Create(packet))); ASSERT_TRUE(command_view.IsValid()); ASSERT_EQ(command_view.GetLeScanInterval(), kScanIntervalSlow); ASSERT_EQ(command_view.GetLeScanWindow(), kScanWindowSlow); test_hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); auto first_connection = GetLeConnectionFuture(); test_hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( ErrorCode::SUCCESS, 0x00, Role::PERIPHERAL, AddressType::PUBLIC_DEVICE_ADDRESS, remote, 0x0100, 0x0010, 0x0C80, ClockAccuracy::PPM_30)); test_hci_layer_->SetCommandFuture(); test_hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeRemoveDeviceFromConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); auto first_connection_status = first_connection.wait_for(kTimeout); ASSERT_EQ(first_connection_status, std::future_status::ready); } TEST_F(AclManagerWithLeConnectionTest, acl_send_data_one_le_connection) { ASSERT_EQ(connection_->GetRemoteAddress(), remote_with_type_); ASSERT_EQ(connection_->GetHandle(), handle_); Loading Loading @@ -1277,7 +1345,7 @@ class AclManagerWithResolvableAddressTest : public AclManagerNoCallbacksTest { TEST_F(AclManagerWithResolvableAddressTest, create_connection_cancel_fail) { auto remote_with_type_ = AddressWithType(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type_); acl_manager_->CreateLeConnection(remote_with_type_, true); // Set random address test_hci_layer_->GetLastCommand(OpCode::LE_SET_RANDOM_ADDRESS); Loading @@ -1302,7 +1370,7 @@ TEST_F(AclManagerWithResolvableAddressTest, create_connection_cancel_fail) { // create another connection test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type2); acl_manager_->CreateLeConnection(remote_with_type2, true); // cancel previous connection test_hci_layer_->GetLastCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); Loading Loading @@ -1383,7 +1451,7 @@ TEST_F(AclManagerLifeCycleTest, unregister_classic_before_connection_request) { TEST_F(AclManagerLifeCycleTest, unregister_le_before_connection_complete) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); Loading Loading @@ -1425,7 +1493,7 @@ TEST_F(AclManagerLifeCycleTest, unregister_le_before_connection_complete) { TEST_F(AclManagerLifeCycleTest, unregister_le_before_enhanced_connection_complete) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); Loading Loading
system/gd/hci/acl_manager.cc +2 −2 Original line number Diff line number Diff line Loading @@ -159,8 +159,8 @@ void AclManager::CreateConnection(Address address) { CallOn(pimpl_->classic_impl_, &classic_impl::create_connection, address); } void AclManager::CreateLeConnection(AddressWithType address_with_type) { CallOn(pimpl_->le_impl_, &le_impl::create_le_connection, address_with_type, true); void AclManager::CreateLeConnection(AddressWithType address_with_type, bool is_direct) { CallOn(pimpl_->le_impl_, &le_impl::create_le_connection, address_with_type, true, is_direct); } void AclManager::SetLeSuggestedDefaultDataParameters(uint16_t octets, uint16_t time) { Loading
system/gd/hci/acl_manager.h +1 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public: virtual void CreateConnection(Address address); // Generates OnLeConnectSuccess if connected, or OnLeConnectFail otherwise virtual void CreateLeConnection(AddressWithType address_with_type); virtual void CreateLeConnection(AddressWithType address_with_type, bool is_direct); // Ask the controller for specific data parameters virtual void SetLeSuggestedDefaultDataParameters(uint16_t octets, uint16_t time); Loading
system/gd/hci/acl_manager/le_impl.h +19 −5 Original line number Diff line number Diff line Loading @@ -32,6 +32,11 @@ namespace acl_manager { using common::BindOnce; constexpr uint16_t kScanIntervalFast = 0x0060; constexpr uint16_t kScanWindowFast = 0x0030; constexpr uint16_t kScanIntervalSlow = 0x0800; constexpr uint16_t kScanWindowSlow = 0x0030; struct le_acl_connection { le_acl_connection(AddressWithType remote_address, AclConnection::QueueDownEnd* queue_down_end, os::Handler* handler) : assembler_(remote_address, queue_down_end, handler), remote_address_(remote_address) {} Loading Loading @@ -398,11 +403,13 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { } } void create_le_connection(AddressWithType address_with_type, bool add_to_connect_list) { void create_le_connection(AddressWithType address_with_type, bool add_to_connect_list, bool is_direct) { // TODO: Configure default LE connection parameters? if (add_to_connect_list) { add_device_to_connect_list(address_with_type); if (is_direct) { direct_connections_.insert(address_with_type); } } if (!address_manager_registered) { Loading @@ -425,8 +432,13 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { return; } uint16_t le_scan_interval = 0x0060; uint16_t le_scan_window = 0x0030; uint16_t le_scan_interval = kScanIntervalSlow; uint16_t le_scan_window = kScanWindowSlow; // If there is any direct connection in the connection list, use the fast parameter if (!direct_connections_.empty()) { le_scan_interval = kScanIntervalFast; le_scan_window = kScanWindowFast; } InitiatorFilterPolicy initiator_filter_policy = InitiatorFilterPolicy::USE_CONNECT_LIST; OwnAddressType own_address_type = static_cast<OwnAddressType>(le_address_manager_->GetCurrentAddress().GetAddressType()); Loading Loading @@ -487,6 +499,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { void remove_device_from_connect_list(AddressWithType address_with_type) { AddressType address_type = address_with_type.GetAddressType(); direct_connections_.erase(address_with_type); if (!address_manager_registered) { le_address_manager_->Register(this); address_manager_registered = true; Loading Loading @@ -620,7 +633,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { void OnResume() override { pause_connection = false; if (!canceled_connections_.empty()) { create_le_connection(*canceled_connections_.begin(), false); create_le_connection(*canceled_connections_.begin(), false, false); } canceled_connections_.clear(); le_address_manager_->AckResume(this); Loading Loading @@ -659,6 +672,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { std::map<uint16_t, le_acl_connection> le_acl_connections_; std::set<AddressWithType> connecting_le_; std::set<AddressWithType> canceled_connections_; std::set<AddressWithType> direct_connections_; bool address_manager_registered = false; bool ready_to_unregister = false; bool pause_connection = false; Loading
system/gd/hci/acl_manager_mock.h +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ class MockAclManager : public AclManager { MOCK_METHOD(void, RegisterCallbacks, (ConnectionCallbacks * callbacks, os::Handler* handler), (override)); MOCK_METHOD(void, RegisterLeCallbacks, (LeConnectionCallbacks * callbacks, os::Handler* handler), (override)); MOCK_METHOD(void, CreateConnection, (Address address), (override)); MOCK_METHOD(void, CreateLeConnection, (AddressWithType address_with_type), (override)); MOCK_METHOD(void, CreateLeConnection, (AddressWithType address_with_type, bool is_direct), (override)); MOCK_METHOD(void, CancelConnect, (Address address), (override)); MOCK_METHOD( void, Loading
system/gd/hci/acl_manager_test.cc +75 −7 Original line number Diff line number Diff line Loading @@ -44,6 +44,10 @@ using packet::PacketView; using packet::RawBuilder; constexpr std::chrono::seconds kTimeout = std::chrono::seconds(2); constexpr uint16_t kScanIntervalFast = 0x0060; constexpr uint16_t kScanWindowFast = 0x0030; constexpr uint16_t kScanIntervalSlow = 0x0800; constexpr uint16_t kScanWindowSlow = 0x0030; const AddressWithType empty_address_with_type = hci::AddressWithType(); PacketView<kLittleEndian> GetPacketView(std::unique_ptr<packet::BasePacketBuilder> packet) { Loading Loading @@ -593,7 +597,7 @@ class AclManagerWithLeConnectionTest : public AclManagerTest { remote_with_type_ = AddressWithType(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type_); acl_manager_->CreateLeConnection(remote_with_type_, true); test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); Loading Loading @@ -682,7 +686,7 @@ TEST_F(AclManagerWithLeConnectionTest, invoke_registered_callback_le_connection_ TEST_F(AclManagerTest, invoke_registered_callback_le_connection_complete_fail) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); Loading Loading @@ -724,7 +728,7 @@ TEST_F(AclManagerTest, invoke_registered_callback_le_connection_complete_fail) { TEST_F(AclManagerTest, cancel_le_connection) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); Loading Loading @@ -759,6 +763,70 @@ TEST_F(AclManagerTest, cancel_le_connection) { test_hci_layer_->IncomingEvent(LeRemoveDeviceFromConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); } TEST_F(AclManagerTest, create_connection_with_fast_mode) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); auto packet = test_hci_layer_->GetLastCommand(OpCode::LE_CREATE_CONNECTION); auto command_view = LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(AclCommandView::Create(packet))); ASSERT_TRUE(command_view.IsValid()); ASSERT_EQ(command_view.GetLeScanInterval(), kScanIntervalFast); ASSERT_EQ(command_view.GetLeScanWindow(), kScanWindowFast); test_hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); auto first_connection = GetLeConnectionFuture(); test_hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( ErrorCode::SUCCESS, 0x00, Role::PERIPHERAL, AddressType::PUBLIC_DEVICE_ADDRESS, remote, 0x0100, 0x0010, 0x0C80, ClockAccuracy::PPM_30)); test_hci_layer_->SetCommandFuture(); test_hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeRemoveDeviceFromConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); auto first_connection_status = first_connection.wait_for(kTimeout); ASSERT_EQ(first_connection_status, std::future_status::ready); } TEST_F(AclManagerTest, create_connection_with_slow_mode) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type, false); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); auto packet = test_hci_layer_->GetLastCommand(OpCode::LE_CREATE_CONNECTION); auto command_view = LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(AclCommandView::Create(packet))); ASSERT_TRUE(command_view.IsValid()); ASSERT_EQ(command_view.GetLeScanInterval(), kScanIntervalSlow); ASSERT_EQ(command_view.GetLeScanWindow(), kScanWindowSlow); test_hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); auto first_connection = GetLeConnectionFuture(); test_hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( ErrorCode::SUCCESS, 0x00, Role::PERIPHERAL, AddressType::PUBLIC_DEVICE_ADDRESS, remote, 0x0100, 0x0010, 0x0C80, ClockAccuracy::PPM_30)); test_hci_layer_->SetCommandFuture(); test_hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeRemoveDeviceFromConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); auto first_connection_status = first_connection.wait_for(kTimeout); ASSERT_EQ(first_connection_status, std::future_status::ready); } TEST_F(AclManagerWithLeConnectionTest, acl_send_data_one_le_connection) { ASSERT_EQ(connection_->GetRemoteAddress(), remote_with_type_); ASSERT_EQ(connection_->GetHandle(), handle_); Loading Loading @@ -1277,7 +1345,7 @@ class AclManagerWithResolvableAddressTest : public AclManagerNoCallbacksTest { TEST_F(AclManagerWithResolvableAddressTest, create_connection_cancel_fail) { auto remote_with_type_ = AddressWithType(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type_); acl_manager_->CreateLeConnection(remote_with_type_, true); // Set random address test_hci_layer_->GetLastCommand(OpCode::LE_SET_RANDOM_ADDRESS); Loading @@ -1302,7 +1370,7 @@ TEST_F(AclManagerWithResolvableAddressTest, create_connection_cancel_fail) { // create another connection test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type2); acl_manager_->CreateLeConnection(remote_with_type2, true); // cancel previous connection test_hci_layer_->GetLastCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); Loading Loading @@ -1383,7 +1451,7 @@ TEST_F(AclManagerLifeCycleTest, unregister_classic_before_connection_request) { TEST_F(AclManagerLifeCycleTest, unregister_le_before_connection_complete) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); Loading Loading @@ -1425,7 +1493,7 @@ TEST_F(AclManagerLifeCycleTest, unregister_le_before_connection_complete) { TEST_F(AclManagerLifeCycleTest, unregister_le_before_enhanced_connection_complete) { AddressWithType remote_with_type(remote, AddressType::PUBLIC_DEVICE_ADDRESS); test_hci_layer_->SetCommandFuture(); acl_manager_->CreateLeConnection(remote_with_type); acl_manager_->CreateLeConnection(remote_with_type, true); test_hci_layer_->GetLastCommand(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); Loading