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_cancel_bond
215 ** Description Initiate bonding with the specified device
217 ** Returns bt_status_t
219 *******************************************************************************/
220 bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr);
222 /*******************************************************************************
224 ** Function btif_dm_remove_bond
226 ** Description Removes bonding with the specified device
228 ** Returns bt_status_t
230 *******************************************************************************/
231 bt_status_t btif_dm_remove_bond(const bt_bdaddr_t *bd_addr);
233 /*******************************************************************************
235 ** Function btif_dm_get_connection_state
237 ** Description Returns whether the remote device is currently connected
239 ** Returns 0 if not connected
241 *******************************************************************************/
242 uint16_t btif_dm_get_connection_state(const bt_bdaddr_t *bd_addr);
244 /*******************************************************************************
246 ** Function btif_dm_pin_reply
248 ** Description BT legacy pairing - PIN code reply
250 ** Returns bt_status_t
252 *******************************************************************************/
253 bt_status_t btif_dm_pin_reply( const bt_bdaddr_t *bd_addr, uint8_t accept,
254 uint8_t pin_len, bt_pin_code_t *pin_code);
256 /*******************************************************************************
258 ** Function btif_dm_passkey_reply
260 ** Description BT SSP passkey reply
262 ** Returns bt_status_t
264 *******************************************************************************/
265 bt_status_t btif_dm_passkey_reply( const bt_bdaddr_t *bd_addr,
266 uint8_t accept, uint32_t passkey);
268 /*******************************************************************************
270 ** Function btif_dm_ssp_reply
272 ** Description BT SSP Reply - Just Works, Numeric Comparison & Passkey Entry
274 ** Returns bt_status_t
276 *******************************************************************************/
277 bt_status_t btif_dm_ssp_reply( const bt_bdaddr_t *bd_addr,
278 bt_ssp_variant_t variant, uint8_t accept,
281 /*******************************************************************************
283 ** Function btif_dm_get_adapter_property
285 ** Description Queries the BTA for the adapter property
287 ** Returns bt_status_t
289 *******************************************************************************/
290 bt_status_t btif_dm_get_adapter_property(bt_property_t *prop);
292 /*******************************************************************************
294 ** Function btif_dm_get_remote_services
296 ** Description Start SDP to get remote services
298 ** Returns bt_status_t
300 *******************************************************************************/
301 bt_status_t btif_dm_get_remote_service_record(bt_bdaddr_t *remote_addr,
305 /*******************************************************************************
307 ** Function btif_dm_get_remote_services
309 ** Description Start SDP to get remote services
311 ** Returns bt_status_t
313 *******************************************************************************/
314 bt_status_t btif_dm_get_remote_services(bt_bdaddr_t *remote_addr);
316 /*******************************************************************************
318 ** Function btif_dm_get_remote_services_by_transport
320 ** Description Start SDP to get remote services by transport
322 ** Returns bt_status_t
324 *******************************************************************************/
325 bt_status_t btif_dm_get_remote_services_by_transport(bt_bdaddr_t *remote_addr, int transport);
327 /*******************************************************************************
329 ** Function btif_dut_mode_configure
331 ** Description Configure Test Mode - 'enable' to 1 puts the device in test mode and 0 exits
334 ** Returns BT_STATUS_SUCCESS on success
336 *******************************************************************************/
337 bt_status_t btif_dut_mode_configure(uint8_t enable);
339 /*******************************************************************************
341 ** Function btif_dut_mode_send
343 ** Description Sends a HCI Vendor specific command to the controller
345 ** Returns BT_STATUS_SUCCESS on success
347 *******************************************************************************/
348 bt_status_t btif_dut_mode_send(uint16_t opcode, uint8_t *buf, uint8_t len);
350 /*******************************************************************************
352 ** Function btif_le_test_mode
354 ** Description Sends a HCI BLE Test command to the Controller
356 ** Returns BT_STATUS_SUCCESS on success
358 *******************************************************************************/
359 bt_status_t btif_le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len);
361 /*******************************************************************************
363 ** Function btif_dm_read_energy_info
365 ** Description Reads the energy info from controller
369 *******************************************************************************/
370 void btif_dm_read_energy_info();
372 /*******************************************************************************
374 ** Function btif_config_hci_snoop_log
376 ** Description enable or disable HCI snoop log
378 ** Returns BT_STATUS_SUCCESS on success
380 *******************************************************************************/
381 bt_status_t btif_config_hci_snoop_log(uint8_t enable);
382 #endif /* BTIF_API_H */