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 "btif_common.h"
36 /*******************************************************************************
38 ********************************************************************************/
40 /*******************************************************************************
42 ** Function btif_init_bluetooth
44 ** Description Creates BTIF task and prepares BT scheduler for startup
46 ** Returns bt_status_t
48 *******************************************************************************/
49 bt_status_t btif_init_bluetooth(void);
51 /*******************************************************************************
53 ** Function btif_enable_bluetooth
55 ** Description Performs chip power on and kickstarts OS scheduler
57 ** Returns bt_status_t
59 *******************************************************************************/
60 bt_status_t btif_enable_bluetooth(void);
62 /*******************************************************************************
64 ** Function btif_disable_bluetooth
66 ** Description Inititates shutdown of Bluetooth system.
67 ** Any active links will be dropped and device entering
68 ** non connectable/discoverable mode
72 *******************************************************************************/
73 bt_status_t btif_disable_bluetooth(void);
75 /*******************************************************************************
77 ** Function btif_shutdown_bluetooth
79 ** Description Finalizes BT scheduler shutdown and terminates BTIF
85 *******************************************************************************/
86 bt_status_t btif_shutdown_bluetooth(void);
88 /*******************************************************************************
90 ** Function btif_get_adapter_properties
92 ** Description Fetches all local adapter properties
94 ** Returns bt_status_t
96 *******************************************************************************/
97 bt_status_t btif_get_adapter_properties(void);
99 /*******************************************************************************
101 ** Function btif_get_adapter_property
103 ** Description Fetches property value from local cache
105 ** Returns bt_status_t
107 *******************************************************************************/
108 bt_status_t btif_get_adapter_property( bt_property_type_t type);
110 /*******************************************************************************
112 ** Function btif_set_adapter_property
114 ** Description Updates core stack with property value and stores it in
117 ** Returns bt_status_t
119 *******************************************************************************/
120 bt_status_t btif_set_adapter_property( const bt_property_t *property);
122 /*******************************************************************************
124 ** Function btif_get_remote_device_property
126 ** Description Fetches the remote device property from the NVRAM
128 ** Returns bt_status_t
130 *******************************************************************************/
131 bt_status_t btif_get_remote_device_property( bt_bdaddr_t *remote_addr,
132 bt_property_type_t type);
134 /*******************************************************************************
136 ** Function btif_get_remote_device_properties
138 ** Description Fetches all the remote device properties from NVRAM
140 ** Returns bt_status_t
142 *******************************************************************************/
143 bt_status_t btif_get_remote_device_properties( bt_bdaddr_t *remote_addr);
145 /*******************************************************************************
147 ** Function btif_set_remote_device_property
149 ** Description Writes the remote device property to NVRAM.
150 ** Currently, BT_PROPERTY_REMOTE_FRIENDLY_NAME is the only
151 ** remote device property that can be set
153 ** Returns bt_status_t
155 *******************************************************************************/
156 bt_status_t btif_set_remote_device_property( bt_bdaddr_t *remote_addr,
157 const bt_property_t *property);
159 /*******************************************************************************
161 ** Function btif_get_remote_service_record
163 ** Description Looks up the service matching uuid on the remote device
164 ** and fetches the SCN and service_name if the UUID is found
166 ** Returns bt_status_t
168 *******************************************************************************/
169 bt_status_t btif_get_remote_service_record( bt_bdaddr_t *remote_addr,
173 /*******************************************************************************
175 ********************************************************************************/
177 /*******************************************************************************
179 ** Function btif_dm_start_discovery
181 ** Description Start device discovery/inquiry
184 ** Returns bt_status_t
186 *******************************************************************************/
187 bt_status_t btif_dm_start_discovery(void);
189 /*******************************************************************************
191 ** Function btif_dm_cancel_discovery
193 ** Description Cancels search
195 ** Returns bt_status_t
197 *******************************************************************************/
198 bt_status_t btif_dm_cancel_discovery(void);
200 /*******************************************************************************
202 ** Function btif_dm_create_bond
204 ** Description Initiate bonding with the specified device
206 ** Returns bt_status_t
208 *******************************************************************************/
209 bt_status_t btif_dm_create_bond(const bt_bdaddr_t *bd_addr, int transport);
211 /*******************************************************************************
213 ** Function btif_dm_create_bond_out_of_band
215 ** Description Initiate bonding with the specified device using OOB data.
217 ** Returns bt_status_t
219 *******************************************************************************/
220 bt_status_t btif_dm_create_bond_out_of_band(const bt_bdaddr_t *bd_addr, int transport,
221 const bt_out_of_band_data_t *oob_data);
223 /*******************************************************************************
225 ** Function btif_dm_cancel_bond
227 ** Description Initiate bonding with the specified device
229 ** Returns bt_status_t
231 *******************************************************************************/
232 bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr);
234 /*******************************************************************************
236 ** Function btif_dm_remove_bond
238 ** Description Removes bonding with the specified device
240 ** Returns bt_status_t
242 *******************************************************************************/
243 bt_status_t btif_dm_remove_bond(const bt_bdaddr_t *bd_addr);
245 /*******************************************************************************
247 ** Function btif_dm_get_connection_state
249 ** Description Returns whether the remote device is currently connected
251 ** Returns 0 if not connected
253 *******************************************************************************/
254 uint16_t btif_dm_get_connection_state(const bt_bdaddr_t *bd_addr);
256 /*******************************************************************************
258 ** Function btif_dm_pin_reply
260 ** Description BT legacy pairing - PIN code reply
262 ** Returns bt_status_t
264 *******************************************************************************/
265 bt_status_t btif_dm_pin_reply( const bt_bdaddr_t *bd_addr, uint8_t accept,
266 uint8_t pin_len, bt_pin_code_t *pin_code);
268 /*******************************************************************************
270 ** Function btif_dm_passkey_reply
272 ** Description BT SSP passkey reply
274 ** Returns bt_status_t
276 *******************************************************************************/
277 bt_status_t btif_dm_passkey_reply( const bt_bdaddr_t *bd_addr,
278 uint8_t accept, uint32_t passkey);
280 /*******************************************************************************
282 ** Function btif_dm_ssp_reply
284 ** Description BT SSP Reply - Just Works, Numeric Comparison & Passkey Entry
286 ** Returns bt_status_t
288 *******************************************************************************/
289 bt_status_t btif_dm_ssp_reply( const bt_bdaddr_t *bd_addr,
290 bt_ssp_variant_t variant, uint8_t accept,
293 /*******************************************************************************
295 ** Function btif_dm_get_adapter_property
297 ** Description Queries the BTA for the adapter property
299 ** Returns bt_status_t
301 *******************************************************************************/
302 bt_status_t btif_dm_get_adapter_property(bt_property_t *prop);
304 /*******************************************************************************
306 ** Function btif_dm_get_remote_services
308 ** Description Start SDP to get remote services
310 ** Returns bt_status_t
312 *******************************************************************************/
313 bt_status_t btif_dm_get_remote_service_record(bt_bdaddr_t *remote_addr,
317 /*******************************************************************************
319 ** Function btif_dm_get_remote_services
321 ** Description Start SDP to get remote services
323 ** Returns bt_status_t
325 *******************************************************************************/
326 bt_status_t btif_dm_get_remote_services(bt_bdaddr_t *remote_addr);
328 /*******************************************************************************
330 ** Function btif_dm_get_remote_services_by_transport
332 ** Description Start SDP to get remote services by transport
334 ** Returns bt_status_t
336 *******************************************************************************/
337 bt_status_t btif_dm_get_remote_services_by_transport(bt_bdaddr_t *remote_addr, int transport);
339 /*******************************************************************************
341 ** Function btif_dut_mode_configure
343 ** Description Configure Test Mode - 'enable' to 1 puts the device in test mode and 0 exits
346 ** Returns BT_STATUS_SUCCESS on success
348 *******************************************************************************/
349 bt_status_t btif_dut_mode_configure(uint8_t enable);
351 /*******************************************************************************
353 ** Function btif_dut_mode_send
355 ** Description Sends a HCI Vendor specific command to the controller
357 ** Returns BT_STATUS_SUCCESS on success
359 *******************************************************************************/
360 bt_status_t btif_dut_mode_send(uint16_t opcode, uint8_t *buf, uint8_t len);
362 /*******************************************************************************
364 ** Function btif_le_test_mode
366 ** Description Sends a HCI BLE Test command to the Controller
368 ** Returns BT_STATUS_SUCCESS on success
370 *******************************************************************************/
371 bt_status_t btif_le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len);
373 /*******************************************************************************
375 ** Function btif_dm_read_energy_info
377 ** Description Reads the energy info from controller
381 *******************************************************************************/
382 void btif_dm_read_energy_info();
384 /*******************************************************************************
386 ** Function btif_config_hci_snoop_log
388 ** Description enable or disable HCI snoop log
390 ** Returns BT_STATUS_SUCCESS on success
392 *******************************************************************************/
393 bt_status_t btif_config_hci_snoop_log(uint8_t enable);
394 #endif /* BTIF_API_H */