1 /* 2 * Copyright 2020 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 <memory> 20 21 #include "common/bidi_queue.h" 22 #include "hci/hci_packets.h" 23 24 namespace bluetooth { 25 namespace hci { 26 namespace acl_manager { 27 28 class AclConnection { 29 public: AclConnection()30 AclConnection() : queue_up_end_(nullptr), handle_(0){}; 31 virtual ~AclConnection() = default; 32 GetHandle()33 uint16_t GetHandle() const { 34 return handle_; 35 } 36 37 using Queue = common::BidiQueue<PacketView<kLittleEndian>, BasePacketBuilder>; 38 using QueueUpEnd = common::BidiQueueEnd<BasePacketBuilder, PacketView<kLittleEndian>>; 39 using QueueDownEnd = common::BidiQueueEnd<PacketView<kLittleEndian>, BasePacketBuilder>; 40 virtual QueueUpEnd* GetAclQueueEnd() const; 41 42 protected: AclConnection(QueueUpEnd * queue_up_end,uint16_t handle)43 AclConnection(QueueUpEnd* queue_up_end, uint16_t handle) : queue_up_end_(queue_up_end), handle_(handle) {} 44 QueueUpEnd* queue_up_end_; 45 uint16_t handle_; 46 DISALLOW_COPY_AND_ASSIGN(AclConnection); 47 }; 48 49 } // namespace acl_manager 50 } // namespace hci 51 } // namespace bluetooth 52