1 /*
2  * Copyright 2023 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 #pragma once
18 
19 #include "bta/include/bta_api.h"  // tBTA_DM_SEARCH_CBACK
20 #include "stack/include/bt_hdr.h"
21 #include "types/bt_transport.h"
22 #include "types/raw_address.h"
23 
24 // TODO: Remove this file after flag separate_service_and_device_discovery rolls
25 // out
26 namespace bta_dm_disc_legacy {
27 
28 // Bta module start and stop entry points
29 void bta_dm_disc_start(bool delay_close_gatt);
30 void bta_dm_disc_stop();
31 
32 // Bta device discovery start and stop entry points
33 void bta_dm_disc_start_device_discovery(tBTA_DM_SEARCH_CBACK*);
34 void bta_dm_disc_stop_device_discovery();
35 
36 // Bta service discovery start and stop entry points
37 void bta_dm_disc_start_service_discovery(service_discovery_callbacks cbacks,
38                                          const RawAddress& bd_addr,
39                                          tBT_TRANSPORT transport);
40 
41 // Bta subsystem entrypoint and lifecycle
42 void bta_dm_disc_disable_search_and_disc();
43 // Indication that an acl has gone down and to examine the current
44 // service discovery procedure, if any.
45 void bta_dm_disc_acl_down(const RawAddress& bd_addr, tBT_TRANSPORT transport);
46 
47 // Return most recent remote name
48 const char* bta_dm_get_remname(void);
49 
50 // LE observe and scan interface
51 void bta_dm_ble_scan(bool start, uint8_t duration_sec, bool low_latency_scan);
52 void bta_dm_ble_csis_observe(bool observe, tBTA_DM_SEARCH_CBACK* p_cback);
53 
54 // Checks if there is a device discovery request queued
55 bool bta_dm_is_search_request_queued();
56 
57 // Proceed to execute service discovery on next device in queue
58 void bta_dm_disc_discover_next_device();
59 
60 // GATT service discovery
61 void bta_dm_disc_gattc_register();
62 void bta_dm_disc_gatt_cancel_open(const RawAddress& bd_addr);
63 void bta_dm_disc_gatt_refresh(const RawAddress& bd_addr);
64 
65 // Stop service discovery procedure, if any, for removed device
66 void bta_dm_disc_remove_device(const RawAddress& bd_addr);
67 
68 // Provide data for the dumpsys procedure
69 void DumpsysBtaDmDisc(int fd);
70 
71 }  // namespace bta_dm_disc_legacy
72