• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "osi/include/future.h"
19 #include "osi/include/log.h"
20 
21 #include "hci/controller.h"
22 #include "hci/hci_layer.h"
23 #include "hci/le_advertising_manager.h"
24 #include "hci/le_scanning_manager.h"
25 #include "main/shim/btm.h"
26 #include "neighbor/connectability.h"
27 #include "neighbor/discoverability.h"
28 #include "neighbor/inquiry.h"
29 #include "neighbor/name.h"
30 #include "neighbor/page.h"
31 #include "os/handler.h"
32 #include "security/security_module.h"
33 #include "shim/dumpsys.h"
34 #include "shim/l2cap.h"
35 #include "shim/stack.h"
36 #include "stack_manager.h"
37 #include "storage/legacy.h"
38 
39 using bluetooth::shim::GetGabeldorscheStack;
40 
41 extern bluetooth::shim::Btm shim_btm;
42 
StartGabeldorscheStack()43 future_t* bluetooth::shim::StartGabeldorscheStack() {
44   GetGabeldorscheStack()->Start();
45   shim_btm.RegisterInquiryCallbacks();
46   return (future_t*)nullptr;
47 }
48 
StopGabeldorscheStack()49 future_t* bluetooth::shim::StopGabeldorscheStack() {
50   GetGabeldorscheStack()->Stop();
51   return (future_t*)nullptr;
52 }
53 
GetGdShimHandler()54 bluetooth::os::Handler* bluetooth::shim::GetGdShimHandler() {
55   return bluetooth::shim::GetDumpsys()->GetGdShimHandler();
56 }
57 
GetAdvertising()58 bluetooth::hci::LeAdvertisingManager* bluetooth::shim::GetAdvertising() {
59   return GetGabeldorscheStack()
60       ->GetStackManager()
61       ->GetInstance<bluetooth::hci::LeAdvertisingManager>();
62 }
63 
GetController()64 bluetooth::hci::Controller* bluetooth::shim::GetController() {
65   return GetGabeldorscheStack()
66       ->GetStackManager()
67       ->GetInstance<bluetooth::hci::Controller>();
68 }
69 
70 bluetooth::neighbor::ConnectabilityModule*
GetConnectability()71 bluetooth::shim::GetConnectability() {
72   return GetGabeldorscheStack()
73       ->GetStackManager()
74       ->GetInstance<bluetooth::neighbor::ConnectabilityModule>();
75 }
76 
77 bluetooth::neighbor::DiscoverabilityModule*
GetDiscoverability()78 bluetooth::shim::GetDiscoverability() {
79   return GetGabeldorscheStack()
80       ->GetStackManager()
81       ->GetInstance<bluetooth::neighbor::DiscoverabilityModule>();
82 }
83 
GetDumpsys()84 bluetooth::shim::Dumpsys* bluetooth::shim::GetDumpsys() {
85   return GetGabeldorscheStack()
86       ->GetStackManager()
87       ->GetInstance<bluetooth::shim::Dumpsys>();
88 }
89 
GetInquiry()90 bluetooth::neighbor::InquiryModule* bluetooth::shim::GetInquiry() {
91   return GetGabeldorscheStack()
92       ->GetStackManager()
93       ->GetInstance<bluetooth::neighbor::InquiryModule>();
94 }
95 
GetHciLayer()96 bluetooth::hci::HciLayer* bluetooth::shim::GetHciLayer() {
97   return GetGabeldorscheStack()
98       ->GetStackManager()
99       ->GetInstance<bluetooth::hci::HciLayer>();
100 }
101 
GetL2cap()102 bluetooth::shim::L2cap* bluetooth::shim::GetL2cap() {
103   return GetGabeldorscheStack()
104       ->GetStackManager()
105       ->GetInstance<bluetooth::shim::L2cap>();
106 }
107 
GetName()108 bluetooth::neighbor::NameModule* bluetooth::shim::GetName() {
109   return GetGabeldorscheStack()
110       ->GetStackManager()
111       ->GetInstance<bluetooth::neighbor::NameModule>();
112 }
113 
GetPage()114 bluetooth::neighbor::PageModule* bluetooth::shim::GetPage() {
115   return GetGabeldorscheStack()
116       ->GetStackManager()
117       ->GetInstance<bluetooth::neighbor::PageModule>();
118 }
119 
GetScanning()120 bluetooth::hci::LeScanningManager* bluetooth::shim::GetScanning() {
121   return GetGabeldorscheStack()
122       ->GetStackManager()
123       ->GetInstance<bluetooth::hci::LeScanningManager>();
124 }
125 
GetSecurityModule()126 bluetooth::security::SecurityModule* bluetooth::shim::GetSecurityModule() {
127   return GetGabeldorscheStack()
128       ->GetStackManager()
129       ->GetInstance<bluetooth::security::SecurityModule>();
130 }
131 
GetStorage()132 bluetooth::storage::LegacyModule* bluetooth::shim::GetStorage() {
133   return GetGabeldorscheStack()
134       ->GetStackManager()
135       ->GetInstance<bluetooth::storage::LegacyModule>();
136 }
137