1 // Copyright 2023 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 #pragma once 16 #include <memory> 17 #include <utility> 18 19 #include "pw_bluetooth_sapphire/internal/host/l2cap/enhanced_retransmission_mode_rx_engine.h" 20 #include "pw_bluetooth_sapphire/internal/host/l2cap/enhanced_retransmission_mode_tx_engine.h" 21 22 namespace bt::l2cap::internal { 23 24 // Construct a pair of EnhancedRetransmissionMode{Rx,Tx}Engines that are 25 // synchronized to each other and share a |send_frame_callback|. They must be 26 // run on the same thread and can be deleted in any order, but must be deleted 27 // consecutively without calling their methods in between. 28 // 29 // The parameters are identical to the EnhancedRetransmissionTxEngine ctor. 30 std::pair<std::unique_ptr<EnhancedRetransmissionModeRxEngine>, 31 std::unique_ptr<EnhancedRetransmissionModeTxEngine>> 32 MakeLinkedEnhancedRetransmissionModeEngines( 33 ChannelId channel_id, 34 uint16_t max_tx_sdu_size, 35 uint8_t max_transmissions, 36 uint8_t n_frames_in_tx_window, 37 TxEngine::TxChannel& channel, 38 EnhancedRetransmissionModeTxEngine::ConnectionFailureCallback 39 connection_failure_callback, 40 pw::async::Dispatcher& dispatcher); 41 42 } // namespace bt::l2cap::internal 43