• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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                 3
43 #endif
44 
45 #ifndef BTA_HL_NUM_MDEPS
46 #define BTA_HL_NUM_MDEPS                5
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             3
78 #endif
79 
80 #ifndef BTA_HL_NUM_SDP_MDEPS
81 #define BTA_HL_NUM_SDP_MDEPS            10
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_LRG_POOL_ID              GKI_POOL_ID_7
106 #define BTA_HL_MAX_TIME                 255
107 #define BTA_HL_MIN_TIME                 1
108 #define BTA_HL_INVALID_APP_HANDLE       0xFF
109 #define BTA_HL_INVALID_MCL_HANDLE       0xFF
110 #define BTA_HL_INVALID_MDL_HANDLE       0xFFFF
111 
112 #define BTA_HL_STATUS_OK                    0
113 #define BTA_HL_STATUS_FAIL                  1   /* Used to pass all other errors */
114 #define BTA_HL_STATUS_ABORTED               2
115 #define BTA_HL_STATUS_NO_RESOURCE           3
116 #define BTA_HL_STATUS_LAST_ITEM             4
117 #define BTA_HL_STATUS_DUPLICATE_APP_ID      5
118 #define BTA_HL_STATUS_INVALID_APP_HANDLE    6
119 #define BTA_HL_STATUS_INVALID_MCL_HANDLE    7
120 #define BTA_HL_STATUS_MCAP_REG_FAIL         8
121 #define BTA_HL_STATUS_MDEP_CO_FAIL          9
122 #define BTA_HL_STATUS_ECHO_CO_FAIL          10
123 #define BTA_HL_STATUS_MDL_CFG_CO_FAIL       11
124 #define BTA_HL_STATUS_SDP_NO_RESOURCE       12
125 #define BTA_HL_STATUS_SDP_FAIL              13
126 #define BTA_HL_STATUS_NO_CCH                14
127 #define BTA_HL_STATUS_NO_MCL                15
128 
129 #define BTA_HL_STATUS_NO_FIRST_RELIABLE     17
130 #define BTA_HL_STATUS_INVALID_DCH_CFG       18
131 #define BTA_HL_STATUS_INVALID_MDL_HANDLE    19
132 #define BTA_HL_STATUS_INVALID_BD_ADDR       20
133 #define BTA_HL_STATUS_INVALID_RECONNECT_CFG 21
134 #define BTA_HL_STATUS_ECHO_TEST_BUSY        22
135 #define BTA_HL_STATUS_INVALID_LOCAL_MDEP_ID 23
136 #define BTA_HL_STATUS_INVALID_MDL_ID        24
137 #define BTA_HL_STATUS_NO_MDL_ID_FOUND       25
138 #define BTA_HL_STATUS_DCH_BUSY              26  /* DCH is congested*/
139 #define BTA_HL_STATUS_INVALID_CTRL_PSM      27
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 } tBTA_HL_MDEP;
250 
251 typedef struct
252 {
253     tBTA_HL_MDEP            mdep[BTA_HL_NUM_MDEPS];
254     tBTA_HL_ECHO_CFG        echo_cfg;
255     tBTA_HL_MDEP_ROLE_MASK  app_role_mask;
256     BOOLEAN                 advertize_source_sdp;
257     UINT8                   num_of_mdeps;
258 } tBTA_HL_SUP_FEATURE;
259 
260 typedef struct
261 {
262     BOOLEAN                 delete_req_pending;
263     tBTA_HL_MDL_ID          mdl_id;
264     tBTA_HL_MCL_HANDLE      mcl_handle;
265 } tBTA_HL_DELETE_MDL;
266 
267 typedef struct
268 {
269     UINT8                   time;
270     UINT16                  mtu;
271     tBTA_HL_MDL_ID          mdl_id;
272     tBTA_HL_MDEP_ID         local_mdep_id;
273     tBTA_HL_MDEP_ROLE       local_mdep_role;
274     BOOLEAN                 active;     /* true if this item is in use */
275     tBTA_HL_DCH_MODE        dch_mode;
276     UINT8                   fcs;
277     BD_ADDR                 peer_bd_addr;
278 } tBTA_HL_MDL_CFG;
279 
280 
281 /* Maximum number of supported feature list items (list_elem in tSDP_SUP_FEATURE_ELEM) */
282 #define BTA_HL_NUM_SUP_FEATURE_ELEMS     10
283 #define BTA_HL_SUP_FEATURE_SDP_BUF_SIZE  512
284 /* This structure is used to add supported feature lists and find supported feature elements */
285 typedef struct
286 {
287     UINT8       mdep_id;
288     UINT16      data_type;
289     tBTA_HL_MDEP_ROLE       mdep_role;
290     char        *p_mdep_desp;
291 } tBTA_HL_SUP_FEATURE_ELEM;
292 
293 typedef struct
294 {
295     UINT16                      num_elems;
296     tBTA_HL_SUP_FEATURE_ELEM   list_elem[BTA_HL_NUM_SUP_FEATURE_ELEMS];
297 } tBTA_HL_SUP_FEATURE_LIST_ELEM;
298 
299 
300 typedef struct
301 {
302     tBTA_HL_DEVICE_TYPE     dev_type;           /* sink, source or dual roles */
303     tBTA_SEC                sec_mask;           /* security mask for accepting conenction*/
304     const char              *p_srv_name;        /* service name to be used in the SDP; null terminated*/
305     const char              *p_srv_desp;        /* service description to be used in the SDP; null terminated */
306     const char              *p_provider_name;   /* provide name to be used in the SDP; null terminated */
307 } tBTA_HL_REG_PARAM;
308 
309 typedef struct
310 {
311     UINT16                  ctrl_psm;
312     BD_ADDR                 bd_addr;           /* Address of peer device */
313     tBTA_SEC                sec_mask;          /* security mask for initiating connection*/
314 } tBTA_HL_CCH_OPEN_PARAM;
315 
316 
317 typedef struct
318 {
319     UINT16                  ctrl_psm;
320     tBTA_HL_MDEP_ID         local_mdep_id;     /* local MDEP ID */
321     tBTA_HL_MDEP_ID         peer_mdep_id;      /* peer mdep id */
322     tBTA_HL_DCH_CFG         local_cfg;
323     tBTA_SEC                sec_mask;          /* security mask for initiating connection*/
324 } tBTA_HL_DCH_OPEN_PARAM;
325 
326 
327 typedef struct
328 {
329     UINT16                  ctrl_psm;
330     tBTA_HL_MDL_ID          mdl_id;
331 } tBTA_HL_DCH_RECONNECT_PARAM;
332 
333 
334 typedef struct
335 {
336     UINT16                  ctrl_psm;
337     UINT16                  pkt_size;
338     tBTA_HL_DCH_CFG         local_cfg;
339 } tBTA_HL_DCH_ECHO_TEST_PARAM;
340 
341 typedef struct
342 {
343     UINT16                  buf_size;
344     UINT8                   p_buf;        /* buffer pointer */
345 } tBTA_HL_DCH_BUF_INFO;
346 
347 typedef struct
348 {
349     tBTA_HL_MDEP_ID         local_mdep_id;  /* local MDEP ID */
350     tBTA_HL_MDL_ID          mdl_id;
351     tBTA_HL_DCH_CREATE_RSP  rsp_code;
352     tBTA_HL_DCH_CFG         cfg_rsp;
353 } tBTA_HL_DCH_CREATE_RSP_PARAM;
354 
355 typedef struct
356 {
357     UINT16              data_type;
358     UINT8               mdep_id;
359     tBTA_HL_MDEP_ROLE   mdep_role;
360     char                mdep_desp[BTA_HL_MDEP_DESP_LEN+1];
361 }tBTA_HL_SDP_MDEP_CFG;
362 
363 typedef struct
364 {
365     UINT16                  ctrl_psm;
366     UINT16                  data_psm;
367     UINT8                   mcap_sup_proc;
368     UINT8                   num_mdeps; /* number of mdep elements from SDP*/
369     char                    srv_name[BTA_SERVICE_NAME_LEN+1];
370     char                    srv_desp[BTA_SERVICE_DESP_LEN+1];
371     char                    provider_name[BTA_PROVIDER_NAME_LEN+1];
372     tBTA_HL_SDP_MDEP_CFG    mdep_cfg[BTA_HL_NUM_SDP_MDEPS];
373 } tBTA_HL_SDP_REC;
374 
375 typedef struct
376 {
377     UINT8                num_recs;
378     tBTA_HL_SDP_REC      sdp_rec[BTA_HL_NUM_SDP_RECS];
379 } tBTA_HL_SDP;
380 
381 /* HL control callback function events */
382 enum
383 {
384     BTA_HL_CTRL_ENABLE_CFM_EVT            = 0,
385     BTA_HL_CTRL_DISABLE_CFM_EVT
386 };
387 typedef UINT8 tBTA_HL_CTRL_EVT;
388 /* Structure associated with BTA_HL_ENABLE_EVT
389    BTA_HL_DISABLE_EVT */
390 
391 typedef struct
392 {
393     tBTA_HL_STATUS  status;
394 } tBTA_HL_CTRL_ENABLE_DISABLE;
395 
396 typedef union
397 {
398     tBTA_HL_CTRL_ENABLE_DISABLE  enable_cfm;
399     tBTA_HL_CTRL_ENABLE_DISABLE  disable_cfm;
400 } tBTA_HL_CTRL;
401 
402 /* HL instance callback function events */
403 enum
404 {
405     BTA_HL_REGISTER_CFM_EVT           =0,
406     BTA_HL_DEREGISTER_CFM_EVT,
407     BTA_HL_CCH_OPEN_IND_EVT,
408     BTA_HL_CCH_OPEN_CFM_EVT,
409     BTA_HL_CCH_CLOSE_IND_EVT,
410     BTA_HL_CCH_CLOSE_CFM_EVT,
411     BTA_HL_DCH_CREATE_IND_EVT,
412     BTA_HL_DCH_OPEN_IND_EVT,
413     BTA_HL_DCH_OPEN_CFM_EVT,
414     BTA_HL_DCH_CLOSE_IND_EVT,
415     BTA_HL_DCH_CLOSE_CFM_EVT,
416     BTA_HL_DCH_RECONNECT_IND_EVT,
417     BTA_HL_DCH_RECONNECT_CFM_EVT,
418 
419     BTA_HL_DCH_ABORT_IND_EVT,
420     BTA_HL_DCH_ABORT_CFM_EVT,
421     BTA_HL_DELETE_MDL_IND_EVT,
422     BTA_HL_DELETE_MDL_CFM_EVT,
423     BTA_HL_DCH_SEND_DATA_CFM_EVT,
424     BTA_HL_DCH_RCV_DATA_IND_EVT,
425     BTA_HL_CONG_CHG_IND_EVT,
426     BTA_HL_DCH_ECHO_TEST_CFM_EVT,
427     BTA_HL_SDP_QUERY_CFM_EVT,
428     BTA_HL_SDP_INFO_IND_EVT
429 };
430 typedef UINT8 tBTA_HL_EVT;
431 
432 
433 typedef struct
434 {
435     tBTA_HL_STATUS          status;        /* start status */
436     UINT8                   app_id;
437     tBTA_HL_APP_HANDLE      app_handle;
438 } tBTA_HL_REGISTER_CFM;
439 
440 
441 typedef struct
442 {
443     tBTA_HL_STATUS          status;        /* start status */
444     tBTA_HL_APP_HANDLE      app_handle;
445 } tBTA_HL_DEREGISTER_CFM;
446 
447 
448 typedef struct
449 {
450     BOOLEAN                 intentional;
451     tBTA_HL_MCL_HANDLE      mcl_handle;
452     tBTA_HL_APP_HANDLE      app_handle;
453 } tBTA_HL_CCH_CLOSE_IND;
454 
455 
456 typedef struct
457 {
458     tBTA_HL_MCL_HANDLE      mcl_handle;
459     tBTA_HL_APP_HANDLE      app_handle;
460 } tBTA_HL_MCL_IND;
461 
462 typedef struct
463 {
464     tBTA_HL_STATUS          status;             /* connection status */
465     tBTA_HL_MCL_HANDLE      mcl_handle;
466     tBTA_HL_APP_HANDLE      app_handle;
467 } tBTA_HL_MCL_CFM;
468 
469 typedef struct
470 {
471     tBTA_HL_MCL_HANDLE      mcl_handle;
472     tBTA_HL_APP_HANDLE      app_handle;
473     BD_ADDR                 bd_addr; /* address of peer device */
474 } tBTA_HL_CCH_OPEN_IND;
475 
476 typedef struct
477 {
478     tBTA_HL_STATUS          status;             /* connection status */
479     tBTA_HL_MCL_HANDLE      mcl_handle;
480     tBTA_HL_APP_HANDLE      app_handle;
481     BD_ADDR                 bd_addr;            /* address of peer device */
482 } tBTA_HL_CCH_OPEN_CFM;
483 
484 typedef struct
485 {
486     tBTA_HL_MCL_HANDLE      mcl_handle;
487     tBTA_HL_APP_HANDLE      app_handle;
488     tBTA_HL_MDEP_ID         local_mdep_id;
489     tBTA_HL_MDL_ID          mdl_id;             /* MCAP data link ID for this
490                                                    data channel conenction    */
491     tBTA_HL_DCH_CFG         cfg;                /* dch cfg requested by the peer device */
492 } tBTA_HL_DCH_CREATE_IND;
493 
494 typedef struct
495 {
496     tBTA_HL_MDL_HANDLE      mdl_handle;
497     tBTA_HL_MCL_HANDLE      mcl_handle;
498     tBTA_HL_APP_HANDLE      app_handle;
499     tBTA_HL_MDEP_ID         local_mdep_id;
500     tBTA_HL_MDL_ID          mdl_id;             /* MCAP data link ID for this
501                                                    data channel conenction    */
502     tBTA_HL_DCH_MODE        dch_mode;           /* data channel mode - reliable or streaming*/
503 
504     BOOLEAN                 first_reliable;  /* whether this is the first reliable data channel */
505     UINT16                  mtu;
506 } tBTA_HL_DCH_OPEN_IND;
507 
508 typedef struct
509 {
510     tBTA_HL_STATUS          status;             /* connection status */
511     tBTA_HL_MDL_HANDLE      mdl_handle;
512     tBTA_HL_MCL_HANDLE      mcl_handle;
513     tBTA_HL_APP_HANDLE      app_handle;
514     tBTA_HL_MDEP_ID         local_mdep_id;
515     tBTA_HL_MDL_ID          mdl_id;             /* MCAP data link ID for this
516                                                    data channel conenction    */
517     tBTA_HL_DCH_MODE        dch_mode;           /* data channel mode - reliable or streaming*/
518     BOOLEAN                 first_reliable;     /* whether this is the first reliable data channel */
519     UINT16                  mtu;
520 } tBTA_HL_DCH_OPEN_CFM;
521 
522 
523 typedef struct
524 {
525     BOOLEAN                 intentional;
526     tBTA_HL_MDL_HANDLE      mdl_handle;
527     tBTA_HL_MCL_HANDLE      mcl_handle;
528     tBTA_HL_APP_HANDLE      app_handle;
529 } tBTA_HL_DCH_CLOSE_IND;
530 
531 
532 typedef struct
533 {
534     tBTA_HL_MDL_HANDLE      mdl_handle;
535     tBTA_HL_MCL_HANDLE      mcl_handle;
536     tBTA_HL_APP_HANDLE      app_handle;
537 } tBTA_HL_MDL_IND;
538 
539 typedef struct
540 {
541     tBTA_HL_STATUS          status;
542     tBTA_HL_MDL_HANDLE      mdl_handle;
543     tBTA_HL_MCL_HANDLE      mcl_handle;
544     tBTA_HL_APP_HANDLE      app_handle;
545 } tBTA_HL_MDL_CFM;
546 
547 typedef struct
548 {
549     tBTA_HL_MCL_HANDLE      mcl_handle;
550     tBTA_HL_APP_HANDLE      app_handle;
551     tBTA_HL_MDL_ID          mdl_id;
552 } tBTA_HL_DELETE_MDL_IND;
553 
554 typedef struct
555 {
556     tBTA_HL_STATUS          status;
557     tBTA_HL_MCL_HANDLE      mcl_handle;
558     tBTA_HL_APP_HANDLE      app_handle;
559     tBTA_HL_MDL_ID          mdl_id;
560 } tBTA_HL_DELETE_MDL_CFM;
561 
562 typedef struct
563 {
564     tBTA_HL_MDL_HANDLE      mdl_handle;
565     tBTA_HL_MCL_HANDLE      mcl_handle;
566     tBTA_HL_APP_HANDLE      app_handle;
567     BOOLEAN                 cong;
568 } tBTA_HL_DCH_CONG_IND;
569 
570 typedef struct
571 {
572     tBTA_HL_APP_HANDLE      app_handle;
573     UINT16                  ctrl_psm;
574     UINT16                  data_psm;
575     UINT8                   data_x_spec;
576     UINT8                   mcap_sup_procs;
577 } tBTA_HL_SDP_INFO_IND;
578 
579 typedef struct
580 {
581     tBTA_HL_STATUS          status;
582     tBTA_HL_APP_HANDLE      app_handle;
583     BD_ADDR                 bd_addr;
584     tBTA_HL_SDP             *p_sdp;
585 } tBTA_HL_SDP_QUERY_CFM;
586 
587 typedef union
588 {
589     tBTA_HL_REGISTER_CFM        reg_cfm;
590     tBTA_HL_DEREGISTER_CFM      dereg_cfm;
591     tBTA_HL_CCH_OPEN_IND        cch_open_ind;
592     tBTA_HL_CCH_OPEN_CFM        cch_open_cfm;
593     tBTA_HL_CCH_CLOSE_IND       cch_close_ind;
594     tBTA_HL_MCL_CFM             cch_close_cfm;
595     tBTA_HL_DCH_CREATE_IND      dch_create_ind;
596     tBTA_HL_DCH_OPEN_IND        dch_open_ind;
597     tBTA_HL_DCH_OPEN_CFM        dch_open_cfm;
598     tBTA_HL_DCH_CLOSE_IND       dch_close_ind;
599     tBTA_HL_MDL_CFM             dch_close_cfm;
600     tBTA_HL_DCH_OPEN_IND        dch_reconnect_ind;
601     tBTA_HL_DCH_OPEN_CFM        dch_reconnect_cfm;
602     tBTA_HL_MCL_IND             dch_abort_ind;
603     tBTA_HL_MCL_CFM             dch_abort_cfm;
604     tBTA_HL_DELETE_MDL_IND      delete_mdl_ind;
605     tBTA_HL_DELETE_MDL_CFM      delete_mdl_cfm;
606     tBTA_HL_MDL_CFM             dch_send_data_cfm;
607     tBTA_HL_MDL_IND             dch_rcv_data_ind;
608     tBTA_HL_DCH_CONG_IND        dch_cong_ind;
609     tBTA_HL_MCL_CFM             echo_test_cfm;
610     tBTA_HL_SDP_QUERY_CFM       sdp_query_cfm;
611     tBTA_HL_SDP_INFO_IND        sdp_info_ind;
612 
613 } tBTA_HL;
614 
615 /* HL callback functions */
616 typedef void tBTA_HL_CTRL_CBACK(tBTA_HL_CTRL_EVT event, tBTA_HL_CTRL *p_data);
617 typedef void tBTA_HL_CBACK(tBTA_HL_EVT event, tBTA_HL *p_data);
618 
619 
620 /*****************************************************************************
621 **  External Function Declarations
622 *****************************************************************************/
623 #ifdef __cplusplus
624 extern "C"
625 {
626 #endif
627 
628 /**************************
629 **  API Functions
630 ***************************/
631 
632 /*******************************************************************************
633 **
634 ** Function         BTA_HlEnable
635 **
636 ** Description      Enable the HL subsystems.  This function must be
637 **                  called before any other functions in the HL API are called.
638 **                  When the enable operation is completed the callback function
639 **                  will be called with an BTA_HL_CTRL_ENABLE_CFM_EVT event.
640 **
641 ** Parameters       p_cback - HL event call back function
642 **
643 ** Returns          void
644 **
645 *******************************************************************************/
646     BTA_API extern void BTA_HlEnable(tBTA_HL_CTRL_CBACK *p_ctrl_cback);
647 /*******************************************************************************
648 **
649 ** Function         BTA_HlDisable
650 **
651 ** Description     Disable the HL subsystem.
652 **
653 ** Returns          void
654 **
655 *******************************************************************************/
656     BTA_API extern void BTA_HlDisable(void);
657 /*******************************************************************************
658 **
659 ** Function         BTA_HlRegister
660 **
661 ** Description      Register a HDP application
662 **
663 **
664 ** Parameters       app_id        - hdp application ID
665 **                  p_reg_param   - non-platform related parameters for the
666 **                                  HDP application
667 **                  p_cback       - HL event callback fucntion
668 **
669 ** Returns          void
670 **
671 *******************************************************************************/
672     BTA_API extern void BTA_HlRegister(UINT8  app_id,
673                                        tBTA_HL_REG_PARAM *p_reg_param,
674                                        tBTA_HL_CBACK *p_cback);
675 
676 /*******************************************************************************
677 **
678 ** Function         BTA_HlDeregister
679 **
680 ** Description      Deregister an HDP application
681 **
682 ** Parameters       app_handle - Application handle
683 **
684 ** Returns         void
685 **
686 *******************************************************************************/
687     BTA_API extern void BTA_HlDeregister(tBTA_HL_APP_HANDLE app_handle);
688 
689 /*******************************************************************************
690 **
691 ** Function         BTA_HlCchOpen
692 **
693 ** Description      Open a Control channel connection with the specified BD address
694 **                  and the control PSM value is used to select which
695 **                  HDP insatnce should be used in case the peer device support
696 **                  multiple HDP instances.
697 **
698 **
699 ** Parameters       app_handle - Application Handle
700 **                  p_open_param - parameters for opening a control channel
701 **
702 ** Returns          void
703 **
704 **                  Note: If the control PSM value is zero then the first HDP
705 **                        instance is used for the control channel setup
706 *******************************************************************************/
707     BTA_API extern void BTA_HlCchOpen(tBTA_HL_APP_HANDLE app_handle,
708                                       tBTA_HL_CCH_OPEN_PARAM *p_open_param);
709 
710 /*******************************************************************************
711 **
712 ** Function         BTA_HlCchClose
713 **
714 ** Description      Close a Control channel connection with the specified MCL
715 **                  handle
716 **
717 ** Parameters       mcl_handle - MCL handle
718 **
719 ** Returns          void
720 **
721 *******************************************************************************/
722     BTA_API extern  void BTA_HlCchClose(tBTA_HL_MCL_HANDLE mcl_handle);
723 
724 /*******************************************************************************
725 **
726 ** Function         BTA_HlDchOpen
727 **
728 ** Description      Open a data channel connection with the specified DCH parameters
729 **
730 ** Parameters       mcl_handle - MCL handle
731 **                  p_open_param - parameters for opening a data channel
732 **
733 ** Returns          void
734 **
735 *******************************************************************************/
736     BTA_API extern  void BTA_HlDchOpen(tBTA_HL_MCL_HANDLE mcl_handle,
737                                        tBTA_HL_DCH_OPEN_PARAM *p_open_param);
738 /*******************************************************************************
739 **
740 ** Function         BTA_HlDchReconnect
741 **
742 ** Description      Reconnect a data channel with the specified MDL_ID
743 **
744 ** Parameters       mcl_handle      - MCL handle
745 *8                  p_recon_param   - parameters for reconnecting a data channel
746 **
747 ** Returns          void
748 **
749 *******************************************************************************/
750     BTA_API extern void BTA_HlDchReconnect(tBTA_HL_MCL_HANDLE mcl_handle,
751                                             tBTA_HL_DCH_RECONNECT_PARAM *p_recon_param);
752 /*******************************************************************************
753 **
754 ** Function         BTA_HlDchClose
755 **
756 ** Description      Close a data channel with the specified MDL handle
757 **
758 ** Parameters       mdl_handle  - MDL handle
759 **
760 ** Returns          void
761 **
762 *******************************************************************************/
763     BTA_API extern void BTA_HlDchClose(tBTA_HL_MDL_HANDLE mdl_handle);
764 
765 /*******************************************************************************
766 **
767 ** Function         BTA_HlDchAbort
768 **
769 ** Description      Abort the current data channel setup with the specified MCL
770 **                  handle
771 **
772 ** Parameters       mcl_handle  - MCL handle
773 **
774 **
775 ** Returns          void
776 **
777 *******************************************************************************/
778     BTA_API extern void BTA_HlDchAbort(tBTA_HL_MCL_HANDLE mcl_handle);
779 
780 /*******************************************************************************
781 **
782 ** Function         BTA_HlSendData
783 **
784 ** Description      Send an APDU to the peer device
785 **
786 ** Parameters       mdl_handle  - MDL handle
787 **                  pkt_size    - size of the data packet to be sent
788 **
789 ** Returns          void
790 **
791 *******************************************************************************/
792     BTA_API extern void BTA_HlSendData(tBTA_HL_MDL_HANDLE mdl_handle,
793                                        UINT16           pkt_size);
794 
795 /*******************************************************************************
796 **
797 ** Function         BTA_HlDeleteMdl
798 **
799 ** Description      Delete the specified MDL_ID within the specified MCL handle
800 **
801 ** Parameters       mcl_handle  - MCL handle
802 **                  mdl_id      - MDL ID
803 **
804 ** Returns          void
805 **
806 **                  note: If mdl_id = 0xFFFF then this means to delete all MDLs
807 **                        and this value can only be used with DeleteMdl request only
808 **                        not other requests
809 **
810 *******************************************************************************/
811     BTA_API extern void BTA_HlDeleteMdl(tBTA_HL_MCL_HANDLE mcl_handle,
812                                         tBTA_HL_MDL_ID mdl_id );
813 
814 /*******************************************************************************
815 **
816 ** Function         BTA_HlDchEchoTest
817 **
818 ** Description      Initiate an echo test with the specified MCL handle
819 **
820 ** Parameters       mcl_handle           - MCL handle
821 *8                  p_echo_test_param   -  parameters for echo testing
822 **
823 ** Returns          void
824 **
825 *******************************************************************************/
826     BTA_API extern void BTA_HlDchEchoTest( tBTA_HL_MCL_HANDLE  mcl_handle,
827                                            tBTA_HL_DCH_ECHO_TEST_PARAM *p_echo_test_param);
828 
829 /*******************************************************************************
830 **
831 ** Function         BTA_HlSdpQuery
832 **
833 ** Description      SDP query request for the specified BD address
834 **
835 ** Parameters       app_handle      - application handle
836 **                  bd_addr         - BD address
837 **
838 ** Returns          void
839 **
840 *******************************************************************************/
841     BTA_API extern  void BTA_HlSdpQuery(tBTA_HL_APP_HANDLE app_handle,
842                                         BD_ADDR bd_addr);
843 
844 /*******************************************************************************
845 **
846 ** Function         BTA_HlDchCreateMdlRsp
847 **
848 ** Description      Set the Response and configuration values for the Create MDL
849 **                  request
850 **
851 ** Parameters       mcl_handle  - MCL handle
852 **                  p_rsp_param - parameters specified whether the request should
853 **                                be accepted or not and if it should be accepted
854 **                                then it also specified the configuration response
855 **                                value
856 **
857 ** Returns          void
858 **
859 *******************************************************************************/
860     BTA_API extern void BTA_HlDchCreateRsp(tBTA_HL_MCL_HANDLE mcl_handle,
861                                            tBTA_HL_DCH_CREATE_RSP_PARAM *p_rsp_param);
862 
863 
864 
865 #ifdef __cplusplus
866 
867 }
868 #endif
869 
870 #endif /* BTA_HL_API_H */
871 
872 
873 
874 
875 
876 
877 
878 
879 
880 
881 
882 
883 
884 
885 
886 
887 
888 
889 
890 
891 
892 
893 
894 
895 
896 
897 
898 
899 
900 
901 
902 
903 
904 
905 
906 
907 
908 
909