blob: ed67b9ea5d76d9e1c9876fd0ab68e6dd27c00052 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
3 * Copyright (C) 2009-2012 Broadcom Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19/*******************************************************************************
20 *
21 * Filename: btif_api.h
22 *
23 * Description: Main API header file for all BTIF functions accessed
24 * from main bluetooth HAL. All HAL extensions will not
25 * require headerfiles as they would be accessed through
26 * callout/callins.
27 *
28 *******************************************************************************/
29
30#ifndef BTIF_API_H
31#define BTIF_API_H
32
Anubhav Gupta6b84f292015-05-05 13:15:07 +053033#include <hardware/bluetooth.h>
34
The Android Open Source Project5738f832012-12-12 16:00:35 -080035#include "btif_common.h"
36#include "btif_dm.h"
37
38/*******************************************************************************
39** BTIF CORE API
40********************************************************************************/
41
42/*******************************************************************************
43**
44** Function btif_init_bluetooth
45**
46** Description Creates BTIF task and prepares BT scheduler for startup
47**
48** Returns bt_status_t
49**
50*******************************************************************************/
51bt_status_t btif_init_bluetooth(void);
52
53/*******************************************************************************
54**
55** Function btif_enable_bluetooth
56**
57** Description Performs chip power on and kickstarts OS scheduler
58**
59** Returns bt_status_t
60**
61*******************************************************************************/
62bt_status_t btif_enable_bluetooth(void);
63
64/*******************************************************************************
65**
66** Function btif_disable_bluetooth
67**
68** Description Inititates shutdown of Bluetooth system.
69** Any active links will be dropped and device entering
70** non connectable/discoverable mode
71**
72** Returns void
73**
74*******************************************************************************/
75bt_status_t btif_disable_bluetooth(void);
76
77/*******************************************************************************
78**
79** Function btif_shutdown_bluetooth
80**
81** Description Finalizes BT scheduler shutdown and terminates BTIF
82** task.
83**
84**
85** Returns void
86**
87*******************************************************************************/
88bt_status_t btif_shutdown_bluetooth(void);
89
90/*******************************************************************************
91**
Ajay Panicker7b266be2016-03-17 17:09:24 -070092** Function is_restricted_mode
93**
94** Description Checks if BT was enabled in restriced mode. In restricted
95** mode, bonds that are created are marked as temporary.
96** These bonds persist until we leave restricted mode, at
97** which point they will be deleted from the config. Also
98** while in restricted mode, the user can access devices
99** that are already paired before entering restricted mode,
100** but they cannot remove any of these devices.
101**
102** Returns bool
103**
104*******************************************************************************/
105bool is_restricted_mode(void);
106
107/*******************************************************************************
108**
The Android Open Source Project5738f832012-12-12 16:00:35 -0800109** Function btif_get_adapter_properties
110**
111** Description Fetches all local adapter properties
112**
113** Returns bt_status_t
114**
115*******************************************************************************/
116bt_status_t btif_get_adapter_properties(void);
117
118/*******************************************************************************
119**
120** Function btif_get_adapter_property
121**
122** Description Fetches property value from local cache
123**
124** Returns bt_status_t
125**
126*******************************************************************************/
127bt_status_t btif_get_adapter_property( bt_property_type_t type);
128
129/*******************************************************************************
130**
131** Function btif_set_adapter_property
132**
133** Description Updates core stack with property value and stores it in
134** local cache
135**
136** Returns bt_status_t
137**
138*******************************************************************************/
139bt_status_t btif_set_adapter_property( const bt_property_t *property);
140
141/*******************************************************************************
142**
143** Function btif_get_remote_device_property
144**
145** Description Fetches the remote device property from the NVRAM
146**
147** Returns bt_status_t
148**
149*******************************************************************************/
150bt_status_t btif_get_remote_device_property( bt_bdaddr_t *remote_addr,
151 bt_property_type_t type);
152
153/*******************************************************************************
154**
155** Function btif_get_remote_device_properties
156**
157** Description Fetches all the remote device properties from NVRAM
158**
159** Returns bt_status_t
160**
161*******************************************************************************/
162bt_status_t btif_get_remote_device_properties( bt_bdaddr_t *remote_addr);
163
164/*******************************************************************************
165**
166** Function btif_set_remote_device_property
167**
168** Description Writes the remote device property to NVRAM.
169** Currently, BT_PROPERTY_REMOTE_FRIENDLY_NAME is the only
170** remote device property that can be set
171**
172** Returns bt_status_t
173**
174*******************************************************************************/
175bt_status_t btif_set_remote_device_property( bt_bdaddr_t *remote_addr,
176 const bt_property_t *property);
177
178/*******************************************************************************
179**
180** Function btif_get_remote_service_record
181**
182** Description Looks up the service matching uuid on the remote device
183** and fetches the SCN and service_name if the UUID is found
184**
185** Returns bt_status_t
186**
187*******************************************************************************/
188bt_status_t btif_get_remote_service_record( bt_bdaddr_t *remote_addr,
189 bt_uuid_t *uuid);
190
191
192/*******************************************************************************
193** BTIF DM API
194********************************************************************************/
195
196/*******************************************************************************
197**
198** Function btif_dm_start_discovery
199**
200** Description Start device discovery/inquiry
201**
202**
203** Returns bt_status_t
204**
205*******************************************************************************/
206bt_status_t btif_dm_start_discovery(void);
207
208/*******************************************************************************
209**
210** Function btif_dm_cancel_discovery
211**
212** Description Cancels search
213**
214** Returns bt_status_t
215**
216*******************************************************************************/
217bt_status_t btif_dm_cancel_discovery(void);
218
219/*******************************************************************************
220**
221** Function btif_dm_create_bond
222**
223** Description Initiate bonding with the specified device
224**
225** Returns bt_status_t
226**
227*******************************************************************************/
Andre Eisenbachb0daa5d2014-08-04 17:50:10 -0700228bt_status_t btif_dm_create_bond(const bt_bdaddr_t *bd_addr, int transport);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800229
230/*******************************************************************************
231**
Jakub Pawlowski1a5bb5f2015-12-01 12:14:22 -0800232** Function btif_dm_create_bond_out_of_band
233**
234** Description Initiate bonding with the specified device using OOB data.
235**
236** Returns bt_status_t
237**
238*******************************************************************************/
239bt_status_t btif_dm_create_bond_out_of_band(const bt_bdaddr_t *bd_addr, int transport,
240 const bt_out_of_band_data_t *oob_data);
241
242/*******************************************************************************
243**
The Android Open Source Project5738f832012-12-12 16:00:35 -0800244** Function btif_dm_cancel_bond
245**
246** Description Initiate bonding with the specified device
247**
248** Returns bt_status_t
249**
250*******************************************************************************/
251bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr);
252
253/*******************************************************************************
254**
255** Function btif_dm_remove_bond
256**
257** Description Removes bonding with the specified device
258**
259** Returns bt_status_t
260**
261*******************************************************************************/
262bt_status_t btif_dm_remove_bond(const bt_bdaddr_t *bd_addr);
263
264/*******************************************************************************
265**
Andre Eisenbach5c0b0522014-06-18 12:20:37 -0700266** Function btif_dm_get_connection_state
267**
268** Description Returns whether the remote device is currently connected
269**
270** Returns 0 if not connected
271**
272*******************************************************************************/
273uint16_t btif_dm_get_connection_state(const bt_bdaddr_t *bd_addr);
274
275/*******************************************************************************
276**
The Android Open Source Project5738f832012-12-12 16:00:35 -0800277** Function btif_dm_pin_reply
278**
279** Description BT legacy pairing - PIN code reply
280**
281** Returns bt_status_t
282**
283*******************************************************************************/
284bt_status_t btif_dm_pin_reply( const bt_bdaddr_t *bd_addr, uint8_t accept,
285 uint8_t pin_len, bt_pin_code_t *pin_code);
286
287/*******************************************************************************
288**
289** Function btif_dm_passkey_reply
290**
291** Description BT SSP passkey reply
292**
293** Returns bt_status_t
294**
295*******************************************************************************/
296bt_status_t btif_dm_passkey_reply( const bt_bdaddr_t *bd_addr,
297 uint8_t accept, uint32_t passkey);
298
299/*******************************************************************************
300**
301** Function btif_dm_ssp_reply
302**
303** Description BT SSP Reply - Just Works, Numeric Comparison & Passkey Entry
304**
305** Returns bt_status_t
306**
307*******************************************************************************/
308bt_status_t btif_dm_ssp_reply( const bt_bdaddr_t *bd_addr,
309 bt_ssp_variant_t variant, uint8_t accept,
310 uint32_t passkey);
311
312/*******************************************************************************
313**
314** Function btif_dm_get_adapter_property
315**
316** Description Queries the BTA for the adapter property
317**
318** Returns bt_status_t
319**
320*******************************************************************************/
321bt_status_t btif_dm_get_adapter_property(bt_property_t *prop);
322
323/*******************************************************************************
324**
325** Function btif_dm_get_remote_services
326**
327** Description Start SDP to get remote services
328**
329** Returns bt_status_t
330**
331*******************************************************************************/
332bt_status_t btif_dm_get_remote_service_record(bt_bdaddr_t *remote_addr,
333 bt_uuid_t *uuid);
334
335
336/*******************************************************************************
337**
338** Function btif_dm_get_remote_services
339**
340** Description Start SDP to get remote services
341**
342** Returns bt_status_t
343**
344*******************************************************************************/
345bt_status_t btif_dm_get_remote_services(bt_bdaddr_t *remote_addr);
346
347/*******************************************************************************
348**
Nitin Arorab4365c52015-06-25 18:30:09 -0700349** Function btif_dm_get_remote_services_by_transport
350**
351** Description Start SDP to get remote services by transport
352**
353** Returns bt_status_t
354**
355*******************************************************************************/
356bt_status_t btif_dm_get_remote_services_by_transport(bt_bdaddr_t *remote_addr, int transport);
357
358/*******************************************************************************
359**
The Android Open Source Project5738f832012-12-12 16:00:35 -0800360** Function btif_dut_mode_configure
361**
362** Description Configure Test Mode - 'enable' to 1 puts the device in test mode and 0 exits
363** test mode
364**
365** Returns BT_STATUS_SUCCESS on success
366**
367*******************************************************************************/
368bt_status_t btif_dut_mode_configure(uint8_t enable);
369
370/*******************************************************************************
371**
372** Function btif_dut_mode_send
373**
374** Description Sends a HCI Vendor specific command to the controller
375**
376** Returns BT_STATUS_SUCCESS on success
377**
378*******************************************************************************/
379bt_status_t btif_dut_mode_send(uint16_t opcode, uint8_t *buf, uint8_t len);
380
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800381/*******************************************************************************
382**
383** Function btif_le_test_mode
384**
385** Description Sends a HCI BLE Test command to the Controller
386**
387** Returns BT_STATUS_SUCCESS on success
388**
389*******************************************************************************/
390bt_status_t btif_le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len);
Zhihai Xubad70b12013-06-04 18:21:25 -0700391
392/*******************************************************************************
393**
Satya Callojie5ba8842014-07-03 17:18:02 -0700394** Function btif_dm_read_energy_info
395**
396** Description Reads the energy info from controller
397**
398** Returns void
399**
400*******************************************************************************/
401void btif_dm_read_energy_info();
402
403/*******************************************************************************
404**
Zhihai Xubad70b12013-06-04 18:21:25 -0700405** Function btif_config_hci_snoop_log
406**
407** Description enable or disable HCI snoop log
408**
409** Returns BT_STATUS_SUCCESS on success
410**
411*******************************************************************************/
412bt_status_t btif_config_hci_snoop_log(uint8_t enable);
Ajay Panickerc138fe42016-02-05 16:50:20 -0800413
414/*******************************************************************************
415**
416** Function btif_debug_bond_event_dump
417**
418** Description Dump bond event information
419**
420** Returns void
421**
422*******************************************************************************/
423void btif_debug_bond_event_dump(int fd);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800424#endif /* BTIF_API_H */