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 * This is the public interface file for the HeaLth device profile (HL) 22 * subsystem of BTA, Broadcom's Bluetooth application layer for mobile 23 * phones. 24 * 25 ******************************************************************************/ 26 #ifndef BTA_HL_API_H 27 #define BTA_HL_API_H 28 29 #include "bta_api.h" 30 #include "btm_api.h" 31 #include "mca_api.h" 32 33 /***************************************************************************** 34 ** Constants and data types 35 *****************************************************************************/ 36 /* Extra Debug Code */ 37 #ifndef BTA_HL_DEBUG 38 #define BTA_HL_DEBUG TRUE 39 #endif 40 41 #ifndef BTA_HL_NUM_APPS 42 #define BTA_HL_NUM_APPS 12 43 #endif 44 45 #ifndef BTA_HL_NUM_MDEPS 46 #define BTA_HL_NUM_MDEPS 13 47 #endif 48 49 #ifndef BTA_HL_NUM_MCLS 50 #define BTA_HL_NUM_MCLS 7 51 #endif 52 53 #ifndef BTA_HL_NUM_MDLS_PER_MDEP 54 #define BTA_HL_NUM_MDLS_PER_MDEP 4 55 #endif 56 57 #ifndef BTA_HL_NUM_MDLS_PER_MCL 58 #define BTA_HL_NUM_MDLS_PER_MCL 10 59 #endif 60 61 #ifndef BTA_HL_NUM_DATA_TYPES 62 #define BTA_HL_NUM_DATA_TYPES 5 /* maximum number of data types can be supported 63 per MDEP ID */ 64 #endif 65 66 #define BTA_HL_MCAP_RSP_TOUT 2 /* 2 seconds */ 67 68 #ifndef BTA_HL_CCH_NUM_FILTER_ELEMS 69 #define BTA_HL_CCH_NUM_FILTER_ELEMS 3 70 #endif 71 72 #ifndef BTA_HL_NUM_SDP_CBACKS 73 #define BTA_HL_NUM_SDP_CBACKS 7 74 #endif 75 76 #ifndef BTA_HL_NUM_SDP_RECS 77 #define BTA_HL_NUM_SDP_RECS 5 78 #endif 79 80 #ifndef BTA_HL_NUM_SDP_MDEPS 81 #define BTA_HL_NUM_SDP_MDEPS 12 82 #endif 83 84 #ifndef BTA_HL_NUM_SVC_ELEMS 85 #define BTA_HL_NUM_SVC_ELEMS 2 86 #endif 87 88 #ifndef BTA_HL_NUM_PROTO_ELEMS 89 #define BTA_HL_NUM_PROTO_ELEMS 2 90 #endif 91 92 #define BTA_HL_VERSION_01_00 0x0100 93 #define BTA_HL_NUM_ADD_PROTO_LISTS 1 94 #define BTA_HL_NUM_ADD_PROTO_ELEMS 2 95 #define BTA_HL_MDEP_SEQ_SIZE 20 96 #define BTA_HL_VAL_ARRY_SIZE 320 97 98 #ifndef BTA_HL_NUM_MDL_CFGS 99 #define BTA_HL_NUM_MDL_CFGS 16 /* numer of MDL cfg saved in the persistent memory*/ 100 #endif 101 102 #define BTA_HL_NUM_TIMERS 7 103 104 #define BTA_HL_CCH_RSP_TOUT 2000 105 #define BTA_HL_MAX_TIME 255 106 #define BTA_HL_MIN_TIME 1 107 #define BTA_HL_INVALID_APP_HANDLE 0xFF 108 #define BTA_HL_INVALID_MCL_HANDLE 0xFF 109 #define BTA_HL_INVALID_MDL_HANDLE 0xFFFF 110 111 #define BTA_HL_STATUS_OK 0 112 #define BTA_HL_STATUS_FAIL 1 /* Used to pass all other errors */ 113 #define BTA_HL_STATUS_ABORTED 2 114 #define BTA_HL_STATUS_NO_RESOURCE 3 115 #define BTA_HL_STATUS_LAST_ITEM 4 116 #define BTA_HL_STATUS_DUPLICATE_APP_ID 5 117 #define BTA_HL_STATUS_INVALID_APP_HANDLE 6 118 #define BTA_HL_STATUS_INVALID_MCL_HANDLE 7 119 #define BTA_HL_STATUS_MCAP_REG_FAIL 8 120 #define BTA_HL_STATUS_MDEP_CO_FAIL 9 121 #define BTA_HL_STATUS_ECHO_CO_FAIL 10 122 #define BTA_HL_STATUS_MDL_CFG_CO_FAIL 11 123 #define BTA_HL_STATUS_SDP_NO_RESOURCE 12 124 #define BTA_HL_STATUS_SDP_FAIL 13 125 #define BTA_HL_STATUS_NO_CCH 14 126 #define BTA_HL_STATUS_NO_MCL 15 127 128 #define BTA_HL_STATUS_NO_FIRST_RELIABLE 17 129 #define BTA_HL_STATUS_INVALID_DCH_CFG 18 130 #define BTA_HL_STATUS_INVALID_MDL_HANDLE 19 131 #define BTA_HL_STATUS_INVALID_BD_ADDR 20 132 #define BTA_HL_STATUS_INVALID_RECONNECT_CFG 21 133 #define BTA_HL_STATUS_ECHO_TEST_BUSY 22 134 #define BTA_HL_STATUS_INVALID_LOCAL_MDEP_ID 23 135 #define BTA_HL_STATUS_INVALID_MDL_ID 24 136 #define BTA_HL_STATUS_NO_MDL_ID_FOUND 25 137 #define BTA_HL_STATUS_DCH_BUSY 26 /* DCH is congested*/ 138 #define BTA_HL_STATUS_INVALID_CTRL_PSM 27 139 #define BTA_HL_STATUS_DUPLICATE_CCH_OPEN 28 140 141 typedef UINT8 tBTA_HL_STATUS; 142 typedef tMCA_HANDLE tBTA_HL_APP_HANDLE; 143 typedef tMCA_CL tBTA_HL_MCL_HANDLE; 144 typedef tMCA_DL tBTA_HL_MDL_HANDLE; 145 enum 146 { 147 BTA_HL_DEVICE_TYPE_SINK, 148 BTA_HL_DEVICE_TYPE_SOURCE, 149 BTA_HL_DEVICE_TYPE_DUAL 150 }; 151 152 typedef UINT8 tBTA_HL_DEVICE_TYPE; 153 154 155 156 #define BTA_HL_SDP_IEEE_11073_20601 0x01 157 158 #define BTA_HL_MCAP_SUP_RECONNECT_MASK_INIT 2 /* 0x02 */ 159 #define BTA_HL_MCAP_SUP_RECONNECT_MASK_ACCEPT 4 /* 0x04 */ 160 #define BTA_HL_MCAP_SUP_CSP_MASK_SYNC_SLAVE 0 /* 0x08 */ 161 #define BTA_HL_MCAP_SUP_CSP_MASK_SYNC_MASTER 0 /* 0x10 */ 162 163 #define BTA_HL_MCAP_SUP_PROC_MASK (BTA_HL_MCAP_SUP_RECONNECT_MASK_INIT | \ 164 BTA_HL_MCAP_SUP_RECONNECT_MASK_ACCEPT | \ 165 BTA_HL_MCAP_SUP_CSP_MASK_SYNC_SLAVE | \ 166 BTA_HL_MCAP_SUP_CSP_MASK_SYNC_MASTER) 167 #define BTA_HL_MDEP_ROLE_SOURCE 0x00 168 #define BTA_HL_MDEP_ROLE_SINK 0x01 169 170 typedef UINT8 tBTA_HL_MDEP_ROLE; 171 172 #define BTA_HL_MDEP_ROLE_MASK_SOURCE 0x01 /* bit mask */ 173 #define BTA_HL_MDEP_ROLE_MASK_SINK 0x02 174 typedef UINT8 tBTA_HL_MDEP_ROLE_MASK; 175 176 177 #define BTA_HL_ECHO_TEST_MDEP_ID 0 178 #define BTA_HL_ECHO_TEST_MDEP_CFG_IDX 0 179 180 #define BTA_HL_INVALID_MDEP_ID 0xFF 181 typedef tMCA_DEP tBTA_HL_MDEP_ID; /* 0 is for echo test, 182 0x01-0x7F availave for use, 183 0x80-0xFF reserved*/ 184 185 186 #define BTA_HL_DELETE_ALL_MDL_IDS 0xFFFF 187 #define BTA_HL_MAX_MDL_VAL 0xFEFF 188 typedef UINT16 tBTA_HL_MDL_ID; /* 0x0000 reserved, 189 0x0001-0xFEFF dynamic range, 190 0xFF00-0xFFFE reserved, 191 0xFFFF indicates all MDLs*/ 192 193 #define BTA_HL_MDEP_DESP_LEN 35 194 195 #define BTA_HL_DCH_MODE_RELIABLE 0 196 #define BTA_HL_DCH_MODE_STREAMING 1 197 198 typedef UINT8 tBTA_HL_DCH_MODE; 199 200 #define BTA_HL_DCH_CFG_NO_PREF 0 201 #define BTA_HL_DCH_CFG_RELIABLE 1 202 #define BTA_HL_DCH_CFG_STREAMING 2 203 #define BTA_HL_DCH_CFG_UNKNOWN 0xFF 204 205 typedef UINT8 tBTA_HL_DCH_CFG; 206 207 /* The Default DCH CFG for the echo test when the device is a Source */ 208 #define BTA_HL_DEFAULT_ECHO_TEST_SRC_DCH_CFG BTA_HL_DCH_CFG_RELIABLE 209 210 #define BTA_HL_DCH_CREATE_RSP_SUCCESS 0 211 #define BTA_HL_DCH_CREATE_RSP_CFG_REJ 1 212 213 typedef UINT8 tBTA_HL_DCH_CREATE_RSP; 214 215 #define BTA_HL_MCAP_SUP_PROC_RECONNECT_INIT 0x02 216 #define BTA_HL_MCAP_SUP_PROC_RECONNECT_APT 0x04 217 #define BTA_HL_MCAP_SUP_PROC_CSP_SLAVE 0x08 218 #define BTA_HL_MCAP_SUP_PROC_CSP_MASTER 0x10 219 220 typedef UINT8 tBTA_HL_SUP_PROC_MASK; 221 222 typedef struct 223 { 224 UINT16 max_rx_apdu_size; /* local rcv MTU */ 225 UINT16 max_tx_apdu_size; /* maximum TX APDU size*/ 226 } tBTA_HL_ECHO_CFG; 227 228 229 typedef struct 230 { 231 UINT16 data_type; 232 UINT16 max_rx_apdu_size; /* local rcv MTU */ 233 UINT16 max_tx_apdu_size; /* maximum TX APDU size*/ 234 char desp[BTA_HL_MDEP_DESP_LEN+1]; 235 } tBTA_HL_MDEP_DATA_TYPE_CFG; 236 237 238 typedef struct 239 { 240 tBTA_HL_MDEP_ROLE mdep_role; 241 UINT8 num_of_mdep_data_types; 242 tBTA_HL_MDEP_DATA_TYPE_CFG data_cfg[BTA_HL_NUM_DATA_TYPES]; 243 } tBTA_HL_MDEP_CFG; 244 245 typedef struct 246 { 247 tBTA_HL_MDEP_ID mdep_id; /* MDEP ID 0x01-0x7F */ 248 tBTA_HL_MDEP_CFG mdep_cfg; 249 UINT8 ori_app_id; 250 } tBTA_HL_MDEP; 251 252 typedef struct 253 { 254 tBTA_HL_MDEP mdep[BTA_HL_NUM_MDEPS]; 255 tBTA_HL_ECHO_CFG echo_cfg; 256 tBTA_HL_MDEP_ROLE_MASK app_role_mask; 257 BOOLEAN advertize_source_sdp; 258 UINT8 num_of_mdeps; 259 } tBTA_HL_SUP_FEATURE; 260 261 typedef struct 262 { 263 BOOLEAN delete_req_pending; 264 tBTA_HL_MDL_ID mdl_id; 265 tBTA_HL_MCL_HANDLE mcl_handle; 266 } tBTA_HL_DELETE_MDL; 267 268 typedef struct 269 { 270 UINT8 time; 271 UINT16 mtu; 272 tBTA_HL_MDL_ID mdl_id; 273 tBTA_HL_MDEP_ID local_mdep_id; 274 tBTA_HL_MDEP_ROLE local_mdep_role; 275 BOOLEAN active; /* true if this item is in use */ 276 tBTA_HL_DCH_MODE dch_mode; 277 UINT8 fcs; 278 BD_ADDR peer_bd_addr; 279 } tBTA_HL_MDL_CFG; 280 281 282 /* Maximum number of supported feature list items (list_elem in tSDP_SUP_FEATURE_ELEM) */ 283 #define BTA_HL_NUM_SUP_FEATURE_ELEMS 13 284 #define BTA_HL_SUP_FEATURE_SDP_BUF_SIZE 512 285 /* This structure is used to add supported feature lists and find supported feature elements */ 286 typedef struct 287 { 288 UINT8 mdep_id; 289 UINT16 data_type; 290 tBTA_HL_MDEP_ROLE mdep_role; 291 char *p_mdep_desp; 292 } tBTA_HL_SUP_FEATURE_ELEM; 293 294 typedef struct 295 { 296 UINT16 num_elems; 297 tBTA_HL_SUP_FEATURE_ELEM list_elem[BTA_HL_NUM_SUP_FEATURE_ELEMS]; 298 } tBTA_HL_SUP_FEATURE_LIST_ELEM; 299 300 301 typedef struct 302 { 303 tBTA_HL_DEVICE_TYPE dev_type; /* sink, source or dual roles */ 304 tBTA_SEC sec_mask; /* security mask for accepting conenction*/ 305 const char *p_srv_name; /* service name to be used in the SDP; null terminated*/ 306 const char *p_srv_desp; /* service description to be used in the SDP; null terminated */ 307 const char *p_provider_name; /* provide name to be used in the SDP; null terminated */ 308 } tBTA_HL_REG_PARAM; 309 310 typedef struct 311 { 312 UINT16 ctrl_psm; 313 BD_ADDR bd_addr; /* Address of peer device */ 314 tBTA_SEC sec_mask; /* security mask for initiating connection*/ 315 } tBTA_HL_CCH_OPEN_PARAM; 316 317 318 typedef struct 319 { 320 UINT16 ctrl_psm; 321 tBTA_HL_MDEP_ID local_mdep_id; /* local MDEP ID */ 322 tBTA_HL_MDEP_ID peer_mdep_id; /* peer mdep id */ 323 tBTA_HL_DCH_CFG local_cfg; 324 tBTA_SEC sec_mask; /* security mask for initiating connection*/ 325 } tBTA_HL_DCH_OPEN_PARAM; 326 327 328 typedef struct 329 { 330 UINT16 ctrl_psm; 331 tBTA_HL_MDL_ID mdl_id; 332 } tBTA_HL_DCH_RECONNECT_PARAM; 333 334 335 typedef struct 336 { 337 UINT16 ctrl_psm; 338 UINT16 pkt_size; 339 tBTA_HL_DCH_CFG local_cfg; 340 } tBTA_HL_DCH_ECHO_TEST_PARAM; 341 342 typedef struct 343 { 344 UINT16 buf_size; 345 UINT8 p_buf; /* buffer pointer */ 346 } tBTA_HL_DCH_BUF_INFO; 347 348 typedef struct 349 { 350 tBTA_HL_MDEP_ID local_mdep_id; /* local MDEP ID */ 351 tBTA_HL_MDL_ID mdl_id; 352 tBTA_HL_DCH_CREATE_RSP rsp_code; 353 tBTA_HL_DCH_CFG cfg_rsp; 354 } tBTA_HL_DCH_CREATE_RSP_PARAM; 355 356 typedef struct 357 { 358 UINT16 data_type; 359 UINT8 mdep_id; 360 tBTA_HL_MDEP_ROLE mdep_role; 361 char mdep_desp[BTA_HL_MDEP_DESP_LEN+1]; 362 }tBTA_HL_SDP_MDEP_CFG; 363 364 typedef struct 365 { 366 UINT16 ctrl_psm; 367 UINT16 data_psm; 368 UINT8 mcap_sup_proc; 369 UINT8 num_mdeps; /* number of mdep elements from SDP*/ 370 char srv_name[BTA_SERVICE_NAME_LEN+1]; 371 char srv_desp[BTA_SERVICE_DESP_LEN+1]; 372 char provider_name[BTA_PROVIDER_NAME_LEN+1]; 373 tBTA_HL_SDP_MDEP_CFG mdep_cfg[BTA_HL_NUM_SDP_MDEPS]; 374 } tBTA_HL_SDP_REC; 375 376 typedef struct 377 { 378 UINT8 num_recs; 379 tBTA_HL_SDP_REC sdp_rec[BTA_HL_NUM_SDP_RECS]; 380 } tBTA_HL_SDP; 381 382 /* HL control callback function events */ 383 enum 384 { 385 BTA_HL_CTRL_ENABLE_CFM_EVT = 0, 386 BTA_HL_CTRL_DISABLE_CFM_EVT 387 }; 388 typedef UINT8 tBTA_HL_CTRL_EVT; 389 /* Structure associated with BTA_HL_ENABLE_EVT 390 BTA_HL_DISABLE_EVT */ 391 392 typedef struct 393 { 394 tBTA_HL_STATUS status; 395 } tBTA_HL_CTRL_ENABLE_DISABLE; 396 397 typedef union 398 { 399 tBTA_HL_CTRL_ENABLE_DISABLE enable_cfm; 400 tBTA_HL_CTRL_ENABLE_DISABLE disable_cfm; 401 } tBTA_HL_CTRL; 402 403 /* HL instance callback function events */ 404 enum 405 { 406 BTA_HL_REGISTER_CFM_EVT =0, 407 BTA_HL_DEREGISTER_CFM_EVT, 408 BTA_HL_CCH_OPEN_IND_EVT, 409 BTA_HL_CCH_OPEN_CFM_EVT, 410 BTA_HL_CCH_CLOSE_IND_EVT, 411 BTA_HL_CCH_CLOSE_CFM_EVT, 412 BTA_HL_DCH_CREATE_IND_EVT, 413 BTA_HL_DCH_OPEN_IND_EVT, 414 BTA_HL_DCH_OPEN_CFM_EVT, 415 BTA_HL_DCH_CLOSE_IND_EVT, 416 BTA_HL_DCH_CLOSE_CFM_EVT, 417 BTA_HL_DCH_RECONNECT_IND_EVT, 418 BTA_HL_DCH_RECONNECT_CFM_EVT, 419 420 BTA_HL_DCH_ABORT_IND_EVT, 421 BTA_HL_DCH_ABORT_CFM_EVT, 422 BTA_HL_DELETE_MDL_IND_EVT, 423 BTA_HL_DELETE_MDL_CFM_EVT, 424 BTA_HL_DCH_SEND_DATA_CFM_EVT, 425 BTA_HL_DCH_RCV_DATA_IND_EVT, 426 BTA_HL_CONG_CHG_IND_EVT, 427 BTA_HL_DCH_ECHO_TEST_CFM_EVT, 428 BTA_HL_SDP_QUERY_CFM_EVT, 429 BTA_HL_SDP_INFO_IND_EVT 430 }; 431 typedef UINT8 tBTA_HL_EVT; 432 433 434 typedef struct 435 { 436 tBTA_HL_STATUS status; /* start status */ 437 UINT8 app_id; 438 tBTA_HL_APP_HANDLE app_handle; 439 } tBTA_HL_REGISTER_CFM; 440 441 442 typedef struct 443 { 444 tBTA_HL_STATUS status; /* start status */ 445 UINT8 app_id; 446 tBTA_HL_APP_HANDLE app_handle; 447 } tBTA_HL_DEREGISTER_CFM; 448 449 450 typedef struct 451 { 452 BOOLEAN intentional; 453 tBTA_HL_MCL_HANDLE mcl_handle; 454 tBTA_HL_APP_HANDLE app_handle; 455 } tBTA_HL_CCH_CLOSE_IND; 456 457 458 typedef struct 459 { 460 tBTA_HL_MCL_HANDLE mcl_handle; 461 tBTA_HL_APP_HANDLE app_handle; 462 } tBTA_HL_MCL_IND; 463 464 typedef struct 465 { 466 tBTA_HL_STATUS status; /* connection status */ 467 tBTA_HL_MCL_HANDLE mcl_handle; 468 tBTA_HL_APP_HANDLE app_handle; 469 } tBTA_HL_MCL_CFM; 470 471 typedef struct 472 { 473 tBTA_HL_MCL_HANDLE mcl_handle; 474 tBTA_HL_APP_HANDLE app_handle; 475 BD_ADDR bd_addr; /* address of peer device */ 476 } tBTA_HL_CCH_OPEN_IND; 477 478 typedef struct 479 { 480 tBTA_HL_STATUS status; /* connection status */ 481 UINT8 app_id; 482 tBTA_HL_MCL_HANDLE mcl_handle; 483 tBTA_HL_APP_HANDLE app_handle; 484 BD_ADDR bd_addr; /* address of peer device */ 485 } tBTA_HL_CCH_OPEN_CFM; 486 487 typedef struct 488 { 489 tBTA_HL_MCL_HANDLE mcl_handle; 490 tBTA_HL_APP_HANDLE app_handle; 491 tBTA_HL_MDEP_ID local_mdep_id; 492 tBTA_HL_MDL_ID mdl_id; /* MCAP data link ID for this 493 data channel conenction */ 494 tBTA_HL_DCH_CFG cfg; /* dch cfg requested by the peer device */ 495 BD_ADDR bd_addr; /* address of peer device */ 496 497 } tBTA_HL_DCH_CREATE_IND; 498 499 typedef struct 500 { 501 tBTA_HL_MDL_HANDLE mdl_handle; 502 tBTA_HL_MCL_HANDLE mcl_handle; 503 tBTA_HL_APP_HANDLE app_handle; 504 tBTA_HL_MDEP_ID local_mdep_id; 505 tBTA_HL_MDL_ID mdl_id; /* MCAP data link ID for this 506 data channel conenction */ 507 tBTA_HL_DCH_MODE dch_mode; /* data channel mode - reliable or streaming*/ 508 509 BOOLEAN first_reliable; /* whether this is the first reliable data channel */ 510 UINT16 mtu; 511 } tBTA_HL_DCH_OPEN_IND; 512 513 typedef struct 514 { 515 tBTA_HL_STATUS status; /* connection status */ 516 tBTA_HL_MDL_HANDLE mdl_handle; 517 tBTA_HL_MCL_HANDLE mcl_handle; 518 tBTA_HL_APP_HANDLE app_handle; 519 tBTA_HL_MDEP_ID local_mdep_id; 520 tBTA_HL_MDL_ID mdl_id; /* MCAP data link ID for this 521 data channel conenction */ 522 tBTA_HL_DCH_MODE dch_mode; /* data channel mode - reliable or streaming*/ 523 BOOLEAN first_reliable; /* whether this is the first reliable data channel */ 524 UINT16 mtu; 525 } tBTA_HL_DCH_OPEN_CFM; 526 527 528 typedef struct 529 { 530 BOOLEAN intentional; 531 tBTA_HL_MDL_HANDLE mdl_handle; 532 tBTA_HL_MCL_HANDLE mcl_handle; 533 tBTA_HL_APP_HANDLE app_handle; 534 } tBTA_HL_DCH_CLOSE_IND; 535 536 537 typedef struct 538 { 539 tBTA_HL_MDL_HANDLE mdl_handle; 540 tBTA_HL_MCL_HANDLE mcl_handle; 541 tBTA_HL_APP_HANDLE app_handle; 542 } tBTA_HL_MDL_IND; 543 544 typedef struct 545 { 546 tBTA_HL_STATUS status; 547 tBTA_HL_MDL_HANDLE mdl_handle; 548 tBTA_HL_MCL_HANDLE mcl_handle; 549 tBTA_HL_APP_HANDLE app_handle; 550 } tBTA_HL_MDL_CFM; 551 552 typedef struct 553 { 554 tBTA_HL_MCL_HANDLE mcl_handle; 555 tBTA_HL_APP_HANDLE app_handle; 556 tBTA_HL_MDL_ID mdl_id; 557 } tBTA_HL_DELETE_MDL_IND; 558 559 typedef struct 560 { 561 tBTA_HL_STATUS status; 562 tBTA_HL_MCL_HANDLE mcl_handle; 563 tBTA_HL_APP_HANDLE app_handle; 564 tBTA_HL_MDL_ID mdl_id; 565 } tBTA_HL_DELETE_MDL_CFM; 566 567 typedef struct 568 { 569 tBTA_HL_MDL_HANDLE mdl_handle; 570 tBTA_HL_MCL_HANDLE mcl_handle; 571 tBTA_HL_APP_HANDLE app_handle; 572 BOOLEAN cong; 573 } tBTA_HL_DCH_CONG_IND; 574 575 typedef struct 576 { 577 tBTA_HL_APP_HANDLE app_handle; 578 UINT16 ctrl_psm; 579 UINT16 data_psm; 580 UINT8 data_x_spec; 581 UINT8 mcap_sup_procs; 582 } tBTA_HL_SDP_INFO_IND; 583 584 typedef struct 585 { 586 tBTA_HL_STATUS status; 587 UINT8 app_id; 588 tBTA_HL_APP_HANDLE app_handle; 589 BD_ADDR bd_addr; 590 tBTA_HL_SDP *p_sdp; 591 } tBTA_HL_SDP_QUERY_CFM; 592 593 typedef union 594 { 595 tBTA_HL_REGISTER_CFM reg_cfm; 596 tBTA_HL_DEREGISTER_CFM dereg_cfm; 597 tBTA_HL_CCH_OPEN_IND cch_open_ind; 598 tBTA_HL_CCH_OPEN_CFM cch_open_cfm; 599 tBTA_HL_CCH_CLOSE_IND cch_close_ind; 600 tBTA_HL_MCL_CFM cch_close_cfm; 601 tBTA_HL_DCH_CREATE_IND dch_create_ind; 602 tBTA_HL_DCH_OPEN_IND dch_open_ind; 603 tBTA_HL_DCH_OPEN_CFM dch_open_cfm; 604 tBTA_HL_DCH_CLOSE_IND dch_close_ind; 605 tBTA_HL_MDL_CFM dch_close_cfm; 606 tBTA_HL_DCH_OPEN_IND dch_reconnect_ind; 607 tBTA_HL_DCH_OPEN_CFM dch_reconnect_cfm; 608 tBTA_HL_MCL_IND dch_abort_ind; 609 tBTA_HL_MCL_CFM dch_abort_cfm; 610 tBTA_HL_DELETE_MDL_IND delete_mdl_ind; 611 tBTA_HL_DELETE_MDL_CFM delete_mdl_cfm; 612 tBTA_HL_MDL_CFM dch_send_data_cfm; 613 tBTA_HL_MDL_IND dch_rcv_data_ind; 614 tBTA_HL_DCH_CONG_IND dch_cong_ind; 615 tBTA_HL_MCL_CFM echo_test_cfm; 616 tBTA_HL_SDP_QUERY_CFM sdp_query_cfm; 617 tBTA_HL_SDP_INFO_IND sdp_info_ind; 618 619 } tBTA_HL; 620 621 /* HL callback functions */ 622 typedef void tBTA_HL_CTRL_CBACK(tBTA_HL_CTRL_EVT event, tBTA_HL_CTRL *p_data); 623 typedef void tBTA_HL_CBACK(tBTA_HL_EVT event, tBTA_HL *p_data); 624 625 626 /***************************************************************************** 627 ** External Function Declarations 628 *****************************************************************************/ 629 #ifdef __cplusplus 630 extern "C" 631 { 632 #endif 633 634 /************************** 635 ** API Functions 636 ***************************/ 637 638 /******************************************************************************* 639 ** 640 ** Function BTA_HlEnable 641 ** 642 ** Description Enable the HL subsystems. This function must be 643 ** called before any other functions in the HL API are called. 644 ** When the enable operation is completed the callback function 645 ** will be called with an BTA_HL_CTRL_ENABLE_CFM_EVT event. 646 ** 647 ** Parameters p_cback - HL event call back function 648 ** 649 ** Returns void 650 ** 651 *******************************************************************************/ 652 extern void BTA_HlEnable(tBTA_HL_CTRL_CBACK *p_ctrl_cback); 653 /******************************************************************************* 654 ** 655 ** Function BTA_HlDisable 656 ** 657 ** Description Disable the HL subsystem. 658 ** 659 ** Returns void 660 ** 661 *******************************************************************************/ 662 extern void BTA_HlDisable(void); 663 664 /******************************************************************************* 665 ** 666 ** Function BTA_HlUpdate 667 ** 668 ** Description Register an HDP application 669 ** 670 ** Parameters app_id - Application ID 671 ** p_reg_param - non-platform related parameters for the 672 ** HDP application 673 ** p_cback - HL event callback fucntion 674 ** 675 ** Returns void 676 ** 677 *******************************************************************************/ 678 extern void BTA_HlUpdate(UINT8 app_id, 679 tBTA_HL_REG_PARAM *p_reg_param, BOOLEAN is_register, 680 tBTA_HL_CBACK *p_cback); 681 682 /******************************************************************************* 683 ** 684 ** Function BTA_HlRegister 685 ** 686 ** Description Register a HDP application 687 ** 688 ** 689 ** Parameters app_id - hdp application ID 690 ** p_reg_param - non-platform related parameters for the 691 ** HDP application 692 ** p_cback - HL event callback fucntion 693 ** 694 ** Returns void 695 ** 696 *******************************************************************************/ 697 extern void BTA_HlRegister(UINT8 app_id, 698 tBTA_HL_REG_PARAM *p_reg_param, 699 tBTA_HL_CBACK *p_cback); 700 701 /******************************************************************************* 702 ** 703 ** Function BTA_HlDeregister 704 ** 705 ** Description Deregister an HDP application 706 ** 707 ** Parameters app_handle - Application handle 708 ** 709 ** Returns void 710 ** 711 *******************************************************************************/ 712 extern void BTA_HlDeregister(UINT8 app_id,tBTA_HL_APP_HANDLE app_handle); 713 714 /******************************************************************************* 715 ** 716 ** Function BTA_HlCchOpen 717 ** 718 ** Description Open a Control channel connection with the specified BD address 719 ** and the control PSM value is used to select which 720 ** HDP insatnce should be used in case the peer device support 721 ** multiple HDP instances. 722 ** 723 ** 724 ** Parameters app_handle - Application Handle 725 ** p_open_param - parameters for opening a control channel 726 ** 727 ** Returns void 728 ** 729 ** Note: If the control PSM value is zero then the first HDP 730 ** instance is used for the control channel setup 731 *******************************************************************************/ 732 extern void BTA_HlCchOpen(UINT8 app_id, tBTA_HL_APP_HANDLE app_handle, 733 tBTA_HL_CCH_OPEN_PARAM *p_open_param); 734 735 /******************************************************************************* 736 ** 737 ** Function BTA_HlCchClose 738 ** 739 ** Description Close a Control channel connection with the specified MCL 740 ** handle 741 ** 742 ** Parameters mcl_handle - MCL handle 743 ** 744 ** Returns void 745 ** 746 *******************************************************************************/ 747 extern void BTA_HlCchClose(tBTA_HL_MCL_HANDLE mcl_handle); 748 749 /******************************************************************************* 750 ** 751 ** Function BTA_HlDchOpen 752 ** 753 ** Description Open a data channel connection with the specified DCH parameters 754 ** 755 ** Parameters mcl_handle - MCL handle 756 ** p_open_param - parameters for opening a data channel 757 ** 758 ** Returns void 759 ** 760 *******************************************************************************/ 761 extern void BTA_HlDchOpen(tBTA_HL_MCL_HANDLE mcl_handle, 762 tBTA_HL_DCH_OPEN_PARAM *p_open_param); 763 /******************************************************************************* 764 ** 765 ** Function BTA_HlDchReconnect 766 ** 767 ** Description Reconnect a data channel with the specified MDL_ID 768 ** 769 ** Parameters mcl_handle - MCL handle 770 *8 p_recon_param - parameters for reconnecting a data channel 771 ** 772 ** Returns void 773 ** 774 *******************************************************************************/ 775 extern void BTA_HlDchReconnect(tBTA_HL_MCL_HANDLE mcl_handle, 776 tBTA_HL_DCH_RECONNECT_PARAM *p_recon_param); 777 /******************************************************************************* 778 ** 779 ** Function BTA_HlDchClose 780 ** 781 ** Description Close a data channel with the specified MDL handle 782 ** 783 ** Parameters mdl_handle - MDL handle 784 ** 785 ** Returns void 786 ** 787 *******************************************************************************/ 788 extern void BTA_HlDchClose(tBTA_HL_MDL_HANDLE mdl_handle); 789 790 /******************************************************************************* 791 ** 792 ** Function BTA_HlDchAbort 793 ** 794 ** Description Abort the current data channel setup with the specified MCL 795 ** handle 796 ** 797 ** Parameters mcl_handle - MCL handle 798 ** 799 ** 800 ** Returns void 801 ** 802 *******************************************************************************/ 803 extern void BTA_HlDchAbort(tBTA_HL_MCL_HANDLE mcl_handle); 804 805 /******************************************************************************* 806 ** 807 ** Function BTA_HlSendData 808 ** 809 ** Description Send an APDU to the peer device 810 ** 811 ** Parameters mdl_handle - MDL handle 812 ** pkt_size - size of the data packet to be sent 813 ** 814 ** Returns void 815 ** 816 *******************************************************************************/ 817 extern void BTA_HlSendData(tBTA_HL_MDL_HANDLE mdl_handle, 818 UINT16 pkt_size); 819 820 /******************************************************************************* 821 ** 822 ** Function BTA_HlDeleteMdl 823 ** 824 ** Description Delete the specified MDL_ID within the specified MCL handle 825 ** 826 ** Parameters mcl_handle - MCL handle 827 ** mdl_id - MDL ID 828 ** 829 ** Returns void 830 ** 831 ** note: If mdl_id = 0xFFFF then this means to delete all MDLs 832 ** and this value can only be used with DeleteMdl request only 833 ** not other requests 834 ** 835 *******************************************************************************/ 836 extern void BTA_HlDeleteMdl(tBTA_HL_MCL_HANDLE mcl_handle, 837 tBTA_HL_MDL_ID mdl_id ); 838 839 /******************************************************************************* 840 ** 841 ** Function BTA_HlDchEchoTest 842 ** 843 ** Description Initiate an echo test with the specified MCL handle 844 ** 845 ** Parameters mcl_handle - MCL handle 846 *8 p_echo_test_param - parameters for echo testing 847 ** 848 ** Returns void 849 ** 850 *******************************************************************************/ 851 extern void BTA_HlDchEchoTest( tBTA_HL_MCL_HANDLE mcl_handle, 852 tBTA_HL_DCH_ECHO_TEST_PARAM *p_echo_test_param); 853 854 /******************************************************************************* 855 ** 856 ** Function BTA_HlSdpQuery 857 ** 858 ** Description SDP query request for the specified BD address 859 ** 860 ** Parameters app_id 861 app_handle - application handle 862 ** bd_addr - BD address 863 ** 864 ** Returns void 865 ** 866 *******************************************************************************/ 867 extern void BTA_HlSdpQuery(UINT8 app_id,tBTA_HL_APP_HANDLE app_handle, 868 BD_ADDR bd_addr); 869 870 /******************************************************************************* 871 ** 872 ** Function BTA_HlDchCreateMdlRsp 873 ** 874 ** Description Set the Response and configuration values for the Create MDL 875 ** request 876 ** 877 ** Parameters mcl_handle - MCL handle 878 ** p_rsp_param - parameters specified whether the request should 879 ** be accepted or not and if it should be accepted 880 ** then it also specified the configuration response 881 ** value 882 ** 883 ** Returns void 884 ** 885 *******************************************************************************/ 886 extern void BTA_HlDchCreateRsp(tBTA_HL_MCL_HANDLE mcl_handle, 887 tBTA_HL_DCH_CREATE_RSP_PARAM *p_rsp_param); 888 889 890 891 #ifdef __cplusplus 892 893 } 894 #endif 895 896 #endif /* BTA_HL_API_H */ 897