Home | History | Annotate | Download | only in hl
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 1998-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 private file for the message access equipment (MSE)
     22  *  subsystem.
     23  *
     24  ******************************************************************************/
     25 #ifndef BTA_HL_INT_H
     26 #define BTA_HL_INT_H
     27 
     28 #include "bt_target.h"
     29 #include "bta_sys.h"
     30 #include "obx_api.h"
     31 #include "bta_hl_api.h"
     32 #include "bta_hl_co.h"
     33 #include "l2cdefs.h"
     34 
     35 
     36 typedef UINT16 (tBTA_HL_ALLOCATE_PSM) (void);
     37 
     38 /*****************************************************************************
     39 **  Constants and data types
     40 *****************************************************************************/
     41 
     42 #ifndef BTA_HL_DISC_SIZE
     43 #define BTA_HL_DISC_SIZE                1600
     44 #endif
     45 #define BTA_HL_NUM_SRCH_ATTR            10
     46 #define BTA_HL_MIN_SDP_MDEP_LEN         7
     47 
     48 /* L2CAP defualt parameters */
     49 #define BTA_HL_L2C_TX_WIN_SIZE          10
     50 #define BTA_HL_L2C_MAX_TRANSMIT         32
     51 #define BTA_HL_L2C_RTRANS_TOUT          2000
     52 #define BTA_HL_L2C_MON_TOUT             12000
     53 #define BTA_HL_L2C_MPS                  1017
     54 #define BTA_HL_L2C_USER_RX_POOL_ID      L2CAP_DEFAULT_ERM_POOL_ID
     55 #define BTA_HL_L2C_USER_TX_POOL_ID      L2CAP_DEFAULT_ERM_POOL_ID /* todo this should be based on data type */
     56 #define BTA_HL_L2C_FCR_RX_POOL_ID       L2CAP_DEFAULT_ERM_POOL_ID
     57 #define BTA_HL_L2C_FCR_TX_POOL_ID       L2CAP_DEFAULT_ERM_POOL_ID
     58 
     59 /* L2CAP FCS setting*/
     60 #define BTA_HL_MCA_USE_FCS              MCA_FCS_USE
     61 #define BTA_HL_MCA_NO_FCS               MCA_FCS_BYPASS
     62 #define BTA_HL_L2C_USE_FCS              1
     63 #define BTA_HL_L2C_NO_FCS               0
     64 #define BTA_HL_DEFAULT_SOURCE_FCS       BTA_HL_L2C_USE_FCS
     65 
     66 /* SDP Operations */
     67 #define BTA_HL_SDP_OP_NONE                  0
     68 #define BTA_HL_SDP_OP_CCH_INIT              1
     69 #define BTA_HL_SDP_OP_DCH_OPEN_INIT         2
     70 #define BTA_HL_SDP_OP_DCH_RECONNECT_INIT    3
     71 #define BTA_HL_SDP_OP_SDP_QUERY_NEW         4
     72 #define BTA_HL_SDP_OP_SDP_QUERY_CURRENT     5
     73 
     74 typedef UINT8 tBTA_HL_SDP_OPER;
     75 
     76 /* CCH Operations */
     77 #define     BTA_HL_CCH_OP_NONE            0
     78 #define     BTA_HL_CCH_OP_LOCAL_OPEN      1
     79 #define     BTA_HL_CCH_OP_REMOTE_OPEN     2
     80 #define     BTA_HL_CCH_OP_LOCAL_CLOSE     3
     81 #define     BTA_HL_CCH_OP_REMOTE_CLOSE    4
     82 
     83 typedef UINT8 tBTA_HL_CCH_OPER;
     84 
     85 /* Pending DCH close operations when closing a CCH */
     86 #define    BTA_HL_CCH_CLOSE_OP_DCH_NONE     0
     87 #define    BTA_HL_CCH_CLOSE_OP_DCH_ABORT    1
     88 #define    BTA_HL_CCH_CLOSE_OP_DCH_CLOSE    2
     89 typedef UINT8 tBTA_HL_CCH_CLOSE_DCH_OPER;
     90 
     91 /* DCH Operations */
     92 #define    BTA_HL_DCH_OP_NONE                    0
     93 #define    BTA_HL_DCH_OP_REMOTE_CREATE           1
     94 #define    BTA_HL_DCH_OP_LOCAL_OPEN              2
     95 #define    BTA_HL_DCH_OP_REMOTE_OPEN             3
     96 #define    BTA_HL_DCH_OP_LOCAL_CLOSE             4
     97 #define    BTA_HL_DCH_OP_REMOTE_CLOSE            5
     98 #define    BTA_HL_DCH_OP_LOCAL_DELETE            6
     99 #define    BTA_HL_DCH_OP_REMOTE_DELETE           7
    100 #define    BTA_HL_DCH_OP_LOCAL_RECONNECT         8
    101 #define    BTA_HL_DCH_OP_REMOTE_RECONNECT        9
    102 #define    BTA_HL_DCH_OP_LOCAL_CLOSE_ECHO_TEST   10
    103 #define    BTA_HL_DCH_OP_LOCAL_CLOSE_RECONNECT   11
    104 
    105 typedef UINT8 tBTA_HL_DCH_OPER;
    106 
    107 /* Echo test Operations */
    108 #define    BTA_HL_ECHO_OP_NONE                 0
    109 #define    BTA_HL_ECHO_OP_CI_GET_ECHO_DATA     1
    110 #define    BTA_HL_ECHO_OP_SDP_INIT             2
    111 #define    BTA_HL_ECHO_OP_MDL_CREATE_CFM       3
    112 #define    BTA_HL_ECHO_OP_DCH_OPEN_CFM         4
    113 #define    BTA_HL_ECHO_OP_LOOP_BACK            5
    114 #define    BTA_HL_ECHO_OP_CI_PUT_ECHO_DATA     6
    115 #define    BTA_HL_ECHO_OP_DCH_CLOSE_CFM        7
    116 #define    BTA_HL_ECHO_OP_OPEN_IND             8
    117 #define    BTA_HL_ECHO_OP_ECHO_PKT             9
    118 
    119 typedef UINT8 tBTA_HL_ECHO_OPER;
    120 
    121 /* abort status mask for abort_oper */
    122 
    123 #define BTA_HL_ABORT_NONE_MASK      0x00
    124 #define BTA_HL_ABORT_PENDING_MASK   0x01
    125 #define BTA_HL_ABORT_LOCAL_MASK     0x10
    126 #define BTA_HL_ABORT_REMOTE_MASK    0x20
    127 #define BTA_HL_ABORT_CCH_CLOSE_MASK 0x40
    128 
    129 /* call out mask for cout_oper */
    130 #define BTA_HL_CO_NONE_MASK          0x00
    131 #define BTA_HL_CO_GET_TX_DATA_MASK   0x01
    132 #define BTA_HL_CO_PUT_RX_DATA_MASK   0x02
    133 #define BTA_HL_CO_GET_ECHO_DATA_MASK 0x04
    134 #define BTA_HL_CO_PUT_ECHO_DATA_MASK 0x08
    135 
    136 typedef struct
    137 {
    138     UINT16      mtu;
    139     UINT8       fcs;                    /* '0' No FCS, otherwise '1' */
    140 } tBTA_HL_L2CAP_CFG_INFO;
    141 
    142 
    143 /* State Machine Events */
    144 enum
    145 {
    146     /* these events are handled by the state machine */
    147     BTA_HL_CCH_OPEN_EVT     = BTA_SYS_EVT_START(BTA_ID_HL),
    148     BTA_HL_CCH_SDP_OK_EVT,
    149     BTA_HL_CCH_SDP_FAIL_EVT,
    150     BTA_HL_MCA_CONNECT_IND_EVT,
    151     BTA_HL_MCA_DISCONNECT_IND_EVT,
    152     BTA_HL_CCH_CLOSE_EVT,
    153     BTA_HL_CCH_CLOSE_CMPL_EVT,
    154     BTA_HL_MCA_RSP_TOUT_IND_EVT,
    155     /* DCH EVENT */
    156     BTA_HL_DCH_SDP_INIT_EVT,
    157     BTA_HL_DCH_OPEN_EVT,
    158     BTA_HL_MCA_CREATE_IND_EVT,
    159     BTA_HL_MCA_CREATE_CFM_EVT,
    160     BTA_HL_MCA_OPEN_IND_EVT,
    161 
    162     BTA_HL_MCA_OPEN_CFM_EVT,
    163     BTA_HL_DCH_CLOSE_EVT,
    164     BTA_HL_MCA_CLOSE_IND_EVT,
    165     BTA_HL_MCA_CLOSE_CFM_EVT,
    166     BTA_HL_API_SEND_DATA_EVT,
    167 
    168     BTA_HL_MCA_RCV_DATA_EVT,
    169     BTA_HL_DCH_CLOSE_CMPL_EVT,
    170     BTA_HL_DCH_RECONNECT_EVT,
    171     BTA_HL_DCH_SDP_FAIL_EVT,
    172     BTA_HL_MCA_RECONNECT_IND_EVT,
    173 
    174     BTA_HL_MCA_RECONNECT_CFM_EVT,
    175     BTA_HL_DCH_CLOSE_ECHO_TEST_EVT,
    176     BTA_HL_API_DCH_CREATE_RSP_EVT,
    177     BTA_HL_DCH_ABORT_EVT,
    178     BTA_HL_MCA_ABORT_IND_EVT,
    179 
    180     BTA_HL_MCA_ABORT_CFM_EVT,
    181     BTA_HL_MCA_CONG_CHG_EVT,
    182     BTA_HL_CI_GET_TX_DATA_EVT,
    183     BTA_HL_CI_PUT_RX_DATA_EVT,
    184     BTA_HL_CI_GET_ECHO_DATA_EVT,
    185     BTA_HL_DCH_ECHO_TEST_EVT,
    186     BTA_HL_CI_PUT_ECHO_DATA_EVT,
    187 
    188     /* these events are handled outside the state machine */
    189     BTA_HL_API_ENABLE_EVT,
    190     BTA_HL_API_DISABLE_EVT,
    191     BTA_HL_API_UPDATE_EVT,
    192     BTA_HL_API_REGISTER_EVT,
    193     BTA_HL_API_DEREGISTER_EVT,
    194     BTA_HL_API_CCH_OPEN_EVT,
    195     BTA_HL_API_CCH_CLOSE_EVT,
    196     BTA_HL_API_DCH_OPEN_EVT,
    197     BTA_HL_API_DCH_RECONNECT_EVT,
    198     BTA_HL_API_DCH_CLOSE_EVT,
    199     BTA_HL_API_DELETE_MDL_EVT,
    200     BTA_HL_API_DCH_ABORT_EVT,
    201 
    202     BTA_HL_API_DCH_ECHO_TEST_EVT,
    203     BTA_HL_API_SDP_QUERY_EVT,
    204     BTA_HL_SDP_QUERY_OK_EVT,
    205     BTA_HL_SDP_QUERY_FAIL_EVT,
    206     BTA_HL_MCA_DELETE_IND_EVT,
    207     BTA_HL_MCA_DELETE_CFM_EVT
    208 };
    209 typedef UINT16 tBTA_HL_INT_EVT;
    210 
    211 #define BTA_HL_DCH_EVT_MIN BTA_HL_DCH_SDP_INIT_EVT
    212 #define BTA_HL_DCH_EVT_MAX 0xFFFF
    213 
    214 
    215 /* state machine states */
    216 enum
    217 {
    218     BTA_HL_CCH_IDLE_ST = 0,      /* Idle  */
    219     BTA_HL_CCH_OPENING_ST,       /* Opening a connection*/
    220     BTA_HL_CCH_OPEN_ST,          /* Connection is open */
    221     BTA_HL_CCH_CLOSING_ST        /* Closing is in progress */
    222 };
    223 typedef UINT8 tBTA_HL_CCH_STATE;
    224 
    225 enum
    226 {
    227     BTA_HL_DCH_IDLE_ST = 0,      /* Idle  */
    228     BTA_HL_DCH_OPENING_ST,       /* Opening a connection*/
    229     BTA_HL_DCH_OPEN_ST,          /* Connection is open */
    230     BTA_HL_DCH_CLOSING_ST        /* Closing is in progress */
    231 };
    232 typedef UINT8 tBTA_HL_DCH_STATE;
    233 
    234 
    235 typedef struct
    236 {
    237     BT_HDR              hdr;
    238     tBTA_HL_CTRL_CBACK  *p_cback;        /* pointer to control callback function */
    239 } tBTA_HL_API_ENABLE;
    240 
    241 typedef struct
    242 {
    243     BT_HDR              hdr;
    244     UINT8               app_id;
    245     BOOLEAN             is_register;        /* Update HL application due to register or deregister */
    246     tBTA_HL_CBACK       *p_cback;           /* pointer to application callback function */
    247     tBTA_HL_DEVICE_TYPE dev_type;           /* sink, source or dual roles */
    248     tBTA_SEC            sec_mask;           /* security mask for accepting conenction*/
    249     char                srv_name[BTA_SERVICE_NAME_LEN +1];        /* service name to be used in the SDP; null terminated*/
    250     char                srv_desp[BTA_SERVICE_DESP_LEN +1];        /* service description to be used in the SDP; null terminated */
    251     char                provider_name[BTA_PROVIDER_NAME_LEN +1];   /* provide name to be used in the SDP; null terminated */
    252 
    253 } tBTA_HL_API_UPDATE;
    254 
    255 typedef struct
    256 {
    257     BT_HDR              hdr;
    258     UINT8               app_id;
    259     tBTA_HL_CBACK       *p_cback;        /* pointer to application callback function */
    260     tBTA_HL_DEVICE_TYPE dev_type;           /* sink, source or dual roles */
    261     tBTA_SEC            sec_mask;           /* security mask for accepting conenction*/
    262     char                srv_name[BTA_SERVICE_NAME_LEN +1];        /* service name to be used in the SDP; null terminated*/
    263     char                srv_desp[BTA_SERVICE_DESP_LEN +1];        /* service description to be used in the SDP; null terminated */
    264     char                provider_name[BTA_PROVIDER_NAME_LEN +1];   /* provide name to be used in the SDP; null terminated */
    265 } tBTA_HL_API_REGISTER;
    266 
    267 typedef struct
    268 {
    269     BT_HDR                  hdr;
    270     UINT8                   app_id;
    271     tBTA_HL_CBACK           *p_cback;        /* pointer to application callback function */
    272     tBTA_HL_APP_HANDLE      app_handle;
    273 } tBTA_HL_API_DEREGISTER;
    274 
    275 typedef struct
    276 {
    277     BT_HDR                  hdr;
    278     UINT8                   app_id;
    279     tBTA_HL_APP_HANDLE      app_handle;
    280     UINT16                  ctrl_psm;
    281     BD_ADDR                 bd_addr;        /* Address of peer device */
    282     tBTA_SEC                sec_mask;       /* security mask for initiating connection*/
    283 } tBTA_HL_API_CCH_OPEN;
    284 
    285 
    286 typedef struct
    287 {
    288     BT_HDR                  hdr;
    289     tBTA_HL_MCL_HANDLE      mcl_handle;
    290 } tBTA_HL_API_CCH_CLOSE;
    291 
    292 
    293 
    294 typedef struct
    295 {
    296     BT_HDR                  hdr;
    297     tBTA_HL_MCL_HANDLE      mcl_handle;
    298     UINT16                  ctrl_psm;
    299     tBTA_HL_MDEP_ID         local_mdep_id;     /* local MDEP ID */
    300     tBTA_HL_MDEP_ID         peer_mdep_id;      /* peer mdep id */
    301     tBTA_HL_DCH_CFG         local_cfg;
    302     tBTA_SEC                sec_mask;          /* security mask for initiating connection*/
    303 } tBTA_HL_API_DCH_OPEN;
    304 
    305 
    306 typedef struct
    307 {
    308     BT_HDR                  hdr;
    309 
    310     tBTA_HL_MCL_HANDLE      mcl_handle;
    311     UINT16                  ctrl_psm;
    312     tBTA_HL_MDL_ID          mdl_id;
    313 } tBTA_HL_API_DCH_RECONNECT;
    314 
    315 typedef struct
    316 {
    317     BT_HDR                  hdr;
    318     tBTA_HL_MDL_HANDLE      mdl_handle;
    319 } tBTA_HL_API_DCH_CLOSE;
    320 
    321 typedef struct
    322 {
    323     BT_HDR                  hdr;
    324     tBTA_HL_MCL_HANDLE      mcl_handle;
    325     tBTA_HL_MDL_ID          mdl_id;
    326 } tBTA_HL_API_DELETE_MDL;
    327 
    328 typedef struct
    329 {
    330     BT_HDR              hdr;
    331     tBTA_HL_MCL_HANDLE mcl_handle;
    332 } tBTA_HL_API_DCH_ABORT;
    333 
    334 
    335 typedef struct
    336 {
    337     BT_HDR              hdr;
    338     tBTA_HL_MDL_HANDLE  mdl_handle;
    339     UINT16              pkt_size;
    340 } tBTA_HL_API_SEND_DATA;
    341 
    342 typedef struct
    343 {
    344     BT_HDR              hdr;
    345     tBTA_HL_MCL_HANDLE  mcl_handle;
    346     UINT16              ctrl_psm;
    347     UINT16              pkt_size;
    348     tBTA_HL_DCH_CFG     local_cfg;
    349 } tBTA_HL_API_DCH_ECHO_TEST;
    350 
    351 typedef struct
    352 {
    353     BT_HDR                  hdr;
    354     UINT8                   app_idx;
    355     UINT8                   mcl_idx;
    356     BOOLEAN                 release_mcl_cb;
    357 }tBTA_HL_CCH_SDP;
    358 
    359 
    360 /* MCA callback event parameters. */
    361 typedef struct
    362 {
    363     BT_HDR              hdr;
    364     tBTA_HL_APP_HANDLE  app_handle;
    365     tBTA_HL_MCL_HANDLE  mcl_handle;
    366     tMCA_CTRL       mca_data;
    367 } tBTA_HL_MCA_EVT;
    368 
    369 
    370 /* MCA callback event parameters. */
    371 typedef struct
    372 {
    373     BT_HDR          hdr;
    374     UINT8           app_idx;
    375     UINT8           mcl_idx;
    376     UINT8           mdl_idx;
    377     BT_HDR          *p_pkt;
    378 } tBTA_HL_MCA_RCV_DATA_EVT;
    379 
    380 
    381 typedef struct
    382 {
    383     BT_HDR                  hdr;
    384     UINT8                   app_idx;
    385     UINT8                   mcl_idx;
    386     UINT8                   mdl_idx;
    387 }tBTA_HL_DCH_SDP;
    388 
    389 typedef struct
    390 {
    391     BT_HDR                  hdr;
    392     tBTA_HL_APP_HANDLE      app_handle;
    393     UINT8                   app_id;
    394     BD_ADDR                 bd_addr;        /* Address of peer device */
    395 } tBTA_HL_API_SDP_QUERY;
    396 
    397 typedef struct
    398 {
    399     BT_HDR                  hdr;
    400     tBTA_HL_MCL_HANDLE      mcl_handle;
    401     tBTA_HL_MDL_ID          mdl_id;
    402     tBTA_HL_MDEP_ID         local_mdep_id;
    403     tBTA_HL_DCH_CREATE_RSP  rsp_code;
    404     tBTA_HL_DCH_CFG         cfg_rsp;
    405 } tBTA_HL_API_DCH_CREATE_RSP;
    406 
    407 typedef struct
    408 {
    409     BT_HDR                  hdr;
    410     tBTA_HL_MDL_HANDLE      mdl_handle;
    411     tBTA_HL_STATUS          status;
    412 } tBTA_HL_CI_GET_PUT_DATA;
    413 
    414 typedef struct
    415 {
    416     BT_HDR                  hdr;
    417     tBTA_HL_MCL_HANDLE      mcl_handle;
    418     tBTA_HL_STATUS          status;
    419 } tBTA_HL_CI_ECHO_DATA;
    420 
    421 /* union of all state machine event data types */
    422 typedef union
    423 {
    424     BT_HDR                      hdr;
    425     tBTA_HL_API_ENABLE          api_enable; /* data for BTA_MSE_API_ENABLE_EVT */
    426     tBTA_HL_API_UPDATE          api_update;
    427     tBTA_HL_API_REGISTER        api_reg;
    428     tBTA_HL_API_DEREGISTER      api_dereg;
    429     tBTA_HL_API_CCH_OPEN        api_cch_open;
    430     tBTA_HL_API_CCH_CLOSE       api_cch_close;
    431     tBTA_HL_API_DCH_CREATE_RSP  api_dch_create_rsp;
    432     tBTA_HL_API_DCH_OPEN        api_dch_open;
    433     tBTA_HL_API_DCH_RECONNECT   api_dch_reconnect;
    434     tBTA_HL_API_DCH_CLOSE       api_dch_close;
    435     tBTA_HL_API_DELETE_MDL      api_delete_mdl;
    436     tBTA_HL_API_DCH_ABORT       api_dch_abort;
    437     tBTA_HL_API_SEND_DATA       api_send_data;
    438     tBTA_HL_API_DCH_ECHO_TEST   api_dch_echo_test;
    439     tBTA_HL_API_SDP_QUERY       api_sdp_query;
    440 
    441     tBTA_HL_CCH_SDP             cch_sdp;
    442     tBTA_HL_MCA_EVT             mca_evt;
    443     tBTA_HL_MCA_RCV_DATA_EVT    mca_rcv_data_evt;
    444     tBTA_HL_DCH_SDP             dch_sdp; /* for DCH_OPEN_EVT and DCH_RECONNECT_EVT */
    445     tBTA_HL_CI_GET_PUT_DATA     ci_get_put_data;
    446     tBTA_HL_CI_ECHO_DATA        ci_get_put_echo_data;
    447 } tBTA_HL_DATA;
    448 
    449 
    450 typedef struct
    451 {
    452     BOOLEAN                 in_use;
    453     UINT16                  mdl_id;
    454     tBTA_HL_MDL_HANDLE      mdl_handle;
    455     tBTA_HL_DCH_OPER        dch_oper;
    456     BOOLEAN                 intentional_close;
    457     tBTA_HL_DCH_STATE       dch_state;
    458     UINT8                   abort_oper;
    459     UINT16                  req_data_psm;
    460     UINT16                  max_rx_apdu_size;
    461     UINT16                  max_tx_apdu_size;
    462     BT_HDR                  *p_tx_pkt;
    463     BT_HDR                  *p_rx_pkt;
    464     tBTA_HL_MDEP_ID         local_mdep_id;
    465     UINT8                   local_mdep_cfg_idx;
    466     tBTA_HL_DCH_CFG         local_cfg;
    467     tBTA_HL_DCH_CFG         remote_cfg;
    468     tBTA_HL_MDEP_ID         peer_mdep_id;
    469     UINT16  peer_data_type;
    470     tBTA_HL_MDEP_ROLE       peer_mdep_role;
    471     tBTA_HL_DCH_MODE        dch_mode;
    472     tBTA_SEC                sec_mask;
    473     BOOLEAN                 is_the_first_reliable;
    474     BOOLEAN                 delete_mdl;
    475     UINT16                  mtu;
    476     tMCA_CHNL_CFG           chnl_cfg;
    477     BOOLEAN                 mdl_cfg_idx_included;
    478     UINT8                   mdl_cfg_idx;
    479     UINT8                   echo_oper;
    480     BOOLEAN                 cong;
    481     BOOLEAN                 close_pending;
    482     UINT8                   cout_oper;
    483     BT_HDR                  *p_echo_tx_pkt;
    484     BT_HDR                  *p_echo_rx_pkt;
    485     tBTA_HL_STATUS          ci_put_echo_data_status;
    486 }tBTA_HL_MDL_CB;
    487 
    488 typedef struct
    489 {
    490     tBTA_HL_MDL_CB          mdl[BTA_HL_NUM_MDLS_PER_MCL];
    491     tBTA_HL_DELETE_MDL      delete_mdl;
    492     BOOLEAN                 in_use;
    493     tBTA_HL_CCH_STATE       cch_state;
    494     UINT16                  req_ctrl_psm;
    495     UINT16                  ctrl_psm;
    496     UINT16                  data_psm;
    497     BD_ADDR                 bd_addr;
    498     UINT16                  cch_mtu;
    499     UINT16                  sec_mask;
    500     tBTA_HL_MCL_HANDLE      mcl_handle;
    501     tSDP_DISCOVERY_DB       *p_db;         /* pointer to discovery database */
    502     tSDP_DISC_CMPL_CB       *sdp_cback;
    503     tBTA_HL_SDP_OPER        sdp_oper;
    504     BOOLEAN                 close_pending;
    505     UINT8                   sdp_mdl_idx;
    506     tBTA_HL_SDP             sdp;
    507     UINT8                   cch_oper;
    508     UINT8                   force_close_local_cch_opening;
    509     BOOLEAN                 intentional_close;
    510     BOOLEAN                 rsp_tout;
    511     UINT8                   timer_oper;
    512     BOOLEAN                 echo_test;
    513     UINT8                   echo_mdl_idx;
    514     UINT8                   cch_close_dch_oper;
    515     UINT8                   app_id;
    516 }tBTA_HL_MCL_CB;
    517 
    518 typedef struct
    519 {
    520     tBTA_HL_MCL_CB       mcb[BTA_HL_NUM_MCLS]; /* application Control Blocks */
    521     tBTA_HL_CBACK        *p_cback;            /* pointer to control callback function */
    522     BOOLEAN              in_use;              /* this CB is in use*/
    523     BOOLEAN              deregistering;
    524     UINT8                app_id;
    525     UINT32               sdp_handle;    /* SDP record handle */
    526     tBTA_HL_SUP_FEATURE  sup_feature;
    527     tBTA_HL_MDL_CFG      mdl_cfg[BTA_HL_NUM_MDL_CFGS];
    528     tBTA_HL_DEVICE_TYPE  dev_type;
    529     tBTA_HL_APP_HANDLE   app_handle;
    530     UINT16               ctrl_psm;   /* L2CAP PSM for the MCAP control channel */
    531     UINT16               data_psm;   /* L2CAP PSM for the MCAP data channel */
    532     UINT16               sec_mask;   /* Security mask for BTM_SetSecurityLevel() */
    533 
    534     char                 srv_name[BTA_SERVICE_NAME_LEN +1];        /* service name to be used in the SDP; null terminated*/
    535     char                 srv_desp[BTA_SERVICE_DESP_LEN +1];        /* service description to be used in the SDP; null terminated */
    536     char                 provider_name[BTA_PROVIDER_NAME_LEN +1];   /* provide name to be used in the SDP; null terminated */
    537 
    538     tMCA_CTRL_CBACK      *p_mcap_cback;            /* pointer to MCAP callback function */
    539     tMCA_DATA_CBACK      *p_data_cback;
    540 }tBTA_HL_APP_CB;
    541 
    542 
    543 typedef struct
    544 {
    545     BOOLEAN             in_use;
    546     tBTA_HL_SDP_OPER    sdp_oper;
    547     UINT8               app_idx;
    548     UINT8               mcl_idx;
    549     UINT8               mdl_idx;
    550 }tBTA_HL_SDP_CB;
    551 
    552 typedef struct
    553 {
    554     BOOLEAN         in_use;
    555     UINT8           app_idx;
    556     UINT8           mcl_idx;
    557 }tBTA_HL_TIMER_CB;
    558 
    559 typedef struct
    560 {
    561     tBTA_HL_APP_CB        acb[BTA_HL_NUM_APPS];      /* HL Control Blocks */
    562     tBTA_HL_CTRL_CBACK    *p_ctrl_cback;            /* pointer to control callback function */
    563     BOOLEAN               enable;
    564     BOOLEAN               disabling;
    565 
    566     tBTA_HL_SDP_CB        scb[BTA_HL_NUM_SDP_CBACKS];
    567     tBTA_HL_TIMER_CB      tcb[BTA_HL_NUM_TIMERS];
    568     BOOLEAN               enable_random_psm;
    569     tBTA_HL_ALLOCATE_PSM  *p_alloc_psm;
    570 }tBTA_HL_CB;
    571 
    572 /******************************************************************************
    573 **  Configuration Definitions
    574 *******************************************************************************/
    575 /* Configuration structure */
    576 
    577 /*****************************************************************************
    578 **  Global data
    579 *****************************************************************************/
    580 
    581 /* HL control block */
    582 #if BTA_DYNAMIC_MEMORY == FALSE
    583 extern tBTA_HL_CB  bta_hl_cb;
    584 #else
    585 extern tBTA_HL_CB *bta_hl_cb_ptr;
    586     #define bta_hl_cb (*bta_hl_cb_ptr)
    587 #endif
    588 
    589 #define BTA_HL_GET_CB_PTR() &(bta_hl_cb)
    590 #define BTA_HL_GET_APP_CB_PTR(app_idx) &(bta_hl_cb.acb[(app_idx)])
    591 #define BTA_HL_GET_MCL_CB_PTR(app_idx, mcl_idx) &(bta_hl_cb.acb[(app_idx)].mcb[(mcl_idx)])
    592 #define BTA_HL_GET_MDL_CB_PTR(app_idx, mcl_idx, mdl_idx) &(bta_hl_cb.acb[(app_idx)].mcb[(mcl_idx)].mdl[mdl_idx])
    593 #define BTA_HL_GET_MDL_CFG_PTR(app_idx, item_idx) &(bta_hl_cb.acb[(app_idx)].mdl_cfg[(item_idx)])
    594 #define BTA_HL_GET_ECHO_CFG_PTR(app_idx)  &(bta_hl_cb.acb[(app_idx)].sup_feature.echo_cfg)
    595 #define BTA_HL_GET_MDEP_CFG_PTR(app_idx, mdep_cfg_idx)  &(bta_hl_cb.acb[(app_idx)].sup_feature.mdep[mdep_cfg_idx].mdep_cfg)
    596 #define BTA_HL_GET_DATA_CFG_PTR(app_idx, mdep_cfg_idx, data_cfg_idx)  \
    597            &(bta_hl_cb.acb[(app_idx)].sup_feature.mdep[mdep_cfg_idx].mdep_cfg.data_cfg[data_cfg_idx])
    598 #define BTA_HL_GET_BUF_PTR(p_pkt) ((UINT8 *)((UINT8 *) (p_pkt+1) + p_pkt->offset))
    599 
    600 /*****************************************************************************
    601 **  Function prototypes
    602 *****************************************************************************/
    603 
    604 #ifdef __cplusplus
    605 extern "C"
    606 {
    607 #endif
    608     /* main */
    609     extern BOOLEAN bta_hl_hdl_event(BT_HDR *p_msg);
    610     /* sdp */
    611     extern BOOLEAN bta_hl_fill_sup_feature_list( const tSDP_DISC_ATTR  *p_attr,
    612                                                  tBTA_HL_SUP_FEATURE_LIST_ELEM *p_list);
    613     extern tBTA_HL_STATUS bta_hl_sdp_update (UINT8 app_id);
    614     extern tBTA_HL_STATUS bta_hl_sdp_register (UINT8 app_idx);
    615     extern tSDP_DISC_REC *bta_hl_find_sink_or_src_srv_class_in_db (const tSDP_DISCOVERY_DB *p_db,
    616                                                                    const tSDP_DISC_REC *p_start_rec);
    617 
    618     /* action routines */
    619     extern void bta_hl_dch_ci_get_tx_data(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    620                                           tBTA_HL_DATA *p_data);
    621     extern void bta_hl_dch_ci_put_rx_data(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    622                                           tBTA_HL_DATA *p_data);
    623     extern void bta_hl_dch_ci_get_echo_data(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    624                                             tBTA_HL_DATA *p_data);
    625 
    626     extern void bta_hl_dch_echo_test(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    627                                      tBTA_HL_DATA *p_data);
    628     extern void bta_hl_dch_ci_put_echo_data(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    629                                             tBTA_HL_DATA *p_data);
    630     extern void bta_hl_dch_send_data(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    631                                      tBTA_HL_DATA *p_data);
    632     extern void bta_hl_dch_sdp_fail(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    633                                     tBTA_HL_DATA *p_data);
    634     extern void bta_hl_dch_mca_cong_change(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    635                                            tBTA_HL_DATA *p_data);
    636     extern void bta_hl_dch_mca_reconnect_ind(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    637                                              tBTA_HL_DATA *p_data);
    638     extern void bta_hl_dch_mca_reconnect_cfm(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    639                                              tBTA_HL_DATA *p_data);
    640     extern void bta_hl_dch_mca_reconnect(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    641                                          tBTA_HL_DATA *p_data);
    642     extern void bta_hl_dch_sdp_init(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    643                                     tBTA_HL_DATA *p_data);
    644     extern void bta_hl_dch_close_echo_test(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    645                                            tBTA_HL_DATA *p_data);
    646     extern void bta_hl_dch_create_rsp(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    647                                       tBTA_HL_DATA *p_data);
    648     extern void bta_hl_dch_mca_rcv_data(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    649                                         tBTA_HL_DATA *p_data);
    650     extern void bta_hl_dch_close_cmpl(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    651                                       tBTA_HL_DATA *p_data);
    652     extern void bta_hl_dch_mca_close_cfm(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    653                                          tBTA_HL_DATA *p_data);
    654     extern void bta_hl_dch_mca_close_ind(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    655                                          tBTA_HL_DATA *p_data);
    656     extern void bta_hl_dch_mca_close(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    657                                      tBTA_HL_DATA *p_data);
    658     extern void bta_hl_dch_mca_delete_ind(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    659                                           tBTA_HL_DATA *p_data);
    660 
    661     extern void bta_hl_dch_mca_delete_cfm(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    662                                           tBTA_HL_DATA *p_data);
    663     extern void bta_hl_dch_mca_delete(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    664                                       tBTA_HL_DATA *p_data);
    665     extern void bta_hl_dch_mca_abort_ind(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    666                                          tBTA_HL_DATA *p_data);
    667     extern void bta_hl_dch_mca_abort_cfm(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    668                                          tBTA_HL_DATA *p_data);
    669     extern void bta_hl_dch_mca_abort(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    670                                      tBTA_HL_DATA *p_data);
    671     extern void bta_hl_dch_mca_open_ind(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    672                                         tBTA_HL_DATA *p_data);
    673     extern void bta_hl_dch_mca_open_cfm(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    674                                         tBTA_HL_DATA *p_data);
    675     extern void bta_hl_dch_mca_create_ind(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    676                                           tBTA_HL_DATA *p_data);
    677     extern void bta_hl_dch_mca_create_cfm(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    678                                           tBTA_HL_DATA *p_data);
    679     extern void bta_hl_dch_mca_create(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    680                                       tBTA_HL_DATA *p_data);
    681     extern void bta_hl_deallocate_spd_cback(UINT8 sdp_cback_idx);
    682     extern tSDP_DISC_CMPL_CB *bta_hl_allocate_spd_cback(tBTA_HL_SDP_OPER sdp_oper, UINT8 app_idx, UINT8 mcl_idx,
    683                                                         UINT8 mdl_idx,
    684                                                         UINT8 *p_sdp_cback_idx);
    685     extern tBTA_HL_STATUS bta_hl_init_sdp(tBTA_HL_SDP_OPER sdp_oper, UINT8 app_idx, UINT8 mcl_idx,
    686                                           UINT8 mdl_idx);
    687     extern void bta_hl_cch_sdp_init(UINT8 app_idx, UINT8 mcl_idx,  tBTA_HL_DATA *p_data);
    688     extern void bta_hl_cch_mca_open(UINT8 app_idx, UINT8 mcl_idx,  tBTA_HL_DATA *p_data);
    689     extern void bta_hl_cch_mca_close(UINT8 app_idx, UINT8 mcl_idx,  tBTA_HL_DATA *p_data);
    690     extern void bta_hl_cch_close_cmpl(UINT8 app_idx, UINT8 mcl_idx,  tBTA_HL_DATA *p_data);
    691     extern void bta_hl_cch_mca_disconnect(UINT8 app_idx, UINT8 mcl_idx,  tBTA_HL_DATA *p_data);
    692     extern void bta_hl_cch_mca_disc_open(UINT8 app_idx, UINT8 mcl_idx,  tBTA_HL_DATA *p_data);
    693     extern void bta_hl_cch_mca_rsp_tout(UINT8 app_idx, UINT8 mcl_idx,  tBTA_HL_DATA *p_data);
    694     extern void bta_hl_cch_mca_connect(UINT8 app_idx, UINT8 mcl_idx,  tBTA_HL_DATA *p_data);
    695 
    696     /* State machine drivers  */
    697     extern void bta_hl_cch_sm_execute(UINT8 inst_idx, UINT8 mcl_idx,
    698                                       UINT16 event, tBTA_HL_DATA *p_data);
    699     extern void bta_hl_dch_sm_execute(UINT8 inst_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    700                                       UINT16 event, tBTA_HL_DATA *p_data);
    701     /* MCAP callback functions  */
    702     extern void bta_hl_mcap_ctrl_cback(tMCA_HANDLE handle, tMCA_CL mcl, UINT8 event,
    703                                        tMCA_CTRL *p_data);
    704 
    705     extern void bta_hl_mcap_data_cback(tMCA_DL mdl, BT_HDR *p_pkt);
    706 
    707     /* utility functions  */
    708     extern BOOLEAN bta_hl_set_ctrl_psm_for_dch(UINT8 app_idx, UINT8 mcl_idx,
    709                                                UINT8 mdl_idx, UINT16 ctrl_psm);
    710     extern BOOLEAN bta_hl_find_sdp_idx_using_ctrl_psm(tBTA_HL_SDP *p_sdp,
    711                                                       UINT16 ctrl_psm,
    712                                                       UINT8 *p_sdp_idx);
    713     extern UINT8 bta_hl_set_user_tx_pool_id(UINT16 max_tx_size);
    714     extern UINT8 bta_hl_set_user_rx_pool_id(UINT16 mtu);
    715     extern UINT8 bta_hl_set_tx_win_size(UINT16 mtu, UINT16 mps);
    716     extern UINT16 bta_hl_set_mps(UINT16 mtu);
    717     extern void bta_hl_clean_mdl_cb(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx);
    718     extern BT_HDR * bta_hl_get_buf(UINT16 data_size);
    719     extern BOOLEAN bta_hl_find_service_in_db( UINT8 app_idx, UINT8 mcl_idx,
    720                                               UINT16 service_uuid,
    721                                               tSDP_DISC_REC **pp_rec );
    722     extern UINT16 bta_hl_get_service_uuids(UINT8 sdp_oper, UINT8 app_idx, UINT8 mcl_idx,
    723                                            UINT8 mdl_idx );
    724     extern BOOLEAN bta_hl_find_echo_cfg_rsp(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdep_idx, UINT8 cfg,
    725                                             UINT8 *p_cfg_rsp);
    726     extern BOOLEAN bta_hl_validate_cfg(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    727                                        UINT8 cfg);
    728     extern BOOLEAN bta_hl_find_cch_cb_indexes(tBTA_HL_DATA *p_msg,
    729                                               UINT8 *p_app_idx,
    730                                               UINT8  *p_mcl_idx);
    731     extern BOOLEAN bta_hl_find_dch_cb_indexes(tBTA_HL_DATA *p_msg,
    732                                               UINT8 *p_app_idx,
    733                                               UINT8 *p_mcl_idx,
    734                                               UINT8 *p_mdl_idx);
    735     extern UINT16  bta_hl_allocate_mdl_id(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx );
    736     extern BOOLEAN bta_hl_find_mdl_idx_using_handle(tBTA_HL_MDL_HANDLE mdl_handle,
    737                                                     UINT8 *p_app_idx, UINT8 *p_mcl_idx,
    738                                                     UINT8 *p_mdl_idx);
    739     extern BOOLEAN bta_hl_find_mdl_idx(UINT8 app_idx, UINT8 mcl_idx, UINT16 mdl_id,
    740                                        UINT8 *p_mdl_idx);
    741     extern BOOLEAN bta_hl_find_an_active_mdl_idx(UINT8 app_idx, UINT8 mcl_idx,
    742                                                  UINT8 *p_mdl_idx);
    743     extern BOOLEAN bta_hl_find_dch_setup_mdl_idx(UINT8 app_idx, UINT8 mcl_idx,
    744                                                  UINT8 *p_mdl_idx);
    745     extern BOOLEAN bta_hl_find_an_in_use_mcl_idx(UINT8 app_idx,
    746                                                  UINT8 *p_mcl_idx);
    747     extern BOOLEAN bta_hl_find_an_in_use_app_idx(UINT8 *p_app_idx);
    748     extern BOOLEAN bta_hl_find_app_idx(UINT8 app_id, UINT8 *p_app_idx);
    749     extern BOOLEAN bta_hl_find_app_idx_using_handle(tBTA_HL_APP_HANDLE app_handle,
    750                                                     UINT8 *p_app_idx);
    751     extern BOOLEAN bta_hl_find_mcl_idx_using_handle( tBTA_HL_MCL_HANDLE mcl_handle,
    752                                                      UINT8 *p_app_idx, UINT8 *p_mcl_idx);
    753     extern BOOLEAN bta_hl_find_mcl_idx(UINT8 app_idx, BD_ADDR p_bd_addr, UINT8 *p_mcl_idx);
    754     extern BOOLEAN bta_hl_is_the_first_reliable_existed(UINT8 app_idx, UINT8 mcl_idx );
    755     extern BOOLEAN  bta_hl_find_non_active_mdl_cfg(UINT8 app_idx, UINT8 start_mdl_cfg_idx,
    756                                                    UINT8 *p_mdl_cfg_idx);
    757     extern BOOLEAN  bta_hl_find_avail_mdl_cfg_idx(UINT8 app_idx, UINT8 mcl_idx,
    758                                                   UINT8 *p_mdl_cfg_idx);
    759     extern BOOLEAN  bta_hl_find_mdl_cfg_idx(UINT8 app_idx, UINT8 mcl_idx,
    760                                             tBTA_HL_MDL_ID mdl_id, UINT8 *p_mdl_cfg_idx);
    761     extern BOOLEAN  bta_hl_get_cur_time(UINT8 app_idx, UINT8 *p_cur_time);
    762     extern void bta_hl_sort_cfg_time_idx(UINT8 app_idx, UINT8 *a, UINT8 n);
    763     extern void  bta_hl_compact_mdl_cfg_time(UINT8 app_idx, UINT8 mdep_id);
    764     extern BOOLEAN  bta_hl_is_mdl_exsit_in_mcl(UINT8 app_idx, BD_ADDR bd_addr,
    765                                                tBTA_HL_MDL_ID mdl_id);
    766     extern BOOLEAN  bta_hl_delete_mdl_cfg(UINT8 app_idx, BD_ADDR bd_addr,
    767                                           tBTA_HL_MDL_ID mdl_id);
    768     extern BOOLEAN  bta_hl_is_mdl_value_valid(tBTA_HL_MDL_ID mdl_id);
    769     extern BOOLEAN bta_hl_find_mdep_cfg_idx(UINT8 app_idx,
    770                                             tBTA_HL_MDEP_ID local_mdep_id, UINT8 *p_mdep_cfg_idx);
    771     extern void bta_hl_find_rxtx_apdu_size(UINT8 app_idx, UINT8 mdep_cfg_idx,
    772                                            UINT16 *p_rx_apu_size,
    773                                            UINT16 *p_tx_apu_size);
    774     extern BOOLEAN bta_hl_validate_peer_cfg(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx,
    775                                             tBTA_HL_MDEP_ID peer_mdep_id,
    776                                             tBTA_HL_MDEP_ROLE peer_mdep_role,
    777                                             UINT8 sdp_idx);
    778     extern tBTA_HL_STATUS bta_hl_chk_local_cfg(UINT8 app_idx, UINT8 mcl_idx,
    779                                                UINT8 mdep_cfg_idx,
    780                                                tBTA_HL_DCH_CFG local_cfg);
    781 
    782     extern BOOLEAN bta_hl_validate_reconnect_params(UINT8 app_idx, UINT8 mcl_idx,
    783                                                     tBTA_HL_API_DCH_RECONNECT *p_reconnect,
    784                                                     UINT8 *p_mdep_cfg_idx, UINT8 *p_mdl_cfg_idx);
    785     extern BOOLEAN bta_hl_find_avail_mcl_idx(UINT8 app_idx, UINT8 *p_mcl_idx);
    786     extern BOOLEAN bta_hl_find_avail_mdl_idx(UINT8 app_idx, UINT8 mcl_idx,
    787                                              UINT8 *p_mdl_idx);
    788     extern BOOLEAN bta_hl_is_a_duplicate_id(UINT8 app_id);
    789     extern BOOLEAN bta_hl_find_avail_app_idx(UINT8 *p_idx);
    790     extern tBTA_HL_STATUS bta_hl_app_update(UINT8 app_id, BOOLEAN is_register);
    791     extern tBTA_HL_STATUS bta_hl_app_registration(UINT8 app_idx);
    792     extern void bta_hl_discard_data(UINT16 event, tBTA_HL_DATA *p_data);
    793     extern void bta_hl_save_mdl_cfg(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx );
    794     extern void bta_hl_set_dch_chan_cfg(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx, tBTA_HL_DATA *p_data);
    795     extern BOOLEAN bta_hl_get_l2cap_cfg(tBTA_HL_MDL_HANDLE mdl_hnd, tBTA_HL_L2CAP_CFG_INFO *p_cfg);
    796     extern BOOLEAN bta_hl_validate_chan_cfg(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx);
    797     extern BOOLEAN bta_hl_is_cong_on(UINT8 app_id, BD_ADDR bd_addr, tBTA_HL_MDL_ID mdl_id);
    798     extern void bta_hl_check_cch_close(UINT8 app_idx, UINT8 mcl_idx,
    799                                        tBTA_HL_DATA *p_data, BOOLEAN check_dch_setup);
    800     extern void bta_hl_clean_app(UINT8 app_idx);
    801     extern void bta_hl_check_deregistration(UINT8 app_idx, tBTA_HL_DATA *p_data );
    802     extern void bta_hl_check_disable(tBTA_HL_DATA *p_data );
    803     extern void  bta_hl_build_abort_ind(tBTA_HL *p_evt_data,
    804                                         tBTA_HL_APP_HANDLE app_handle,
    805                                         tBTA_HL_MCL_HANDLE mcl_handle);
    806     extern void  bta_hl_build_abort_cfm(tBTA_HL *p_evt_data,
    807                                         tBTA_HL_APP_HANDLE app_handle,
    808                                         tBTA_HL_MCL_HANDLE mcl_handle,
    809                                         tBTA_HL_STATUS status);
    810     extern void  bta_hl_build_dch_close_cfm(tBTA_HL *p_evt_data,
    811                                             tBTA_HL_APP_HANDLE app_handle,
    812                                             tBTA_HL_MCL_HANDLE mcl_handle,
    813                                             tBTA_HL_MDL_HANDLE mdl_handle,
    814                                             tBTA_HL_STATUS status);
    815     extern void  bta_hl_build_dch_close_ind(tBTA_HL *p_evt_data,
    816                                             tBTA_HL_APP_HANDLE app_handle,
    817                                             tBTA_HL_MCL_HANDLE mcl_handle,
    818                                             tBTA_HL_MDL_HANDLE mdl_handle,
    819                                             BOOLEAN intentional);
    820     extern void  bta_hl_build_send_data_cfm(tBTA_HL *p_evt_data,
    821                                             tBTA_HL_APP_HANDLE app_handle,
    822                                             tBTA_HL_MCL_HANDLE mcl_handle,
    823                                             tBTA_HL_MDL_HANDLE mdl_handle,
    824                                             tBTA_HL_STATUS status );
    825     extern void  bta_hl_build_rcv_data_ind(tBTA_HL *p_evt_data,
    826                                            tBTA_HL_APP_HANDLE app_handle,
    827                                            tBTA_HL_MCL_HANDLE mcl_handle,
    828                                            tBTA_HL_MDL_HANDLE mdl_handle);
    829     extern void  bta_hl_build_cch_open_cfm(tBTA_HL *p_evt_data,
    830                                             UINT8 app_id,
    831                                            tBTA_HL_APP_HANDLE app_handle,
    832                                            tBTA_HL_MCL_HANDLE mcl_handle,
    833                                            BD_ADDR bd_addr,
    834                                            tBTA_HL_STATUS status );
    835     extern void  bta_hl_build_cch_open_ind(tBTA_HL *p_evt_data,
    836                                            tBTA_HL_APP_HANDLE app_handle,
    837                                            tBTA_HL_MCL_HANDLE mcl_handle,
    838                                            BD_ADDR bd_addr);
    839     extern void  bta_hl_build_cch_close_cfm(tBTA_HL *p_evt_data,
    840                                             tBTA_HL_APP_HANDLE app_handle,
    841                                             tBTA_HL_MCL_HANDLE mcl_handle,
    842                                             tBTA_HL_STATUS status );
    843     extern void   bta_hl_build_cch_close_ind(tBTA_HL *p_evt_data,
    844                                              tBTA_HL_APP_HANDLE app_handle,
    845                                              tBTA_HL_MCL_HANDLE mcl_handle,
    846                                              BOOLEAN intentional);
    847 
    848     extern void  bta_hl_build_dch_open_cfm(tBTA_HL *p_evt_data,
    849                                            tBTA_HL_APP_HANDLE app_handle,
    850                                            tBTA_HL_MCL_HANDLE mcl_handle,
    851                                            tBTA_HL_MDL_HANDLE mdl_handle,
    852                                            tBTA_HL_MDEP_ID local_mdep_id,
    853                                            tBTA_HL_MDL_ID mdl_id,
    854                                            tBTA_HL_DCH_MODE dch_mode,
    855                                            BOOLEAN first_reliable,
    856                                            UINT16 mtu,
    857                                            tBTA_HL_STATUS status);
    858 
    859     extern void  bta_hl_build_delete_mdl_cfm(tBTA_HL *p_evt_data,
    860                                              tBTA_HL_APP_HANDLE app_handle,
    861                                              tBTA_HL_MCL_HANDLE mcl_handle,
    862                                              tBTA_HL_MDL_ID mdl_id,
    863                                              tBTA_HL_STATUS status);
    864     extern void  bta_hl_build_echo_test_cfm(tBTA_HL *p_evt_data,
    865                                             tBTA_HL_APP_HANDLE app_handle,
    866                                             tBTA_HL_MCL_HANDLE mcl_handle,
    867                                             tBTA_HL_STATUS status );
    868     extern void  bta_hl_build_sdp_query_cfm(tBTA_HL *p_evt_data,
    869                                             UINT8 app_id,
    870                                             tBTA_HL_APP_HANDLE app_handle,
    871                                             BD_ADDR bd_addr,
    872                                             tBTA_HL_SDP *p_sdp,
    873                                             tBTA_HL_STATUS status);
    874 
    875 #if (BTA_HL_DEBUG == TRUE)
    876     extern  char *bta_hl_status_code(tBTA_HL_STATUS status);
    877     extern char *bta_hl_evt_code(tBTA_HL_INT_EVT evt_code);
    878 #endif
    879 #ifdef __cplusplus
    880 }
    881 #endif
    882 #endif /* BTA_MSE_INT_H */
    883 
    884 
    885