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 #include "gd/hci/controller.h"
18 #include "gd/hci/hci_layer.h"
19 #include "gd/hci/le_advertising_manager.h"
20 #include "gd/hci/le_scanning_manager.h"
21 #include "gd/neighbor/connectability.h"
22 #include "gd/neighbor/discoverability.h"
23 #include "gd/neighbor/inquiry.h"
24 #include "gd/neighbor/name.h"
25 #include "gd/neighbor/page.h"
26 #include "gd/os/handler.h"
27 #include "gd/security/security_module.h"
28 #include "gd/shim/dumpsys.h"
29 #include "gd/shim/l2cap.h"
30 #include "gd/storage/storage_module.h"
31 
32 #include "hci/acl_manager.h"
33 
34 #include "main/shim/entry.h"
35 #include "main/shim/stack.h"
36 
37 namespace bluetooth {
38 namespace shim {
39 
GetGdShimHandler()40 os::Handler* GetGdShimHandler() { return GetDumpsys()->GetGdShimHandler(); }
41 
GetAdvertising()42 hci::LeAdvertisingManager* GetAdvertising() {
43   return Stack::GetInstance()
44       ->GetStackManager()
45       ->GetInstance<hci::LeAdvertisingManager>();
46 }
47 
GetController()48 hci::Controller* GetController() {
49   return Stack::GetInstance()
50       ->GetStackManager()
51       ->GetInstance<hci::Controller>();
52 }
53 
GetConnectability()54 neighbor::ConnectabilityModule* GetConnectability() {
55   return Stack::GetInstance()
56       ->GetStackManager()
57       ->GetInstance<neighbor::ConnectabilityModule>();
58 }
59 
GetDiscoverability()60 neighbor::DiscoverabilityModule* GetDiscoverability() {
61   return Stack::GetInstance()
62       ->GetStackManager()
63       ->GetInstance<neighbor::DiscoverabilityModule>();
64 }
65 
GetDumpsys()66 Dumpsys* GetDumpsys() {
67   return Stack::GetInstance()->GetStackManager()->GetInstance<Dumpsys>();
68 }
69 
GetInquiry()70 neighbor::InquiryModule* GetInquiry() {
71   return Stack::GetInstance()
72       ->GetStackManager()
73       ->GetInstance<neighbor::InquiryModule>();
74 }
75 
GetHciLayer()76 hci::HciLayer* GetHciLayer() {
77   return Stack::GetInstance()->GetStackManager()->GetInstance<hci::HciLayer>();
78 }
79 
GetL2cap()80 L2cap* GetL2cap() {
81   return Stack::GetInstance()->GetStackManager()->GetInstance<L2cap>();
82 }
83 
GetL2capLeModule()84 bluetooth::l2cap::le::L2capLeModule* GetL2capLeModule() {
85   return Stack::GetInstance()
86       ->GetStackManager()
87       ->GetInstance<bluetooth::l2cap::le::L2capLeModule>();
88 }
89 
GetName()90 neighbor::NameModule* GetName() {
91   return Stack::GetInstance()
92       ->GetStackManager()
93       ->GetInstance<neighbor::NameModule>();
94 }
95 
GetPage()96 neighbor::PageModule* GetPage() {
97   return Stack::GetInstance()
98       ->GetStackManager()
99       ->GetInstance<neighbor::PageModule>();
100 }
101 
GetScanning()102 hci::LeScanningManager* GetScanning() {
103   return Stack::GetInstance()
104       ->GetStackManager()
105       ->GetInstance<hci::LeScanningManager>();
106 }
107 
GetSecurityModule()108 security::SecurityModule* GetSecurityModule() {
109   return Stack::GetInstance()
110       ->GetStackManager()
111       ->GetInstance<security::SecurityModule>();
112 }
113 
GetStorage()114 storage::StorageModule* GetStorage() {
115   return Stack::GetInstance()
116       ->GetStackManager()
117       ->GetInstance<storage::StorageModule>();
118 }
119 
GetAclManager()120 hci::AclManager* GetAclManager() {
121   return Stack::GetInstance()
122       ->GetStackManager()
123       ->GetInstance<hci::AclManager>();
124 }
125 
126 }  // namespace shim
127 }  // namespace bluetooth
128