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