• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   virtual bool ReadRemoteVersionInformation() = 0;
38 
39   using Queue = common::BidiQueue<PacketView<kLittleEndian>, BasePacketBuilder>;
40   using QueueUpEnd = common::BidiQueueEnd<BasePacketBuilder, PacketView<kLittleEndian>>;
41   using QueueDownEnd = common::BidiQueueEnd<PacketView<kLittleEndian>, BasePacketBuilder>;
42   virtual QueueUpEnd* GetAclQueueEnd() const;
43 
44   bool locally_initiated_{false};
45 
46  protected:
AclConnection(QueueUpEnd * queue_up_end,uint16_t handle)47   AclConnection(QueueUpEnd* queue_up_end, uint16_t handle) : queue_up_end_(queue_up_end), handle_(handle) {}
48   QueueUpEnd* queue_up_end_;
49   uint16_t handle_;
50   DISALLOW_COPY_AND_ASSIGN(AclConnection);
51 };
52 
53 }  // namespace acl_manager
54 }  // namespace hci
55 }  // namespace bluetooth
56