Loading tools/rootcanal/model/controller/dual_mode_controller.cc +3 −3 Original line number Diff line number Diff line Loading @@ -1828,7 +1828,7 @@ void DualModeController::LeCreateConnection(CommandView command) { link_layer_controller_.SetLeMaximumCeLength( command_view.GetMaximumCeLength()); auto status = link_layer_controller_.SetLeConnect(true); auto status = link_layer_controller_.SetLeConnect(true, false); send_event_(bluetooth::hci::LeCreateConnectionStatusBuilder::Create( status, kNumCommandPackets)); Loading Loading @@ -1906,7 +1906,7 @@ void DualModeController::LeConnectionCancel(CommandView command) { gd_hci::LeConnectionManagementCommandView::Create( gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); ErrorCode status = link_layer_controller_.SetLeConnect(false); ErrorCode status = link_layer_controller_.SetLeConnect(false, false); send_event_(bluetooth::hci::LeCreateConnectionCancelCompleteBuilder::Create( kNumCommandPackets, status)); Loading Loading @@ -2135,7 +2135,7 @@ void DualModeController::LeExtendedCreateConnection(CommandView command) { link_layer_controller_.SetLeMinimumCeLength(params[0].min_ce_length_); link_layer_controller_.SetLeMaximumCeLength(params[0].max_ce_length_); auto status = link_layer_controller_.SetLeConnect(true); auto status = link_layer_controller_.SetLeConnect(true, true); send_event_(bluetooth::hci::LeExtendedCreateConnectionStatusBuilder::Create( status, kNumCommandPackets)); Loading tools/rootcanal/model/controller/link_layer_controller.cc +27 −10 Original line number Diff line number Diff line Loading @@ -1354,7 +1354,7 @@ void LinkLayerController::IncomingLeAdvertisementPacket( properties_.GetLeAddress(), address)); } if (!le_connect_) { if (!le_connect_ || le_pending_connect_) { return; } if (!(adv_type == model::packets::AdvertisementType::ADV_IND || Loading Loading @@ -1422,7 +1422,7 @@ void LinkLayerController::IncomingLeAdvertisementPacket( LOG_INFO("Connecting to %s (type %hhx) own_address %s (type %hhx)", incoming.GetSourceAddress().ToString().c_str(), address_type, own_address.ToString().c_str(), le_address_type_); le_connect_ = false; le_pending_connect_ = true; le_scan_enable_ = bluetooth::hci::OpCode::NONE; SendLeLinkLayerPacket(model::packets::LeConnectBuilder::Create( Loading Loading @@ -1552,12 +1552,11 @@ void LinkLayerController::IncomingScoDisconnect( } } uint16_t LinkLayerController::HandleLeConnection(AddressWithType address, AddressWithType own_address, uint8_t role, uint16_t connection_interval, uint16_t connection_latency, uint16_t supervision_timeout) { uint16_t LinkLayerController::HandleLeConnection( AddressWithType address, AddressWithType own_address, uint8_t role, uint16_t connection_interval, uint16_t connection_latency, uint16_t supervision_timeout, bool send_le_channel_selection_algorithm_event) { // Note: the HCI_LE_Connection_Complete event is not sent if the // HCI_LE_Enhanced_Connection_Complete event (see Section 7.7.65.10) is // unmasked. Loading Loading @@ -1589,6 +1588,19 @@ uint16_t LinkLayerController::HandleLeConnection(AddressWithType address, static_cast<bluetooth::hci::ClockAccuracy>(0x00))); } // Note: the HCI_LE_Connection_Complete event is immediately followed by // an HCI_LE_Channel_Selection_Algorithm event if the connection is created // using the LE_Extended_Create_Connection command (see Section 7.7.8.66). if (send_le_channel_selection_algorithm_event && properties_.IsUnmasked(EventCode::LE_META_EVENT) && properties_.GetLeEventSupported( SubeventCode::CHANNEL_SELECTION_ALGORITHM)) { // The selection channel algorithm probably will have no impact // on emulation. send_event_(bluetooth::hci::LeChannelSelectionAlgorithmBuilder::Create( handle, bluetooth::hci::ChannelSelectionAlgorithm::ALGORITHM_1)); } if (own_address.GetAddress() == le_connecting_rpa_) { le_connecting_rpa_ = Address::kEmpty; } Loading Loading @@ -1643,7 +1655,7 @@ void LinkLayerController::IncomingLeConnectPacket( static_cast<bluetooth::hci::AddressType>(connect.GetAddressType())), my_address, static_cast<uint8_t>(bluetooth::hci::Role::PERIPHERAL), connection_interval, connect.GetLeConnectionLatency(), connect.GetLeConnectionSupervisionTimeout()); connect.GetLeConnectionSupervisionTimeout(), false); SendLeLinkLayerPacket(model::packets::LeConnectCompleteBuilder::Create( incoming.GetDestinationAddress(), incoming.GetSourceAddress(), Loading Loading @@ -1676,7 +1688,10 @@ void LinkLayerController::IncomingLeConnectCompletePacket( static_cast<bluetooth::hci::AddressType>(le_address_type_)), static_cast<uint8_t>(bluetooth::hci::Role::CENTRAL), complete.GetLeConnectionInterval(), complete.GetLeConnectionLatency(), complete.GetLeConnectionSupervisionTimeout()); complete.GetLeConnectionSupervisionTimeout(), le_extended_connect_); le_connect_ = false; le_extended_connect_ = false; le_pending_connect_ = false; } void LinkLayerController::IncomingLeConnectionParameterRequest( Loading Loading @@ -3663,6 +3678,8 @@ void LinkLayerController::Reset() { LeDisableAdvertisingSets(); le_scan_enable_ = bluetooth::hci::OpCode::NONE; le_connect_ = false; le_extended_connect_ = false; le_pending_connect_ = false; if (inquiry_timer_task_id_ != kInvalidTaskId) { CancelScheduledTask(inquiry_timer_task_id_); inquiry_timer_task_id_ = kInvalidTaskId; Loading tools/rootcanal/model/controller/link_layer_controller.h +7 −2 Original line number Diff line number Diff line Loading @@ -182,7 +182,8 @@ class LinkLayerController { uint16_t HandleLeConnection(AddressWithType addr, AddressWithType own_addr, uint8_t role, uint16_t connection_interval, uint16_t connection_latency, uint16_t supervision_timeout); uint16_t supervision_timeout, bool send_le_channel_selection_algorithm_event); bool ListBusy(uint16_t ignore_mask); Loading Loading @@ -283,11 +284,13 @@ class LinkLayerController { void SetLeAddressType(bluetooth::hci::OwnAddressType le_address_type) { le_address_type_ = le_address_type; } ErrorCode SetLeConnect(bool le_connect) { ErrorCode SetLeConnect(bool le_connect, bool extended) { if (le_connect_ == le_connect) { return ErrorCode::COMMAND_DISALLOWED; } le_connect_ = le_connect; le_extended_connect_ = extended; le_pending_connect_ = false; return ErrorCode::SUCCESS; } void SetLeConnectionIntervalMin(uint16_t min) { Loading Loading @@ -503,6 +506,8 @@ class LinkLayerController { bluetooth::hci::OwnAddressType le_address_type_{}; bool le_connect_{false}; bool le_extended_connect_{false}; bool le_pending_connect_{false}; uint16_t le_connection_interval_min_{}; uint16_t le_connection_interval_max_{}; uint16_t le_connection_latency_{}; Loading Loading
tools/rootcanal/model/controller/dual_mode_controller.cc +3 −3 Original line number Diff line number Diff line Loading @@ -1828,7 +1828,7 @@ void DualModeController::LeCreateConnection(CommandView command) { link_layer_controller_.SetLeMaximumCeLength( command_view.GetMaximumCeLength()); auto status = link_layer_controller_.SetLeConnect(true); auto status = link_layer_controller_.SetLeConnect(true, false); send_event_(bluetooth::hci::LeCreateConnectionStatusBuilder::Create( status, kNumCommandPackets)); Loading Loading @@ -1906,7 +1906,7 @@ void DualModeController::LeConnectionCancel(CommandView command) { gd_hci::LeConnectionManagementCommandView::Create( gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); ErrorCode status = link_layer_controller_.SetLeConnect(false); ErrorCode status = link_layer_controller_.SetLeConnect(false, false); send_event_(bluetooth::hci::LeCreateConnectionCancelCompleteBuilder::Create( kNumCommandPackets, status)); Loading Loading @@ -2135,7 +2135,7 @@ void DualModeController::LeExtendedCreateConnection(CommandView command) { link_layer_controller_.SetLeMinimumCeLength(params[0].min_ce_length_); link_layer_controller_.SetLeMaximumCeLength(params[0].max_ce_length_); auto status = link_layer_controller_.SetLeConnect(true); auto status = link_layer_controller_.SetLeConnect(true, true); send_event_(bluetooth::hci::LeExtendedCreateConnectionStatusBuilder::Create( status, kNumCommandPackets)); Loading
tools/rootcanal/model/controller/link_layer_controller.cc +27 −10 Original line number Diff line number Diff line Loading @@ -1354,7 +1354,7 @@ void LinkLayerController::IncomingLeAdvertisementPacket( properties_.GetLeAddress(), address)); } if (!le_connect_) { if (!le_connect_ || le_pending_connect_) { return; } if (!(adv_type == model::packets::AdvertisementType::ADV_IND || Loading Loading @@ -1422,7 +1422,7 @@ void LinkLayerController::IncomingLeAdvertisementPacket( LOG_INFO("Connecting to %s (type %hhx) own_address %s (type %hhx)", incoming.GetSourceAddress().ToString().c_str(), address_type, own_address.ToString().c_str(), le_address_type_); le_connect_ = false; le_pending_connect_ = true; le_scan_enable_ = bluetooth::hci::OpCode::NONE; SendLeLinkLayerPacket(model::packets::LeConnectBuilder::Create( Loading Loading @@ -1552,12 +1552,11 @@ void LinkLayerController::IncomingScoDisconnect( } } uint16_t LinkLayerController::HandleLeConnection(AddressWithType address, AddressWithType own_address, uint8_t role, uint16_t connection_interval, uint16_t connection_latency, uint16_t supervision_timeout) { uint16_t LinkLayerController::HandleLeConnection( AddressWithType address, AddressWithType own_address, uint8_t role, uint16_t connection_interval, uint16_t connection_latency, uint16_t supervision_timeout, bool send_le_channel_selection_algorithm_event) { // Note: the HCI_LE_Connection_Complete event is not sent if the // HCI_LE_Enhanced_Connection_Complete event (see Section 7.7.65.10) is // unmasked. Loading Loading @@ -1589,6 +1588,19 @@ uint16_t LinkLayerController::HandleLeConnection(AddressWithType address, static_cast<bluetooth::hci::ClockAccuracy>(0x00))); } // Note: the HCI_LE_Connection_Complete event is immediately followed by // an HCI_LE_Channel_Selection_Algorithm event if the connection is created // using the LE_Extended_Create_Connection command (see Section 7.7.8.66). if (send_le_channel_selection_algorithm_event && properties_.IsUnmasked(EventCode::LE_META_EVENT) && properties_.GetLeEventSupported( SubeventCode::CHANNEL_SELECTION_ALGORITHM)) { // The selection channel algorithm probably will have no impact // on emulation. send_event_(bluetooth::hci::LeChannelSelectionAlgorithmBuilder::Create( handle, bluetooth::hci::ChannelSelectionAlgorithm::ALGORITHM_1)); } if (own_address.GetAddress() == le_connecting_rpa_) { le_connecting_rpa_ = Address::kEmpty; } Loading Loading @@ -1643,7 +1655,7 @@ void LinkLayerController::IncomingLeConnectPacket( static_cast<bluetooth::hci::AddressType>(connect.GetAddressType())), my_address, static_cast<uint8_t>(bluetooth::hci::Role::PERIPHERAL), connection_interval, connect.GetLeConnectionLatency(), connect.GetLeConnectionSupervisionTimeout()); connect.GetLeConnectionSupervisionTimeout(), false); SendLeLinkLayerPacket(model::packets::LeConnectCompleteBuilder::Create( incoming.GetDestinationAddress(), incoming.GetSourceAddress(), Loading Loading @@ -1676,7 +1688,10 @@ void LinkLayerController::IncomingLeConnectCompletePacket( static_cast<bluetooth::hci::AddressType>(le_address_type_)), static_cast<uint8_t>(bluetooth::hci::Role::CENTRAL), complete.GetLeConnectionInterval(), complete.GetLeConnectionLatency(), complete.GetLeConnectionSupervisionTimeout()); complete.GetLeConnectionSupervisionTimeout(), le_extended_connect_); le_connect_ = false; le_extended_connect_ = false; le_pending_connect_ = false; } void LinkLayerController::IncomingLeConnectionParameterRequest( Loading Loading @@ -3663,6 +3678,8 @@ void LinkLayerController::Reset() { LeDisableAdvertisingSets(); le_scan_enable_ = bluetooth::hci::OpCode::NONE; le_connect_ = false; le_extended_connect_ = false; le_pending_connect_ = false; if (inquiry_timer_task_id_ != kInvalidTaskId) { CancelScheduledTask(inquiry_timer_task_id_); inquiry_timer_task_id_ = kInvalidTaskId; Loading
tools/rootcanal/model/controller/link_layer_controller.h +7 −2 Original line number Diff line number Diff line Loading @@ -182,7 +182,8 @@ class LinkLayerController { uint16_t HandleLeConnection(AddressWithType addr, AddressWithType own_addr, uint8_t role, uint16_t connection_interval, uint16_t connection_latency, uint16_t supervision_timeout); uint16_t supervision_timeout, bool send_le_channel_selection_algorithm_event); bool ListBusy(uint16_t ignore_mask); Loading Loading @@ -283,11 +284,13 @@ class LinkLayerController { void SetLeAddressType(bluetooth::hci::OwnAddressType le_address_type) { le_address_type_ = le_address_type; } ErrorCode SetLeConnect(bool le_connect) { ErrorCode SetLeConnect(bool le_connect, bool extended) { if (le_connect_ == le_connect) { return ErrorCode::COMMAND_DISALLOWED; } le_connect_ = le_connect; le_extended_connect_ = extended; le_pending_connect_ = false; return ErrorCode::SUCCESS; } void SetLeConnectionIntervalMin(uint16_t min) { Loading Loading @@ -503,6 +506,8 @@ class LinkLayerController { bluetooth::hci::OwnAddressType le_address_type_{}; bool le_connect_{false}; bool le_extended_connect_{false}; bool le_pending_connect_{false}; uint16_t le_connection_interval_min_{}; uint16_t le_connection_interval_max_{}; uint16_t le_connection_latency_{}; Loading