Loading system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +2 −6 Original line number Diff line number Diff line Loading @@ -1537,15 +1537,11 @@ void DualModeController::LeConnectionUpdate(CommandPacketView command) { auto command_view = gd_hci::LeConnectionUpdateView::Create( gd_hci::LeConnectionManagementCommandView::Create(command)); ASSERT(command_view.IsValid()); ErrorCode status = link_layer_controller_.LeConnectionUpdate(command_view); auto status_packet = bluetooth::hci::LeConnectionUpdateStatusBuilder::Create( ErrorCode::CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR, kNumCommandPackets); status, kNumCommandPackets); send_event_(std::move(status_packet)); auto complete_packet = bluetooth::hci::LeConnectionUpdateCompleteBuilder::Create( ErrorCode::SUCCESS, 0x0002, 0x0006, 0x0000, 0x01f4); send_event_(std::move(complete_packet)); } void DualModeController::CreateConnection(CommandPacketView command) { Loading system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc +40 −0 Original line number Diff line number Diff line Loading @@ -1646,6 +1646,46 @@ ErrorCode LinkLayerController::WriteLinkSupervisionTimeout(uint16_t handle, return ErrorCode::SUCCESS; } void LinkLayerController::LeConnectionUpdateComplete( bluetooth::hci::LeConnectionUpdateView connection_update) { uint16_t handle = connection_update.GetConnectionHandle(); ErrorCode status = ErrorCode::SUCCESS; if (!connections_.HasHandle(handle)) { status = ErrorCode::UNKNOWN_CONNECTION; } uint16_t interval_min = connection_update.GetConnIntervalMin(); uint16_t interval_max = connection_update.GetConnIntervalMax(); uint16_t latency = connection_update.GetConnLatency(); uint16_t supervision_timeout = connection_update.GetSupervisionTimeout(); if (interval_min < 6 || interval_max > 0xC80 || interval_min > interval_max || interval_max < interval_min || latency > 0x1F3 || supervision_timeout < 0xA || supervision_timeout > 0xC80 || // The Supervision_Timeout in milliseconds (*10) shall be larger than (1 + // Connection_Latency) * Connection_Interval_Max (* 5/4) * 2 supervision_timeout <= ((((1 + latency) * interval_max * 10) / 4) / 10)) { status = ErrorCode::INVALID_HCI_COMMAND_PARAMETERS; } uint16_t interval = (interval_min + interval_max) / 2; send_event_(bluetooth::hci::LeConnectionUpdateCompleteBuilder::Create( status, handle, interval, latency, supervision_timeout)); } ErrorCode LinkLayerController::LeConnectionUpdate( bluetooth::hci::LeConnectionUpdateView connection_update) { uint16_t handle = connection_update.GetConnectionHandle(); if (!connections_.HasHandle(handle)) { return ErrorCode::UNKNOWN_CONNECTION; } // This could negotiate with the remote device in the future ScheduleTask(milliseconds(25), [this, connection_update]() { LeConnectionUpdateComplete(connection_update); }); return ErrorCode::SUCCESS; } void LinkLayerController::LeWhiteListClear() { le_white_list_.clear(); } void LinkLayerController::LeResolvingListClear() { le_resolving_list_.clear(); } Loading system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h +5 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,11 @@ class LinkLayerController { void LeAdvertising(); void LeConnectionUpdateComplete( bluetooth::hci::LeConnectionUpdateView connection_update_view); ErrorCode LeConnectionUpdate( bluetooth::hci::LeConnectionUpdateView connection_update_view); void HandleLeConnection(AddressWithType addr, AddressWithType own_addr, uint8_t role, uint16_t connection_interval, uint16_t connection_latency, Loading Loading
system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +2 −6 Original line number Diff line number Diff line Loading @@ -1537,15 +1537,11 @@ void DualModeController::LeConnectionUpdate(CommandPacketView command) { auto command_view = gd_hci::LeConnectionUpdateView::Create( gd_hci::LeConnectionManagementCommandView::Create(command)); ASSERT(command_view.IsValid()); ErrorCode status = link_layer_controller_.LeConnectionUpdate(command_view); auto status_packet = bluetooth::hci::LeConnectionUpdateStatusBuilder::Create( ErrorCode::CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR, kNumCommandPackets); status, kNumCommandPackets); send_event_(std::move(status_packet)); auto complete_packet = bluetooth::hci::LeConnectionUpdateCompleteBuilder::Create( ErrorCode::SUCCESS, 0x0002, 0x0006, 0x0000, 0x01f4); send_event_(std::move(complete_packet)); } void DualModeController::CreateConnection(CommandPacketView command) { Loading
system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc +40 −0 Original line number Diff line number Diff line Loading @@ -1646,6 +1646,46 @@ ErrorCode LinkLayerController::WriteLinkSupervisionTimeout(uint16_t handle, return ErrorCode::SUCCESS; } void LinkLayerController::LeConnectionUpdateComplete( bluetooth::hci::LeConnectionUpdateView connection_update) { uint16_t handle = connection_update.GetConnectionHandle(); ErrorCode status = ErrorCode::SUCCESS; if (!connections_.HasHandle(handle)) { status = ErrorCode::UNKNOWN_CONNECTION; } uint16_t interval_min = connection_update.GetConnIntervalMin(); uint16_t interval_max = connection_update.GetConnIntervalMax(); uint16_t latency = connection_update.GetConnLatency(); uint16_t supervision_timeout = connection_update.GetSupervisionTimeout(); if (interval_min < 6 || interval_max > 0xC80 || interval_min > interval_max || interval_max < interval_min || latency > 0x1F3 || supervision_timeout < 0xA || supervision_timeout > 0xC80 || // The Supervision_Timeout in milliseconds (*10) shall be larger than (1 + // Connection_Latency) * Connection_Interval_Max (* 5/4) * 2 supervision_timeout <= ((((1 + latency) * interval_max * 10) / 4) / 10)) { status = ErrorCode::INVALID_HCI_COMMAND_PARAMETERS; } uint16_t interval = (interval_min + interval_max) / 2; send_event_(bluetooth::hci::LeConnectionUpdateCompleteBuilder::Create( status, handle, interval, latency, supervision_timeout)); } ErrorCode LinkLayerController::LeConnectionUpdate( bluetooth::hci::LeConnectionUpdateView connection_update) { uint16_t handle = connection_update.GetConnectionHandle(); if (!connections_.HasHandle(handle)) { return ErrorCode::UNKNOWN_CONNECTION; } // This could negotiate with the remote device in the future ScheduleTask(milliseconds(25), [this, connection_update]() { LeConnectionUpdateComplete(connection_update); }); return ErrorCode::SUCCESS; } void LinkLayerController::LeWhiteListClear() { le_white_list_.clear(); } void LinkLayerController::LeResolvingListClear() { le_resolving_list_.clear(); } Loading
system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h +5 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,11 @@ class LinkLayerController { void LeAdvertising(); void LeConnectionUpdateComplete( bluetooth::hci::LeConnectionUpdateView connection_update_view); ErrorCode LeConnectionUpdate( bluetooth::hci::LeConnectionUpdateView connection_update_view); void HandleLeConnection(AddressWithType addr, AddressWithType own_addr, uint8_t role, uint16_t connection_interval, uint16_t connection_latency, Loading