1 /*
2  * Copyright 2021 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 <cstdint>
18 #include <future>
19 
20 #include "btif/include/stack_manager_t.h"
21 #include "hardware/bluetooth.h"
22 #include "stack/include/bt_octets.h"
23 #include "types/raw_address.h"
24 
25 // TODO(b/369381361) Enfore -Wmissing-prototypes
26 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
27 
invoke_adapter_state_changed_cb(bt_state_t)28 void invoke_adapter_state_changed_cb(bt_state_t /* state */) {}
invoke_adapter_properties_cb(bt_status_t,int,bt_property_t *)29 void invoke_adapter_properties_cb(bt_status_t /* status */, int /* num_properties */,
30                                   bt_property_t* /* properties */) {}
invoke_remote_device_properties_cb(bt_status_t,RawAddress,int,bt_property_t *)31 void invoke_remote_device_properties_cb(bt_status_t /* status */, RawAddress /* bd_addr */,
32                                         int /* num_properties */, bt_property_t* /* properties */) {
33 }
invoke_device_found_cb(int,bt_property_t *)34 void invoke_device_found_cb(int /* num_properties */, bt_property_t* /* properties */) {}
invoke_discovery_state_changed_cb(bt_discovery_state_t)35 void invoke_discovery_state_changed_cb(bt_discovery_state_t /* state */) {}
invoke_pin_request_cb(RawAddress,bt_bdname_t,uint32_t,bool)36 void invoke_pin_request_cb(RawAddress /* bd_addr */, bt_bdname_t /* bd_name */, uint32_t /* cod */,
37                            bool /* min_16_digit */) {}
invoke_ssp_request_cb(RawAddress,bt_ssp_variant_t,uint32_t)38 void invoke_ssp_request_cb(RawAddress /* bd_addr */, bt_ssp_variant_t /* pairing_variant */,
39                            uint32_t /* pass_key */) {}
invoke_oob_data_request_cb(tBT_TRANSPORT,bool,Octet16,Octet16,RawAddress,uint8_t)40 void invoke_oob_data_request_cb(tBT_TRANSPORT /* t */, bool /* valid */, Octet16 /* c */,
41                                 Octet16 /* r */, RawAddress /* raw_address */,
42                                 uint8_t /* address_type */) {}
invoke_bond_state_changed_cb(bt_status_t,RawAddress,bt_bond_state_t,int)43 void invoke_bond_state_changed_cb(bt_status_t /* status */, RawAddress /* bd_addr */,
44                                   bt_bond_state_t /* state */, int /* fail_reason */) {}
invoke_address_consolidate_cb(RawAddress,RawAddress)45 void invoke_address_consolidate_cb(RawAddress /* main_bd_addr */,
46                                    RawAddress /* secondary_bd_addr */) {}
invoke_le_address_associate_cb(RawAddress,RawAddress,uint8_t)47 void invoke_le_address_associate_cb(RawAddress /* main_bd_addr */,
48                                     RawAddress /* secondary_bd_addr */,
49                                     uint8_t /* identity_address_type */) {}
invoke_acl_state_changed_cb(bt_status_t,RawAddress,bt_acl_state_t,int,bt_hci_error_code_t,bt_conn_direction_t,uint16_t)50 void invoke_acl_state_changed_cb(bt_status_t /* status */, RawAddress /* bd_addr */,
51                                  bt_acl_state_t /* state */, int /* transport_link_type */,
52                                  bt_hci_error_code_t /* hci_reason */,
53                                  bt_conn_direction_t /* direction */, uint16_t /* acl_handle */) {}
invoke_thread_evt_cb(bt_cb_thread_evt)54 void invoke_thread_evt_cb(bt_cb_thread_evt /* event */) {}
55 
invoke_le_test_mode_cb(bt_status_t,uint16_t)56 void invoke_le_test_mode_cb(bt_status_t /* status */, uint16_t /* count */) {}
57 
invoke_energy_info_cb(bt_activity_energy_info,bt_uid_traffic_t *)58 void invoke_energy_info_cb(bt_activity_energy_info /* energy_info */,
59                            bt_uid_traffic_t* /* uid_data */) {}
invoke_link_quality_report_cb(uint64_t,int,int,int,int,int,int)60 void invoke_link_quality_report_cb(uint64_t /* timestamp */, int /* report_id */, int /* rssi */,
61                                    int /* snr */, int /* retransmission_count */,
62                                    int /* packets_not_receive_count */,
63                                    int /* negative_acknowledgement_count */) {}
invoke_key_missing_cb(const RawAddress)64 void invoke_key_missing_cb(const RawAddress /* bd_addr */) {}
invoke_encryption_change_cb(bt_encryption_change_evt)65 void invoke_encryption_change_cb(bt_encryption_change_evt /* bd_addr */) {}
66 
init_stack(bluetooth::core::CoreInterface *)67 static void init_stack(bluetooth::core::CoreInterface* /* interface */) {}
68 
start_up_stack_async(bluetooth::core::CoreInterface *,ProfileStartCallback,ProfileStopCallback)69 static void start_up_stack_async(bluetooth::core::CoreInterface* /* interface */,
70                                  ProfileStartCallback /* startProfiles */,
71                                  ProfileStopCallback /* stopProfiles */) {}
72 
shut_down_stack_async(ProfileStopCallback)73 static void shut_down_stack_async(ProfileStopCallback /* stopProfiles */) {}
74 
clean_up_stack(ProfileStopCallback)75 static void clean_up_stack(ProfileStopCallback /* stopProfiles */) {}
76 
start_up_rust_module_async(std::promise<void>)77 static void start_up_rust_module_async(std::promise<void> /* promise */) {}
78 
shut_down_rust_module_async()79 static void shut_down_rust_module_async() {}
80 
get_stack_is_running()81 static bool get_stack_is_running() { return true; }
82 
83 static const stack_manager_t interface = {
84         init_stack,          start_up_stack_async,       shut_down_stack_async,
85         clean_up_stack,      start_up_rust_module_async, shut_down_rust_module_async,
86         get_stack_is_running};
87 
stack_manager_get_interface()88 const stack_manager_t* stack_manager_get_interface() { return &interface; }
89