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