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 "main/shim/entry.h"
18 
19 #include "hal/snoop_logger.h"
20 #include "hci/acl_manager.h"
21 #include "hci/controller.h"
22 #include "hci/controller_interface.h"
23 #include "hci/distance_measurement_manager.h"
24 #include "hci/hci_layer.h"
25 #include "hci/le_advertising_manager.h"
26 #include "hci/le_scanning_manager.h"
27 #if TARGET_FLOSS
28 #include "hci/msft.h"
29 #endif
30 #include "hci/remote_name_request.h"
31 #include "main/shim/stack.h"
32 #include "metrics/counter_metrics.h"
33 #include "os/handler.h"
34 #include "shim/dumpsys.h"
35 #include "storage/storage_module.h"
36 
37 namespace bluetooth {
38 namespace shim {
39 
GetGdShimHandler()40 os::Handler* GetGdShimHandler() { return Stack::GetInstance()->GetHandler(); }
41 
GetAdvertising()42 hci::LeAdvertisingManager* GetAdvertising() {
43   return Stack::GetInstance()
44       ->GetStackManager()
45       ->GetInstance<hci::LeAdvertisingManager>();
46 }
47 
GetController()48 hci::ControllerInterface* GetController() {
49   return Stack::GetInstance()
50       ->GetStackManager()
51       ->GetInstance<hci::Controller>();
52 }
53 
GetDumpsys()54 Dumpsys* GetDumpsys() {
55   return Stack::GetInstance()->GetStackManager()->GetInstance<Dumpsys>();
56 }
57 
GetHciLayer()58 hci::HciInterface* GetHciLayer() {
59   return Stack::GetInstance()->GetStackManager()->GetInstance<hci::HciLayer>();
60 }
61 
GetRemoteNameRequest()62 hci::RemoteNameRequestModule* GetRemoteNameRequest() {
63   return Stack::GetInstance()
64       ->GetStackManager()
65       ->GetInstance<hci::RemoteNameRequestModule>();
66 }
67 
GetScanning()68 hci::LeScanningManager* GetScanning() {
69   return Stack::GetInstance()
70       ->GetStackManager()
71       ->GetInstance<hci::LeScanningManager>();
72 }
73 
GetDistanceMeasurementManager()74 hci::DistanceMeasurementManager* GetDistanceMeasurementManager() {
75   return Stack::GetInstance()
76       ->GetStackManager()
77       ->GetInstance<hci::DistanceMeasurementManager>();
78 }
79 
GetSnoopLogger()80 hal::SnoopLogger* GetSnoopLogger() {
81   return Stack::GetInstance()
82       ->GetStackManager()
83       ->GetInstance<hal::SnoopLogger>();
84 }
85 
GetStorage()86 storage::StorageModule* GetStorage() {
87   return Stack::GetInstance()
88       ->GetStackManager()
89       ->GetInstance<storage::StorageModule>();
90 }
91 
GetAclManager()92 hci::AclManager* GetAclManager() {
93   return Stack::GetInstance()
94       ->GetStackManager()
95       ->GetInstance<hci::AclManager>();
96 }
97 
GetCounterMetrics()98 metrics::CounterMetrics* GetCounterMetrics() {
99   return Stack::GetInstance()
100       ->GetStackManager()
101       ->GetInstance<metrics::CounterMetrics>();
102 }
103 
104 #if TARGET_FLOSS
GetMsftExtensionManager()105 hci::MsftExtensionManager* GetMsftExtensionManager() {
106   return Stack::GetInstance()
107       ->GetStackManager()
108       ->GetInstance<hci::MsftExtensionManager>();
109 }
110 #endif
111 
112 }  // namespace shim
113 }  // namespace bluetooth
114