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