1/****************************************************************************** 2 * 3 * Copyright (C) 2003-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 * This is the public interface file for BTA, Broadcom's Bluetooth 22 * application layer for mobile phones. 23 * 24 ******************************************************************************/ 25#ifndef BTA_API_H 26#define BTA_API_H 27 28#include "data_types.h" 29#include "bt_target.h" 30#include "bt_types.h" 31#include "btm_api.h" 32#include "uipc_msg.h" 33 34#if BLE_INCLUDED == TRUE 35#include "btm_ble_api.h" 36#endif 37 38/***************************************************************************** 39** Constants and data types 40*****************************************************************************/ 41 42/* Status Return Value */ 43#define BTA_SUCCESS 0 /* Successful operation. */ 44#define BTA_FAILURE 1 /* Generic failure. */ 45#define BTA_PENDING 2 /* API cannot be completed right now */ 46#define BTA_BUSY 3 47#define BTA_NO_RESOURCES 4 48#define BTA_WRONG_MODE 5 49 50typedef UINT8 tBTA_STATUS; 51 52/* 53 * Service ID 54 * 55 * NOTES: When you add a new Service ID for BTA AND require to change the value of BTA_MAX_SERVICE_ID, 56 * make sure that the correct security ID of the new service from Security service definitions (btm_api.h) 57 * should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in bta_dm_act.c. 58 */ 59 60#define BTA_RES_SERVICE_ID 0 /* Reserved */ 61#define BTA_SPP_SERVICE_ID 1 /* Serial port profile. */ 62#define BTA_DUN_SERVICE_ID 2 /* Dial-up networking profile. */ 63#define BTA_A2DP_SOURCE_SERVICE_ID 3 /* A2DP Source profile. */ 64#define BTA_LAP_SERVICE_ID 4 /* LAN access profile. */ 65#define BTA_HSP_SERVICE_ID 5 /* Headset profile. */ 66#define BTA_HFP_SERVICE_ID 6 /* Hands-free profile. */ 67#define BTA_OPP_SERVICE_ID 7 /* Object push */ 68#define BTA_FTP_SERVICE_ID 8 /* File transfer */ 69#define BTA_CTP_SERVICE_ID 9 /* Cordless Terminal */ 70#define BTA_ICP_SERVICE_ID 10 /* Intercom Terminal */ 71#define BTA_SYNC_SERVICE_ID 11 /* Synchronization */ 72#define BTA_BPP_SERVICE_ID 12 /* Basic printing profile */ 73#define BTA_BIP_SERVICE_ID 13 /* Basic Imaging profile */ 74#define BTA_PANU_SERVICE_ID 14 /* PAN User */ 75#define BTA_NAP_SERVICE_ID 15 /* PAN Network access point */ 76#define BTA_GN_SERVICE_ID 16 /* PAN Group Ad-hoc networks */ 77#define BTA_SAP_SERVICE_ID 17 /* SIM Access profile */ 78#define BTA_A2DP_SERVICE_ID 18 /* A2DP Sink */ 79#define BTA_AVRCP_SERVICE_ID 19 /* A/V remote control */ 80#define BTA_HID_SERVICE_ID 20 /* HID */ 81#define BTA_VDP_SERVICE_ID 21 /* Video distribution */ 82#define BTA_PBAP_SERVICE_ID 22 /* PhoneBook Access Server*/ 83#define BTA_HSP_HS_SERVICE_ID 23 /* HFP HS role */ 84#define BTA_HFP_HS_SERVICE_ID 24 /* HSP HS role */ 85#define BTA_MAP_SERVICE_ID 25 /* Message Access Profile */ 86#define BTA_MN_SERVICE_ID 26 /* Message Notification Service */ 87#define BTA_HDP_SERVICE_ID 27 /* Health Device Profile */ 88#define BTA_PCE_SERVICE_ID 28 /* PhoneBook Access Client*/ 89 90#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE 91/* BLE profile service ID */ 92#define BTA_BLE_SERVICE_ID 29 /* GATT profile */ 93 94// btla-specific ++ 95#define BTA_USER_SERVICE_ID 30 /* User requested UUID */ 96 97#define BTA_MAX_SERVICE_ID 31 98// btla-specific -- 99#else 100#define BTA_USER_SERVICE_ID 29 /* User requested UUID */ 101#define BTA_MAX_SERVICE_ID 30 102#endif 103/* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1) 104 * are used by BTA JV */ 105#define BTA_FIRST_JV_SERVICE_ID (BTM_SEC_SERVICE_FIRST_EMPTY + 1) 106#define BTA_LAST_JV_SERVICE_ID (BTM_SEC_MAX_SERVICES - 1) 107 108typedef UINT8 tBTA_SERVICE_ID; 109 110/* Service ID Mask */ 111#define BTA_RES_SERVICE_MASK 0x00000001 /* Reserved */ 112#define BTA_SPP_SERVICE_MASK 0x00000002 /* Serial port profile. */ 113#define BTA_DUN_SERVICE_MASK 0x00000004 /* Dial-up networking profile. */ 114#define BTA_FAX_SERVICE_MASK 0x00000008 /* Fax profile. */ 115#define BTA_LAP_SERVICE_MASK 0x00000010 /* LAN access profile. */ 116#define BTA_HSP_SERVICE_MASK 0x00000020 /* HSP AG role. */ 117#define BTA_HFP_SERVICE_MASK 0x00000040 /* HFP AG role */ 118#define BTA_OPP_SERVICE_MASK 0x00000080 /* Object push */ 119#define BTA_FTP_SERVICE_MASK 0x00000100 /* File transfer */ 120#define BTA_CTP_SERVICE_MASK 0x00000200 /* Cordless Terminal */ 121#define BTA_ICP_SERVICE_MASK 0x00000400 /* Intercom Terminal */ 122#define BTA_SYNC_SERVICE_MASK 0x00000800 /* Synchronization */ 123#define BTA_BPP_SERVICE_MASK 0x00001000 /* Print server */ 124#define BTA_BIP_SERVICE_MASK 0x00002000 /* Basic Imaging */ 125#define BTA_PANU_SERVICE_MASK 0x00004000 /* PAN User */ 126#define BTA_NAP_SERVICE_MASK 0x00008000 /* PAN Network access point */ 127#define BTA_GN_SERVICE_MASK 0x00010000 /* PAN Group Ad-hoc networks */ 128#define BTA_SAP_SERVICE_MASK 0x00020000 /* PAN Group Ad-hoc networks */ 129#define BTA_A2DP_SERVICE_MASK 0x00040000 /* Advanced audio distribution */ 130#define BTA_AVRCP_SERVICE_MASK 0x00080000 /* A/V remote control */ 131#define BTA_HID_SERVICE_MASK 0x00100000 /* HID */ 132#define BTA_VDP_SERVICE_MASK 0x00200000 /* Video distribution */ 133#define BTA_PBAP_SERVICE_MASK 0x00400000 /* Phone Book Server */ 134#define BTA_HSP_HS_SERVICE_MASK 0x00800000 /* HFP HS role */ 135#define BTA_HFP_HS_SERVICE_MASK 0x01000000 /* HSP HS role */ 136#define BTA_MAS_SERVICE_MASK 0x02000000 /* Message Access Profile */ 137#define BTA_MN_SERVICE_MASK 0x04000000 /* Message Notification Profile */ 138#define BTA_HL_SERVICE_MASK 0x08000000 /* Health Device Profile */ 139#define BTA_PCE_SERVICE_MASK 0x10000000 /* Phone Book Client */ 140 141#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE 142#define BTA_BLE_SERVICE_MASK 0x20000000 /* GATT based service */ 143// btla-specific ++ 144#define BTA_USER_SERVICE_MASK 0x40000000 /* Message Notification Profile */ 145// btla-specific -- 146#else 147// btla-specific ++ 148#define BTA_USER_SERVICE_MASK 0x20000000 /* Message Notification Profile */ 149// btla-specific -- 150#endif 151 152#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE 153#define BTA_ALL_SERVICE_MASK 0x3FFFFFFF /* All services supported by BTA. */ 154#else 155#define BTA_ALL_SERVICE_MASK 0x1FFFFFFF /* All services supported by BTA. */ 156#endif 157 158typedef UINT32 tBTA_SERVICE_MASK; 159 160/* extended service mask, including mask with one or more GATT UUID */ 161typedef struct 162{ 163 tBTA_SERVICE_MASK srvc_mask; 164 UINT8 num_uuid; 165 tBT_UUID *p_uuid; 166}tBTA_SERVICE_MASK_EXT; 167 168/* Security Setting Mask */ 169#define BTA_SEC_NONE BTM_SEC_NONE /* No security. */ 170#define BTA_SEC_AUTHORIZE (BTM_SEC_IN_AUTHORIZE ) /* Authorization required (only needed for out going connection )*/ 171#define BTA_SEC_AUTHENTICATE (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */ 172#define BTA_SEC_ENCRYPT (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT) /* Encryption required. */ 173 174typedef UINT8 tBTA_SEC; 175 176/* Ignore for Discoverable, Connectable, Pairable and Connectable Paired only device modes */ 177 178#define BTA_DM_IGNORE 0xFF 179 180#define BTA_ALL_APP_ID 0xFF 181 182/* Discoverable Modes */ 183#define BTA_DM_NON_DISC BTM_NON_DISCOVERABLE /* Device is not discoverable. */ 184#define BTA_DM_GENERAL_DISC BTM_GENERAL_DISCOVERABLE /* General discoverable. */ 185#define BTA_DM_LIMITED_DISC BTM_LIMITED_DISCOVERABLE /* Limited discoverable. */ 186#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) 187#define BTA_DM_BLE_NON_DISCOVERABLE BTM_BLE_NON_DISCOVERABLE /* Device is not LE discoverable */ 188#define BTA_DM_BLE_GENERAL_DISCOVERABLE BTM_BLE_GENERAL_DISCOVERABLE /* Device is LE General discoverable */ 189#define BTA_DM_BLE_LIMITED_DISCOVERABLE BTM_BLE_LIMITED_DISCOVERABLE /* Device is LE Limited discoverable */ 190#endif 191typedef UINT16 tBTA_DM_DISC; /* this discoverability mode is a bit mask among BR mode and LE mode */ 192 193/* Connectable Modes */ 194#define BTA_DM_NON_CONN BTM_NON_CONNECTABLE /* Device is not connectable. */ 195#define BTA_DM_CONN BTM_CONNECTABLE /* Device is connectable. */ 196#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) 197#define BTA_DM_BLE_NON_CONNECTABLE BTM_BLE_NON_CONNECTABLE /* Device is LE non-connectable. */ 198#define BTA_DM_BLE_CONNECTABLE BTM_BLE_CONNECTABLE /* Device is LE connectable. */ 199#endif 200 201// btla-specific ++ 202typedef UINT16 tBTA_DM_CONN; 203// btla-specific -- 204 205/* Pairable Modes */ 206#define BTA_DM_PAIRABLE 1 207#define BTA_DM_NON_PAIRABLE 0 208 209/* Connectable Paired Only Mode */ 210#define BTA_DM_CONN_ALL 0 211#define BTA_DM_CONN_PAIRED 1 212 213/* Inquiry Modes */ 214#define BTA_DM_INQUIRY_NONE BTM_INQUIRY_NONE /*No BR inquiry. */ 215#define BTA_DM_GENERAL_INQUIRY BTM_GENERAL_INQUIRY /* Perform general inquiry. */ 216#define BTA_DM_LIMITED_INQUIRY BTM_LIMITED_INQUIRY /* Perform limited inquiry. */ 217 218#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) 219#define BTA_BLE_INQUIRY_NONE BTM_BLE_INQUIRY_NONE 220#define BTA_BLE_GENERAL_INQUIRY BTM_BLE_GENERAL_INQUIRY /* Perform LE general inquiry. */ 221#define BTA_BLE_LIMITED_INQUIRY BTM_BLE_LIMITED_INQUIRY /* Perform LE limited inquiry. */ 222#endif 223typedef UINT8 tBTA_DM_INQ_MODE; 224 225/* Inquiry Filter Type */ 226#define BTA_DM_INQ_CLR BTM_CLR_INQUIRY_FILTER /* Clear inquiry filter. */ 227#define BTA_DM_INQ_DEV_CLASS BTM_FILTER_COND_DEVICE_CLASS /* Filter on device class. */ 228#define BTA_DM_INQ_BD_ADDR BTM_FILTER_COND_BD_ADDR /* Filter on a specific BD address. */ 229 230typedef UINT8 tBTA_DM_INQ_FILT; 231 232/* Authorize Response */ 233#define BTA_DM_AUTH_PERM 0 /* Authorized for future connections to the service */ 234#define BTA_DM_AUTH_TEMP 1 /* Authorized for current connection only */ 235#define BTA_DM_NOT_AUTH 2 /* Not authorized for the service */ 236 237typedef UINT8 tBTA_AUTH_RESP; 238 239/* M/S preferred roles */ 240#define BTA_ANY_ROLE 0x00 241#define BTA_MASTER_ROLE_PREF 0x01 242#define BTA_MASTER_ROLE_ONLY 0x02 243 244typedef UINT8 tBTA_PREF_ROLES; 245 246enum 247{ 248 249 BTA_DM_NO_SCATTERNET, /* Device doesn't support scatternet, it might 250 support "role switch during connection" for 251 an incoming connection, when it already has 252 another connection in master role */ 253 BTA_DM_PARTIAL_SCATTERNET, /* Device supports partial scatternet. It can have 254 simulateous connection in Master and Slave roles 255 for short period of time */ 256 BTA_DM_FULL_SCATTERNET /* Device can have simultaneous connection in master 257 and slave roles */ 258 259}; 260 261 262/* Inquiry filter device class condition */ 263typedef struct 264{ 265 DEV_CLASS dev_class; /* device class of interest */ 266 DEV_CLASS dev_class_mask; /* mask to determine the bits of device class of interest */ 267} tBTA_DM_COD_COND; 268 269 270/* Inquiry Filter Condition */ 271typedef union 272{ 273 BD_ADDR bd_addr; /* BD address of device to filter. */ 274 tBTA_DM_COD_COND dev_class_cond; /* Device class filter condition */ 275} tBTA_DM_INQ_COND; 276 277/* Inquiry Parameters */ 278typedef struct 279{ 280 tBTA_DM_INQ_MODE mode; /* Inquiry mode, limited or general. */ 281 UINT8 duration; /* Inquiry duration in 1.28 sec units. */ 282 UINT8 max_resps; /* Maximum inquiry responses. Set to zero for unlimited responses. */ 283 BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */ 284 tBTA_DM_INQ_FILT filter_type; /* Filter condition type. */ 285 tBTA_DM_INQ_COND filter_cond; /* Filter condition data. */ 286#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE) 287 UINT8 intl_duration[4];/*duration array storing the interleave scan's time portions*/ 288#endif 289} tBTA_DM_INQ; 290 291typedef struct 292{ 293 UINT8 bta_dm_eir_min_name_len; /* minimum length of local name when it is shortened */ 294#if (BTA_EIR_CANNED_UUID_LIST == TRUE) 295 UINT8 bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */ 296 UINT8 *bta_dm_eir_uuid16; /* 16-bit UUIDs */ 297#else 298 UINT32 uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */ 299#endif 300 INT8 *bta_dm_eir_inq_tx_power; /* Inquiry TX power */ 301 UINT8 bta_dm_eir_flag_len; /* length of flags in bytes */ 302 UINT8 *bta_dm_eir_flags; /* flags for EIR */ 303 UINT8 bta_dm_eir_manufac_spec_len; /* length of manufacturer specific in bytes */ 304 UINT8 *bta_dm_eir_manufac_spec; /* manufacturer specific */ 305 UINT8 bta_dm_eir_additional_len; /* length of additional data in bytes */ 306 UINT8 *bta_dm_eir_additional; /* additional data */ 307} tBTA_DM_EIR_CONF; 308 309#if BLE_INCLUDED == TRUE 310/* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */ 311#define BTA_BLE_LIMIT_DISC_FLAG BTM_BLE_LIMIT_DISC_FLAG 312#define BTA_BLE_GEN_DISC_FLAG BTM_BLE_GEN_DISC_FLAG 313#define BTA_BLE_BREDR_NOT_SPT BTM_BLE_BREDR_NOT_SPT 314#define BTA_BLE_NON_LIMIT_DISC_FLAG BTM_BLE_NON_LIMIT_DISC_FLAG 315#define BTA_BLE_ADV_FLAG_MASK BTM_BLE_ADV_FLAG_MASK 316#define BTA_BLE_LIMIT_DISC_MASK BTM_BLE_LIMIT_DISC_MASK 317 318/* ADV data bit mask */ 319#define BTA_BLE_AD_BIT_DEV_NAME BTM_BLE_AD_BIT_DEV_NAME 320#define BTA_BLE_AD_BIT_FLAGS BTM_BLE_AD_BIT_FLAGS 321#define BTA_BLE_AD_BIT_MANU BTM_BLE_AD_BIT_MANU 322#define BTA_BLE_AD_BIT_TX_PWR BTM_BLE_AD_BIT_TX_PWR 323#define BTA_BLE_AD_BIT_INT_RANGE BTM_BLE_AD_BIT_INT_RANGE 324#define BTA_BLE_AD_BIT_SERVICE BTM_BLE_AD_BIT_SERVICE 325#define BTA_BLE_AD_BIT_APPEARANCE BTM_BLE_AD_BIT_APPEARANCE 326#define BTA_BLE_AD_BIT_PROPRIETARY BTM_BLE_AD_BIT_PROPRIETARY 327#define BTA_DM_BLE_AD_BIT_SERVICE_SOL BTM_BLE_AD_BIT_SERVICE_SOL 328#define BTA_DM_BLE_AD_BIT_SERVICE_DATA BTM_BLE_AD_BIT_SERVICE_DATA 329#define BTA_DM_BLE_AD_BIT_SIGN_DATA BTM_BLE_AD_BIT_SIGN_DATA 330#define BTA_DM_BLE_AD_BIT_SERVICE_128SOL BTM_BLE_AD_BIT_SERVICE_128SOL 331#define BTA_DM_BLE_AD_BIT_PUBLIC_ADDR BTM_BLE_AD_BIT_PUBLIC_ADDR 332#define BTA_DM_BLE_AD_BIT_RANDOM_ADDR BTM_BLE_AD_BIT_RANDOM_ADDR 333 334typedef UINT16 tBTA_BLE_AD_MASK; 335 336/* slave preferred connection interval range */ 337typedef struct 338{ 339 UINT16 low; 340 UINT16 hi; 341 342}tBTA_BLE_INT_RANGE; 343 344/* Service tag supported in the device */ 345typedef struct 346{ 347 UINT8 num_service; 348 BOOLEAN list_cmpl; 349 UINT16 *p_uuid; 350}tBTA_BLE_SERVICE; 351 352 353typedef struct 354{ 355 UINT8 len; 356 UINT8 *p_val; 357}tBTA_BLE_MANU; 358 359typedef struct 360{ 361 UINT8 adv_type; 362 UINT8 len; 363 UINT8 *p_val; /* number of len byte */ 364}tBTA_BLE_PROP_ELEM; 365 366/* vendor proprietary adv type */ 367typedef struct 368{ 369 UINT8 num_elem; 370 tBTA_BLE_PROP_ELEM *p_elem; 371}tBTA_BLE_PROPRIETARY; 372 373typedef struct 374{ 375 tBTA_BLE_MANU manu; /* manufactuer data */ 376 tBTA_BLE_INT_RANGE int_range; /* slave prefered conn interval range */ 377 tBTA_BLE_SERVICE services; /* services */ 378 UINT16 appearance; /* appearance data */ 379 UINT8 flag; 380 tBTA_BLE_PROPRIETARY *p_proprietary; 381 382}tBTA_BLE_ADV_DATA; 383 384/* These are the fields returned in each device adv packet. It 385** is returned in the results callback if registered. 386*/ 387typedef struct 388{ 389 UINT8 conn_mode; 390 tBTA_BLE_AD_MASK ad_mask; /* mask of the valid adv data field */ 391 UINT8 flag; 392 UINT8 tx_power_level; 393 UINT8 remote_name_len; 394 UINT8 *p_remote_name; 395 tBTA_BLE_SERVICE service; 396} tBTA_BLE_INQ_DATA; 397#endif 398 399/* BLE customer specific feature function type definitions */ 400/* data type used on customer specific feature for RSSI monitoring */ 401#define BTA_BLE_RSSI_ALERT_HI 0 402#define BTA_BLE_RSSI_ALERT_RANGE 1 403#define BTA_BLE_RSSI_ALERT_LO 2 404typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_TYPE; 405 406#define BTA_BLE_RSSI_ALERT_NONE BTM_BLE_RSSI_ALERT_NONE /* (0) */ 407#define BTA_BLE_RSSI_ALERT_HI_BIT BTM_BLE_RSSI_ALERT_HI_BIT /* (1) */ 408#define BTA_BLE_RSSI_ALERT_RANGE_BIT BTM_BLE_RSSI_ALERT_RANGE_BIT /* (1 << 1) */ 409#define BTA_BLE_RSSI_ALERT_LO_BIT BTM_BLE_RSSI_ALERT_LO_BIT /* (1 << 2) */ 410typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_MASK; 411 412 413typedef void (tBTA_DM_BLE_RSSI_CBACK) (BD_ADDR bd_addr, tBTA_DM_BLE_RSSI_ALERT_TYPE alert_type, INT8 rssi); 414 415/* max number of filter spot for different filter type */ 416#define BTA_DM_BLE_MAX_UUID_FILTER BTM_BLE_MAX_UUID_FILTER /* 8 */ 417#define BTA_DM_BLE_MAX_ADDR_FILTER BTM_BLE_MAX_ADDR_FILTER /* 8 */ 418#define BTA_DM_BLE_PF_STR_COND_MAX BTM_BLE_PF_STR_COND_MAX /* 4 apply to manu data , or local name */ 419#define BTA_DM_BLE_PF_STR_LEN_MAX BTM_BLE_PF_STR_LEN_MAX /* match for first 20 bytes */ 420 421#define BTA_DM_BLE_PF_LOGIC_OR 0 422#define BTA_DM_BLE_PF_LOGIC_AND 1 423typedef UINT8 tBTA_DM_BLE_PF_LOGIC_TYPE; 424 425enum 426{ 427 BTA_DM_BLE_SCAN_COND_ADD, 428 BTA_DM_BLE_SCAN_COND_DELETE, 429 BTA_DM_BLE_SCAN_COND_CLEAR = 2 430}; 431typedef UINT8 tBTA_DM_BLE_SCAN_COND_OP; 432 433/* filter selection bit index */ 434#define BTA_DM_BLE_PF_ADDR_FILTER BTM_BLE_PF_ADDR_FILTER 435#define BTA_DM_BLE_PF_SRVC_UUID BTM_BLE_PF_SRVC_UUID 436#define BTA_DM_BLE_PF_SRVC_SOL_UUID BTM_BLE_PF_SRVC_SOL_UUID 437#define BTA_DM_BLE_PF_LOCAL_NAME BTM_BLE_PF_LOCAL_NAME 438#define BTA_DM_BLE_PF_MANU_DATA BTM_BLE_PF_MANU_DATA 439#define BTA_DM_BLE_PF_SRVC_DATA BTM_BLE_PF_SRVC_DATA 440#define BTA_DM_BLE_PF_TYPE_MAX BTM_BLE_PF_TYPE_MAX 441#define BTA_DM_BLE_PF_TYPE_ALL BTM_BLE_PF_TYPE_ALL 442typedef UINT8 tBTA_DM_BLE_PF_COND_TYPE; 443 444typedef struct 445{ 446 tBLE_BD_ADDR *p_target_addr; /* target address, if NULL, generic UUID filter */ 447 tBT_UUID uuid; /* UUID condition */ 448 tBTA_DM_BLE_PF_LOGIC_TYPE cond_logic; /* AND/OR */ 449}tBTA_DM_BLE_PF_UUID_COND; 450 451typedef struct 452{ 453 UINT8 data_len; /* <= 20 bytes */ 454 UINT8 *p_data; 455}tBTA_DM_BLE_PF_LOCAL_NAME_COND; 456 457typedef struct 458{ 459 UINT16 company_id; /* company ID */ 460 UINT8 data_len; /* <= 20 bytes */ 461 UINT8 *p_pattern; 462}tBTA_DM_BLE_PF_MANU_COND; 463 464typedef union 465{ 466 tBLE_BD_ADDR target_addr; 467 tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */ 468 tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */ 469 tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */ 470 tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */ 471}tBTA_DM_BLE_PF_COND_PARAM; 472 473 474typedef INT8 tBTA_DM_RSSI_VALUE; 475typedef UINT8 tBTA_DM_LINK_QUALITY_VALUE; 476 477 478/* signal strength mask */ 479#define BTA_SIG_STRENGTH_RSSI_MASK 1 480#define BTA_SIG_STRENGTH_LINK_QUALITY_MASK 2 481 482typedef UINT8 tBTA_SIG_STRENGTH_MASK; 483 484 485/* Security Callback Events */ 486#define BTA_DM_ENABLE_EVT 0 /* Enable Event */ 487#define BTA_DM_DISABLE_EVT 1 /* Disable Event */ 488#define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */ 489#define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */ 490#define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */ 491#define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */ 492#define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */ 493#define BTA_DM_SIG_STRENGTH_EVT 7 /* Signal strength for bluetooth connection */ 494#define BTA_DM_BUSY_LEVEL_EVT 8 /* System busy level */ 495#define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */ 496#define BTA_DM_SP_CFM_REQ_EVT 10 /* Simple Pairing User Confirmation request. */ 497#define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */ 498#define BTA_DM_SP_RMT_OOB_EVT 12 /* Simple Pairing Remote OOB Data request. */ 499#define BTA_DM_SP_KEYPRESS_EVT 13 /* Key press notification event. */ 500#define BTA_DM_ROLE_CHG_EVT 14 /* Role Change event. */ 501#define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */ 502#define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */ 503#define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */ 504#define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */ 505#define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */ 506#define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */ 507#define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */ 508// btla-specific ++ 509#define BTA_DM_BLE_AUTH_CMPL_EVT 22 /* BLE Auth complete */ 510// btla-specific -- 511#define BTA_DM_DEV_UNPAIRED_EVT 23 512#define BTA_DM_HW_ERROR_EVT 24 /* BT Chip H/W error */ 513typedef UINT8 tBTA_DM_SEC_EVT; 514 515/* Structure associated with BTA_DM_ENABLE_EVT */ 516typedef struct 517{ 518 BD_ADDR bd_addr; /* BD address of local device. */ 519 tBTA_STATUS status; 520} tBTA_DM_ENABLE; 521 522/* Structure associated with BTA_DM_PIN_REQ_EVT */ 523typedef struct 524{ 525 BD_ADDR bd_addr; /* BD address peer device. */ 526 DEV_CLASS dev_class; /* Class of Device */ 527 BD_NAME bd_name; /* Name of peer device. */ 528} tBTA_DM_PIN_REQ; 529 530/* BLE related definition */ 531 532#define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10) 533#define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x)) 534#define BTA_DM_AUTH_SMP_PASSKEY_FAIL BTA_DM_AUTH_CONVERT_SMP_CODE (SMP_PASSKEY_ENTRY_FAIL) 535#define BTA_DM_AUTH_SMP_OOB_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_OOB_FAIL) 536#define BTA_DM_AUTH_SMP_PAIR_AUTH_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_AUTH_FAIL) 537#define BTA_DM_AUTH_SMP_CONFIRM_VALUE_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_VALUE_ERR) 538#define BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT) 539#define BTA_DM_AUTH_SMP_ENC_KEY_SIZE (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_KEY_SIZE) 540#define BTA_DM_AUTH_SMP_INVALID_CMD (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_CMD) 541#define BTA_DM_AUTH_SMP_UNKNOWN_ERR (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_FAIL_UNKNOWN) 542#define BTA_DM_AUTH_SMP_REPEATED_ATTEMPT (BTA_DM_AUTH_FAIL_BASE + SMP_REPEATED_ATTEMPTS) 543#define BTA_DM_AUTH_SMP_INTERNAL_ERR (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_INTERNAL_ERR) 544#define BTA_DM_AUTH_SMP_UNKNOWN_IO (BTA_DM_AUTH_FAIL_BASE + SMP_UNKNOWN_IO_CAP) 545#define BTA_DM_AUTH_SMP_INIT_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_INIT_FAIL) 546#define BTA_DM_AUTH_SMP_CONFIRM_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_FAIL) 547#define BTA_DM_AUTH_SMP_BUSY (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY) 548#define BTA_DM_AUTH_SMP_ENC_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL) 549#define BTA_DM_AUTH_SMP_RSP_TIMEOUT (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT) 550 551/* connection parameter boundary value and dummy value */ 552#define BTA_DM_BLE_SCAN_INT_MIN BTM_BLE_SCAN_INT_MIN 553#define BTA_DM_BLE_SCAN_INT_MAX BTM_BLE_SCAN_INT_MAX 554#define BTA_DM_BLE_SCAN_WIN_MIN BTM_BLE_SCAN_WIN_MIN 555#define BTA_DM_BLE_SCAN_WIN_MAX BTM_BLE_SCAN_WIN_MAX 556#define BTA_DM_BLE_CONN_INT_MIN BTM_BLE_CONN_INT_MIN 557#define BTA_DM_BLE_CONN_INT_MAX BTM_BLE_CONN_INT_MAX 558#define BTA_DM_BLE_CONN_LATENCY_MAX BTM_BLE_CONN_LATENCY_MAX 559#define BTA_DM_BLE_CONN_SUP_TOUT_MIN BTM_BLE_CONN_SUP_TOUT_MIN 560#define BTA_DM_BLE_CONN_SUP_TOUT_MAX BTM_BLE_CONN_SUP_TOUT_MAX 561#define BTA_DM_BLE_CONN_PARAM_UNDEF BTM_BLE_CONN_PARAM_UNDEF /* use this value when a specific value not to be overwritten */ 562 563 564#define BTA_LE_KEY_PENC BTM_LE_KEY_PENC /* encryption information of peer device */ 565#define BTA_LE_KEY_PID BTM_LE_KEY_PID /* identity key of the peer device */ 566#define BTA_LE_KEY_PCSRK BTM_LE_KEY_PCSRK /* peer SRK */ 567#define BTA_LE_KEY_LENC BTM_LE_KEY_LENC /* master role security information:div */ 568#define BTA_LE_KEY_LID BTM_LE_KEY_LID /* master device ID key */ 569#define BTA_LE_KEY_LCSRK BTM_LE_KEY_LCSRK /* local CSRK has been deliver to peer */ 570typedef UINT8 tBTA_LE_KEY_TYPE; /* can be used as a bit mask */ 571 572 573typedef tBTM_LE_PENC_KEYS tBTA_LE_PENC_KEYS ; 574typedef tBTM_LE_PCSRK_KEYS tBTA_LE_PCSRK_KEYS; 575typedef tBTM_LE_LENC_KEYS tBTA_LE_LENC_KEYS ; 576typedef tBTM_LE_LCSRK_KEYS tBTA_LE_LCSRK_KEYS ; 577typedef tBTM_LE_PID_KEYS tBTA_LE_PID_KEYS ; 578 579typedef union 580{ 581 tBTA_LE_PENC_KEYS penc_key; /* received peer encryption key */ 582 tBTA_LE_PCSRK_KEYS psrk_key; /* received peer device SRK */ 583 tBTA_LE_PID_KEYS pid_key; /* peer device ID key */ 584 tBTA_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/ 585 tBTA_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/ 586}tBTA_LE_KEY_VALUE; 587 588#define BTA_BLE_LOCAL_KEY_TYPE_ID 1 589#define BTA_BLE_LOCAL_KEY_TYPE_ER 2 590typedef UINT8 tBTA_DM_BLE_LOCAL_KEY_MASK; 591 592typedef struct 593{ 594 BT_OCTET16 ir; 595 BT_OCTET16 irk; 596 BT_OCTET16 dhk; 597}tBTA_BLE_LOCAL_ID_KEYS; 598 599#define BTA_DM_SEC_GRANTED BTA_SUCCESS 600#define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT 601#define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT 602typedef UINT8 tBTA_DM_BLE_SEC_GRANT; 603 604 605#define BTA_DM_BLE_ONN_NONE BTM_BLE_CONN_NONE 606#define BTA_DM_BLE_CONN_AUTO BTM_BLE_CONN_AUTO 607#define BTA_DM_BLE_CONN_SELECTIVE BTM_BLE_CONN_SELECTIVE 608typedef UINT8 tBTA_DM_BLE_CONN_TYPE; 609 610typedef BOOLEAN (tBTA_DM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name); 611 612/* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */ 613typedef struct 614{ 615 BD_ADDR bd_addr; /* peer address */ 616 BD_NAME bd_name; /* peer device name */ 617} tBTA_DM_BLE_SEC_REQ; 618 619typedef struct 620{ 621 BD_ADDR bd_addr; /* peer address */ 622 tBTM_LE_KEY_TYPE key_type; 623 tBTM_LE_KEY_VALUE key_value; 624}tBTA_DM_BLE_KEY; 625 626/* Structure associated with BTA_DM_AUTH_CMPL_EVT */ 627typedef struct 628{ 629 BD_ADDR bd_addr; /* BD address peer device. */ 630 BD_NAME bd_name; /* Name of peer device. */ 631 BOOLEAN key_present; /* Valid link key value in key element */ 632 LINK_KEY key; /* Link key associated with peer device. */ 633 UINT8 key_type; /* The type of Link Key */ 634 BOOLEAN success; /* TRUE of authentication succeeded, FALSE if failed. */ 635#if BLE_INCLUDED == TRUE 636 BOOLEAN privacy_enabled; /* used for BLE device only */ 637#endif 638 UINT8 fail_reason; /* The HCI reason/error code for when success=FALSE */ 639 640} tBTA_DM_AUTH_CMPL; 641 642 643/* Structure associated with BTA_DM_AUTHORIZE_EVT */ 644typedef struct 645{ 646 BD_ADDR bd_addr; /* BD address peer device. */ 647 BD_NAME bd_name; /* Name of peer device. */ 648 tBTA_SERVICE_ID service; /* Service ID to authorize. */ 649// btla-specific ++ 650 DEV_CLASS dev_class; 651// btla-specific -- 652} tBTA_DM_AUTHORIZE; 653 654/* Structure associated with BTA_DM_LINK_UP_EVT */ 655typedef struct 656{ 657 BD_ADDR bd_addr; /* BD address peer device. */ 658} tBTA_DM_LINK_UP; 659 660/* Structure associated with BTA_DM_LINK_DOWN_EVT */ 661typedef struct 662{ 663 BD_ADDR bd_addr; /* BD address peer device. */ 664 UINT8 status; /* connection open/closed */ 665 BOOLEAN is_removed; /* TRUE if device is removed when link is down */ 666} tBTA_DM_LINK_DOWN; 667 668/* Structure associated with BTA_DM_ROLE_CHG_EVT */ 669typedef struct 670{ 671 BD_ADDR bd_addr; /* BD address peer device. */ 672 UINT8 new_role; /* the new connection role */ 673} tBTA_DM_ROLE_CHG; 674 675/* Structure associated with BTA_DM_SIG_STRENGTH_EVT */ 676typedef struct 677{ 678 BD_ADDR bd_addr; /* BD address peer device. */ 679 tBTA_SIG_STRENGTH_MASK mask; /* mask for the values that are valid */ 680 tBTA_DM_RSSI_VALUE rssi_value; 681 tBTA_DM_LINK_QUALITY_VALUE link_quality_value; 682 683} tBTA_DM_SIG_STRENGTH; 684 685/* Structure associated with BTA_DM_BUSY_LEVEL_EVT */ 686typedef struct 687{ 688 UINT8 level; /* when paging or inquiring, level is 10. 689 Otherwise, the number of ACL links */ 690 UINT8 level_flags; /* indicates individual flags */ 691} tBTA_DM_BUSY_LEVEL; 692 693#define BTA_IO_CAP_OUT BTM_IO_CAP_OUT /* DisplayOnly */ 694#define BTA_IO_CAP_IO BTM_IO_CAP_IO /* DisplayYesNo */ 695#define BTA_IO_CAP_IN BTM_IO_CAP_IN /* KeyboardOnly */ 696#define BTA_IO_CAP_NONE BTM_IO_CAP_NONE /* NoInputNoOutput */ 697typedef tBTM_IO_CAP tBTA_IO_CAP; 698 699#define BTA_AUTH_SP_NO BTM_AUTH_SP_NO /* 0 MITM Protection Not Required - Single Profile/non-bonding 700 Numeric comparison with automatic accept allowed */ 701#define BTA_AUTH_SP_YES BTM_AUTH_SP_YES /* 1 MITM Protection Required - Single Profile/non-bonding 702 Use IO Capabilities to determine authentication procedure */ 703#define BTA_AUTH_AP_NO BTM_AUTH_AP_NO /* 2 MITM Protection Not Required - All Profiles/dedicated bonding 704 Numeric comparison with automatic accept allowed */ 705#define BTA_AUTH_AP_YES BTM_AUTH_AP_YES /* 3 MITM Protection Required - All Profiles/dedicated bonding 706 Use IO Capabilities to determine authentication procedure */ 707#define BTA_AUTH_SPGB_NO BTM_AUTH_SPGB_NO /* 4 MITM Protection Not Required - Single Profiles/general bonding 708 Numeric comparison with automatic accept allowed */ 709#define BTA_AUTH_SPGB_YES BTM_AUTH_SPGB_YES /* 5 MITM Protection Required - Single Profiles/general bonding 710 Use IO Capabilities to determine authentication procedure */ 711typedef tBTM_AUTH_REQ tBTA_AUTH_REQ; 712 713#define BTA_AUTH_DD_BOND BTM_AUTH_DD_BOND /* 2 this bit is set for dedicated bonding */ 714#define BTA_AUTH_GEN_BOND BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */ 715#define BTA_AUTH_BONDS BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */ 716 717#define BTA_LE_AUTH_NO_BOND BTM_LE_AUTH_REQ_NO_BOND /* 0*/ 718#define BTA_LE_AUTH_BOND BTM_LE_AUTH_REQ_BOND /* 1 << 0 */ 719#define BTA_LE_AUTH_REQ_MITM BTM_LE_AUTH_REQ_MITM /* 1 << 2 */ 720typedef tBTM_LE_AUTH_REQ tBTA_LE_AUTH_REQ; /* combination of the above bit pattern */ 721 722#define BTA_OOB_NONE BTM_OOB_NONE 723#define BTA_OOB_PRESENT BTM_OOB_PRESENT 724#if BTM_OOB_INCLUDED == TRUE 725#define BTA_OOB_UNKNOWN BTM_OOB_UNKNOWN 726#endif 727typedef tBTM_OOB_DATA tBTA_OOB_DATA; 728 729/* Structure associated with BTA_DM_SP_CFM_REQ_EVT */ 730typedef struct 731{ 732 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */ 733 BD_ADDR bd_addr; /* peer address */ 734 DEV_CLASS dev_class; /* peer CoD */ 735 BD_NAME bd_name; /* peer device name */ 736 UINT32 num_val; /* the numeric value for comparison. If just_works, do not show this number to UI */ 737 BOOLEAN just_works; /* TRUE, if "Just Works" association model */ 738 tBTA_AUTH_REQ loc_auth_req; /* Authentication required for local device */ 739 tBTA_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */ 740 tBTA_IO_CAP loc_io_caps; /* IO Capabilities of local device */ 741 tBTA_AUTH_REQ rmt_io_caps; /* IO Capabilities of remote device */ 742} tBTA_DM_SP_CFM_REQ; 743 744enum 745{ 746 BTA_SP_KEY_STARTED, /* passkey entry started */ 747 BTA_SP_KEY_ENTERED, /* passkey digit entered */ 748 BTA_SP_KEY_ERASED, /* passkey digit erased */ 749 BTA_SP_KEY_CLEARED, /* passkey cleared */ 750 BTA_SP_KEY_COMPLT /* passkey entry completed */ 751}; 752typedef UINT8 tBTA_SP_KEY_TYPE; 753 754/* Structure associated with BTA_DM_SP_KEYPRESS_EVT */ 755typedef struct 756{ 757 BD_ADDR bd_addr; /* peer address */ 758 tBTA_SP_KEY_TYPE notif_type; 759}tBTA_DM_SP_KEY_PRESS; 760 761/* Structure associated with BTA_DM_SP_KEY_NOTIF_EVT */ 762typedef struct 763{ 764 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */ 765 BD_ADDR bd_addr; /* peer address */ 766 DEV_CLASS dev_class; /* peer CoD */ 767 BD_NAME bd_name; /* peer device name */ 768 UINT32 passkey; /* the numeric value for comparison. If just_works, do not show this number to UI */ 769} tBTA_DM_SP_KEY_NOTIF; 770 771/* Structure associated with BTA_DM_SP_RMT_OOB_EVT */ 772typedef struct 773{ 774 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */ 775 BD_ADDR bd_addr; /* peer address */ 776 DEV_CLASS dev_class; /* peer CoD */ 777 BD_NAME bd_name; /* peer device name */ 778} tBTA_DM_SP_RMT_OOB; 779 780/* Structure associated with BTA_DM_BOND_CANCEL_CMPL_EVT */ 781typedef struct 782{ 783 tBTA_STATUS result; /* TRUE of bond cancel succeeded, FALSE if failed. */ 784} tBTA_DM_BOND_CANCEL_CMPL; 785 786/* Union of all security callback structures */ 787typedef union 788{ 789 tBTA_DM_ENABLE enable; /* BTA enabled */ 790 tBTA_DM_PIN_REQ pin_req; /* PIN request. */ 791 tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */ 792 tBTA_DM_AUTHORIZE authorize; /* Authorization request. */ 793 tBTA_DM_LINK_UP link_up; /* ACL connection down event */ 794 tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */ 795 tBTA_DM_SIG_STRENGTH sig_strength; /* rssi and link quality value */ 796 tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */ 797 tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */ 798 tBTA_DM_SP_KEY_NOTIF key_notif; /* passkey notification */ 799 tBTA_DM_SP_RMT_OOB rmt_oob; /* remote oob */ 800 tBTA_DM_BOND_CANCEL_CMPL bond_cancel_cmpl; /* Bond Cancel Complete indication */ 801 tBTA_DM_SP_KEY_PRESS key_press; /* key press notification event */ 802 tBTA_DM_ROLE_CHG role_chg; /* role change event */ 803 tBTA_DM_BLE_SEC_REQ ble_req; /* BLE SMP related request */ 804 tBTA_DM_BLE_KEY ble_key; /* BLE SMP keys used when pairing */ 805 tBTA_BLE_LOCAL_ID_KEYS ble_id_keys; /* IR event */ 806 BT_OCTET16 ble_er; /* ER event data */ 807} tBTA_DM_SEC; 808 809/* Security callback */ 810typedef void (tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data); 811 812/* Vendor Specific Command Callback */ 813typedef tBTM_VSC_CMPL_CB tBTA_VENDOR_CMPL_CBACK; 814 815/* Search callback events */ 816#define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */ 817#define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */ 818#define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */ 819#define BTA_DM_DISC_BLE_RES_EVT 3 /* Discovery result for BLE GATT based servoce on a peer device. */ 820#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */ 821#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */ 822#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */ 823 824typedef UINT8 tBTA_DM_SEARCH_EVT; 825 826#define BTA_DM_INQ_RES_IGNORE_RSSI BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */ 827 828/* Structure associated with BTA_DM_INQ_RES_EVT */ 829typedef struct 830{ 831 BD_ADDR bd_addr; /* BD address peer device. */ 832 DEV_CLASS dev_class; /* Device class of peer device. */ 833 BOOLEAN remt_name_not_required; /* Application sets this flag if it already knows the name of the device */ 834 /* If the device name is known to application BTA skips the remote name request */ 835 BOOLEAN is_limited; /* TRUE, if the limited inquiry bit is set in the CoD */ 836 INT8 rssi; /* The rssi value */ 837 UINT8 *p_eir; /* received EIR */ 838#if (BLE_INCLUDED == TRUE) 839 UINT8 inq_result_type; 840 UINT8 ble_addr_type; 841 tBTM_BLE_EVT_TYPE ble_evt_type; 842 tBT_DEVICE_TYPE device_type; 843#endif 844 845} tBTA_DM_INQ_RES; 846 847/* Structure associated with BTA_DM_INQ_CMPL_EVT */ 848typedef struct 849{ 850 UINT8 num_resps; /* Number of inquiry responses. */ 851} tBTA_DM_INQ_CMPL; 852 853/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */ 854typedef struct 855{ 856 BD_ADDR bd_addr; /* BD address peer device. */ 857 UINT8 num_record; /* Number of DI record */ 858 tBTA_STATUS result; 859} tBTA_DM_DI_DISC_CMPL; 860 861/* Structure associated with BTA_DM_DISC_RES_EVT */ 862typedef struct 863{ 864 BD_ADDR bd_addr; /* BD address peer device. */ 865 BD_NAME bd_name; /* Name of peer device. */ 866 tBTA_SERVICE_MASK services; /* Services found on peer device. */ 867// btla-specific ++ 868 UINT8 * p_raw_data; /* Raw data for discovery DB */ 869 UINT32 raw_data_size; /* size of raw data */ 870 tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */ 871 UINT32 num_uuids; 872 UINT8 *p_uuid_list; 873// btla-specific -- 874 tBTA_STATUS result; 875} tBTA_DM_DISC_RES; 876 877/* Structure associated with tBTA_DM_DISC_BLE_RES */ 878typedef struct 879{ 880 BD_ADDR bd_addr; /* BD address peer device. */ 881 BD_NAME bd_name; /* Name of peer device. */ 882 tBT_UUID service; /* GATT based Services UUID found on peer device. */ 883} tBTA_DM_DISC_BLE_RES; 884 885 886/* Union of all search callback structures */ 887typedef union 888{ 889 tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */ 890 tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */ 891 tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */ 892 tBTA_DM_DISC_BLE_RES disc_ble_res; /* discovery result for GATT based service */ 893 tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */ 894 895} tBTA_DM_SEARCH; 896 897/* Search callback */ 898typedef void (tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data); 899 900/* Execute call back */ 901typedef void (tBTA_DM_EXEC_CBACK) (void * p_param); 902 903/* Encryption callback*/ 904typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_STATUS result); 905 906#if BLE_INCLUDED == TRUE 907#define BTA_DM_BLE_SEC_NONE BTM_BLE_SEC_NONE 908#define BTA_DM_BLE_SEC_ENCRYPT BTM_BLE_SEC_ENCRYPT 909#define BTA_DM_BLE_SEC_NO_MITM BTM_BLE_SEC_ENCRYPT_NO_MITM 910#define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM 911typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT; 912#else 913typedef UINT8 tBTA_DM_BLE_SEC_ACT; 914#endif 915 916/* Maximum service name length */ 917#define BTA_SERVICE_NAME_LEN 35 918#define BTA_SERVICE_DESP_LEN BTA_SERVICE_NAME_LEN 919#define BTA_PROVIDER_NAME_LEN BTA_SERVICE_NAME_LEN 920 921 922/* link policy masks */ 923#define BTA_DM_LP_SWITCH HCI_ENABLE_MASTER_SLAVE_SWITCH 924#define BTA_DM_LP_HOLD HCI_ENABLE_HOLD_MODE 925#define BTA_DM_LP_SNIFF HCI_ENABLE_SNIFF_MODE 926#define BTA_DM_LP_PARK HCI_ENABLE_PARK_MODE 927typedef UINT16 tBTA_DM_LP_MASK; 928 929/* power mode actions */ 930#define BTA_DM_PM_NO_ACTION 0x00 /* no change to the current pm setting */ 931#define BTA_DM_PM_PARK 0x10 /* prefers park mode */ 932#define BTA_DM_PM_SNIFF 0x20 /* prefers sniff mode */ 933#define BTA_DM_PM_SNIFF1 0x21 /* prefers sniff1 mode */ 934#define BTA_DM_PM_SNIFF2 0x22 /* prefers sniff2 mode */ 935#define BTA_DM_PM_SNIFF3 0x23 /* prefers sniff3 mode */ 936#define BTA_DM_PM_SNIFF4 0x24 /* prefers sniff4 mode */ 937#define BTA_DM_PM_SNIFF5 0x25 /* prefers sniff5 mode */ 938#define BTA_DM_PM_SNIFF6 0x26 /* prefers sniff6 mode */ 939#define BTA_DM_PM_SNIFF7 0x27 /* prefers sniff7 mode */ 940#define BTA_DM_PM_SNIFF_USER0 0x28 /* prefers user-defined sniff0 mode (testtool only) */ 941#define BTA_DM_PM_SNIFF_USER1 0x29 /* prefers user-defined sniff1 mode (testtool only) */ 942#define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */ 943#define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */ 944#define BTA_DM_PM_NO_PREF 0x01 /* service has no prefernce on power mode setting. eg. connection to service got closed */ 945 946typedef UINT8 tBTA_DM_PM_ACTTION; 947 948/* index to bta_dm_ssr_spec */ 949#define BTA_DM_PM_SSR0 0 950#define BTA_DM_PM_SSR1 1 /* BTA_DM_PM_SSR1 will be dedicated for 951 HH SSR setting entry, no other profile can use it */ 952#define BTA_DM_PM_SSR2 2 953#define BTA_DM_PM_SSR3 3 954#define BTA_DM_PM_SSR4 4 955#define BTA_DM_PM_SSR5 5 956#define BTA_DM_PM_SSR6 6 957 958#define BTA_DM_PM_NUM_EVTS 9 959 960#ifndef BTA_DM_PM_PARK_IDX 961#define BTA_DM_PM_PARK_IDX 5 /* the actual index to bta_dm_pm_md[] for PARK mode */ 962#endif 963 964#define BTA_DM_SW_BB_TO_MM BTM_SW_BB_TO_MM 965#define BTA_DM_SW_MM_TO_BB BTM_SW_MM_TO_BB 966#define BTA_DM_SW_BB_TO_BTC BTM_SW_BB_TO_BTC 967#define BTA_DM_SW_BTC_TO_BB BTM_SW_BTC_TO_BB 968 969typedef tBTM_SW_DIR tBTA_DM_SW_DIR; 970 971/* Switch callback events */ 972#define BTA_DM_SWITCH_CMPL_EVT 0 /* Completion of the Switch API */ 973 974typedef UINT8 tBTA_DM_SWITCH_EVT; 975typedef void (tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event, tBTA_STATUS status); 976 977/* Audio routing out configuration */ 978#define BTA_DM_ROUTE_NONE 0x00 /* No Audio output */ 979#define BTA_DM_ROUTE_DAC 0x01 /* routing over analog output */ 980#define BTA_DM_ROUTE_I2S 0x02 /* routing over digital (I2S) output */ 981#define BTA_DM_ROUTE_BT_MONO 0x04 /* routing over SCO */ 982#define BTA_DM_ROUTE_BT_STEREO 0x08 /* routing over BT Stereo */ 983#define BTA_DM_ROUTE_HOST 0x10 /* routing over Host */ 984#define BTA_DM_ROUTE_FMTX 0x20 /* routing over FMTX */ 985#define BTA_DM_ROUTE_FMRX 0x40 /* routing over FMRX */ 986#define BTA_DM_ROUTE_BTSNK 0x80 /* routing over BT SNK */ 987 988typedef UINT8 tBTA_DM_ROUTE_PATH; 989 990 991/* Device Identification (DI) data structure 992*/ 993/* Used to set the DI record */ 994typedef tSDP_DI_RECORD tBTA_DI_RECORD; 995/* Used to get the DI record */ 996typedef tSDP_DI_GET_RECORD tBTA_DI_GET_RECORD; 997/* SDP discovery database */ 998typedef tSDP_DISCOVERY_DB tBTA_DISCOVERY_DB; 999 1000#ifndef BTA_DI_NUM_MAX 1001#define BTA_DI_NUM_MAX 3 1002#endif 1003 1004/* Device features mask definitions */ 1005#define BTA_FEATURE_BYTES_PER_PAGE BTM_FEATURE_BYTES_PER_PAGE 1006#define BTA_EXT_FEATURES_PAGE_MAX BTM_EXT_FEATURES_PAGE_MAX 1007 1008/***************************************************************************** 1009** External Function Declarations 1010*****************************************************************************/ 1011#ifdef __cplusplus 1012extern "C" 1013{ 1014#endif 1015 1016/******************************************************************************* 1017** 1018** Function BTA_EnableBluetooth 1019** 1020** Description This function initializes BTA and prepares BTA and the 1021** Bluetooth protocol stack for use. This function is 1022** typically called at startup or when Bluetooth services 1023** are required by the phone. This function must be called 1024** before calling any other API function. 1025** 1026** 1027** Returns BTA_SUCCESS if successful. 1028** BTA_FAIL if internal failure. 1029** 1030*******************************************************************************/ 1031BTA_API extern tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback); 1032 1033/******************************************************************************* 1034** 1035** Function BTA_DisableBluetooth 1036** 1037** Description This function disables BTA and the Bluetooth protocol 1038** stack. It is called when BTA is no longer being used 1039** by any application in the system. 1040** 1041** 1042** Returns void 1043** 1044*******************************************************************************/ 1045BTA_API extern tBTA_STATUS BTA_DisableBluetooth(void); 1046 1047/******************************************************************************* 1048** 1049** Function BTA_EnableTestMode 1050** 1051** Description Enables bluetooth device under test mode 1052** 1053** 1054** Returns tBTA_STATUS 1055** 1056*******************************************************************************/ 1057BTA_API extern tBTA_STATUS BTA_EnableTestMode(void); 1058 1059/******************************************************************************* 1060** 1061** Function BTA_DisableTestMode 1062** 1063** Description Disable bluetooth device under test mode 1064** 1065** 1066** Returns None 1067** 1068*******************************************************************************/ 1069BTA_API extern void BTA_DisableTestMode(void); 1070 1071/******************************************************************************* 1072** 1073** Function BTA_DmIsDeviceUp 1074** 1075** Description This function tests whether the Bluetooth module is up 1076** and ready. This is a direct execution function that 1077** may lock task scheduling on some platforms. 1078** 1079** 1080** Returns TRUE if the module is ready. 1081** FALSE if the module is not ready. 1082** 1083*******************************************************************************/ 1084BTA_API extern BOOLEAN BTA_DmIsDeviceUp(void); 1085 1086/******************************************************************************* 1087** 1088** Function BTA_DmSetDeviceName 1089** 1090** Description This function sets the Bluetooth name of the local device. 1091** 1092** 1093** Returns void 1094** 1095*******************************************************************************/ 1096BTA_API extern void BTA_DmSetDeviceName(char *p_name); 1097 1098/******************************************************************************* 1099** 1100** Function BTA_DmSetVisibility 1101** 1102** Description This function sets the Bluetooth connectable,discoverable, 1103** pairable and conn paired only modesmodes of the local device. 1104** This controls whether other Bluetooth devices can find and connect to 1105** the local device. 1106** 1107** 1108** Returns void 1109** 1110*******************************************************************************/ 1111BTA_API extern void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode, UINT8 pairable_mode, UINT8 conn_filter); 1112 1113/******************************************************************************* 1114** 1115** Function BTA_DmSetScanParam 1116** 1117** Description This function sets the parameters for page scan and 1118** inquiry scan. 1119** 1120** 1121** Returns void 1122** 1123*******************************************************************************/ 1124BTA_API extern void BTA_DmSetScanParam (UINT16 page_scan_interval, UINT16 page_scan_window, 1125 UINT16 inquiry_scan_interval, UINT16 inquiry_scan_window); 1126 1127/******************************************************************************* 1128** 1129** Function BTA_DmSetAfhChannels 1130** 1131** Description This function sets the AFH first and 1132** last disable channel, so channels within 1133** that range are disabled. 1134** In order to use this API, BTM_BYPASS_AMP_AUTO_AFH must be set 1135** to be TRUE 1136** 1137** Returns void 1138** 1139*******************************************************************************/ 1140BTA_API extern void BTA_DmSetAfhChannels(UINT8 first, UINT8 last); 1141 1142 1143/******************************************************************************* 1144** 1145** Function BTA_DmVendorSpecificCommand 1146** 1147** Description This function sends the vendor specific command 1148** to the controller 1149** 1150** 1151** Returns tBTA_STATUS 1152** 1153*******************************************************************************/ 1154BTA_API extern tBTA_STATUS BTA_DmVendorSpecificCommand (UINT16 opcode, UINT8 param_len,UINT8 *p_param_buf, tBTA_VENDOR_CMPL_CBACK *p_cback); 1155 1156 1157/******************************************************************************* 1158** 1159** Function BTA_DmSearch 1160** 1161** Description This function searches for peer Bluetooth devices. It 1162** first performs an inquiry; for each device found from the 1163** inquiry it gets the remote name of the device. If 1164** parameter services is nonzero, service discovery will be 1165** performed on each device for the services specified. 1166** 1167** 1168** Returns void 1169** 1170*******************************************************************************/ 1171BTA_API extern void BTA_DmSearch(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK services, 1172 tBTA_DM_SEARCH_CBACK *p_cback); 1173 1174/******************************************************************************* 1175** 1176** Function BTA_DmSearchCancel 1177** 1178** Description This function cancels a search that has been initiated 1179** by calling BTA_DmSearch(). 1180** 1181** 1182** Returns void 1183** 1184*******************************************************************************/ 1185BTA_API extern void BTA_DmSearchCancel(void); 1186 1187/******************************************************************************* 1188** 1189** Function BTA_DmDiscover 1190** 1191** Description This function performs service discovery for the services 1192** of a particular peer device. 1193** 1194** 1195** Returns void 1196** 1197*******************************************************************************/ 1198BTA_API extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services, 1199 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search); 1200 1201// btla-specific ++ 1202/******************************************************************************* 1203** 1204** Function BTA_DmDiscoverUUID 1205** 1206** Description This function performs service discovery for the services 1207** of a particular peer device. 1208** 1209** 1210** Returns void 1211** 1212*******************************************************************************/ 1213BTA_API extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid, 1214 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search); 1215 1216/******************************************************************************* 1217** 1218** Function BTA_DmGetCachedRemoteName 1219** 1220** Description Retieve cached remote name if available 1221** 1222** Returns BTA_SUCCESS if cached name was retrieved 1223** BTA_FAILURE if cached name is not available 1224** 1225*******************************************************************************/ 1226tBTA_STATUS BTA_DmGetCachedRemoteName(BD_ADDR remote_device, UINT8 **pp_cached_name); 1227// btla-specific -- 1228 1229/******************************************************************************* 1230** 1231** Function BTA_DmIsMaster 1232** 1233** Description This function checks if the local device is the master of 1234** the link to the given device 1235** 1236** Returns TRUE if master. 1237** FALSE if not. 1238** 1239*******************************************************************************/ 1240BTA_API extern BOOLEAN BTA_DmIsMaster(BD_ADDR bd_addr); 1241 1242/******************************************************************************* 1243** 1244** Function BTA_DmBond 1245** 1246** Description This function initiates a bonding procedure with a peer 1247** device. The bonding procedure enables authentication 1248** and optionally encryption on the Bluetooth link. 1249** 1250** 1251** Returns void 1252** 1253*******************************************************************************/ 1254BTA_API extern void BTA_DmBond(BD_ADDR bd_addr); 1255 1256/******************************************************************************* 1257** 1258** Function BTA_DmBondCancel 1259** 1260** Description This function cancels a bonding procedure with a peer 1261** device. 1262** 1263** 1264** Returns void 1265** 1266*******************************************************************************/ 1267BTA_API extern void BTA_DmBondCancel(BD_ADDR bd_addr); 1268 1269/******************************************************************************* 1270** 1271** Function BTA_DmPinReply 1272** 1273** Description This function provides a PIN when one is requested by DM 1274** during a bonding procedure. The application should call 1275** this function after the security callback is called with 1276** a BTA_DM_PIN_REQ_EVT. 1277** 1278** 1279** Returns void 1280** 1281*******************************************************************************/ 1282BTA_API extern void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len, 1283 UINT8 *p_pin); 1284 1285/******************************************************************************* 1286** 1287** Function BTA_DmLinkPolicy 1288** 1289** Description This function sets/clears the link policy mask to the given 1290** bd_addr. 1291** If clearing the sniff or park mode mask, the link is put 1292** in active mode. 1293** 1294** Returns void 1295** 1296*******************************************************************************/ 1297BTA_API extern void BTA_DmLinkPolicy(BD_ADDR bd_addr, tBTA_DM_LP_MASK policy_mask, 1298 BOOLEAN set); 1299 1300#if (BTM_OOB_INCLUDED == TRUE) 1301/******************************************************************************* 1302** 1303** Function BTA_DmLocalOob 1304** 1305** Description This function retrieves the OOB data from local controller. 1306** The result is reported by bta_dm_co_loc_oob(). 1307** 1308** Returns void 1309** 1310*******************************************************************************/ 1311BTA_API extern void BTA_DmLocalOob(void); 1312#endif /* BTM_OOB_INCLUDED */ 1313 1314/******************************************************************************* 1315** 1316** Function BTA_DmConfirm 1317** 1318** Description This function accepts or rejects the numerical value of the 1319** Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT 1320** 1321** Returns void 1322** 1323*******************************************************************************/ 1324BTA_API extern void BTA_DmConfirm(BD_ADDR bd_addr, BOOLEAN accept); 1325 1326/******************************************************************************* 1327** 1328** Function BTA_DmPasskeyCancel 1329** 1330** Description This function is called to cancel the simple pairing process 1331** reported by BTA_DM_SP_KEY_NOTIF_EVT 1332** 1333** Returns void 1334** 1335*******************************************************************************/ 1336BTA_API extern void BTA_DmPasskeyCancel(BD_ADDR bd_addr); 1337 1338/******************************************************************************* 1339** 1340** Function BTA_DmAddDevice 1341** 1342** Description This function adds a device to the security database list 1343** of peer devices. This function would typically be called 1344** at system startup to initialize the security database with 1345** known peer devices. This is a direct execution function 1346** that may lock task scheduling on some platforms. 1347** 1348** Returns void 1349** 1350*******************************************************************************/ 1351BTA_API extern void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, 1352 LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask, 1353 BOOLEAN is_trusted, UINT8 key_type, 1354 tBTA_IO_CAP io_cap); 1355 1356/******************************************************************************* 1357** 1358** Function BTA_DmAddDevWithName 1359** 1360** Description This function is newer version of BTA_DmAddDevice() 1361** which added bd_name and features as input parameters. 1362** 1363** 1364** Returns void 1365** 1366** Note: features points to the remote device features array. 1367** The array size is 1368** BTA_FEATURE_BYTES_PER_PAGE * (BTA_EXT_FEATURES_PAGE_MAX + 1) 1369** 1370*******************************************************************************/ 1371BTA_API extern void BTA_DmAddDevWithName (BD_ADDR bd_addr, DEV_CLASS dev_class, 1372 BD_NAME bd_name, UINT8 *features, 1373 LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask, 1374 BOOLEAN is_trusted, UINT8 key_type, tBTA_IO_CAP io_cap); 1375 1376/******************************************************************************* 1377** 1378** Function BTA_DmRemoveDevice 1379** 1380** Description This function removes a device from the security database. 1381** This is a direct execution function that may lock task 1382** scheduling on some platforms. 1383** 1384** 1385** Returns BTA_SUCCESS if successful. 1386** BTA_FAIL if operation failed. 1387** 1388*******************************************************************************/ 1389BTA_API extern tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr); 1390 1391/******************************************************************************* 1392** 1393** Function BTA_DmAuthorizeReply 1394** 1395** Description This function provides an authorization reply when 1396** authorization is requested by BTA. The application calls 1397** this function after the security callback is called with 1398** a BTA_DM_AUTHORIZE_EVT. 1399** 1400** 1401** Returns void 1402** 1403*******************************************************************************/ 1404BTA_API extern void BTA_DmAuthorizeReply(BD_ADDR bd_addr, tBTA_SERVICE_ID service, 1405 tBTA_AUTH_RESP response); 1406 1407/******************************************************************************* 1408** 1409** Function BTA_DmSignalStrength 1410** 1411** Description This function initiates RSSI and channnel quality 1412** measurments. BTA_DM_SIG_STRENGTH_EVT is sent to 1413** application with the values of RSSI and channel 1414** quality 1415** 1416** 1417** Returns void 1418** 1419*******************************************************************************/ 1420BTA_API extern void BTA_DmSignalStrength(tBTA_SIG_STRENGTH_MASK mask, UINT16 period, BOOLEAN start); 1421 1422/******************************************************************************* 1423** 1424** Function BTA_DmWriteInqTxPower 1425** 1426** Description This command is used to write the inquiry transmit power level 1427** used to transmit the inquiry (ID) data packets. 1428** 1429** Parameters tx_power - tx inquiry power to use, valid value is -70 ~ 20 1430 1431** Returns void 1432** 1433*******************************************************************************/ 1434BTA_API extern void BTA_DmWriteInqTxPower(INT8 tx_power); 1435 1436/******************************************************************************* 1437** 1438** Function BTA_DmEirAddUUID 1439** 1440** Description This function is called to add UUID into EIR. 1441** 1442** Parameters tBT_UUID - UUID 1443** 1444** Returns None 1445** 1446*******************************************************************************/ 1447BTA_API extern void BTA_DmEirAddUUID (tBT_UUID *p_uuid); 1448 1449/******************************************************************************* 1450** 1451** Function BTA_DmEirRemoveUUID 1452** 1453** Description This function is called to remove UUID from EIR. 1454** 1455** Parameters tBT_UUID - UUID 1456** 1457** Returns None 1458** 1459*******************************************************************************/ 1460BTA_API extern void BTA_DmEirRemoveUUID (tBT_UUID *p_uuid); 1461 1462/******************************************************************************* 1463** 1464** Function BTA_DmSetEIRConfig 1465** 1466** Description This function is called to override the BTA default EIR parameters. 1467** This funciton is only valid in a system where BTU & App task 1468** are in the same memory space. 1469** 1470** Parameters Pointer to User defined EIR config 1471** 1472** Returns None 1473** 1474*******************************************************************************/ 1475BTA_API extern void BTA_DmSetEIRConfig (tBTA_DM_EIR_CONF *p_eir_cfg); 1476 1477/******************************************************************************* 1478** 1479** Function BTA_CheckEirData 1480** 1481** Description This function is called to get EIR data from significant part. 1482** 1483** Parameters p_eir - pointer of EIR significant part 1484** type - finding EIR data type 1485** p_length - return the length of EIR data 1486** 1487** Returns pointer of EIR data 1488** 1489*******************************************************************************/ 1490BTA_API extern UINT8 *BTA_CheckEirData( UINT8 *p_eir, UINT8 tag, UINT8 *p_length ); 1491 1492/******************************************************************************* 1493** 1494** Function BTA_GetEirService 1495** 1496** Description This function is called to get BTA service mask from EIR. 1497** 1498** Parameters p_eir - pointer of EIR significant part 1499** p_services - return the BTA service mask 1500** 1501** Returns None 1502** 1503*******************************************************************************/ 1504BTA_API extern void BTA_GetEirService( UINT8 *p_eir, tBTA_SERVICE_MASK *p_services ); 1505 1506/******************************************************************************* 1507** 1508** Function BTA_DmUseSsr 1509** 1510** Description This function is called to check if the connected peer device 1511** supports SSR or not. 1512** 1513** Returns TRUE, if SSR is supported 1514** 1515*******************************************************************************/ 1516BTA_API extern BOOLEAN BTA_DmUseSsr( BD_ADDR bd_addr ); 1517 1518 1519/******************************************************************************* 1520** 1521** Function BTA_DmSetLocalDiRecord 1522** 1523** Description This function adds a DI record to the local SDP database. 1524** 1525** Returns BTA_SUCCESS if record set sucessfully, otherwise error code. 1526** 1527*******************************************************************************/ 1528BTA_API extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info, 1529 UINT32 *p_handle ); 1530 1531/******************************************************************************* 1532** 1533** Function BTA_DmGetLocalDiRecord 1534** 1535** Description Get a specified DI record to the local SDP database. If no 1536** record handle is provided, the primary DI record will be 1537** returned. 1538** 1539** Returns BTA_SUCCESS if record set sucessfully, otherwise error code. 1540** 1541*******************************************************************************/ 1542BTA_API extern tBTA_STATUS BTA_DmGetLocalDiRecord( tBTA_DI_GET_RECORD *p_device_info, 1543 UINT32 *p_handle ); 1544 1545/******************************************************************************* 1546** 1547** Function BTA_DmDiDiscover 1548** 1549** Description This function queries a remote device for DI information. 1550** 1551** Returns None. 1552** 1553*******************************************************************************/ 1554BTA_API extern void BTA_DmDiDiscover( BD_ADDR remote_device, tBTA_DISCOVERY_DB *p_db, 1555 UINT32 len, tBTA_DM_SEARCH_CBACK *p_cback ); 1556 1557/******************************************************************************* 1558** 1559** Function BTA_DmGetDiRecord 1560** 1561** Description This function retrieves a remote device's DI record from 1562** the specified database. 1563** 1564** Returns None. 1565** 1566*******************************************************************************/ 1567BTA_API extern tBTA_STATUS BTA_DmGetDiRecord( UINT8 get_record_index, tBTA_DI_GET_RECORD *p_device_info, 1568 tBTA_DISCOVERY_DB *p_db ); 1569 1570/******************************************************************************* 1571** 1572** 1573** Function BTA_DmCloseACL 1574** 1575** Description This function force to close an ACL connection and remove the 1576** device from the security database list of known devices. 1577** 1578** Parameters: bd_addr - Address of the peer device 1579** remove_dev - remove device or not after link down 1580** 1581** Returns void. 1582** 1583*******************************************************************************/ 1584BTA_API extern void BTA_DmCloseACL(BD_ADDR bd_addr, BOOLEAN remove_dev); 1585 1586/******************************************************************************* 1587** 1588** Function BTA_SysFeatures 1589** 1590** Description This function is called to set system features. 1591** 1592** Returns void 1593** 1594*******************************************************************************/ 1595BTA_API extern void BTA_SysFeatures (UINT16 sys_features); 1596 1597/******************************************************************************* 1598** 1599** Function bta_dmexecutecallback 1600** 1601** Description This function will request BTA to execute a call back in the context of BTU task 1602** This API was named in lower case because it is only intended 1603** for the internal customers(like BTIF). 1604** 1605** Returns void 1606** 1607*******************************************************************************/ 1608BTA_API extern void bta_dmexecutecallback (tBTA_DM_EXEC_CBACK* p_callback, void * p_param); 1609 1610#if (BTM_SCO_HCI_INCLUDED == TRUE) 1611/******************************************************************************* 1612** 1613** Function BTA_DmPcmInitSamples 1614** 1615** Description initialize the down sample converter. 1616** 1617** src_sps: original samples per second (source audio data) 1618** (ex. 44100, 48000) 1619** bits: number of bits per pcm sample (16) 1620** n_channels: number of channels (i.e. mono(1), stereo(2)...) 1621** 1622** Returns none 1623** 1624*******************************************************************************/ 1625BTA_API extern void BTA_DmPcmInitSamples (UINT32 src_sps, UINT32 bits, UINT32 n_channels); 1626 1627/************************************************************************************** 1628** Function BTA_DmPcmResample 1629** 1630** Description Down sampling utility to convert higher sampling rate into 8K/16bits 1631** PCM samples. 1632** 1633** Parameters p_src: pointer to the buffer where the original sampling PCM 1634** are stored. 1635** in_bytes: Length of the input PCM sample buffer in byte. 1636** p_dst: pointer to the buffer which is to be used to store 1637** the converted PCM samples. 1638** 1639** 1640** Returns INT32: number of samples converted. 1641** 1642**************************************************************************************/ 1643BTA_API extern INT32 BTA_DmPcmResample (void *p_src, UINT32 in_bytes, void *p_dst); 1644#endif 1645 1646#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) 1647/* BLE related API functions */ 1648/******************************************************************************* 1649** 1650** Function BTA_DmBleSecurityGrant 1651** 1652** Description Grant security request access. 1653** 1654** Parameters: bd_addr - BD address of the peer 1655** res - security grant status. 1656** 1657** Returns void 1658** 1659*******************************************************************************/ 1660BTA_API extern void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res); 1661 1662 1663 1664/******************************************************************************* 1665** 1666** Function BTA_DmBleSetBgConnType 1667** 1668** Description This function is called to set BLE connectable mode for a 1669** peripheral device. 1670** 1671** Parameters bg_conn_type: it can be auto connection, or selective connection. 1672** p_select_cback: callback function when selective connection procedure 1673** is being used. 1674** 1675** Returns void 1676** 1677*******************************************************************************/ 1678BTA_API extern void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, tBTA_DM_BLE_SEL_CBACK *p_select_cback); 1679 1680/******************************************************************************* 1681** 1682** Function BTA_DmBlePasskeyReply 1683** 1684** Description Send BLE SMP passkey reply. 1685** 1686** Parameters: bd_addr - BD address of the peer 1687** accept - passkey entry sucessful or declined. 1688** passkey - passkey value, must be a 6 digit number, 1689** can be lead by 0. 1690** 1691** Returns void 1692** 1693*******************************************************************************/ 1694BTA_API extern void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, BOOLEAN accept, UINT32 passkey); 1695 1696/******************************************************************************* 1697** 1698** Function BTA_DmAddBleDevice 1699** 1700** Description Add a BLE device. This function will be normally called 1701** during host startup to restore all required information 1702** for a LE device stored in the NVRAM. 1703** 1704** Parameters: bd_addr - BD address of the peer 1705** dev_type - Remote device's device type. 1706** addr_type - LE device address type. 1707** 1708** Returns void 1709** 1710*******************************************************************************/ 1711BTA_API extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, 1712 tBT_DEVICE_TYPE dev_type); 1713 1714 1715/******************************************************************************* 1716** 1717** Function BTA_DmAddBleKey 1718** 1719** Description Add/modify LE device information. This function will be 1720** normally called during host startup to restore all required 1721** information stored in the NVRAM. 1722** 1723** Parameters: bd_addr - BD address of the peer 1724** p_le_key - LE key values. 1725** key_type - LE SMP key type. 1726** 1727** Returns void 1728** 1729*******************************************************************************/ 1730BTA_API extern void BTA_DmAddBleKey (BD_ADDR bd_addr, tBTA_LE_KEY_VALUE *p_le_key, 1731 tBTA_LE_KEY_TYPE key_type); 1732 1733/******************************************************************************* 1734** 1735** Function BTA_DmSetBlePrefConnParams 1736** 1737** Description This function is called to set the preferred connection 1738** parameters when default connection parameter is not desired. 1739** 1740** Parameters: bd_addr - BD address of the peripheral 1741** min_conn_int - minimum preferred connection interval 1742** max_conn_int - maximum preferred connection interval 1743** slave_latency - preferred slave latency 1744** supervision_tout - preferred supervision timeout 1745** 1746** 1747** Returns void 1748** 1749*******************************************************************************/ 1750BTA_API extern void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr, 1751 UINT16 min_conn_int, UINT16 max_conn_int, 1752 UINT16 slave_latency, UINT16 supervision_tout ); 1753 1754/******************************************************************************* 1755** 1756** Function BTA_DmSetBleConnScanParams 1757** 1758** Description This function is called to set scan parameters used in 1759** BLE connection request 1760** 1761** Parameters: bd_addr - BD address of the peripheral 1762** scan_interval - scan interval 1763** scan_window - scan window 1764** 1765** Returns void 1766** 1767*******************************************************************************/ 1768BTA_API extern void BTA_DmSetBleConnScanParams(UINT16 scan_interval, 1769 UINT16 scan_window ); 1770 1771/******************************************************************************* 1772** 1773** Function BTA_DmSetBleAdvParams 1774** 1775** Description This function sets the advertising parameters BLE functionality. 1776** It is to be called when device act in peripheral or broadcaster 1777** role. 1778** 1779** Parameters: adv_int_min - adv interval minimum 1780** adv_int_max - adv interval max 1781** p_dir_bda - directed adv initator address 1782** 1783** Returns void 1784** 1785*******************************************************************************/ 1786BTA_API extern void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max, 1787 tBLE_BD_ADDR *p_dir_bda); 1788/******************************************************************************* 1789** 1790** Function BTA_DmSearchExt 1791** 1792** Description This function searches for peer Bluetooth devices. It performs 1793** an inquiry and gets the remote name for devices. Service 1794** discovery is done if services is non zero 1795** 1796** Parameters p_dm_inq: inquiry conditions 1797** services: if service is not empty, service discovery will be done. 1798** for all GATT based service condition, put num_uuid, and 1799** p_uuid is the pointer to the list of UUID values. 1800** p_cback: callback functino when search is completed. 1801** 1802** 1803** 1804** Returns void 1805** 1806*******************************************************************************/ 1807BTA_API extern void BTA_DmSearchExt(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK_EXT *p_services, 1808 tBTA_DM_SEARCH_CBACK *p_cback); 1809 1810/******************************************************************************* 1811** 1812** Function BTA_DmDiscoverExt 1813** 1814** Description This function does service discovery for services of a 1815** peer device. When services.num_uuid is 0, it indicates all 1816** GATT based services are to be searched; other wise a list of 1817** UUID of interested services should be provided through 1818** services.p_uuid. 1819** 1820** 1821** 1822** Returns void 1823** 1824*******************************************************************************/ 1825BTA_API extern void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services, 1826 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search); 1827 1828 1829/******************************************************************************* 1830** 1831** Function BTA_DmSetEncryption 1832** 1833** Description This function is called to ensure that connection is 1834** encrypted. Should be called only on an open connection. 1835** Typically only needed for connections that first want to 1836** bring up unencrypted links, then later encrypt them. 1837** 1838** Parameters: bd_addr - Address of the peer device 1839** p_callback - Pointer to callback function to indicat the 1840** link encryption status 1841** sec_act - This is the security action to indicate 1842** what knid of BLE security level is required for 1843** the BLE link if the BLE is supported 1844** Note: This parameter is ignored for the BR/EDR link 1845** or the BLE is not supported 1846** 1847** Returns void 1848** 1849** 1850*******************************************************************************/ 1851BTA_API extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_DM_ENCRYPT_CBACK *p_callback, 1852 tBTA_DM_BLE_SEC_ACT sec_act); 1853 1854 1855/******************************************************************************* 1856** 1857** Function BTA_DmBleObserve 1858** 1859** Description This procedure keep the device listening for advertising 1860** events from a broadcast device. 1861** 1862** Parameters start: start or stop observe. 1863** duration : Duration of the scan. Continuous scan if 0 is passed 1864** p_results_cb: Callback to be called with scan results 1865** 1866** Returns void 1867** 1868*******************************************************************************/ 1869BTA_API extern void BTA_DmBleObserve(BOOLEAN start, UINT8 duration, 1870 tBTA_DM_SEARCH_CBACK *p_results_cb); 1871 1872 1873#endif 1874 1875// btla-specific ++ 1876/******************************************************************************* 1877** 1878** Function BTA_DmSetAfhChannelAssessment 1879** 1880** Description This function is called to set the channel assessment mode on or off 1881** 1882** Returns status 1883** 1884*******************************************************************************/ 1885BTA_API extern void BTA_DmSetAfhChannelAssessment (BOOLEAN enable_or_disable); 1886 1887#if BLE_INCLUDE == TRUE 1888// btla-specific -- 1889/******************************************************************************* 1890** 1891** Function BTA_DmBleConfigLocalPrivacy 1892** 1893** Description Enable/disable privacy on the local device 1894** 1895** Parameters: privacy_enable - enable/disabe privacy on remote device. 1896** 1897** Returns void 1898** 1899*******************************************************************************/ 1900BTA_API extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable); 1901 1902/******************************************************************************* 1903** 1904** Function BTA_DmBleEnableRemotePrivacy 1905** 1906** Description Enable/disable privacy on a remote device 1907** 1908** Parameters: bd_addr - BD address of the peer 1909** privacy_enable - enable/disabe privacy on remote device. 1910** 1911** Returns void 1912** 1913*******************************************************************************/ 1914BTA_API extern void BTA_DmBleEnableRemotePrivacy(BD_ADDR bd_addr, BOOLEAN privacy_enable); 1915 1916 1917/******************************************************************************* 1918** 1919** Function BTA_DmBleSetAdvConfig 1920** 1921** Description This function is called to override the BTA default ADV parameters. 1922** 1923** Parameters Pointer to User defined ADV data structure 1924** 1925** Returns None 1926** 1927*******************************************************************************/ 1928BTA_API extern void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask, 1929 tBTA_BLE_ADV_DATA *p_adv_cfg); 1930#endif 1931 1932#ifdef __cplusplus 1933} 1934#endif 1935 1936#endif /* BTA_API_H */ 1937 1938