From: Myles Watson Date: Tue, 17 Nov 2020 05:24:21 +0000 (-0800) Subject: Add AclCommands for LE and BR/EDR X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d8817d9c21bf21c924dfbad531bb72f78c9c0362;p=android-x86%2Fsystem-bt.git Add AclCommands for LE and BR/EDR Bug: 172725986 Test: atest bluetooth_test_gd Tag: #gd-refactor Change-Id: I822ce0751be08a98a30c219853e1540e2e461a08 --- diff --git a/gd/hci/acl_connection_interface.h b/gd/hci/acl_connection_interface.h index 5b2564bea..eb8b12bb5 100644 --- a/gd/hci/acl_connection_interface.h +++ b/gd/hci/acl_connection_interface.h @@ -40,7 +40,7 @@ constexpr EventCode AclConnectionEvents[] = { EventCode::LINK_SUPERVISION_TIMEOUT_CHANGED, }; -typedef CommandInterface AclConnectionInterface; +typedef CommandInterface AclConnectionInterface; } // namespace hci } // namespace bluetooth diff --git a/gd/hci/acl_manager_test.cc b/gd/hci/acl_manager_test.cc index a9de6a2eb..79e9e227a 100644 --- a/gd/hci/acl_manager_test.cc +++ b/gd/hci/acl_manager_test.cc @@ -156,11 +156,12 @@ class TestHciLayer : public HciLayer { EXPECT_NE(std::future_status::timeout, result); } if (command_queue_.empty()) { - return ConnectionManagementCommandView::Create( - CommandPacketView::Create(PacketView(std::make_shared>()))); + return ConnectionManagementCommandView::Create(AclCommandView::Create( + CommandPacketView::Create(PacketView(std::make_shared>())))); } CommandPacketView command_packet_view = GetLastCommand(); - ConnectionManagementCommandView command = ConnectionManagementCommandView::Create(command_packet_view); + ConnectionManagementCommandView command = + ConnectionManagementCommandView::Create(AclCommandView::Create(command_packet_view)); EXPECT_TRUE(command.IsValid()); EXPECT_EQ(command.GetOpCode(), op_code); @@ -176,11 +177,12 @@ class TestHciLayer : public HciLayer { EXPECT_NE(std::future_status::timeout, result); } if (command_queue_.empty()) { - return ConnectionManagementCommandView::Create( - CommandPacketView::Create(PacketView(std::make_shared>()))); + return ConnectionManagementCommandView::Create(AclCommandView::Create( + CommandPacketView::Create(PacketView(std::make_shared>())))); } CommandPacketView command_packet_view = GetLastCommand(); - ConnectionManagementCommandView command = ConnectionManagementCommandView::Create(command_packet_view); + ConnectionManagementCommandView command = + ConnectionManagementCommandView::Create(AclCommandView::Create(command_packet_view)); EXPECT_TRUE(command.IsValid()); EXPECT_EQ(command.GetOpCode(), op_code); @@ -582,7 +584,8 @@ class AclManagerWithLeConnectionTest : public AclManagerTest { test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); auto packet = test_hci_layer_->GetCommandPacket(OpCode::LE_CREATE_CONNECTION); - auto le_connection_management_command_view = LeConnectionManagementCommandView::Create(packet); + auto le_connection_management_command_view = + LeConnectionManagementCommandView::Create(AclCommandView::Create(packet)); auto command_view = LeCreateConnectionView::Create(le_connection_management_command_view); ASSERT_TRUE(command_view.IsValid()); if (use_connect_list_) { @@ -664,7 +667,8 @@ TEST_F(AclManagerTest, invoke_registered_callback_le_connection_complete_fail) { test_hci_layer_->IncomingEvent(LeAddDeviceToConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); test_hci_layer_->SetCommandFuture(); auto packet = test_hci_layer_->GetLastCommandPacket(OpCode::LE_CREATE_CONNECTION); - auto le_connection_management_command_view = LeConnectionManagementCommandView::Create(packet); + auto le_connection_management_command_view = + LeConnectionManagementCommandView::Create(AclCommandView::Create(packet)); auto command_view = LeCreateConnectionView::Create(le_connection_management_command_view); ASSERT_TRUE(command_view.IsValid()); if (use_connect_list_) { @@ -691,7 +695,7 @@ TEST_F(AclManagerTest, invoke_registered_callback_le_connection_complete_fail) { test_hci_layer_->SetCommandFuture(); packet = test_hci_layer_->GetLastCommandPacket(OpCode::LE_REMOVE_DEVICE_FROM_CONNECT_LIST); - le_connection_management_command_view = LeConnectionManagementCommandView::Create(packet); + le_connection_management_command_view = LeConnectionManagementCommandView::Create(AclCommandView::Create(packet)); auto remove_command_view = LeRemoveDeviceFromConnectListView::Create(le_connection_management_command_view); ASSERT_TRUE(remove_command_view.IsValid()); test_hci_layer_->IncomingEvent(LeRemoveDeviceFromConnectListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); @@ -709,7 +713,8 @@ TEST_F(AclManagerTest, cancel_le_connection) { test_hci_layer_->SetCommandFuture(); acl_manager_->CancelLeConnect(remote_with_type); auto packet = test_hci_layer_->GetLastCommandPacket(OpCode::LE_CREATE_CONNECTION_CANCEL); - auto le_connection_management_command_view = LeConnectionManagementCommandView::Create(packet); + auto le_connection_management_command_view = + LeConnectionManagementCommandView::Create(AclCommandView::Create(packet)); auto command_view = LeCreateConnectionCancelView::Create(le_connection_management_command_view); ASSERT_TRUE(command_view.IsValid()); @@ -727,7 +732,7 @@ TEST_F(AclManagerTest, cancel_le_connection) { test_hci_layer_->SetCommandFuture(); packet = test_hci_layer_->GetLastCommandPacket(OpCode::LE_REMOVE_DEVICE_FROM_CONNECT_LIST); - le_connection_management_command_view = LeConnectionManagementCommandView::Create(packet); + le_connection_management_command_view = LeConnectionManagementCommandView::Create(AclCommandView::Create(packet)); auto remove_command_view = LeRemoveDeviceFromConnectListView::Create(le_connection_management_command_view); ASSERT_TRUE(remove_command_view.IsValid()); @@ -776,7 +781,8 @@ TEST_F(AclManagerWithLeConnectionTest, invoke_registered_callback_le_connection_ connection_->LeConnectionUpdate(connection_interval_min, connection_interval_max, connection_latency, supervision_timeout, 0x10, 0x20); auto update_packet = test_hci_layer_->GetCommandPacket(OpCode::LE_CONNECTION_UPDATE); - auto update_view = LeConnectionUpdateView::Create(LeConnectionManagementCommandView::Create(update_packet)); + auto update_view = + LeConnectionUpdateView::Create(LeConnectionManagementCommandView::Create(AclCommandView::Create(update_packet))); ASSERT_TRUE(update_view.IsValid()); EXPECT_EQ(update_view.GetConnectionHandle(), handle_); EXPECT_CALL(mock_le_connection_management_callbacks_, diff --git a/gd/hci/facade/acl_manager_facade.cc b/gd/hci/facade/acl_manager_facade.cc index 3daa03706..1e0df842d 100644 --- a/gd/hci/facade/acl_manager_facade.cc +++ b/gd/hci/facade/acl_manager_facade.cc @@ -114,8 +114,9 @@ class AclManagerFacadeService : public AclManagerFacade::Service, public Connect ::grpc::ServerContext* context, const ConnectionCommandMsg* request, ::google::protobuf::Empty* response) override { - auto command_view = ConnectionManagementCommandView::Create(CommandPacketView::Create(PacketView( - std::make_shared>(request->packet().begin(), request->packet().end())))); + auto command_view = ConnectionManagementCommandView::Create( + AclCommandView::Create(CommandPacketView::Create(PacketView( + std::make_shared>(request->packet().begin(), request->packet().end()))))); if (!command_view.IsValid()) { return ::grpc::Status(::grpc::StatusCode::INVALID_ARGUMENT, "Invalid command packet"); } diff --git a/gd/hci/facade/le_acl_manager_facade.cc b/gd/hci/facade/le_acl_manager_facade.cc index d86b377be..7806b4a69 100644 --- a/gd/hci/facade/le_acl_manager_facade.cc +++ b/gd/hci/facade/le_acl_manager_facade.cc @@ -120,8 +120,9 @@ class LeAclManagerFacadeService : public LeAclManagerFacade::Service, public LeC ::grpc::ServerContext* context, const LeConnectionCommandMsg* request, ::google::protobuf::Empty* response) override { - auto command_view = ConnectionManagementCommandView::Create(CommandPacketView::Create(PacketView( - std::make_shared>(request->packet().begin(), request->packet().end())))); + auto command_view = ConnectionManagementCommandView::Create( + AclCommandView::Create(CommandPacketView::Create(PacketView( + std::make_shared>(request->packet().begin(), request->packet().end()))))); if (!command_view.IsValid()) { return ::grpc::Status(::grpc::StatusCode::INVALID_ARGUMENT, "Invalid command packet"); } diff --git a/gd/hci/fuzz/fuzz_hci_layer.h b/gd/hci/fuzz/fuzz_hci_layer.h index c76956f18..19d7c0584 100644 --- a/gd/hci/fuzz/fuzz_hci_layer.h +++ b/gd/hci/fuzz/fuzz_hci_layer.h @@ -155,8 +155,8 @@ class FuzzHciLayer : public HciLayer { os::fuzz::DevNullQueue* acl_dev_null_; os::fuzz::FuzzInjectQueue* acl_inject_; - FuzzCommandInterface acl_connection_interface_{}; - FuzzCommandInterface le_acl_connection_interface_{}; + FuzzCommandInterface acl_connection_interface_{}; + FuzzCommandInterface le_acl_connection_interface_{}; FuzzCommandInterface security_interface_{}; FuzzCommandInterface le_security_interface_{}; FuzzCommandInterface le_advertising_interface_{}; diff --git a/gd/hci/fuzz/hci_layer_fuzz_client.cc b/gd/hci/fuzz/hci_layer_fuzz_client.cc index 607e7b519..ca58030a8 100644 --- a/gd/hci/fuzz/hci_layer_fuzz_client.cc +++ b/gd/hci/fuzz/hci_layer_fuzz_client.cc @@ -104,12 +104,11 @@ void HciLayerFuzzClient::injectLeSecurityCommand(std::vector data) { } void HciLayerFuzzClient::injectAclConnectionCommand(std::vector data) { - inject_command(data, acl_connection_interface_); + inject_command(data, acl_connection_interface_); } void HciLayerFuzzClient::injectLeAclConnectionCommand(std::vector data) { - inject_command(data, - le_acl_connection_interface_); + inject_command(data, le_acl_connection_interface_); } void HciLayerFuzzClient::injectLeAdvertisingCommand(std::vector data) { diff --git a/gd/hci/hci_layer.cc b/gd/hci/hci_layer.cc index b187c213a..176177763 100644 --- a/gd/hci/hci_layer.cc +++ b/gd/hci/hci_layer.cc @@ -338,7 +338,7 @@ void HciLayer::on_read_remote_version_complete(EventPacketView event_view) { if (view.GetStatus() != ErrorCode::SUCCESS) { auto status = view.GetStatus(); std::string error_code = ErrorCodeText(status); - LOG_ERROR("Received on_read_remote_version_information_complete with error code %s", error_code.c_str()); + LOG_ERROR("Received with error code %s", error_code.c_str()); return; } uint16_t handle = view.GetConnectionHandle(); diff --git a/gd/hci/hci_layer.h b/gd/hci/hci_layer.h index 462c3d6b8..d8a187560 100644 --- a/gd/hci/hci_layer.h +++ b/gd/hci/hci_layer.h @@ -132,8 +132,8 @@ class HciLayer : public Module, public CommandInterface { void on_read_remote_version_complete(EventPacketView event_view); // Interfaces - CommandInterfaceImpl acl_connection_manager_interface_{*this}; - CommandInterfaceImpl le_acl_connection_manager_interface_{*this}; + CommandInterfaceImpl acl_connection_manager_interface_{*this}; + CommandInterfaceImpl le_acl_connection_manager_interface_{*this}; CommandInterfaceImpl security_interface{*this}; CommandInterfaceImpl le_security_interface{*this}; CommandInterfaceImpl le_advertising_interface{*this}; diff --git a/gd/hci/hci_layer_test.cc b/gd/hci/hci_layer_test.cc index f21a64bb6..e3c45ad30 100644 --- a/gd/hci/hci_layer_test.cc +++ b/gd/hci/hci_layer_test.cc @@ -586,8 +586,8 @@ TEST_F(HciTest, createConnectionTest) { // Check the command auto sent_command = hal->GetSentCommand(); ASSERT_LT(0, sent_command.size()); - CreateConnectionView view = - CreateConnectionView::Create(ConnectionManagementCommandView::Create(CommandPacketView::Create(sent_command))); + CreateConnectionView view = CreateConnectionView::Create( + ConnectionManagementCommandView::Create(AclCommandView::Create(CommandPacketView::Create(sent_command)))); ASSERT_TRUE(view.IsValid()); ASSERT_EQ(bd_addr, view.GetBdAddr()); ASSERT_EQ(packet_type, view.GetPacketType()); diff --git a/gd/hci/hci_packets.pdl b/gd/hci/hci_packets.pdl index 58cf8a781..bdf482a26 100644 --- a/gd/hci/hci_packets.pdl +++ b/gd/hci/hci_packets.pdl @@ -621,12 +621,13 @@ packet CommandPacket { // Packets for interfaces packet DiscoveryCommand : CommandPacket { _payload_, } -packet ConnectionManagementCommand : CommandPacket { _payload_, } +packet AclCommand : CommandPacket { _payload_, } +packet ConnectionManagementCommand : AclCommand { _payload_, } packet SecurityCommand : CommandPacket { _payload_, } packet ScoConnectionCommand : CommandPacket { _payload_, } packet LeAdvertisingCommand : CommandPacket { _payload_, } packet LeScanningCommand : CommandPacket { _payload_, } -packet LeConnectionManagementCommand : CommandPacket { _payload_, } +packet LeConnectionManagementCommand : AclCommand { _payload_, } packet LeSecurityCommand : CommandPacket { _payload_, } packet VendorCommand : CommandPacket { _payload_, } @@ -888,7 +889,7 @@ enum DisconnectReason : 8 { UNACCEPTABLE_CONNECTION_PARAMETERS = 0x3B, } -packet Disconnect : ConnectionManagementCommand (op_code = DISCONNECT) { +packet Disconnect : AclCommand (op_code = DISCONNECT) { connection_handle : 12, _reserved_ : 4, reason : DisconnectReason, @@ -1055,7 +1056,7 @@ packet ReadRemoteExtendedFeatures : ConnectionManagementCommand (op_code = READ_ packet ReadRemoteExtendedFeaturesStatus : CommandStatus (command_op_code = READ_REMOTE_EXTENDED_FEATURES) { } -packet ReadRemoteVersionInformation : ConnectionManagementCommand (op_code = READ_REMOTE_VERSION_INFORMATION) { +packet ReadRemoteVersionInformation : AclCommand (op_code = READ_REMOTE_VERSION_INFORMATION) { connection_handle : 12, _reserved_ : 4, } @@ -2301,7 +2302,7 @@ packet ReadLinkQualityComplete : CommandComplete (command_op_code = READ_LINK_QU link_quality : 8, } -packet ReadRssi : ConnectionManagementCommand (op_code = READ_RSSI) { +packet ReadRssi : AclCommand (op_code = READ_RSSI) { connection_handle : 12, _reserved_ : 4, } diff --git a/gd/hci/hci_packets_test.cc b/gd/hci/hci_packets_test.cc index 5379af7a6..589dca50c 100644 --- a/gd/hci/hci_packets_test.cc +++ b/gd/hci/hci_packets_test.cc @@ -429,7 +429,7 @@ TEST(HciPacketsTest, testLeExtendedCreateConnection) { std::make_shared>(le_extended_create_connection); PacketView packet_bytes_view(packet_bytes); auto view = LeExtendedCreateConnectionView::Create( - LeConnectionManagementCommandView::Create(CommandPacketView::Create(packet_bytes_view))); + LeConnectionManagementCommandView::Create(AclCommandView::Create(CommandPacketView::Create(packet_bytes_view)))); ASSERT_TRUE(view.IsValid()); } diff --git a/gd/hci/le_acl_connection_interface.h b/gd/hci/le_acl_connection_interface.h index 08ec6d007..8f1a9487d 100644 --- a/gd/hci/le_acl_connection_interface.h +++ b/gd/hci/le_acl_connection_interface.h @@ -31,7 +31,7 @@ constexpr SubeventCode LeConnectionManagementEvents[] = { SubeventCode::REMOTE_CONNECTION_PARAMETER_REQUEST, }; -typedef CommandInterface LeAclConnectionInterface; +typedef CommandInterface LeAclConnectionInterface; } // namespace hci } // namespace bluetooth diff --git a/gd/hci/le_address_manager_test.cc b/gd/hci/le_address_manager_test.cc index 9f2ff4291..bb2ea289b 100644 --- a/gd/hci/le_address_manager_test.cc +++ b/gd/hci/le_address_manager_test.cc @@ -324,7 +324,8 @@ TEST_F(LeAddressManagerWithSingleClientTest, add_device_to_connect_list) { test_hci_layer_->SetCommandFuture(); le_address_manager_->AddDeviceToConnectList(ConnectListAddressType::RANDOM, address); auto packet = test_hci_layer_->GetCommandPacket(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); - auto packet_view = LeAddDeviceToConnectListView::Create(LeConnectionManagementCommandView::Create(packet)); + auto packet_view = + LeAddDeviceToConnectListView::Create(LeConnectionManagementCommandView::Create(AclCommandView::Create(packet))); ASSERT_TRUE(packet_view.IsValid()); ASSERT_EQ(ConnectListAddressType::RANDOM, packet_view.GetAddressType()); ASSERT_EQ(address, packet_view.GetAddress()); @@ -344,7 +345,8 @@ TEST_F(LeAddressManagerWithSingleClientTest, remove_device_from_connect_list) { test_hci_layer_->SetCommandFuture(); le_address_manager_->RemoveDeviceFromConnectList(ConnectListAddressType::RANDOM, address); auto packet = test_hci_layer_->GetCommandPacket(OpCode::LE_REMOVE_DEVICE_FROM_CONNECT_LIST); - auto packet_view = LeRemoveDeviceFromConnectListView::Create(LeConnectionManagementCommandView::Create(packet)); + auto packet_view = LeRemoveDeviceFromConnectListView::Create( + LeConnectionManagementCommandView::Create(AclCommandView::Create(packet))); ASSERT_TRUE(packet_view.IsValid()); ASSERT_EQ(ConnectListAddressType::RANDOM, packet_view.GetAddressType()); ASSERT_EQ(address, packet_view.GetAddress()); @@ -435,7 +437,8 @@ TEST_F(LeAddressManagerWithSingleClientTest, register_during_command_complete) { test_hci_layer_->SetCommandFuture(); le_address_manager_->AddDeviceToConnectList(ConnectListAddressType::RANDOM, address); auto packet = test_hci_layer_->GetCommandPacket(OpCode::LE_ADD_DEVICE_TO_CONNECT_LIST); - auto packet_view = LeAddDeviceToConnectListView::Create(LeConnectionManagementCommandView::Create(packet)); + auto packet_view = + LeAddDeviceToConnectListView::Create(LeConnectionManagementCommandView::Create(AclCommandView::Create(packet))); ASSERT_TRUE(packet_view.IsValid()); ASSERT_EQ(ConnectListAddressType::RANDOM, packet_view.GetAddressType()); ASSERT_EQ(address, packet_view.GetAddress()); diff --git a/gd/hci/le_advertising_manager_test.cc b/gd/hci/le_advertising_manager_test.cc index dc76ecd47..4a4e2b8f1 100644 --- a/gd/hci/le_advertising_manager_test.cc +++ b/gd/hci/le_advertising_manager_test.cc @@ -128,12 +128,12 @@ class TestHciLayer : public HciLayer { ConnectionManagementCommandView GetCommandPacket(OpCode op_code) { if (command_queue_.empty()) { - return ConnectionManagementCommandView::Create( - CommandPacketView::Create(PacketView(std::make_shared>()))); + return ConnectionManagementCommandView::Create(AclCommandView::Create( + CommandPacketView::Create(PacketView(std::make_shared>())))); } CommandPacketView command_packet_view = CommandPacketView::Create(command_queue_.front()); command_queue_.pop_front(); - ConnectionManagementCommandView command = ConnectionManagementCommandView::Create(command_packet_view); + auto command = ConnectionManagementCommandView::Create(AclCommandView::Create(command_packet_view)); EXPECT_TRUE(command.IsValid()); EXPECT_EQ(command.GetOpCode(), op_code); @@ -409,7 +409,7 @@ class LeExtendedAdvertisingAPITest : public LeExtendedAdvertisingManagerTest { for (size_t i = 0; i < adv_opcodes.size(); i++) { auto packet_view = test_hci_layer_->GetCommandPacket(adv_opcodes[i]); CommandPacketView command_packet_view = CommandPacketView::Create(packet_view); - ConnectionManagementCommandView command = ConnectionManagementCommandView::Create(command_packet_view); + auto command = ConnectionManagementCommandView::Create(AclCommandView::Create(command_packet_view)); if (adv_opcodes[i] == OpCode::LE_SET_EXTENDED_ADVERTISING_PARAMETERS) { test_hci_layer_->IncomingEvent(LeSetExtendedAdvertisingParametersCompleteBuilder::Create( uint8_t{1}, ErrorCode::SUCCESS, static_cast(-23))); @@ -464,7 +464,7 @@ TEST_F(LeAdvertisingManagerTest, create_advertiser_test) { for (size_t i = 0; i < adv_opcodes.size(); i++) { auto packet_view = test_hci_layer_->GetCommandPacket(adv_opcodes[i]); CommandPacketView command_packet_view = CommandPacketView::Create(packet_view); - ConnectionManagementCommandView command = ConnectionManagementCommandView::Create(command_packet_view); + auto command = ConnectionManagementCommandView::Create(AclCommandView::Create(command_packet_view)); test_hci_layer_->IncomingEvent( CommandCompleteBuilder::Create(uint8_t{1}, adv_opcodes[i], std::make_unique(success_vector))); } @@ -555,7 +555,7 @@ TEST_F(LeExtendedAdvertisingManagerTest, create_advertiser_test) { for (size_t i = 0; i < adv_opcodes.size(); i++) { auto packet_view = test_hci_layer_->GetCommandPacket(adv_opcodes[i]); CommandPacketView command_packet_view = CommandPacketView::Create(packet_view); - ConnectionManagementCommandView command = ConnectionManagementCommandView::Create(command_packet_view); + auto command = ConnectionManagementCommandView::Create(AclCommandView::Create(command_packet_view)); if (adv_opcodes[i] == OpCode::LE_SET_EXTENDED_ADVERTISING_PARAMETERS) { test_hci_layer_->IncomingEvent(LeSetExtendedAdvertisingParametersCompleteBuilder::Create( uint8_t{1}, ErrorCode::SUCCESS, static_cast(-23))); diff --git a/gd/hci/le_scanning_manager_test.cc b/gd/hci/le_scanning_manager_test.cc index 6d75ed138..4e5201487 100644 --- a/gd/hci/le_scanning_manager_test.cc +++ b/gd/hci/le_scanning_manager_test.cc @@ -106,7 +106,7 @@ class TestHciLayer : public HciLayer { ConnectionManagementCommandView GetCommandPacket(OpCode op_code) { CommandPacketView command_packet_view = GetLastCommand(); - ConnectionManagementCommandView command = ConnectionManagementCommandView::Create(command_packet_view); + auto command = ConnectionManagementCommandView::Create(AclCommandView::Create(command_packet_view)); EXPECT_TRUE(command.IsValid()); EXPECT_EQ(command.GetOpCode(), op_code); return command; diff --git a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc index 537a58dd4..53c4fe968 100644 --- a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +++ b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc @@ -285,7 +285,8 @@ DualModeController::DualModeController(const std::string& properties_filename, u void DualModeController::SniffSubrating(CommandPacketView command) { auto command_view = gd_hci::SniffSubratingView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); send_event_(gd_hci::SniffSubratingCompleteBuilder::Create( @@ -487,7 +488,8 @@ void DualModeController::ReadLocalVersionInformation( void DualModeController::ReadRemoteVersionInformation( CommandPacketView command) { auto command_view = gd_hci::ReadRemoteVersionInformationView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); auto status = link_layer_controller_.SendCommandToRemoteByHandle( @@ -563,7 +565,8 @@ void DualModeController::ReadLocalExtendedFeatures(CommandPacketView command) { void DualModeController::ReadRemoteExtendedFeatures(CommandPacketView command) { auto command_view = gd_hci::ReadRemoteExtendedFeaturesView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); auto status = link_layer_controller_.SendCommandToRemoteByHandle( @@ -577,7 +580,8 @@ void DualModeController::ReadRemoteExtendedFeatures(CommandPacketView command) { void DualModeController::SwitchRole(CommandPacketView command) { auto command_view = gd_hci::SwitchRoleView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); auto status = link_layer_controller_.SwitchRole( @@ -591,7 +595,8 @@ void DualModeController::SwitchRole(CommandPacketView command) { void DualModeController::ReadRemoteSupportedFeatures( CommandPacketView command) { auto command_view = gd_hci::ReadRemoteSupportedFeaturesView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); auto status = link_layer_controller_.SendCommandToRemoteByHandle( @@ -606,7 +611,8 @@ void DualModeController::ReadRemoteSupportedFeatures( void DualModeController::ReadClockOffset(CommandPacketView command) { auto command_view = gd_hci::ReadClockOffsetView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); @@ -841,7 +847,8 @@ void DualModeController::WriteSimplePairingMode(CommandPacketView command) { void DualModeController::ChangeConnectionPacketType(CommandPacketView command) { auto command_view = gd_hci::ChangeConnectionPacketTypeView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); @@ -944,7 +951,8 @@ void DualModeController::WriteInquiryScanType(CommandPacketView command) { void DualModeController::AuthenticationRequested(CommandPacketView command) { auto command_view = gd_hci::AuthenticationRequestedView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); auto status = link_layer_controller_.AuthenticationRequested(handle); @@ -956,7 +964,8 @@ void DualModeController::AuthenticationRequested(CommandPacketView command) { void DualModeController::SetConnectionEncryption(CommandPacketView command) { auto command_view = gd_hci::SetConnectionEncryptionView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); uint8_t encryption_enable = @@ -971,7 +980,8 @@ void DualModeController::SetConnectionEncryption(CommandPacketView command) { void DualModeController::ChangeConnectionLinkKey(CommandPacketView command) { auto command_view = gd_hci::ChangeConnectionLinkKeyView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); @@ -984,7 +994,8 @@ void DualModeController::ChangeConnectionLinkKey(CommandPacketView command) { void DualModeController::CentralLinkKey(CommandPacketView command) { auto command_view = gd_hci::CentralLinkKeyView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint8_t key_flag = static_cast(command_view.GetKeyFlag()); @@ -1050,7 +1061,8 @@ void DualModeController::WritePageTimeout(CommandPacketView command) { void DualModeController::HoldMode(CommandPacketView command) { auto command_view = gd_hci::HoldModeView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); uint16_t hold_mode_max_interval = command_view.GetHoldModeMaxInterval(); @@ -1066,7 +1078,8 @@ void DualModeController::HoldMode(CommandPacketView command) { void DualModeController::SniffMode(CommandPacketView command) { auto command_view = gd_hci::SniffModeView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); uint16_t sniff_max_interval = command_view.GetSniffMaxInterval(); @@ -1085,7 +1098,8 @@ void DualModeController::SniffMode(CommandPacketView command) { void DualModeController::ExitSniffMode(CommandPacketView command) { auto command_view = gd_hci::ExitSniffModeView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); auto status = @@ -1098,7 +1112,8 @@ void DualModeController::ExitSniffMode(CommandPacketView command) { void DualModeController::QosSetup(CommandPacketView command) { auto command_view = gd_hci::QosSetupView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); uint8_t service_type = static_cast(command_view.GetServiceType()); @@ -1119,7 +1134,8 @@ void DualModeController::QosSetup(CommandPacketView command) { void DualModeController::ReadDefaultLinkPolicySettings( CommandPacketView command) { auto command_view = gd_hci::ReadDefaultLinkPolicySettingsView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t settings = link_layer_controller_.ReadDefaultLinkPolicySettings(); auto packet = @@ -1131,7 +1147,8 @@ void DualModeController::ReadDefaultLinkPolicySettings( void DualModeController::WriteDefaultLinkPolicySettings( CommandPacketView command) { auto command_view = gd_hci::WriteDefaultLinkPolicySettingsView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); ErrorCode status = link_layer_controller_.WriteDefaultLinkPolicySettings( command_view.GetDefaultLinkPolicySettings()); @@ -1143,7 +1160,8 @@ void DualModeController::WriteDefaultLinkPolicySettings( void DualModeController::FlowSpecification(CommandPacketView command) { auto command_view = gd_hci::FlowSpecificationView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); uint8_t flow_direction = @@ -1165,7 +1183,8 @@ void DualModeController::FlowSpecification(CommandPacketView command) { void DualModeController::WriteLinkPolicySettings(CommandPacketView command) { auto command_view = gd_hci::WriteLinkPolicySettingsView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); @@ -1182,7 +1201,8 @@ void DualModeController::WriteLinkPolicySettings(CommandPacketView command) { void DualModeController::WriteLinkSupervisionTimeout( CommandPacketView command) { auto command_view = gd_hci::WriteLinkSupervisionTimeoutView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); @@ -1393,7 +1413,8 @@ void DualModeController::InquiryCancel(CommandPacketView command) { void DualModeController::AcceptConnectionRequest(CommandPacketView command) { auto command_view = gd_hci::AcceptConnectionRequestView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); Address addr = command_view.GetBdAddr(); bool try_role_switch = command_view.GetRole() == @@ -1407,7 +1428,8 @@ void DualModeController::AcceptConnectionRequest(CommandPacketView command) { void DualModeController::RejectConnectionRequest(CommandPacketView command) { auto command_view = gd_hci::RejectConnectionRequestView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); Address addr = command_view.GetBdAddr(); uint8_t reason = static_cast(command_view.GetReason()); @@ -1619,7 +1641,8 @@ void DualModeController::LeSetScanEnable(CommandPacketView command) { void DualModeController::LeCreateConnection(CommandPacketView command) { auto command_view = gd_hci::LeCreateConnectionView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); link_layer_controller_.SetLeScanInterval(command_view.GetLeScanInterval()); link_layer_controller_.SetLeScanWindow(command_view.GetLeScanWindow()); @@ -1656,7 +1679,8 @@ void DualModeController::LeCreateConnection(CommandPacketView command) { void DualModeController::LeConnectionUpdate(CommandPacketView command) { auto command_view = gd_hci::LeConnectionUpdateView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); ErrorCode status = link_layer_controller_.LeConnectionUpdate(command_view); @@ -1667,7 +1691,8 @@ void DualModeController::LeConnectionUpdate(CommandPacketView command) { void DualModeController::CreateConnection(CommandPacketView command) { auto command_view = gd_hci::CreateConnectionView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); Address address = command_view.GetBdAddr(); @@ -1691,7 +1716,8 @@ void DualModeController::CreateConnection(CommandPacketView command) { void DualModeController::CreateConnectionCancel(CommandPacketView command) { auto command_view = gd_hci::CreateConnectionCancelView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); Address address = command_view.GetBdAddr(); @@ -1705,7 +1731,8 @@ void DualModeController::CreateConnectionCancel(CommandPacketView command) { void DualModeController::Disconnect(CommandPacketView command) { auto command_view = gd_hci::DisconnectView::Create( - gd_hci::ConnectionManagementCommandView::Create(command)); + gd_hci::ConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle(); @@ -1720,7 +1747,8 @@ void DualModeController::Disconnect(CommandPacketView command) { void DualModeController::LeConnectionCancel(CommandPacketView command) { auto command_view = gd_hci::LeCreateConnectionCancelView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); ErrorCode status = link_layer_controller_.SetLeConnect(false); send_event_(bluetooth::hci::LeCreateConnectionCancelCompleteBuilder::Create( @@ -1729,7 +1757,8 @@ void DualModeController::LeConnectionCancel(CommandPacketView command) { void DualModeController::LeReadConnectListSize(CommandPacketView command) { auto command_view = gd_hci::LeReadConnectListSizeView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); auto packet = bluetooth::hci::LeReadConnectListSizeCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS, @@ -1739,7 +1768,8 @@ void DualModeController::LeReadConnectListSize(CommandPacketView command) { void DualModeController::LeClearConnectList(CommandPacketView command) { auto command_view = gd_hci::LeClearConnectListView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); link_layer_controller_.LeConnectListClear(); auto packet = bluetooth::hci::LeClearConnectListCompleteBuilder::Create( @@ -1749,7 +1779,8 @@ void DualModeController::LeClearConnectList(CommandPacketView command) { void DualModeController::LeAddDeviceToConnectList(CommandPacketView command) { auto command_view = gd_hci::LeAddDeviceToConnectListView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); if (link_layer_controller_.LeConnectListFull()) { @@ -1770,7 +1801,8 @@ void DualModeController::LeAddDeviceToConnectList(CommandPacketView command) { void DualModeController::LeRemoveDeviceFromConnectList( CommandPacketView command) { auto command_view = gd_hci::LeRemoveDeviceFromConnectListView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint8_t addr_type = static_cast(command_view.GetAddressType()); @@ -1817,7 +1849,8 @@ void DualModeController::LeReadMaximumDataLength(CommandPacketView command) { void DualModeController::LeReadSuggestedDefaultDataLength(CommandPacketView command) { auto command_view = gd_hci::LeReadSuggestedDefaultDataLengthView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); send_event_(bluetooth::hci::LeReadSuggestedDefaultDataLengthCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS, kLeMaximumDataLength, kLeMaximumDataTime)); @@ -1910,7 +1943,8 @@ void DualModeController::LeSetExtendedScanEnable(CommandPacketView command) { void DualModeController::LeExtendedCreateConnection(CommandPacketView command) { auto command_view = gd_hci::LeExtendedCreateConnectionView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); ASSERT_LOG(command_view.GetInitiatingPhys() == 1, "Only LE_1M is supported"); auto params = command_view.GetPhyScanParameters(); @@ -2089,7 +2123,8 @@ void DualModeController::LeRemoveIsoDataPath(CommandPacketView command) { void DualModeController::LeReadRemoteFeatures(CommandPacketView command) { auto command_view = gd_hci::LeReadRemoteFeaturesView::Create( - gd_hci::LeConnectionManagementCommandView::Create(command)); + gd_hci::LeConnectionManagementCommandView::Create( + gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint16_t handle = command_view.GetConnectionHandle();