Loading tools/rootcanal/model/controller/acl_connection.cc +13 −4 Original line number Diff line number Diff line Loading @@ -17,9 +17,14 @@ #include "acl_connection.h" namespace rootcanal { AclConnection::AclConnection(AddressWithType addr, AddressWithType own_addr, AclConnection::AclConnection(AddressWithType address, AddressWithType own_address, AddressWithType resolved_address, Phy::Type phy_type) : address_(addr), own_address_(own_addr), type_(phy_type) {} : address_(address), own_address_(own_address), resolved_address_(resolved_address), type_(phy_type) {} void AclConnection::Encrypt() { encrypted_ = true; }; Loading @@ -31,8 +36,12 @@ void AclConnection::SetAddress(AddressWithType address) { address_ = address; } AddressWithType AclConnection::GetOwnAddress() const { return own_address_; } void AclConnection::SetOwnAddress(AddressWithType own_addr) { own_address_ = own_addr; AddressWithType AclConnection::GetResolvedAddress() const { return resolved_address_; } void AclConnection::SetOwnAddress(AddressWithType address) { own_address_ = address; } Phy::Type AclConnection::GetPhyType() const { return type_; } Loading tools/rootcanal/model/controller/acl_connection.h +6 −3 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ using ::bluetooth::hci::AddressWithType; // Model the connection of a device to the controller. class AclConnection { public: AclConnection(AddressWithType addr, AddressWithType own_addr, Phy::Type phy_type); AclConnection(AddressWithType address, AddressWithType own_address, AddressWithType resolved_address, Phy::Type phy_type); virtual ~AclConnection() = default; Loading @@ -43,13 +43,16 @@ class AclConnection { AddressWithType GetOwnAddress() const; void SetOwnAddress(AddressWithType own_addr); void SetOwnAddress(AddressWithType address); AddressWithType GetResolvedAddress() const; Phy::Type GetPhyType() const; private: AddressWithType address_; AddressWithType own_address_; AddressWithType resolved_address_; Phy::Type type_{Phy::Type::BR_EDR}; // State variables Loading tools/rootcanal/model/controller/acl_connection_handler.cc +29 −20 Original line number Diff line number Diff line Loading @@ -70,27 +70,35 @@ bool AclConnectionHandler::CancelPendingConnection(Address addr) { } classic_connection_pending_ = false; pending_connection_address_ = Address::kEmpty; pending_le_connection_resolved_address_ = AddressWithType(); return true; } bool AclConnectionHandler::CreatePendingLeConnection(AddressWithType addr) { bool device_connected = false; bool AclConnectionHandler::CreatePendingLeConnection( AddressWithType peer, AddressWithType resolved_peer, AddressWithType local_address) { for (auto pair : acl_connections_) { auto connection = std::get<AclConnection>(pair); if (connection.GetAddress() == addr) { device_connected = true; if (connection.GetAddress() == peer || connection.GetResolvedAddress() == resolved_peer) { LOG_INFO("%s: %s is already connected", __func__, peer.ToString().c_str()); if (connection.GetResolvedAddress() == resolved_peer) { LOG_INFO("%s: allowing a second connection with %s", __func__, resolved_peer.ToString().c_str()); } else { return false; } } if (device_connected) { LOG_INFO("%s: %s is already connected", __func__, addr.ToString().c_str()); return false; } if (le_connection_pending_) { LOG_INFO("%s: connection already pending", __func__); return false; } le_connection_pending_ = true; pending_le_connection_address_ = addr; pending_le_connection_address_ = peer; pending_le_connection_own_address_ = local_address; pending_le_connection_resolved_address_ = resolved_peer; return true; } Loading @@ -105,6 +113,8 @@ bool AclConnectionHandler::CancelPendingLeConnection(AddressWithType addr) { le_connection_pending_ = false; pending_le_connection_address_ = AddressWithType{Address::kEmpty, AddressType::PUBLIC_DEVICE_ADDRESS}; pending_le_connection_resolved_address_ = AddressWithType{Address::kEmpty, AddressType::PUBLIC_DEVICE_ADDRESS}; return true; } Loading @@ -117,7 +127,7 @@ uint16_t AclConnectionHandler::CreateConnection(Address addr, AclConnection{ AddressWithType{addr, AddressType::PUBLIC_DEVICE_ADDRESS}, AddressWithType{own_addr, AddressType::PUBLIC_DEVICE_ADDRESS}, Phy::Type::BR_EDR}); AddressWithType(), Phy::Type::BR_EDR}); return handle; } return kReservedHandle; Loading @@ -125,10 +135,12 @@ uint16_t AclConnectionHandler::CreateConnection(Address addr, uint16_t AclConnectionHandler::CreateLeConnection(AddressWithType addr, AddressWithType own_addr) { AddressWithType resolved_peer = pending_le_connection_resolved_address_; if (CancelPendingLeConnection(addr)) { uint16_t handle = GetUnusedHandle(); acl_connections_.emplace( handle, AclConnection{addr, own_addr, Phy::Type::LOW_ENERGY}); handle, AclConnection{addr, own_addr, resolved_peer, Phy::Type::LOW_ENERGY}); return handle; } return kReservedHandle; Loading Loading @@ -184,6 +196,12 @@ AddressWithType AclConnectionHandler::GetOwnAddress(uint16_t handle) const { return acl_connections_.at(handle).GetOwnAddress(); } AddressWithType AclConnectionHandler::GetResolvedAddress( uint16_t handle) const { ASSERT_LOG(HasHandle(handle), "Unknown handle %hd", handle); return acl_connections_.at(handle).GetResolvedAddress(); } void AclConnectionHandler::Encrypt(uint16_t handle) { if (!HasHandle(handle)) { return; Loading @@ -198,15 +216,6 @@ bool AclConnectionHandler::IsEncrypted(uint16_t handle) const { return acl_connections_.at(handle).IsEncrypted(); } void AclConnectionHandler::SetAddress(uint16_t handle, AddressWithType address) { if (!HasHandle(handle)) { return; } auto connection = acl_connections_.at(handle); connection.SetAddress(address); } Phy::Type AclConnectionHandler::GetPhyType(uint16_t handle) const { if (!HasHandle(handle)) { return Phy::Type::BR_EDR; Loading tools/rootcanal/model/controller/acl_connection_handler.h +10 −3 Original line number Diff line number Diff line Loading @@ -58,7 +58,9 @@ class AclConnectionHandler { bluetooth::hci::Address addr) const; ScoLinkParameters GetScoLinkParameters(bluetooth::hci::Address addr) const; bool CreatePendingLeConnection(bluetooth::hci::AddressWithType addr); bool CreatePendingLeConnection(bluetooth::hci::AddressWithType peer, bluetooth::hci::AddressWithType resolved_peer, bluetooth::hci::AddressWithType local_address); bool HasPendingLeConnection(bluetooth::hci::AddressWithType addr) const; bool CancelPendingLeConnection(bluetooth::hci::AddressWithType addr); Loading @@ -75,12 +77,11 @@ class AclConnectionHandler { bluetooth::hci::AddressWithType GetAddress(uint16_t handle) const; bluetooth::hci::Address GetScoAddress(uint16_t handle) const; bluetooth::hci::AddressWithType GetOwnAddress(uint16_t handle) const; bluetooth::hci::AddressWithType GetResolvedAddress(uint16_t handle) const; void Encrypt(uint16_t handle); bool IsEncrypted(uint16_t handle) const; void SetAddress(uint16_t handle, bluetooth::hci::AddressWithType address); Phy::Type GetPhyType(uint16_t handle) const; std::unique_ptr<bluetooth::hci::LeSetCigParametersCompleteBuilder> Loading Loading @@ -135,6 +136,12 @@ class AclConnectionHandler { bluetooth::hci::AddressWithType pending_le_connection_address_{ bluetooth::hci::Address::kEmpty, bluetooth::hci::AddressType::PUBLIC_DEVICE_ADDRESS}; bluetooth::hci::AddressWithType pending_le_connection_own_address_{ bluetooth::hci::Address::kEmpty, bluetooth::hci::AddressType::PUBLIC_DEVICE_ADDRESS}; bluetooth::hci::AddressWithType pending_le_connection_resolved_address_{ bluetooth::hci::Address::kEmpty, bluetooth::hci::AddressType::PUBLIC_DEVICE_ADDRESS}; uint16_t GetUnusedHandle(); uint16_t last_handle_{kReservedHandle - 2}; Loading tools/rootcanal/model/controller/dual_mode_controller.cc +48 −21 Original line number Diff line number Diff line Loading @@ -2024,10 +2024,13 @@ void DualModeController::LeAddDeviceToFilterAcceptList(CommandView command) { gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint8_t addr_type = static_cast<uint8_t>(command_view.GetAddressType()); Address address = command_view.GetAddress(); ErrorCode result = link_layer_controller_.LeFilterAcceptListAddDevice(address, addr_type); ErrorCode result = ErrorCode::INVALID_HCI_COMMAND_PARAMETERS; if (command_view.GetAddressType() != bluetooth::hci::FilterAcceptListAddressType::ANONYMOUS_ADVERTISERS) { result = link_layer_controller_.LeFilterAcceptListAddDevice( command_view.GetAddress(), static_cast<bluetooth::hci::AddressType>( command_view.GetAddressType())); } send_event_( bluetooth::hci::LeAddDeviceToFilterAcceptListCompleteBuilder::Create( kNumCommandPackets, result)); Loading @@ -2040,12 +2043,18 @@ void DualModeController::LeRemoveDeviceFromFilterAcceptList( gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint8_t addr_type = static_cast<uint8_t>(command_view.GetAddressType()); Address address = command_view.GetAddress(); link_layer_controller_.LeFilterAcceptListRemoveDevice(address, addr_type); ErrorCode status = ErrorCode::SUCCESS; if (command_view.GetAddressType() != bluetooth::hci::FilterAcceptListAddressType::ANONYMOUS_ADVERTISERS) { link_layer_controller_.LeFilterAcceptListAddDevice( command_view.GetAddress(), static_cast<bluetooth::hci::AddressType>( command_view.GetAddressType())); } else { status = ErrorCode::INVALID_HCI_COMMAND_PARAMETERS; } send_event_( bluetooth::hci::LeRemoveDeviceFromFilterAcceptListCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS)); kNumCommandPackets, status)); } void DualModeController::LeClearResolvingList(CommandView command) { Loading Loading @@ -2116,14 +2125,18 @@ void DualModeController::LeAddDeviceToResolvingList(CommandView command) { auto command_view = gd_hci::LeAddDeviceToResolvingListView::Create( gd_hci::LeSecurityCommandView::Create(command)); ASSERT(command_view.IsValid()); auto addr_type = static_cast<uint8_t>(command_view.GetPeerIdentityAddressType()); Address address = command_view.GetPeerIdentityAddress(); AddressType peer_address_type; switch (command_view.GetPeerIdentityAddressType()) { case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS: peer_address_type = AddressType::PUBLIC_DEVICE_ADDRESS; break; case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS: peer_address_type = AddressType::RANDOM_DEVICE_ADDRESS; break; } auto status = link_layer_controller_.LeResolvingListAddDevice( address, addr_type, command_view.GetPeerIrk(), command_view.GetLocalIrk()); command_view.GetPeerIdentityAddress(), peer_address_type, command_view.GetPeerIrk(), command_view.GetLocalIrk()); send_event_(bluetooth::hci::LeAddDeviceToResolvingListCompleteBuilder::Create( kNumCommandPackets, status)); } Loading @@ -2133,10 +2146,17 @@ void DualModeController::LeRemoveDeviceFromResolvingList(CommandView command) { gd_hci::LeSecurityCommandView::Create(command)); ASSERT(command_view.IsValid()); uint8_t addr_type = static_cast<uint8_t>(command_view.GetPeerIdentityAddressType()); Address address = command_view.GetPeerIdentityAddress(); link_layer_controller_.LeResolvingListRemoveDevice(address, addr_type); AddressType peer_address_type; switch (command_view.GetPeerIdentityAddressType()) { case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS: peer_address_type = AddressType::PUBLIC_DEVICE_ADDRESS; break; case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS: peer_address_type = AddressType::RANDOM_DEVICE_ADDRESS; break; } link_layer_controller_.LeResolvingListRemoveDevice( command_view.GetPeerIdentityAddress(), peer_address_type); send_event_( bluetooth::hci::LeRemoveDeviceFromResolvingListCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS)); Loading Loading @@ -2225,11 +2245,18 @@ void DualModeController::LeSetPrivacyMode(CommandView command) { gd_hci::LeSecurityCommandView::Create(command)); ASSERT(command_view.IsValid()); uint8_t peer_identity_address_type = static_cast<uint8_t>(command_view.GetPeerIdentityAddressType()); Address peer_identity_address = command_view.GetPeerIdentityAddress(); uint8_t privacy_mode = static_cast<uint8_t>(command_view.GetPrivacyMode()); AddressType peer_identity_address_type; switch (command_view.GetPeerIdentityAddressType()) { case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS: peer_identity_address_type = AddressType::PUBLIC_DEVICE_ADDRESS; break; case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS: peer_identity_address_type = AddressType::RANDOM_DEVICE_ADDRESS; break; } if (link_layer_controller_.LeResolvingListContainsDevice( peer_identity_address, peer_identity_address_type)) { link_layer_controller_.LeSetPrivacyMode( Loading Loading
tools/rootcanal/model/controller/acl_connection.cc +13 −4 Original line number Diff line number Diff line Loading @@ -17,9 +17,14 @@ #include "acl_connection.h" namespace rootcanal { AclConnection::AclConnection(AddressWithType addr, AddressWithType own_addr, AclConnection::AclConnection(AddressWithType address, AddressWithType own_address, AddressWithType resolved_address, Phy::Type phy_type) : address_(addr), own_address_(own_addr), type_(phy_type) {} : address_(address), own_address_(own_address), resolved_address_(resolved_address), type_(phy_type) {} void AclConnection::Encrypt() { encrypted_ = true; }; Loading @@ -31,8 +36,12 @@ void AclConnection::SetAddress(AddressWithType address) { address_ = address; } AddressWithType AclConnection::GetOwnAddress() const { return own_address_; } void AclConnection::SetOwnAddress(AddressWithType own_addr) { own_address_ = own_addr; AddressWithType AclConnection::GetResolvedAddress() const { return resolved_address_; } void AclConnection::SetOwnAddress(AddressWithType address) { own_address_ = address; } Phy::Type AclConnection::GetPhyType() const { return type_; } Loading
tools/rootcanal/model/controller/acl_connection.h +6 −3 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ using ::bluetooth::hci::AddressWithType; // Model the connection of a device to the controller. class AclConnection { public: AclConnection(AddressWithType addr, AddressWithType own_addr, Phy::Type phy_type); AclConnection(AddressWithType address, AddressWithType own_address, AddressWithType resolved_address, Phy::Type phy_type); virtual ~AclConnection() = default; Loading @@ -43,13 +43,16 @@ class AclConnection { AddressWithType GetOwnAddress() const; void SetOwnAddress(AddressWithType own_addr); void SetOwnAddress(AddressWithType address); AddressWithType GetResolvedAddress() const; Phy::Type GetPhyType() const; private: AddressWithType address_; AddressWithType own_address_; AddressWithType resolved_address_; Phy::Type type_{Phy::Type::BR_EDR}; // State variables Loading
tools/rootcanal/model/controller/acl_connection_handler.cc +29 −20 Original line number Diff line number Diff line Loading @@ -70,27 +70,35 @@ bool AclConnectionHandler::CancelPendingConnection(Address addr) { } classic_connection_pending_ = false; pending_connection_address_ = Address::kEmpty; pending_le_connection_resolved_address_ = AddressWithType(); return true; } bool AclConnectionHandler::CreatePendingLeConnection(AddressWithType addr) { bool device_connected = false; bool AclConnectionHandler::CreatePendingLeConnection( AddressWithType peer, AddressWithType resolved_peer, AddressWithType local_address) { for (auto pair : acl_connections_) { auto connection = std::get<AclConnection>(pair); if (connection.GetAddress() == addr) { device_connected = true; if (connection.GetAddress() == peer || connection.GetResolvedAddress() == resolved_peer) { LOG_INFO("%s: %s is already connected", __func__, peer.ToString().c_str()); if (connection.GetResolvedAddress() == resolved_peer) { LOG_INFO("%s: allowing a second connection with %s", __func__, resolved_peer.ToString().c_str()); } else { return false; } } if (device_connected) { LOG_INFO("%s: %s is already connected", __func__, addr.ToString().c_str()); return false; } if (le_connection_pending_) { LOG_INFO("%s: connection already pending", __func__); return false; } le_connection_pending_ = true; pending_le_connection_address_ = addr; pending_le_connection_address_ = peer; pending_le_connection_own_address_ = local_address; pending_le_connection_resolved_address_ = resolved_peer; return true; } Loading @@ -105,6 +113,8 @@ bool AclConnectionHandler::CancelPendingLeConnection(AddressWithType addr) { le_connection_pending_ = false; pending_le_connection_address_ = AddressWithType{Address::kEmpty, AddressType::PUBLIC_DEVICE_ADDRESS}; pending_le_connection_resolved_address_ = AddressWithType{Address::kEmpty, AddressType::PUBLIC_DEVICE_ADDRESS}; return true; } Loading @@ -117,7 +127,7 @@ uint16_t AclConnectionHandler::CreateConnection(Address addr, AclConnection{ AddressWithType{addr, AddressType::PUBLIC_DEVICE_ADDRESS}, AddressWithType{own_addr, AddressType::PUBLIC_DEVICE_ADDRESS}, Phy::Type::BR_EDR}); AddressWithType(), Phy::Type::BR_EDR}); return handle; } return kReservedHandle; Loading @@ -125,10 +135,12 @@ uint16_t AclConnectionHandler::CreateConnection(Address addr, uint16_t AclConnectionHandler::CreateLeConnection(AddressWithType addr, AddressWithType own_addr) { AddressWithType resolved_peer = pending_le_connection_resolved_address_; if (CancelPendingLeConnection(addr)) { uint16_t handle = GetUnusedHandle(); acl_connections_.emplace( handle, AclConnection{addr, own_addr, Phy::Type::LOW_ENERGY}); handle, AclConnection{addr, own_addr, resolved_peer, Phy::Type::LOW_ENERGY}); return handle; } return kReservedHandle; Loading Loading @@ -184,6 +196,12 @@ AddressWithType AclConnectionHandler::GetOwnAddress(uint16_t handle) const { return acl_connections_.at(handle).GetOwnAddress(); } AddressWithType AclConnectionHandler::GetResolvedAddress( uint16_t handle) const { ASSERT_LOG(HasHandle(handle), "Unknown handle %hd", handle); return acl_connections_.at(handle).GetResolvedAddress(); } void AclConnectionHandler::Encrypt(uint16_t handle) { if (!HasHandle(handle)) { return; Loading @@ -198,15 +216,6 @@ bool AclConnectionHandler::IsEncrypted(uint16_t handle) const { return acl_connections_.at(handle).IsEncrypted(); } void AclConnectionHandler::SetAddress(uint16_t handle, AddressWithType address) { if (!HasHandle(handle)) { return; } auto connection = acl_connections_.at(handle); connection.SetAddress(address); } Phy::Type AclConnectionHandler::GetPhyType(uint16_t handle) const { if (!HasHandle(handle)) { return Phy::Type::BR_EDR; Loading
tools/rootcanal/model/controller/acl_connection_handler.h +10 −3 Original line number Diff line number Diff line Loading @@ -58,7 +58,9 @@ class AclConnectionHandler { bluetooth::hci::Address addr) const; ScoLinkParameters GetScoLinkParameters(bluetooth::hci::Address addr) const; bool CreatePendingLeConnection(bluetooth::hci::AddressWithType addr); bool CreatePendingLeConnection(bluetooth::hci::AddressWithType peer, bluetooth::hci::AddressWithType resolved_peer, bluetooth::hci::AddressWithType local_address); bool HasPendingLeConnection(bluetooth::hci::AddressWithType addr) const; bool CancelPendingLeConnection(bluetooth::hci::AddressWithType addr); Loading @@ -75,12 +77,11 @@ class AclConnectionHandler { bluetooth::hci::AddressWithType GetAddress(uint16_t handle) const; bluetooth::hci::Address GetScoAddress(uint16_t handle) const; bluetooth::hci::AddressWithType GetOwnAddress(uint16_t handle) const; bluetooth::hci::AddressWithType GetResolvedAddress(uint16_t handle) const; void Encrypt(uint16_t handle); bool IsEncrypted(uint16_t handle) const; void SetAddress(uint16_t handle, bluetooth::hci::AddressWithType address); Phy::Type GetPhyType(uint16_t handle) const; std::unique_ptr<bluetooth::hci::LeSetCigParametersCompleteBuilder> Loading Loading @@ -135,6 +136,12 @@ class AclConnectionHandler { bluetooth::hci::AddressWithType pending_le_connection_address_{ bluetooth::hci::Address::kEmpty, bluetooth::hci::AddressType::PUBLIC_DEVICE_ADDRESS}; bluetooth::hci::AddressWithType pending_le_connection_own_address_{ bluetooth::hci::Address::kEmpty, bluetooth::hci::AddressType::PUBLIC_DEVICE_ADDRESS}; bluetooth::hci::AddressWithType pending_le_connection_resolved_address_{ bluetooth::hci::Address::kEmpty, bluetooth::hci::AddressType::PUBLIC_DEVICE_ADDRESS}; uint16_t GetUnusedHandle(); uint16_t last_handle_{kReservedHandle - 2}; Loading
tools/rootcanal/model/controller/dual_mode_controller.cc +48 −21 Original line number Diff line number Diff line Loading @@ -2024,10 +2024,13 @@ void DualModeController::LeAddDeviceToFilterAcceptList(CommandView command) { gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint8_t addr_type = static_cast<uint8_t>(command_view.GetAddressType()); Address address = command_view.GetAddress(); ErrorCode result = link_layer_controller_.LeFilterAcceptListAddDevice(address, addr_type); ErrorCode result = ErrorCode::INVALID_HCI_COMMAND_PARAMETERS; if (command_view.GetAddressType() != bluetooth::hci::FilterAcceptListAddressType::ANONYMOUS_ADVERTISERS) { result = link_layer_controller_.LeFilterAcceptListAddDevice( command_view.GetAddress(), static_cast<bluetooth::hci::AddressType>( command_view.GetAddressType())); } send_event_( bluetooth::hci::LeAddDeviceToFilterAcceptListCompleteBuilder::Create( kNumCommandPackets, result)); Loading @@ -2040,12 +2043,18 @@ void DualModeController::LeRemoveDeviceFromFilterAcceptList( gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); uint8_t addr_type = static_cast<uint8_t>(command_view.GetAddressType()); Address address = command_view.GetAddress(); link_layer_controller_.LeFilterAcceptListRemoveDevice(address, addr_type); ErrorCode status = ErrorCode::SUCCESS; if (command_view.GetAddressType() != bluetooth::hci::FilterAcceptListAddressType::ANONYMOUS_ADVERTISERS) { link_layer_controller_.LeFilterAcceptListAddDevice( command_view.GetAddress(), static_cast<bluetooth::hci::AddressType>( command_view.GetAddressType())); } else { status = ErrorCode::INVALID_HCI_COMMAND_PARAMETERS; } send_event_( bluetooth::hci::LeRemoveDeviceFromFilterAcceptListCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS)); kNumCommandPackets, status)); } void DualModeController::LeClearResolvingList(CommandView command) { Loading Loading @@ -2116,14 +2125,18 @@ void DualModeController::LeAddDeviceToResolvingList(CommandView command) { auto command_view = gd_hci::LeAddDeviceToResolvingListView::Create( gd_hci::LeSecurityCommandView::Create(command)); ASSERT(command_view.IsValid()); auto addr_type = static_cast<uint8_t>(command_view.GetPeerIdentityAddressType()); Address address = command_view.GetPeerIdentityAddress(); AddressType peer_address_type; switch (command_view.GetPeerIdentityAddressType()) { case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS: peer_address_type = AddressType::PUBLIC_DEVICE_ADDRESS; break; case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS: peer_address_type = AddressType::RANDOM_DEVICE_ADDRESS; break; } auto status = link_layer_controller_.LeResolvingListAddDevice( address, addr_type, command_view.GetPeerIrk(), command_view.GetLocalIrk()); command_view.GetPeerIdentityAddress(), peer_address_type, command_view.GetPeerIrk(), command_view.GetLocalIrk()); send_event_(bluetooth::hci::LeAddDeviceToResolvingListCompleteBuilder::Create( kNumCommandPackets, status)); } Loading @@ -2133,10 +2146,17 @@ void DualModeController::LeRemoveDeviceFromResolvingList(CommandView command) { gd_hci::LeSecurityCommandView::Create(command)); ASSERT(command_view.IsValid()); uint8_t addr_type = static_cast<uint8_t>(command_view.GetPeerIdentityAddressType()); Address address = command_view.GetPeerIdentityAddress(); link_layer_controller_.LeResolvingListRemoveDevice(address, addr_type); AddressType peer_address_type; switch (command_view.GetPeerIdentityAddressType()) { case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS: peer_address_type = AddressType::PUBLIC_DEVICE_ADDRESS; break; case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS: peer_address_type = AddressType::RANDOM_DEVICE_ADDRESS; break; } link_layer_controller_.LeResolvingListRemoveDevice( command_view.GetPeerIdentityAddress(), peer_address_type); send_event_( bluetooth::hci::LeRemoveDeviceFromResolvingListCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS)); Loading Loading @@ -2225,11 +2245,18 @@ void DualModeController::LeSetPrivacyMode(CommandView command) { gd_hci::LeSecurityCommandView::Create(command)); ASSERT(command_view.IsValid()); uint8_t peer_identity_address_type = static_cast<uint8_t>(command_view.GetPeerIdentityAddressType()); Address peer_identity_address = command_view.GetPeerIdentityAddress(); uint8_t privacy_mode = static_cast<uint8_t>(command_view.GetPrivacyMode()); AddressType peer_identity_address_type; switch (command_view.GetPeerIdentityAddressType()) { case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS: peer_identity_address_type = AddressType::PUBLIC_DEVICE_ADDRESS; break; case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS: peer_identity_address_type = AddressType::RANDOM_DEVICE_ADDRESS; break; } if (link_layer_controller_.LeResolvingListContainsDevice( peer_identity_address, peer_identity_address_type)) { link_layer_controller_.LeSetPrivacyMode( Loading