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 AclConnection(const AclConnection&) = delete; 32 AclConnection& operator=(const AclConnection&) = delete; 33 34 virtual ~AclConnection() = default; 35 GetHandle()36 uint16_t GetHandle() const { 37 return handle_; 38 } 39 40 virtual bool ReadRemoteVersionInformation() = 0; 41 42 using Queue = common::BidiQueue<PacketView<kLittleEndian>, BasePacketBuilder>; 43 using QueueUpEnd = common::BidiQueueEnd<BasePacketBuilder, PacketView<kLittleEndian>>; 44 using QueueDownEnd = common::BidiQueueEnd<PacketView<kLittleEndian>, BasePacketBuilder>; 45 virtual QueueUpEnd* GetAclQueueEnd() const; 46 47 bool locally_initiated_{false}; 48 49 protected: AclConnection(QueueUpEnd * queue_up_end,uint16_t handle)50 AclConnection(QueueUpEnd* queue_up_end, uint16_t handle) : queue_up_end_(queue_up_end), handle_(handle) {} 51 QueueUpEnd* queue_up_end_; 52 uint16_t handle_; 53 }; 54 55 } // namespace acl_manager 56 } // namespace hci 57 } // namespace bluetooth 58