btif_api.h revision bad70b1d0071ee9b16a029ff145e8e53038571ff
1/****************************************************************************** 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 33#include "btif_common.h" 34#include "btif_dm.h" 35 36/******************************************************************************* 37** BTIF CORE API 38********************************************************************************/ 39 40/******************************************************************************* 41** 42** Function btif_init_bluetooth 43** 44** Description Creates BTIF task and prepares BT scheduler for startup 45** 46** Returns bt_status_t 47** 48*******************************************************************************/ 49bt_status_t btif_init_bluetooth(void); 50 51/******************************************************************************* 52** 53** Function btif_enable_bluetooth 54** 55** Description Performs chip power on and kickstarts OS scheduler 56** 57** Returns bt_status_t 58** 59*******************************************************************************/ 60bt_status_t btif_enable_bluetooth(void); 61 62/******************************************************************************* 63** 64** Function btif_disable_bluetooth 65** 66** Description Inititates shutdown of Bluetooth system. 67** Any active links will be dropped and device entering 68** non connectable/discoverable mode 69** 70** Returns void 71** 72*******************************************************************************/ 73bt_status_t btif_disable_bluetooth(void); 74 75/******************************************************************************* 76** 77** Function btif_shutdown_bluetooth 78** 79** Description Finalizes BT scheduler shutdown and terminates BTIF 80** task. 81** 82** 83** Returns void 84** 85*******************************************************************************/ 86bt_status_t btif_shutdown_bluetooth(void); 87 88/******************************************************************************* 89** 90** Function btif_get_adapter_properties 91** 92** Description Fetches all local adapter properties 93** 94** Returns bt_status_t 95** 96*******************************************************************************/ 97bt_status_t btif_get_adapter_properties(void); 98 99/******************************************************************************* 100** 101** Function btif_get_adapter_property 102** 103** Description Fetches property value from local cache 104** 105** Returns bt_status_t 106** 107*******************************************************************************/ 108bt_status_t btif_get_adapter_property( bt_property_type_t type); 109 110/******************************************************************************* 111** 112** Function btif_set_adapter_property 113** 114** Description Updates core stack with property value and stores it in 115** local cache 116** 117** Returns bt_status_t 118** 119*******************************************************************************/ 120bt_status_t btif_set_adapter_property( const bt_property_t *property); 121 122/******************************************************************************* 123** 124** Function btif_get_remote_device_property 125** 126** Description Fetches the remote device property from the NVRAM 127** 128** Returns bt_status_t 129** 130*******************************************************************************/ 131bt_status_t btif_get_remote_device_property( bt_bdaddr_t *remote_addr, 132 bt_property_type_t type); 133 134/******************************************************************************* 135** 136** Function btif_get_remote_device_properties 137** 138** Description Fetches all the remote device properties from NVRAM 139** 140** Returns bt_status_t 141** 142*******************************************************************************/ 143bt_status_t btif_get_remote_device_properties( bt_bdaddr_t *remote_addr); 144 145/******************************************************************************* 146** 147** Function btif_set_remote_device_property 148** 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 152** 153** Returns bt_status_t 154** 155*******************************************************************************/ 156bt_status_t btif_set_remote_device_property( bt_bdaddr_t *remote_addr, 157 const bt_property_t *property); 158 159/******************************************************************************* 160** 161** Function btif_get_remote_service_record 162** 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 165** 166** Returns bt_status_t 167** 168*******************************************************************************/ 169bt_status_t btif_get_remote_service_record( bt_bdaddr_t *remote_addr, 170 bt_uuid_t *uuid); 171 172 173/******************************************************************************* 174** BTIF DM API 175********************************************************************************/ 176 177/******************************************************************************* 178** 179** Function btif_dm_start_discovery 180** 181** Description Start device discovery/inquiry 182** 183** 184** Returns bt_status_t 185** 186*******************************************************************************/ 187bt_status_t btif_dm_start_discovery(void); 188 189/******************************************************************************* 190** 191** Function btif_dm_cancel_discovery 192** 193** Description Cancels search 194** 195** Returns bt_status_t 196** 197*******************************************************************************/ 198bt_status_t btif_dm_cancel_discovery(void); 199 200/******************************************************************************* 201** 202** Function btif_dm_create_bond 203** 204** Description Initiate bonding with the specified device 205** 206** Returns bt_status_t 207** 208*******************************************************************************/ 209bt_status_t btif_dm_create_bond(const bt_bdaddr_t *bd_addr); 210 211/******************************************************************************* 212** 213** Function btif_dm_cancel_bond 214** 215** Description Initiate bonding with the specified device 216** 217** Returns bt_status_t 218** 219*******************************************************************************/ 220bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr); 221 222/******************************************************************************* 223** 224** Function btif_dm_remove_bond 225** 226** Description Removes bonding with the specified device 227** 228** Returns bt_status_t 229** 230*******************************************************************************/ 231bt_status_t btif_dm_remove_bond(const bt_bdaddr_t *bd_addr); 232 233/******************************************************************************* 234** 235** Function btif_dm_pin_reply 236** 237** Description BT legacy pairing - PIN code reply 238** 239** Returns bt_status_t 240** 241*******************************************************************************/ 242bt_status_t btif_dm_pin_reply( const bt_bdaddr_t *bd_addr, uint8_t accept, 243 uint8_t pin_len, bt_pin_code_t *pin_code); 244 245/******************************************************************************* 246** 247** Function btif_dm_passkey_reply 248** 249** Description BT SSP passkey reply 250** 251** Returns bt_status_t 252** 253*******************************************************************************/ 254bt_status_t btif_dm_passkey_reply( const bt_bdaddr_t *bd_addr, 255 uint8_t accept, uint32_t passkey); 256 257/******************************************************************************* 258** 259** Function btif_dm_ssp_reply 260** 261** Description BT SSP Reply - Just Works, Numeric Comparison & Passkey Entry 262** 263** Returns bt_status_t 264** 265*******************************************************************************/ 266bt_status_t btif_dm_ssp_reply( const bt_bdaddr_t *bd_addr, 267 bt_ssp_variant_t variant, uint8_t accept, 268 uint32_t passkey); 269 270/******************************************************************************* 271** 272** Function btif_dm_get_adapter_property 273** 274** Description Queries the BTA for the adapter property 275** 276** Returns bt_status_t 277** 278*******************************************************************************/ 279bt_status_t btif_dm_get_adapter_property(bt_property_t *prop); 280 281/******************************************************************************* 282** 283** Function btif_dm_get_remote_services 284** 285** Description Start SDP to get remote services 286** 287** Returns bt_status_t 288** 289*******************************************************************************/ 290bt_status_t btif_dm_get_remote_service_record(bt_bdaddr_t *remote_addr, 291 bt_uuid_t *uuid); 292 293 294/******************************************************************************* 295** 296** Function btif_dm_get_remote_services 297** 298** Description Start SDP to get remote services 299** 300** Returns bt_status_t 301** 302*******************************************************************************/ 303bt_status_t btif_dm_get_remote_services(bt_bdaddr_t *remote_addr); 304 305/******************************************************************************* 306** 307** Function btif_dut_mode_configure 308** 309** Description Configure Test Mode - 'enable' to 1 puts the device in test mode and 0 exits 310** test mode 311** 312** Returns BT_STATUS_SUCCESS on success 313** 314*******************************************************************************/ 315bt_status_t btif_dut_mode_configure(uint8_t enable); 316 317/******************************************************************************* 318** 319** Function btif_dut_mode_send 320** 321** Description Sends a HCI Vendor specific command to the controller 322** 323** Returns BT_STATUS_SUCCESS on success 324** 325*******************************************************************************/ 326bt_status_t btif_dut_mode_send(uint16_t opcode, uint8_t *buf, uint8_t len); 327 328/******************************************************************************* 329** 330** Function btif_le_test_mode 331** 332** Description Sends a HCI BLE Test command to the Controller 333** 334** Returns BT_STATUS_SUCCESS on success 335** 336*******************************************************************************/ 337bt_status_t btif_le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len); 338 339/******************************************************************************* 340** 341** Function btif_config_hci_snoop_log 342** 343** Description enable or disable HCI snoop log 344** 345** Returns BT_STATUS_SUCCESS on success 346** 347*******************************************************************************/ 348bt_status_t btif_config_hci_snoop_log(uint8_t enable); 349#endif /* BTIF_API_H */ 350