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 "pw_bluetooth_sapphire/internal/host/l2cap/tx_engine.h"
17 
18 namespace bt::l2cap::internal {
19 
20 // Implements the sender-side functionality of L2CAP Basic Mode. See Bluetooth
21 // Core Spec v5.0, Volume 3, Part A, Sec 2.4, "Modes of Operation".
22 //
23 // THREAD-SAFETY: This class may is _not_ thread-safe. In particular, the class
24 // assumes that some other party ensures that QueueSdu() is not invoked
25 // concurrently with the destructor.
26 class BasicModeTxEngine final : public TxEngine {
27  public:
BasicModeTxEngine(ChannelId channel_id,uint16_t max_tx_sdu_size,TxChannel & channel)28   BasicModeTxEngine(ChannelId channel_id,
29                     uint16_t max_tx_sdu_size,
30                     TxChannel& channel)
31       : TxEngine(channel_id, max_tx_sdu_size, channel) {}
32   ~BasicModeTxEngine() override = default;
33 
34   // Notify that an SDU is ready for transmitting. See |TxEngine|.
35   void NotifySduQueued() override;
36 
37  private:
38   BT_DISALLOW_COPY_AND_ASSIGN_ALLOW_MOVE(BasicModeTxEngine);
39 };
40 
41 }  // namespace bt::l2cap::internal
42