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