1 /******************************************************************************
3 * Copyright (C) 2009-2012 Broadcom Corporation
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:
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ******************************************************************************/
19 /*******************************************************************************
21 * Filename: btif_api.h
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
28 *******************************************************************************/
33 #include <hardware/bluetooth.h>
35 #include "btif_common.h"
38 /*******************************************************************************
40 ********************************************************************************/
42 /*******************************************************************************
44 ** Function btif_init_bluetooth
46 ** Description Creates BTIF task and prepares BT scheduler for startup
48 ** Returns bt_status_t
50 *******************************************************************************/
51 bt_status_t btif_init_bluetooth(void);
53 /*******************************************************************************
55 ** Function btif_enable_bluetooth
57 ** Description Performs chip power on and kickstarts OS scheduler
59 ** Returns bt_status_t
61 *******************************************************************************/
62 bt_status_t btif_enable_bluetooth(void);
64 /*******************************************************************************
66 ** Function btif_disable_bluetooth
68 ** Description Inititates shutdown of Bluetooth system.
69 ** Any active links will be dropped and device entering
70 ** non connectable/discoverable mode
74 *******************************************************************************/
75 bt_status_t btif_disable_bluetooth(void);
77 /*******************************************************************************
79 ** Function btif_shutdown_bluetooth
81 ** Description Finalizes BT scheduler shutdown and terminates BTIF
87 *******************************************************************************/
88 bt_status_t btif_shutdown_bluetooth(void);
90 /*******************************************************************************
92 ** Function btif_get_adapter_properties
94 ** Description Fetches all local adapter properties
96 ** Returns bt_status_t
98 *******************************************************************************/
99 bt_status_t btif_get_adapter_properties(void);
101 /*******************************************************************************
103 ** Function btif_get_adapter_property
105 ** Description Fetches property value from local cache
107 ** Returns bt_status_t
109 *******************************************************************************/
110 bt_status_t btif_get_adapter_property( bt_property_type_t type);
112 /*******************************************************************************
114 ** Function btif_set_adapter_property
116 ** Description Updates core stack with property value and stores it in
119 ** Returns bt_status_t
121 *******************************************************************************/
122 bt_status_t btif_set_adapter_property( const bt_property_t *property);
124 /*******************************************************************************
126 ** Function btif_get_remote_device_property
128 ** Description Fetches the remote device property from the NVRAM
130 ** Returns bt_status_t
132 *******************************************************************************/
133 bt_status_t btif_get_remote_device_property( bt_bdaddr_t *remote_addr,
134 bt_property_type_t type);
136 /*******************************************************************************
138 ** Function btif_get_remote_device_properties
140 ** Description Fetches all the remote device properties from NVRAM
142 ** Returns bt_status_t
144 *******************************************************************************/
145 bt_status_t btif_get_remote_device_properties( bt_bdaddr_t *remote_addr);
147 /*******************************************************************************
149 ** Function btif_set_remote_device_property
151 ** Description Writes the remote device property to NVRAM.
152 ** Currently, BT_PROPERTY_REMOTE_FRIENDLY_NAME is the only
153 ** remote device property that can be set
155 ** Returns bt_status_t
157 *******************************************************************************/
158 bt_status_t btif_set_remote_device_property( bt_bdaddr_t *remote_addr,
159 const bt_property_t *property);
161 /*******************************************************************************
163 ** Function btif_get_remote_service_record
165 ** Description Looks up the service matching uuid on the remote device
166 ** and fetches the SCN and service_name if the UUID is found
168 ** Returns bt_status_t
170 *******************************************************************************/
171 bt_status_t btif_get_remote_service_record( bt_bdaddr_t *remote_addr,
175 /*******************************************************************************
177 ********************************************************************************/
179 /*******************************************************************************
181 ** Function btif_dm_start_discovery
183 ** Description Start device discovery/inquiry
186 ** Returns bt_status_t
188 *******************************************************************************/
189 bt_status_t btif_dm_start_discovery(void);
191 /*******************************************************************************
193 ** Function btif_dm_cancel_discovery
195 ** Description Cancels search
197 ** Returns bt_status_t
199 *******************************************************************************/
200 bt_status_t btif_dm_cancel_discovery(void);
202 /*******************************************************************************
204 ** Function btif_dm_create_bond
206 ** Description Initiate bonding with the specified device
208 ** Returns bt_status_t
210 *******************************************************************************/
211 bt_status_t btif_dm_create_bond(const bt_bdaddr_t *bd_addr, int transport);
213 /*******************************************************************************
215 ** Function btif_dm_create_bond_out_of_band
217 ** Description Initiate bonding with the specified device using OOB data.
219 ** Returns bt_status_t
221 *******************************************************************************/
222 bt_status_t btif_dm_create_bond_out_of_band(const bt_bdaddr_t *bd_addr, int transport,
223 const bt_out_of_band_data_t *oob_data);
225 /*******************************************************************************
227 ** Function btif_dm_cancel_bond
229 ** Description Initiate bonding with the specified device
231 ** Returns bt_status_t
233 *******************************************************************************/
234 bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr);
236 /*******************************************************************************
238 ** Function btif_dm_remove_bond
240 ** Description Removes bonding with the specified device
242 ** Returns bt_status_t
244 *******************************************************************************/
245 bt_status_t btif_dm_remove_bond(const bt_bdaddr_t *bd_addr);
247 /*******************************************************************************
249 ** Function btif_dm_get_connection_state
251 ** Description Returns whether the remote device is currently connected
253 ** Returns 0 if not connected
255 *******************************************************************************/
256 uint16_t btif_dm_get_connection_state(const bt_bdaddr_t *bd_addr);
258 /*******************************************************************************
260 ** Function btif_dm_pin_reply
262 ** Description BT legacy pairing - PIN code reply
264 ** Returns bt_status_t
266 *******************************************************************************/
267 bt_status_t btif_dm_pin_reply( const bt_bdaddr_t *bd_addr, uint8_t accept,
268 uint8_t pin_len, bt_pin_code_t *pin_code);
270 /*******************************************************************************
272 ** Function btif_dm_passkey_reply
274 ** Description BT SSP passkey reply
276 ** Returns bt_status_t
278 *******************************************************************************/
279 bt_status_t btif_dm_passkey_reply( const bt_bdaddr_t *bd_addr,
280 uint8_t accept, uint32_t passkey);
282 /*******************************************************************************
284 ** Function btif_dm_ssp_reply
286 ** Description BT SSP Reply - Just Works, Numeric Comparison & Passkey Entry
288 ** Returns bt_status_t
290 *******************************************************************************/
291 bt_status_t btif_dm_ssp_reply( const bt_bdaddr_t *bd_addr,
292 bt_ssp_variant_t variant, uint8_t accept,
295 /*******************************************************************************
297 ** Function btif_dm_get_adapter_property
299 ** Description Queries the BTA for the adapter property
301 ** Returns bt_status_t
303 *******************************************************************************/
304 bt_status_t btif_dm_get_adapter_property(bt_property_t *prop);
306 /*******************************************************************************
308 ** Function btif_dm_get_remote_services
310 ** Description Start SDP to get remote services
312 ** Returns bt_status_t
314 *******************************************************************************/
315 bt_status_t btif_dm_get_remote_service_record(bt_bdaddr_t *remote_addr,
319 /*******************************************************************************
321 ** Function btif_dm_get_remote_services
323 ** Description Start SDP to get remote services
325 ** Returns bt_status_t
327 *******************************************************************************/
328 bt_status_t btif_dm_get_remote_services(bt_bdaddr_t *remote_addr);
330 /*******************************************************************************
332 ** Function btif_dm_get_remote_services_by_transport
334 ** Description Start SDP to get remote services by transport
336 ** Returns bt_status_t
338 *******************************************************************************/
339 bt_status_t btif_dm_get_remote_services_by_transport(bt_bdaddr_t *remote_addr, int transport);
341 /*******************************************************************************
343 ** Function btif_dut_mode_configure
345 ** Description Configure Test Mode - 'enable' to 1 puts the device in test mode and 0 exits
348 ** Returns BT_STATUS_SUCCESS on success
350 *******************************************************************************/
351 bt_status_t btif_dut_mode_configure(uint8_t enable);
353 /*******************************************************************************
355 ** Function btif_dut_mode_send
357 ** Description Sends a HCI Vendor specific command to the controller
359 ** Returns BT_STATUS_SUCCESS on success
361 *******************************************************************************/
362 bt_status_t btif_dut_mode_send(uint16_t opcode, uint8_t *buf, uint8_t len);
364 /*******************************************************************************
366 ** Function btif_le_test_mode
368 ** Description Sends a HCI BLE Test command to the Controller
370 ** Returns BT_STATUS_SUCCESS on success
372 *******************************************************************************/
373 bt_status_t btif_le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len);
375 /*******************************************************************************
377 ** Function btif_dm_read_energy_info
379 ** Description Reads the energy info from controller
383 *******************************************************************************/
384 void btif_dm_read_energy_info();
386 /*******************************************************************************
388 ** Function btif_config_hci_snoop_log
390 ** Description enable or disable HCI snoop log
392 ** Returns BT_STATUS_SUCCESS on success
394 *******************************************************************************/
395 bt_status_t btif_config_hci_snoop_log(uint8_t enable);
397 /*******************************************************************************
399 ** Function btif_debug_bond_event_dump
401 ** Description Dump bond event information
405 *******************************************************************************/
406 void btif_debug_bond_event_dump(int fd);
407 #endif /* BTIF_API_H */