• 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 #define LOG_TAG "bt_shim"
18 
19 #include "main/shim/shim.h"
20 #include "main/shim/entry.h"
21 #include "main/shim/stack.h"
22 
23 #include "gd/common/init_flags.h"
24 #include "gd/os/log.h"
25 
ShimModuleStartUp()26 future_t* ShimModuleStartUp() {
27   bluetooth::shim::Stack::GetInstance()->StartEverything();
28   return kReturnImmediate;
29 }
30 
GeneralShutDown()31 future_t* GeneralShutDown() {
32   bluetooth::shim::Stack::GetInstance()->Stop();
33   return kReturnImmediate;
34 }
35 
36 EXPORT_SYMBOL extern const module_t gd_shim_module = {
37     .name = GD_SHIM_MODULE,
38     .init = kUnusedModuleApi,
39     .start_up = ShimModuleStartUp,
40     .shut_down = GeneralShutDown,
41     .clean_up = kUnusedModuleApi,
42     .dependencies = {kUnusedModuleDependencies}};
43 
is_gd_link_policy_enabled()44 bool bluetooth::shim::is_gd_link_policy_enabled() {
45   return bluetooth::common::init_flags::gd_link_policy_is_enabled();
46 }
47 
is_gd_l2cap_enabled()48 bool bluetooth::shim::is_gd_l2cap_enabled() {
49   return bluetooth::common::init_flags::gd_l2cap_is_enabled();
50 }
51 
is_gd_shim_enabled()52 bool bluetooth::shim::is_gd_shim_enabled() {
53   return bluetooth::common::init_flags::gd_core_is_enabled();
54 }
55 
is_gd_stack_started_up()56 bool bluetooth::shim::is_gd_stack_started_up() {
57   return bluetooth::shim::Stack::GetInstance()->IsRunning();
58 }
59 
is_gd_dumpsys_module_started()60 bool bluetooth::shim::is_gd_dumpsys_module_started() {
61   return bluetooth::shim::Stack::GetInstance()->IsDumpsysModuleStarted();
62 }
63 
is_gd_btaa_enabled()64 bool bluetooth::shim::is_gd_btaa_enabled() {
65   return bluetooth::common::init_flags::btaa_hci_is_enabled();
66 }
67 
is_classic_discovery_only_enabled()68 bool bluetooth::shim::is_classic_discovery_only_enabled() {
69   return bluetooth::common::init_flags::classic_discovery_only_is_enabled();
70 }
71