Hansong Zhang | f68f5f8 | 2019-11-14 13:01:51 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include "common/bidi_queue.h" |
| 20 | #include "l2cap/cid.h" |
| 21 | #include "l2cap/l2cap_packets.h" |
| 22 | |
| 23 | namespace bluetooth { |
| 24 | namespace l2cap { |
| 25 | namespace internal { |
Hansong Zhang | a631253 | 2019-11-19 14:01:36 -0800 | [diff] [blame] | 26 | class Sender; |
Hansong Zhang | f68f5f8 | 2019-11-14 13:01:51 -0800 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Common interface for internal channel implementation |
| 30 | */ |
| 31 | class ChannelImpl { |
| 32 | public: |
| 33 | virtual ~ChannelImpl() = default; |
| 34 | |
| 35 | /** |
| 36 | * Return the queue end for upper layer (L2CAP user) |
| 37 | */ |
| 38 | virtual common::BidiQueueEnd<packet::BasePacketBuilder, packet::PacketView<packet::kLittleEndian>>* |
| 39 | GetQueueUpEnd() = 0; |
| 40 | |
| 41 | /** |
Hansong Zhang | b096076 | 2019-11-14 17:57:10 -0800 | [diff] [blame] | 42 | * Return the queue end for lower layer (sender and receiver) |
Hansong Zhang | f68f5f8 | 2019-11-14 13:01:51 -0800 | [diff] [blame] | 43 | */ |
| 44 | virtual common::BidiQueueEnd<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder>* |
| 45 | GetQueueDownEnd() = 0; |
| 46 | |
| 47 | virtual Cid GetCid() const = 0; |
| 48 | |
| 49 | virtual Cid GetRemoteCid() const = 0; |
| 50 | |
| 51 | /** |
Hansong Zhang | a631253 | 2019-11-19 14:01:36 -0800 | [diff] [blame] | 52 | * Callback from the Scheduler to notify the Sender for this channel. On config update, channel might notify the |
| 53 | * configuration change to Sender. |
| 54 | * Fixed channel doesn't need to implement it, as it doesn't need to send config update to Sender. |
Hansong Zhang | f68f5f8 | 2019-11-14 13:01:51 -0800 | [diff] [blame] | 55 | */ |
Hansong Zhang | a631253 | 2019-11-19 14:01:36 -0800 | [diff] [blame] | 56 | virtual void SetSender(l2cap::internal::Sender* sender) = 0; |
Hansong Zhang | f68f5f8 | 2019-11-14 13:01:51 -0800 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | } // namespace internal |
| 60 | } // namespace l2cap |
| 61 | } // namespace bluetooth |