Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2006-2012 Broadcom Corporation
      4  *
      5  *  Licensed under the Apache License, Version 2.0 (the "License");
      6  *  you may not use this file except in compliance with the License.
      7  *  You may obtain a copy of the License at:
      8  *
      9  *  http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  *
     17  ******************************************************************************/
     18 
     19 /******************************************************************************
     20  *
     21  *  This is the public interface file the BTA Java I/F
     22  *
     23  ******************************************************************************/
     24 #ifndef BTA_JV_API_H
     25 #define BTA_JV_API_H
     26 
     27 #include "data_types.h"
     28 #include "bt_target.h"
     29 #include "bt_types.h"
     30 #include "bta_api.h"
     31 #include "btm_api.h"
     32 /*****************************************************************************
     33 **  Constants and data types
     34 *****************************************************************************/
     35 /* status values */
     36 #define BTA_JV_SUCCESS             0            /* Successful operation. */
     37 #define BTA_JV_FAILURE             1            /* Generic failure. */
     38 #define BTA_JV_BUSY                2            /* Temporarily can not handle this request. */
     39 #define BTA_JV_NO_DATA             3            /* no data. */
     40 
     41 typedef UINT8 tBTA_JV_STATUS;
     42 #define BTA_JV_INTERNAL_ERR        (-1) /* internal error. */
     43 
     44 #define BTA_JV_MAX_UUIDS        SDP_MAX_UUID_FILTERS
     45 #define BTA_JV_MAX_ATTRS        SDP_MAX_ATTR_FILTERS
     46 #define BTA_JV_MAX_SDP_REC      SDP_MAX_RECORDS
     47 #if SDP_FOR_JV_INCLUDED == TRUE
     48 #define BTA_JV_MAX_L2C_CONN     (GAP_MAX_CONNECTIONS + 1)
     49 #else
     50 #define BTA_JV_MAX_L2C_CONN     GAP_MAX_CONNECTIONS
     51 #endif
     52 #define BTA_JV_MAX_SCN          PORT_MAX_RFC_PORTS /* same as BTM_MAX_SCN (in btm_int.h) */
     53 #define BTA_JV_MAX_RFC_CONN     MAX_RFC_PORTS
     54 
     55 #ifndef BTA_JV_DEF_RFC_MTU
     56 #define BTA_JV_DEF_RFC_MTU      (3*330)
     57 #endif
     58 
     59 /* */
     60 #ifndef BTA_JV_MAX_RFC_SR_SESSION
     61 #define BTA_JV_MAX_RFC_SR_SESSION   3
     62 #endif
     63 
     64 /* BTA_JV_MAX_RFC_SR_SESSION can not be bigger than MAX_BD_CONNECTIONS */
     65 #if (BTA_JV_MAX_RFC_SR_SESSION > MAX_BD_CONNECTIONS)
     66 #undef BTA_JV_MAX_RFC_SR_SESSION
     67 #define BTA_JV_MAX_RFC_SR_SESSION   MAX_BD_CONNECTIONS
     68 #endif
     69 
     70 #define BTA_JV_FIRST_SERVICE_ID BTA_FIRST_JV_SERVICE_ID
     71 #define BTA_JV_LAST_SERVICE_ID  BTA_LAST_JV_SERVICE_ID
     72 #define BTA_JV_NUM_SERVICE_ID   (BTA_LAST_JV_SERVICE_ID - BTA_FIRST_JV_SERVICE_ID + 1)
     73 
     74 /* Discoverable modes */
     75 enum
     76 {
     77     BTA_JV_DISC_NONE,
     78     BTA_JV_DISC_LIMITED,
     79     BTA_JV_DISC_GENERAL
     80 };
     81 typedef UINT16 tBTA_JV_DISC;
     82 
     83 /* Security Mode (BTA_JvGetSecurityMode) */
     84 #define BTA_JV_SEC_MODE_UNDEFINED   BTM_SEC_MODE_UNDEFINED  /* 0 */
     85 #define BTA_JV_SEC_MODE_NONE        BTM_SEC_MODE_NONE       /* 1 */
     86 #define BTA_JV_SEC_MODE_SERVICE     BTM_SEC_MODE_SERVICE    /* 2 */
     87 #define BTA_JV_SEC_MODE_LINK        BTM_SEC_MODE_LINK       /* 3 */
     88 #define BTA_JV_SEC_MODE_SP          BTM_SEC_MODE_SP         /* 4 */
     89 #define BTA_JV_SEC_MODE_SP_DEBUG    BTM_SEC_MODE_SP_DEBUG   /* 5 */
     90 typedef UINT8 tBTA_JV_SEC_MODE;
     91 
     92 #define BTA_JV_ROLE_SLAVE       BTM_ROLE_SLAVE
     93 #define BTA_JV_ROLE_MASTER      BTM_ROLE_MASTER
     94 typedef UINT32 tBTA_JV_ROLE;
     95 
     96 #define BTA_JV_SERVICE_LMTD_DISCOVER    BTM_COD_SERVICE_LMTD_DISCOVER   /* 0x0020 */
     97 #define BTA_JV_SERVICE_POSITIONING      BTM_COD_SERVICE_POSITIONING     /* 0x0100 */
     98 #define BTA_JV_SERVICE_NETWORKING       BTM_COD_SERVICE_NETWORKING      /* 0x0200 */
     99 #define BTA_JV_SERVICE_RENDERING        BTM_COD_SERVICE_RENDERING       /* 0x0400 */
    100 #define BTA_JV_SERVICE_CAPTURING        BTM_COD_SERVICE_CAPTURING       /* 0x0800 */
    101 #define BTA_JV_SERVICE_OBJ_TRANSFER     BTM_COD_SERVICE_OBJ_TRANSFER    /* 0x1000 */
    102 #define BTA_JV_SERVICE_AUDIO            BTM_COD_SERVICE_AUDIO           /* 0x2000 */
    103 #define BTA_JV_SERVICE_TELEPHONY        BTM_COD_SERVICE_TELEPHONY       /* 0x4000 */
    104 #define BTA_JV_SERVICE_INFORMATION      BTM_COD_SERVICE_INFORMATION     /* 0x8000 */
    105 
    106 
    107 
    108 /* Java I/F callback events */
    109 /* events received by tBTA_JV_DM_CBACK */
    110 #define BTA_JV_ENABLE_EVT           0  /* JV enabled */
    111 #define BTA_JV_SET_DISCOVER_EVT     1  /* the result for BTA_JvSetDiscoverability */
    112 #define BTA_JV_LOCAL_ADDR_EVT       2  /* Local device address */
    113 #define BTA_JV_LOCAL_NAME_EVT       3  /* Local device name */
    114 #define BTA_JV_REMOTE_NAME_EVT      4  /* Remote device name */
    115 #define BTA_JV_SET_ENCRYPTION_EVT   5  /* Set Encryption */
    116 #define BTA_JV_GET_SCN_EVT          6  /* Reserved an SCN */
    117 #define BTA_JV_GET_PSM_EVT          7  /* Reserved a PSM */
    118 #define BTA_JV_DISCOVERY_COMP_EVT   8  /* SDP discovery complete */
    119 #define BTA_JV_SERVICES_LEN_EVT     9  /* the result for BTA_JvGetServicesLength */
    120 #define BTA_JV_SERVICE_SEL_EVT      10 /* the result for BTA_JvServiceSelect */
    121 #define BTA_JV_CREATE_RECORD_EVT    11 /* the result for BTA_JvCreateRecord */
    122 #define BTA_JV_UPDATE_RECORD_EVT    12 /* the result for BTA_JvUpdateRecord */
    123 #define BTA_JV_ADD_ATTR_EVT         13 /* the result for BTA_JvAddAttribute */
    124 #define BTA_JV_DELETE_ATTR_EVT      14 /* the result for BTA_JvDeleteAttribute */
    125 #define BTA_JV_CANCEL_DISCVRY_EVT   15 /* the result for BTA_JvCancelDiscovery */
    126 
    127 /* events received by tBTA_JV_L2CAP_CBACK */
    128 #define BTA_JV_L2CAP_OPEN_EVT       16 /* open status of L2CAP connection */
    129 #define BTA_JV_L2CAP_CLOSE_EVT      17 /* L2CAP connection closed */
    130 #define BTA_JV_L2CAP_START_EVT      18 /* L2CAP server started */
    131 #define BTA_JV_L2CAP_CL_INIT_EVT    19 /* L2CAP client initiated a connection */
    132 #define BTA_JV_L2CAP_DATA_IND_EVT   20 /* L2CAP connection received data */
    133 #define BTA_JV_L2CAP_CONG_EVT       21 /* L2CAP connection congestion status changed */
    134 #define BTA_JV_L2CAP_READ_EVT       22 /* the result for BTA_JvL2capRead */
    135 #define BTA_JV_L2CAP_RECEIVE_EVT    23 /* the result for BTA_JvL2capReceive*/
    136 #define BTA_JV_L2CAP_WRITE_EVT      24 /* the result for BTA_JvL2capWrite*/
    137 
    138 /* events received by tBTA_JV_RFCOMM_CBACK */
    139 #define BTA_JV_RFCOMM_OPEN_EVT      25 /* open status of RFCOMM Client connection */
    140 #define BTA_JV_RFCOMM_CLOSE_EVT     26 /* RFCOMM connection closed */
    141 #define BTA_JV_RFCOMM_START_EVT     27 /* RFCOMM server started */
    142 #define BTA_JV_RFCOMM_CL_INIT_EVT   28 /* RFCOMM client initiated a connection */
    143 #define BTA_JV_RFCOMM_DATA_IND_EVT  29 /* RFCOMM connection received data */
    144 #define BTA_JV_RFCOMM_CONG_EVT      30 /* RFCOMM connection congestion status changed */
    145 #define BTA_JV_RFCOMM_READ_EVT      31 /* the result for BTA_JvRfcommRead */
    146 #define BTA_JV_RFCOMM_WRITE_EVT     32 /* the result for BTA_JvRfcommWrite*/
    147 #define BTA_JV_RFCOMM_SRV_OPEN_EVT  33 /* open status of Server RFCOMM connection */
    148 #define BTA_JV_MAX_EVT              34 /* max number of JV events */
    149 
    150 typedef UINT16 tBTA_JV_EVT;
    151 
    152 /* data associated with BTA_JV_SET_DISCOVER_EVT */
    153 typedef struct
    154 {
    155     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    156     tBTA_JV_DISC    disc_mode;  /* The current discoverable mode */
    157 } tBTA_JV_SET_DISCOVER;
    158 
    159 /* data associated with BTA_JV_DISCOVERY_COMP_EVT_ */
    160 typedef struct
    161 {
    162     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    163     int scn;                    /* channel # */
    164 } tBTA_JV_DISCOVERY_COMP;
    165 
    166 /* data associated with BTA_JV_SET_ENCRYPTION_EVT */
    167 typedef struct
    168 {
    169     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    170     BD_ADDR     bd_addr;        /* The peer address */
    171 } tBTA_JV_SET_ENCRYPTION;
    172 
    173 /* data associated with BTA_JV_SERVICES_LEN_EVT */
    174 typedef struct
    175 {
    176     INT32       num_services;       /* -1, if error. Otherwise, the number of
    177                                      * services collected from peer */
    178     UINT16      *p_services_len;    /* this points the same location as the
    179                                      * parameter in BTA_JvGetServicesLength() */
    180 } tBTA_JV_SERVICES_LEN;
    181 
    182 /* data associated with BTA_JV_SERVICE_SEL_EVT */
    183 typedef struct
    184 {
    185     BD_ADDR     bd_addr;            /* The peer address */
    186     UINT16      service_len;        /* the length of this record */
    187 } tBTA_JV_SERVICE_SEL;
    188 
    189 /* data associated with BTA_JV_CREATE_RECORD_EVT */
    190 typedef struct
    191 {
    192    tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    193 } tBTA_JV_CREATE_RECORD;
    194 
    195 /* data associated with BTA_JV_UPDATE_RECORD_EVT */
    196 typedef struct
    197 {
    198     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    199     UINT32          handle;     /* The SDP record handle was updated */
    200 } tBTA_JV_UPDATE_RECORD;
    201 
    202 /* data associated with BTA_JV_ADD_ATTR_EVT */
    203 typedef struct
    204 {
    205     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    206     UINT32          handle;     /* The SDP record handle was updated */
    207 } tBTA_JV_ADD_ATTR;
    208 
    209 /* data associated with BTA_JV_DELETE_ATTR_EVT */
    210 typedef struct
    211 {
    212     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    213     UINT32          handle;     /* The SDP record handle was updated */
    214 } tBTA_JV_DELETE_ATTR;
    215 
    216 /* data associated with BTA_JV_L2CAP_OPEN_EVT */
    217 typedef struct
    218 {
    219     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    220     UINT32          handle;     /* The connection handle */
    221     BD_ADDR         rem_bda;    /* The peer address */
    222     INT32           tx_mtu;     /* The transmit MTU */
    223 } tBTA_JV_L2CAP_OPEN;
    224 
    225 /* data associated with BTA_JV_L2CAP_CLOSE_EVT */
    226 typedef struct
    227 {
    228     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    229     UINT32          handle;     /* The connection handle */
    230     BOOLEAN         async;      /* FALSE, if local initiates disconnect */
    231 } tBTA_JV_L2CAP_CLOSE;
    232 
    233 /* data associated with BTA_JV_L2CAP_START_EVT */
    234 typedef struct
    235 {
    236     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    237     UINT32          handle;     /* The connection handle */
    238     UINT8           sec_id;     /* security ID used by this server */
    239 } tBTA_JV_L2CAP_START;
    240 
    241 /* data associated with BTA_JV_L2CAP_CL_INIT_EVT */
    242 typedef struct
    243 {
    244     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    245     UINT32          handle;     /* The connection handle */
    246     UINT8           sec_id;     /* security ID used by this client */
    247 } tBTA_JV_L2CAP_CL_INIT;
    248 
    249 /* data associated with BTA_JV_L2CAP_CONG_EVT */
    250 typedef struct
    251 {
    252     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    253     UINT32          handle;     /* The connection handle */
    254     BOOLEAN         cong;       /* TRUE, congested. FALSE, uncongested */
    255 } tBTA_JV_L2CAP_CONG;
    256 
    257 /* data associated with BTA_JV_L2CAP_READ_EVT */
    258 typedef struct
    259 {
    260     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    261     UINT32          handle;     /* The connection handle */
    262     UINT32          req_id;     /* The req_id in the associated BTA_JvL2capRead() */
    263     UINT8           *p_data;    /* This points the same location as the p_data
    264                                  * parameter in BTA_JvL2capRead () */
    265     UINT16          len;        /* The length of the data read. */
    266 } tBTA_JV_L2CAP_READ;
    267 
    268 /* data associated with BTA_JV_L2CAP_RECEIVE_EVT */
    269 typedef struct
    270 {
    271     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    272     UINT32          handle;     /* The connection handle */
    273     UINT32          req_id;     /* The req_id in the associated BTA_JvL2capReceive() */
    274     UINT8           *p_data;    /* This points the same location as the p_data
    275                                  * parameter in BTA_JvL2capReceive () */
    276     UINT16          len;        /* The length of the data read. */
    277 } tBTA_JV_L2CAP_RECEIVE;
    278 
    279 /* data associated with BTA_JV_L2CAP_WRITE_EVT */
    280 typedef struct
    281 {
    282     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    283     UINT32          handle;     /* The connection handle */
    284     UINT32          req_id;     /* The req_id in the associated BTA_JvL2capWrite() */
    285     UINT16          len;        /* The length of the data written. */
    286     BOOLEAN         cong;       /* congestion status */
    287 } tBTA_JV_L2CAP_WRITE;
    288 
    289 /* data associated with BTA_JV_RFCOMM_OPEN_EVT */
    290 typedef struct
    291 {
    292     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    293     UINT32          handle;     /* The connection handle */
    294     BD_ADDR         rem_bda;    /* The peer address */
    295 } tBTA_JV_RFCOMM_OPEN;
    296 /* data associated with BTA_JV_RFCOMM_SRV_OPEN_EVT */
    297 typedef struct
    298 {
    299     tBTA_JV_STATUS  status;             /* Whether the operation succeeded or failed. */
    300     UINT32          handle;             /* The connection handle */
    301     UINT32          new_listen_handle;  /* The new listen handle */
    302     BD_ADDR         rem_bda;            /* The peer address */
    303 } tBTA_JV_RFCOMM_SRV_OPEN;
    304 
    305 
    306 /* data associated with BTA_JV_RFCOMM_CLOSE_EVT */
    307 typedef struct
    308 {
    309     tBTA_JV_STATUS  status;      /* Whether the operation succeeded or failed. */
    310     UINT32          port_status; /* PORT status */
    311     UINT32          handle;      /* The connection handle */
    312     BOOLEAN         async;       /* FALSE, if local initiates disconnect */
    313 } tBTA_JV_RFCOMM_CLOSE;
    314 
    315 /* data associated with BTA_JV_RFCOMM_START_EVT */
    316 typedef struct
    317 {
    318     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    319     UINT32          handle;     /* The connection handle */
    320     UINT8           sec_id;     /* security ID used by this server */
    321     BOOLEAN         use_co;     /* TRUE to use co_rfc_data */
    322 } tBTA_JV_RFCOMM_START;
    323 
    324 /* data associated with BTA_JV_RFCOMM_CL_INIT_EVT */
    325 typedef struct
    326 {
    327     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    328     UINT32          handle;     /* The connection handle */
    329     UINT8           sec_id;     /* security ID used by this client */
    330     BOOLEAN         use_co;     /* TRUE to use co_rfc_data */
    331 } tBTA_JV_RFCOMM_CL_INIT;
    332 /*data associated with BTA_JV_L2CAP_DATA_IND_EVT & BTA_JV_RFCOMM_DATA_IND_EVT */
    333 typedef struct
    334 {
    335     UINT32          handle;     /* The connection handle */
    336 } tBTA_JV_DATA_IND;
    337 
    338 /* data associated with BTA_JV_RFCOMM_CONG_EVT */
    339 typedef struct
    340 {
    341     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    342     UINT32          handle;     /* The connection handle */
    343     BOOLEAN         cong;       /* TRUE, congested. FALSE, uncongested */
    344 } tBTA_JV_RFCOMM_CONG;
    345 
    346 /* data associated with BTA_JV_RFCOMM_READ_EVT */
    347 typedef struct
    348 {
    349     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    350     UINT32          handle;     /* The connection handle */
    351     UINT32          req_id;     /* The req_id in the associated BTA_JvRfcommRead() */
    352     UINT8           *p_data;    /* This points the same location as the p_data
    353                                  * parameter in BTA_JvRfcommRead () */
    354     UINT16          len;        /* The length of the data read. */
    355 } tBTA_JV_RFCOMM_READ;
    356 
    357 /* data associated with BTA_JV_RFCOMM_WRITE_EVT */
    358 typedef struct
    359 {
    360     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
    361     UINT32          handle;     /* The connection handle */
    362     UINT32          req_id;     /* The req_id in the associated BTA_JvRfcommWrite() */
    363     int             len;        /* The length of the data written. */
    364     BOOLEAN         cong;       /* congestion status */
    365 } tBTA_JV_RFCOMM_WRITE;
    366 
    367 
    368 /* union of data associated with JV callback */
    369 typedef union
    370 {
    371     tBTA_JV_STATUS          status;         /* BTA_JV_ENABLE_EVT */
    372     tBTA_JV_DISCOVERY_COMP  disc_comp;      /* BTA_JV_DISCOVERY_COMP_EVT */
    373     tBTA_JV_SET_DISCOVER    set_discover;   /* BTA_JV_SET_DISCOVER_EVT */
    374     tBTA_JV_SET_ENCRYPTION  set_encrypt;    /* BTA_JV_SET_ENCRYPTION_EVT */
    375     BD_ADDR                 bd_addr;        /* BTA_JV_LOCAL_ADDR_EVT */
    376     UINT8                   *p_name;        /* BTA_JV_LOCAL_NAME_EVT,
    377                                                BTA_JV_REMOTE_NAME_EVT */
    378     UINT8                   scn;            /* BTA_JV_GET_SCN_EVT */
    379     UINT16                  psm;            /* BTA_JV_GET_PSM_EVT */
    380     tBTA_JV_SERVICES_LEN    servs_len;      /* BTA_JV_SERVICES_LEN_EVT */
    381     tBTA_JV_SERVICE_SEL     serv_sel;       /* BTA_JV_SERVICE_SEL_EVT */
    382     tBTA_JV_CREATE_RECORD   create_rec;     /* BTA_JV_CREATE_RECORD_EVT */
    383     tBTA_JV_UPDATE_RECORD   update_rec;     /* BTA_JV_UPDATE_RECORD_EVT */
    384     tBTA_JV_ADD_ATTR        add_attr;       /* BTA_JV_ADD_ATTR_EVT */
    385     tBTA_JV_DELETE_ATTR     del_attr;       /* BTA_JV_DELETE_ATTR_EVT */
    386     tBTA_JV_L2CAP_OPEN      l2c_open;       /* BTA_JV_L2CAP_OPEN_EVT */
    387     tBTA_JV_L2CAP_CLOSE     l2c_close;      /* BTA_JV_L2CAP_CLOSE_EVT */
    388     tBTA_JV_L2CAP_START     l2c_start;      /* BTA_JV_L2CAP_START_EVT */
    389     tBTA_JV_L2CAP_CL_INIT   l2c_cl_init;    /* BTA_JV_L2CAP_CL_INIT_EVT */
    390     tBTA_JV_L2CAP_CONG      l2c_cong;       /* BTA_JV_L2CAP_CONG_EVT */
    391     tBTA_JV_L2CAP_READ      l2c_read;       /* BTA_JV_L2CAP_READ_EVT */
    392     tBTA_JV_L2CAP_WRITE     l2c_write;      /* BTA_JV_L2CAP_WRITE_EVT */
    393     tBTA_JV_RFCOMM_OPEN     rfc_open;       /* BTA_JV_RFCOMM_OPEN_EVT */
    394     tBTA_JV_RFCOMM_SRV_OPEN rfc_srv_open;   /* BTA_JV_RFCOMM_SRV_OPEN_EVT */
    395     tBTA_JV_RFCOMM_CLOSE    rfc_close;      /* BTA_JV_RFCOMM_CLOSE_EVT */
    396     tBTA_JV_RFCOMM_START    rfc_start;      /* BTA_JV_RFCOMM_START_EVT */
    397     tBTA_JV_RFCOMM_CL_INIT  rfc_cl_init;    /* BTA_JV_RFCOMM_CL_INIT_EVT */
    398     tBTA_JV_RFCOMM_CONG     rfc_cong;       /* BTA_JV_RFCOMM_CONG_EVT */
    399     tBTA_JV_RFCOMM_READ     rfc_read;       /* BTA_JV_RFCOMM_READ_EVT */
    400     tBTA_JV_RFCOMM_WRITE    rfc_write;      /* BTA_JV_RFCOMM_WRITE_EVT */
    401     tBTA_JV_DATA_IND        data_ind;    /* BTA_JV_L2CAP_DATA_IND_EVT
    402                                                BTA_JV_RFCOMM_DATA_IND_EVT */
    403 } tBTA_JV;
    404 
    405 /* JAVA DM Interface callback */
    406 typedef void (tBTA_JV_DM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void * user_data);
    407 
    408 /* JAVA RFCOMM interface callback */
    409 typedef void* (tBTA_JV_RFCOMM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data);
    410 
    411 /* JAVA L2CAP interface callback */
    412 typedef void (tBTA_JV_L2CAP_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data);
    413 
    414 /* JV configuration structure */
    415 typedef struct
    416 {
    417     UINT16  sdp_raw_size;           /* The size of p_sdp_raw_data */
    418     UINT16  sdp_db_size;            /* The size of p_sdp_db */
    419     UINT8   *p_sdp_raw_data;        /* The data buffer to keep raw data */
    420     tSDP_DISCOVERY_DB   *p_sdp_db;  /* The data buffer to keep SDP database */
    421 } tBTA_JV_CFG;
    422 
    423 /*****************************************************************************
    424 **  External Function Declarations
    425 *****************************************************************************/
    426 #ifdef __cplusplus
    427 extern "C"
    428 {
    429 #endif
    430 
    431 /*******************************************************************************
    432 **
    433 ** Function         BTA_JvEnable
    434 **
    435 ** Description      Enable the Java I/F service. When the enable
    436 **                  operation is complete the callback function will be
    437 **                  called with a BTA_JV_ENABLE_EVT. This function must
    438 **                  be called before other functions in the JV API are
    439 **                  called.
    440 **
    441 ** Returns          BTA_JV_SUCCESS if successful.
    442 **                  BTA_JV_FAIL if internal failure.
    443 **
    444 *******************************************************************************/
    445 BTA_API extern tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback);
    446 
    447 /*******************************************************************************
    448 **
    449 ** Function         BTA_JvDisable
    450 **
    451 ** Description      Disable the Java I/F
    452 **
    453 ** Returns          void
    454 **
    455 *******************************************************************************/
    456 BTA_API extern void BTA_JvDisable(void);
    457 
    458 /*******************************************************************************
    459 **
    460 ** Function         BTA_JvIsEnable
    461 **
    462 ** Description      Get the JV registration status.
    463 **
    464 ** Returns          TRUE, if registered
    465 **
    466 *******************************************************************************/
    467 BTA_API extern BOOLEAN BTA_JvIsEnable(void);
    468 
    469 /*******************************************************************************
    470 **
    471 ** Function         BTA_JvSetDiscoverability
    472 **
    473 ** Description      This function sets the Bluetooth  discoverable modes
    474 **                  of the local device.  This controls whether other
    475 **                  Bluetooth devices can find the local device.
    476 **
    477 **                  When the operation is complete the tBTA_JV_DM_CBACK callback
    478 **                  function will be called with a BTA_JV_SET_DISCOVER_EVT.
    479 **
    480 ** Returns          BTA_JV_SUCCESS if successful.
    481 **                  BTA_JV_FAIL if internal failure.
    482 **
    483 *******************************************************************************/
    484 BTA_API extern tBTA_JV_STATUS BTA_JvSetDiscoverability(tBTA_JV_DISC disc_mode);
    485 
    486 /*******************************************************************************
    487 **
    488 ** Function         BTA_JvGetDiscoverability
    489 **
    490 ** Description      This function gets the Bluetooth
    491 **                  discoverable modes of local device
    492 **
    493 ** Returns          The current Bluetooth discoverable mode.
    494 **
    495 *******************************************************************************/
    496 BTA_API extern tBTA_JV_DISC BTA_JvGetDiscoverability(void);
    497 
    498 /*******************************************************************************
    499 **
    500 ** Function         BTA_JvGetLocalDeviceAddr
    501 **
    502 ** Description      This function obtains the local Bluetooth device address.
    503 **                  The local Bluetooth device address is reported by the
    504 **                  tBTA_JV_DM_CBACK callback with a BTA_JV_LOCAL_ADDR_EVT.
    505 **
    506 ** Returns          BTA_JV_SUCCESS if successful.
    507 **                  BTA_JV_FAIL if internal failure.
    508 **
    509 *******************************************************************************/
    510 BTA_API extern tBTA_JV_STATUS BTA_JvGetLocalDeviceAddr(void);
    511 
    512 /*******************************************************************************
    513 **
    514 ** Function         BTA_JvGetLocalDeviceName
    515 **
    516 ** Description      This function obtains the name of the local device
    517 **                  The local Bluetooth device name is reported by the
    518 **                  tBTA_JV_DM_CBACK callback with a BTA_JV_LOCAL_NAME_EVT.
    519 **
    520 ** Returns          BTA_JV_SUCCESS if successful.
    521 **                  BTA_JV_FAIL if internal failure.
    522 **
    523 *******************************************************************************/
    524 BTA_API extern tBTA_JV_STATUS BTA_JvGetLocalDeviceName(void);
    525 
    526 /*******************************************************************************
    527 **
    528 ** Function         BTA_JvGetRemoteDeviceName
    529 **
    530 ** Description      This function obtains the name of the specified device.
    531 **                  The Bluetooth device name is reported by the
    532 **                  tBTA_JV_DM_CBACK callback with a BTA_JV_REMOTE_NAME_EVT.
    533 **
    534 ** Returns          BTA_JV_SUCCESS if successful.
    535 **                  BTA_JV_FAIL if internal failure.
    536 **
    537 *******************************************************************************/
    538 BTA_API extern tBTA_JV_STATUS BTA_JvGetRemoteDeviceName(BD_ADDR bd_addr);
    539 
    540 /*******************************************************************************
    541 **
    542 ** Function         BTA_JvGetPreknownDevice
    543 **
    544 ** Description      This function obtains the Bluetooth address in the inquiry
    545 **                  database collected via the previous call to BTA_DmSearch().
    546 **
    547 ** Returns          The number of preknown devices if p_bd_addr is NULL
    548 **                  BTA_JV_SUCCESS if successful.
    549 **                  BTA_JV_INTERNAL_ERR(-1) if internal failure.
    550 **
    551 *******************************************************************************/
    552 BTA_API extern INT32 BTA_JvGetPreknownDevice(UINT8 * p_bd_addr, UINT32 index);
    553 
    554 /*******************************************************************************
    555 **
    556 ** Function         BTA_JvGetDeviceClass
    557 **
    558 ** Description      This function obtains the local Class of Device.
    559 **
    560 ** Returns          DEV_CLASS, A three-byte array of UINT8 that contains the
    561 **                  Class of Device information. The definitions are in the
    562 **                  "Bluetooth Assigned Numbers".
    563 **
    564 *******************************************************************************/
    565 BTA_API extern UINT8 * BTA_JvGetDeviceClass(void);
    566 
    567 /*******************************************************************************
    568 **
    569 ** Function         BTA_JvSetServiceClass
    570 **
    571 ** Description      This function sets the service class of local Class of Device
    572 **
    573 ** Returns          BTA_JV_SUCCESS if successful.
    574 **                  BTA_JV_FAIL if internal failure.
    575 **
    576 *******************************************************************************/
    577 BTA_API extern tBTA_JV_STATUS BTA_JvSetServiceClass(UINT32 service);
    578 
    579 /*******************************************************************************
    580 **
    581 ** Function         BTA_JvSetEncryption
    582 **
    583 ** Description      This function ensures that the connection to the given device
    584 **                  is encrypted.
    585 **                  When the operation is complete the tBTA_JV_DM_CBACK callback
    586 **                  function will be called with a BTA_JV_SET_ENCRYPTION_EVT.
    587 **
    588 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    589 **                  BTA_JV_FAILURE, otherwise.
    590 **
    591 *******************************************************************************/
    592 BTA_API extern tBTA_JV_STATUS BTA_JvSetEncryption(BD_ADDR bd_addr);
    593 
    594 /*******************************************************************************
    595 **
    596 ** Function         BTA_JvIsAuthenticated
    597 **
    598 ** Description      This function checks if the peer device is authenticated
    599 **
    600 ** Returns          TRUE if authenticated.
    601 **                  FALSE if not.
    602 **
    603 *******************************************************************************/
    604 BTA_API extern BOOLEAN BTA_JvIsAuthenticated(BD_ADDR bd_addr);
    605 
    606 /*******************************************************************************
    607 **
    608 ** Function         BTA_JvIsTrusted
    609 **
    610 ** Description      This function checks if the peer device is trusted
    611 **                  (previously paired)
    612 **
    613 ** Returns          TRUE if trusted.
    614 **                  FALSE if not.
    615 **
    616 *******************************************************************************/
    617 BTA_API extern BOOLEAN BTA_JvIsTrusted(BD_ADDR bd_addr);
    618 
    619 /*******************************************************************************
    620 **
    621 ** Function         BTA_JvIsAuthorized
    622 **
    623 ** Description      This function checks if the peer device is authorized
    624 **
    625 ** Returns          TRUE if authorized.
    626 **                  FALSE if not.
    627 **
    628 *******************************************************************************/
    629 BTA_API extern BOOLEAN BTA_JvIsAuthorized(BD_ADDR bd_addr);
    630 
    631 /*******************************************************************************
    632 **
    633 ** Function         BTA_JvIsEncrypted
    634 **
    635 ** Description      This function checks if the link to peer device is encrypted
    636 **
    637 ** Returns          TRUE if encrypted.
    638 **                  FALSE if not.
    639 **
    640 *******************************************************************************/
    641 BTA_API extern BOOLEAN BTA_JvIsEncrypted(BD_ADDR bd_addr);
    642 
    643 /*******************************************************************************
    644 **
    645 ** Function         BTA_JvGetSecurityMode
    646 **
    647 ** Description      This function returns the current Bluetooth security mode
    648 **                  of the local device
    649 **
    650 ** Returns          The current Bluetooth security mode.
    651 **
    652 *******************************************************************************/
    653 BTA_API extern tBTA_JV_SEC_MODE BTA_JvGetSecurityMode(void);
    654 
    655 /* BTA_JvIsMaster is replaced by BTA_DmIsMaster */
    656 
    657 /*******************************************************************************
    658 **
    659 ** Function         BTA_JvGetSCN
    660 **
    661 ** Description      This function reserves a SCN (server channel number) for
    662 **                  applications running over RFCOMM. It is primarily called by
    663 **                  server profiles/applications to register their SCN into the
    664 **                  SDP database. The SCN is reported by the tBTA_JV_DM_CBACK
    665 **                  callback with a BTA_JV_GET_SCN_EVT.
    666 **                  If the SCN reported is 0, that means all SCN resources are
    667 **                  exhausted.
    668 **
    669 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    670 **                  BTA_JV_FAILURE, otherwise.
    671 **
    672 *******************************************************************************/
    673 BTA_API extern tBTA_JV_STATUS BTA_JvGetSCN(void);
    674 
    675 /*******************************************************************************
    676 **
    677 ** Function         BTA_JvFreeSCN
    678 **
    679 ** Description      This function frees a server channel number that was used
    680 **                  by an application running over RFCOMM.
    681 **
    682 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    683 **                  BTA_JV_FAILURE, otherwise.
    684 **
    685 *******************************************************************************/
    686 BTA_API extern tBTA_JV_STATUS BTA_JvFreeSCN(UINT8 scn);
    687 
    688 /*******************************************************************************
    689 **
    690 ** Function         BTA_JvGetPSM
    691 **
    692 ** Description      This function reserves a PSM (Protocol Service Multiplexer)
    693 **                  applications running over L2CAP. It is primarily called by
    694 **                  server profiles/applications to register their PSM into the
    695 **                  SDP database.
    696 **
    697 ** Returns          The next free PSM
    698 **
    699 *******************************************************************************/
    700 BTA_API extern UINT16 BTA_JvGetPSM(void);
    701 
    702 /*******************************************************************************
    703 **
    704 ** Function         BTA_JvStartDiscovery
    705 **
    706 ** Description      This function performs service discovery for the services
    707 **                  provided by the given peer device. When the operation is
    708 **                  complete the tBTA_JV_DM_CBACK callback function will be
    709 **                  called with a BTA_JV_DISCOVERY_COMP_EVT.
    710 **
    711 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    712 **                  BTA_JV_FAILURE, otherwise.
    713 **
    714 *******************************************************************************/
    715 BTA_API extern tBTA_JV_STATUS BTA_JvStartDiscovery(BD_ADDR bd_addr, UINT16 num_uuid,
    716                            tSDP_UUID *p_uuid_list, void* user_data);
    717 
    718 /*******************************************************************************
    719 **
    720 ** Function         BTA_JvCancelDiscovery
    721 **
    722 ** Description      This function cancels an active service discovery.
    723 **                  When the operation is
    724 **                  complete the tBTA_JV_DM_CBACK callback function will be
    725 **                  called with a BTA_JV_CANCEL_DISCVRY_EVT.
    726 **
    727 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    728 **                  BTA_JV_FAILURE, otherwise.
    729 **
    730 *******************************************************************************/
    731 BTA_API extern tBTA_JV_STATUS BTA_JvCancelDiscovery(void * user_data);
    732 
    733 /*******************************************************************************
    734 **
    735 ** Function         BTA_JvGetServicesLength
    736 **
    737 ** Description      This function obtains the number of services and the length
    738 **                  of each service found in the SDP database (result of last
    739 **                  BTA_JvStartDiscovery().When the operation is complete the
    740 **                  tBTA_JV_DM_CBACK callback function will be called with a
    741 **                  BTA_JV_SERVICES_LEN_EVT.
    742 **
    743 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    744 **                  BTA_JV_FAILURE, otherwise.
    745 **
    746 *******************************************************************************/
    747 BTA_API extern tBTA_JV_STATUS BTA_JvGetServicesLength(BOOLEAN inc_hdr, UINT16 *p_services_len);
    748 
    749 /*******************************************************************************
    750 **
    751 ** Function         BTA_JvGetServicesResult
    752 **
    753 ** Description      This function returns a number of service records found
    754 **                  during current service search, equals to the number returned
    755 **                  by previous call to BTA_JvGetServicesLength.
    756 **                  The contents of each SDP record will be returned under a
    757 **                  TLV (type, len, value) representation in the data buffer
    758 **                  provided by the caller.
    759 **
    760 ** Returns          -1, if error. Otherwise, the number of services
    761 **
    762 *******************************************************************************/
    763 BTA_API extern INT32 BTA_JvGetServicesResult(BOOLEAN inc_hdr, UINT8 **TLVs);
    764 
    765 /*******************************************************************************
    766 **
    767 ** Function         BTA_JvServiceSelect
    768 **
    769 ** Description      This function checks if the SDP database contains the given
    770 **                  service UUID. When the operation is complete the
    771 **                  tBTA_JV_DM_CBACK callback function will be called with a
    772 **                  BTA_JV_SERVICE_SEL_EVT with the length of the service record.
    773 **                  If the service is not found or error, -1 is reported.
    774 **
    775 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    776 **                  BTA_JV_FAILURE, otherwise.
    777 **
    778 *******************************************************************************/
    779 BTA_API extern tBTA_JV_STATUS BTA_JvServiceSelect(UINT16 uuid);
    780 
    781 /*******************************************************************************
    782 **
    783 ** Function         BTA_JvServiceResult
    784 **
    785 ** Description      This function returns the contents of the SDP record from
    786 **                  last BTA_JvServiceSelect. The contents will be returned under
    787 **                  a TLV (type, len, value) representation in the data buffer
    788 **                  provided by the caller.
    789 **
    790 ** Returns          -1, if error. Otherwise, the length of service record.
    791 **
    792 *******************************************************************************/
    793 BTA_API extern INT32 BTA_JvServiceResult(UINT8 *TLV);
    794 
    795 /*******************************************************************************
    796 **
    797 ** Function         BTA_JvCreateRecord
    798 **
    799 ** Description      Create a service record in the local SDP database by user in
    800 **                  tBTA_JV_DM_CBACK callback with a BTA_JV_CREATE_RECORD_EVT.
    801 **
    802 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    803 **                  BTA_JV_FAILURE, otherwise.
    804 **
    805 *******************************************************************************/
    806 BTA_API extern tBTA_JV_STATUS BTA_JvCreateRecordByUser(void* user_data);
    807 
    808 /*******************************************************************************
    809 **
    810 ** Function         BTA_JvUpdateRecord
    811 **
    812 ** Description      Update a service record in the local SDP database.
    813 **                  When the operation is complete the tBTA_JV_DM_CBACK callback
    814 **                  function will be called with a BTA_JV_UPDATE_RECORD_EVT.
    815 **
    816 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    817 **                  BTA_JV_FAILURE, otherwise.
    818 **
    819 *******************************************************************************/
    820 BTA_API extern tBTA_JV_STATUS BTA_JvUpdateRecord(UINT32 handle, UINT16 *p_ids,
    821                            UINT8 **p_values, INT32 *p_value_sizes, INT32 array_len);
    822 
    823 /*******************************************************************************
    824 **
    825 ** Function         BTA_JvAddAttribute
    826 **
    827 ** Description      Add an attribute to a service record in the local SDP database.
    828 **                  When the operation is complete the tBTA_JV_DM_CBACK callback
    829 **                  function will be called with a BTA_JV_ADD_ATTR_EVT.
    830 **
    831 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    832 **                  BTA_JV_FAILURE, otherwise.
    833 **
    834 *******************************************************************************/
    835 BTA_API extern tBTA_JV_STATUS BTA_JvAddAttribute(UINT32 handle, UINT16 attr_id,
    836                            UINT8 *p_value, INT32 value_size);
    837 
    838 /*******************************************************************************
    839 **
    840 ** Function         BTA_JvDeleteAttribute
    841 **
    842 ** Description      Delete an attribute from a service record in the local SDP database.
    843 **                  When the operation is complete the tBTA_JV_DM_CBACK callback
    844 **                  function will be called with a BTA_JV_DELETE_ATTR_EVT.
    845 **
    846 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    847 **                  BTA_JV_FAILURE, otherwise.
    848 **
    849 *******************************************************************************/
    850 BTA_API extern tBTA_JV_STATUS BTA_JvDeleteAttribute(UINT32 handle, UINT16 attr_id);
    851 
    852 /*******************************************************************************
    853 **
    854 ** Function         BTA_JvDeleteRecord
    855 **
    856 ** Description      Delete a service record in the local SDP database.
    857 **
    858 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    859 **                  BTA_JV_FAILURE, otherwise.
    860 **
    861 *******************************************************************************/
    862 BTA_API extern tBTA_JV_STATUS BTA_JvDeleteRecord(UINT32 handle);
    863 
    864 /*******************************************************************************
    865 **
    866 ** Function         BTA_JvReadRecord
    867 **
    868 ** Description      Read a service record in the local SDP database.
    869 **
    870 ** Returns          -1, if the record is not found.
    871 **                  Otherwise, the offset (0 or 1) to start of data in p_data.
    872 **
    873 **                  The size of data copied into p_data is in *p_data_len.
    874 **
    875 *******************************************************************************/
    876 BTA_API extern INT32 BTA_JvReadRecord(UINT32 handle, UINT8 *p_data, INT32 *p_data_len);
    877 
    878 /*******************************************************************************
    879 **
    880 ** Function         BTA_JvL2capConnect
    881 **
    882 ** Description      Initiate a connection as a L2CAP client to the given BD
    883 **                  Address.
    884 **                  When the connection is initiated or failed to initiate,
    885 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_CL_INIT_EVT
    886 **                  When the connection is established or failed,
    887 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT
    888 **
    889 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    890 **                  BTA_JV_FAILURE, otherwise.
    891 **
    892 *******************************************************************************/
    893 BTA_API extern tBTA_JV_STATUS BTA_JvL2capConnect(tBTA_SEC sec_mask,
    894                            tBTA_JV_ROLE role,  UINT16 remote_psm, UINT16 rx_mtu,
    895                            BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback);
    896 
    897 /*******************************************************************************
    898 **
    899 ** Function         BTA_JvL2capClose
    900 **
    901 ** Description      This function closes an L2CAP client connection
    902 **
    903 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    904 **                  BTA_JV_FAILURE, otherwise.
    905 **
    906 *******************************************************************************/
    907 BTA_API extern tBTA_JV_STATUS BTA_JvL2capClose(UINT32 handle);
    908 
    909 /*******************************************************************************
    910 **
    911 ** Function         BTA_JvL2capStartServer
    912 **
    913 ** Description      This function starts an L2CAP server and listens for an L2CAP
    914 **                  connection from a remote Bluetooth device.  When the server
    915 **                  is started successfully, tBTA_JV_L2CAP_CBACK is called with
    916 **                  BTA_JV_L2CAP_START_EVT.  When the connection is established,
    917 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT.
    918 **
    919 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    920 **                  BTA_JV_FAILURE, otherwise.
    921 **
    922 *******************************************************************************/
    923 BTA_API extern tBTA_JV_STATUS BTA_JvL2capStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
    924                            UINT16 local_psm, UINT16 rx_mtu,
    925                            tBTA_JV_L2CAP_CBACK *p_cback);
    926 
    927 /*******************************************************************************
    928 **
    929 ** Function         BTA_JvL2capStopServer
    930 **
    931 ** Description      This function stops the L2CAP server. If the server has an
    932 **                  active connection, it would be closed.
    933 **
    934 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    935 **                  BTA_JV_FAILURE, otherwise.
    936 **
    937 *******************************************************************************/
    938 BTA_API extern tBTA_JV_STATUS BTA_JvL2capStopServer(UINT16 local_psm);
    939 
    940 /*******************************************************************************
    941 **
    942 ** Function         BTA_JvL2capRead
    943 **
    944 ** Description      This function reads data from an L2CAP connection
    945 **                  When the operation is complete, tBTA_JV_L2CAP_CBACK is
    946 **                  called with BTA_JV_L2CAP_READ_EVT.
    947 **
    948 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    949 **                  BTA_JV_FAILURE, otherwise.
    950 **
    951 *******************************************************************************/
    952 BTA_API extern tBTA_JV_STATUS BTA_JvL2capRead(UINT32 handle, UINT32 req_id,
    953                                               UINT8 *p_data, UINT16 len);
    954 
    955 /*******************************************************************************
    956 **
    957 ** Function         BTA_JvL2capReceive
    958 **
    959 ** Description      This function reads data from an L2CAP connection
    960 **                  When the operation is complete, tBTA_JV_L2CAP_CBACK is
    961 **                  called with BTA_JV_L2CAP_RECEIVE_EVT.
    962 **                  If there are more data queued in L2CAP than len, the extra data will be discarded.
    963 **
    964 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    965 **                  BTA_JV_FAILURE, otherwise.
    966 **
    967 *******************************************************************************/
    968 BTA_API extern tBTA_JV_STATUS BTA_JvL2capReceive(UINT32 handle, UINT32 req_id,
    969                                               UINT8 *p_data, UINT16 len);
    970 
    971 /*******************************************************************************
    972 **
    973 ** Function         BTA_JvL2capReady
    974 **
    975 ** Description      This function determined if there is data to read from
    976 **                  an L2CAP connection
    977 **
    978 ** Returns          BTA_JV_SUCCESS, if data queue size is in *p_data_size.
    979 **                  BTA_JV_FAILURE, if error.
    980 **
    981 *******************************************************************************/
    982 BTA_API extern tBTA_JV_STATUS BTA_JvL2capReady(UINT32 handle, UINT32 *p_data_size);
    983 
    984 /*******************************************************************************
    985 **
    986 ** Function         BTA_JvL2capWrite
    987 **
    988 ** Description      This function writes data to an L2CAP connection
    989 **                  When the operation is complete, tBTA_JV_L2CAP_CBACK is
    990 **                  called with BTA_JV_L2CAP_WRITE_EVT.
    991 **
    992 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
    993 **                  BTA_JV_FAILURE, otherwise.
    994 **
    995 *******************************************************************************/
    996 BTA_API extern tBTA_JV_STATUS BTA_JvL2capWrite(UINT32 handle, UINT32 req_id,
    997                                                UINT8 *p_data, UINT16 len);
    998 
    999 /*******************************************************************************
   1000 **
   1001 ** Function         BTA_JvRfcommConnect
   1002 **
   1003 ** Description      This function makes an RFCOMM conection to a remote BD
   1004 **                  Address.
   1005 **                  When the connection is initiated or failed to initiate,
   1006 **                  tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_CL_INIT_EVT
   1007 **                  When the connection is established or failed,
   1008 **                  tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_OPEN_EVT
   1009 **
   1010 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
   1011 **                  BTA_JV_FAILURE, otherwise.
   1012 **
   1013 *******************************************************************************/
   1014 BTA_API extern tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
   1015                            tBTA_JV_ROLE role, UINT8 remote_scn, BD_ADDR peer_bd_addr,
   1016                            tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
   1017 
   1018 /*******************************************************************************
   1019 **
   1020 ** Function         BTA_JvRfcommClose
   1021 **
   1022 ** Description      This function closes an RFCOMM connection
   1023 **
   1024 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
   1025 **                  BTA_JV_FAILURE, otherwise.
   1026 **
   1027 *******************************************************************************/
   1028 BTA_API extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle);
   1029 
   1030 /*******************************************************************************
   1031 **
   1032 ** Function         BTA_JvRfcommStartServer
   1033 **
   1034 ** Description      This function starts listening for an RFCOMM connection
   1035 **                  request from a remote Bluetooth device.  When the server is
   1036 **                  started successfully, tBTA_JV_RFCOMM_CBACK is called
   1037 **                  with BTA_JV_RFCOMM_START_EVT.
   1038 **                  When the connection is established, tBTA_JV_RFCOMM_CBACK
   1039 **                  is called with BTA_JV_RFCOMM_OPEN_EVT.
   1040 **
   1041 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
   1042 **                  BTA_JV_FAILURE, otherwise.
   1043 **
   1044 *******************************************************************************/
   1045 BTA_API extern tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask,
   1046                            tBTA_JV_ROLE role, UINT8 local_scn, UINT8 max_session,
   1047                            tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
   1048 
   1049 /*******************************************************************************
   1050 **
   1051 ** Function         BTA_JvRfcommStopServer
   1052 **
   1053 ** Description      This function stops the RFCOMM server. If the server has an
   1054 **                  active connection, it would be closed.
   1055 **
   1056 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
   1057 **                  BTA_JV_FAILURE, otherwise.
   1058 **
   1059 *******************************************************************************/
   1060 BTA_API extern tBTA_JV_STATUS BTA_JvRfcommStopServer(UINT32 handle);
   1061 
   1062 /*******************************************************************************
   1063 **
   1064 ** Function         BTA_JvRfcommRead
   1065 **
   1066 ** Description      This function reads data from an RFCOMM connection
   1067 **                  When the operation is complete, tBTA_JV_RFCOMM_CBACK is
   1068 **                  called with BTA_JV_RFCOMM_READ_EVT.
   1069 **
   1070 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
   1071 **                  BTA_JV_FAILURE, otherwise.
   1072 **
   1073 *******************************************************************************/
   1074 BTA_API extern tBTA_JV_STATUS BTA_JvRfcommRead(UINT32 handle, UINT32 req_id,
   1075                                                UINT8 *p_data, UINT16 len);
   1076 
   1077 /*******************************************************************************
   1078 **
   1079 ** Function         BTA_JvRfcommReady
   1080 **
   1081 ** Description      This function determined if there is data to read from
   1082 **                  an RFCOMM connection
   1083 **
   1084 ** Returns          BTA_JV_SUCCESS, if data queue size is in *p_data_size.
   1085 **                  BTA_JV_FAILURE, if error.
   1086 **
   1087 *******************************************************************************/
   1088 BTA_API extern tBTA_JV_STATUS BTA_JvRfcommReady(UINT32 handle, UINT32 *p_data_size);
   1089 
   1090 /*******************************************************************************
   1091 **
   1092 ** Function         BTA_JvRfcommWrite
   1093 **
   1094 ** Description      This function writes data to an RFCOMM connection
   1095 **                  When the operation is complete, tBTA_JV_RFCOMM_CBACK is
   1096 **                  called with BTA_JV_RFCOMM_WRITE_EVT.
   1097 **
   1098 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
   1099 **                  BTA_JV_FAILURE, otherwise.
   1100 **
   1101 *******************************************************************************/
   1102 BTA_API extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id);
   1103 
   1104 
   1105 /*******************************************************************************
   1106 **
   1107 ** Function         BTA_JvRfcommGetPortHdl
   1108 **
   1109 ** Description    This function fetches the rfcomm port handle
   1110 **
   1111 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
   1112 **                  BTA_JV_FAILURE, otherwise.
   1113 **
   1114 *******************************************************************************/
   1115 UINT16 BTA_JvRfcommGetPortHdl(UINT32 handle);
   1116 
   1117 #ifdef __cplusplus
   1118 }
   1119 #endif
   1120 
   1121 #endif /* BTA_JV_API_H */
   1122 
   1123