blob: ae17660a055d74bd7fb26f55757febe83649ee2f [file] [log] [blame]
Hansong Zhangf68f5f82019-11-14 13:01:51 -08001/*
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
23namespace bluetooth {
24namespace l2cap {
25namespace internal {
Hansong Zhanga6312532019-11-19 14:01:36 -080026class Sender;
Hansong Zhangf68f5f82019-11-14 13:01:51 -080027
28/**
29 * Common interface for internal channel implementation
30 */
31class 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 Zhangb0960762019-11-14 17:57:10 -080042 * Return the queue end for lower layer (sender and receiver)
Hansong Zhangf68f5f82019-11-14 13:01:51 -080043 */
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 Zhanga6312532019-11-19 14:01:36 -080052 * 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 Zhangf68f5f82019-11-14 13:01:51 -080055 */
Hansong Zhanga6312532019-11-19 14:01:36 -080056 virtual void SetSender(l2cap::internal::Sender* sender) = 0;
Hansong Zhangf68f5f82019-11-14 13:01:51 -080057};
58
59} // namespace internal
60} // namespace l2cap
61} // namespace bluetooth