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 "common/bt_target.h"
28 #include "stack/bt_types.h"
29 #include "bta/bta_api.h"
30 #include "stack/btm_api.h"
31 #include "stack/l2c_api.h"
32 #include "stack/rfcdefs.h"
33 #include "stack/sdp_api.h"
34 
35 #if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
36 /*****************************************************************************
37 **  Constants and data types
38 *****************************************************************************/
39 /* status values */
40 #define BTA_JV_SUCCESS             0            /* Successful operation. */
41 #define BTA_JV_FAILURE             1            /* Generic failure. */
42 #define BTA_JV_BUSY                2            /* Temporarily can not handle this request. */
43 #define BTA_JV_NO_DATA             3            /* no data. */
44 #define BTA_JV_NO_RESOURCE         4            /* No more set pm control block */
45 #define BTA_JV_ALREADY_DONE        5            /* already done, repeat the operation */
46 
47 typedef UINT8 tBTA_JV_STATUS;
48 #define BTA_JV_INTERNAL_ERR        (-1) /* internal error. */
49 
50 #define BTA_JV_MAX_UUIDS        SDP_MAX_UUID_FILTERS
51 #define BTA_JV_MAX_ATTRS        SDP_MAX_ATTR_FILTERS
52 #define BTA_JV_MAX_SDP_REC      SDP_MAX_RECORDS
53 #define BTA_JV_MAX_L2C_CONN     GAP_MAX_CONNECTIONS /* GAP handle is used as index, hence do not change this value */
54 #define BTA_JV_MAX_SCN          PORT_MAX_RFC_PORTS /* same as BTM_MAX_SCN (in btm_int.h) */
55 #define BTA_JV_MAX_RFC_CONN     MAX_RFC_PORTS
56 #define BTA_JV_MAX_CREDIT_NUM   PORT_RX_BUF_HIGH_WM
57 
58 #ifndef BTA_JV_DEF_RFC_MTU
59 #define BTA_JV_DEF_RFC_MTU      (3*330)
60 #endif
61 
62 #ifndef BTA_JV_MAX_RFC_SR_SESSION
63 #define BTA_JV_MAX_RFC_SR_SESSION   MAX_BD_CONNECTIONS
64 #endif
65 
66 /* BTA_JV_MAX_RFC_SR_SESSION can not be bigger than MAX_BD_CONNECTIONS */
67 #if (BTA_JV_MAX_RFC_SR_SESSION > MAX_BD_CONNECTIONS)
68 #undef BTA_JV_MAX_RFC_SR_SESSION
69 #define BTA_JV_MAX_RFC_SR_SESSION   MAX_BD_CONNECTIONS
70 #endif
71 
72 #define BTA_JV_FIRST_SERVICE_ID BTA_FIRST_JV_SERVICE_ID
73 #define BTA_JV_LAST_SERVICE_ID  BTA_LAST_JV_SERVICE_ID
74 #define BTA_JV_NUM_SERVICE_ID   (BTA_LAST_JV_SERVICE_ID - BTA_FIRST_JV_SERVICE_ID + 1)
75 
76 /* Discoverable modes */
77 enum {
78     BTA_JV_DISC_NONE,
79     BTA_JV_DISC_LIMITED,
80     BTA_JV_DISC_GENERAL
81 };
82 typedef UINT16 tBTA_JV_DISC;
83 
84 #define BTA_JV_ROLE_SLAVE       BTM_ROLE_SLAVE
85 #define BTA_JV_ROLE_MASTER      BTM_ROLE_MASTER
86 typedef UINT32 tBTA_JV_ROLE;
87 
88 #define BTA_JV_SERVICE_LMTD_DISCOVER    BTM_COD_SERVICE_LMTD_DISCOVER   /* 0x0020 */
89 #define BTA_JV_SERVICE_POSITIONING      BTM_COD_SERVICE_POSITIONING     /* 0x0100 */
90 #define BTA_JV_SERVICE_NETWORKING       BTM_COD_SERVICE_NETWORKING      /* 0x0200 */
91 #define BTA_JV_SERVICE_RENDERING        BTM_COD_SERVICE_RENDERING       /* 0x0400 */
92 #define BTA_JV_SERVICE_CAPTURING        BTM_COD_SERVICE_CAPTURING       /* 0x0800 */
93 #define BTA_JV_SERVICE_OBJ_TRANSFER     BTM_COD_SERVICE_OBJ_TRANSFER    /* 0x1000 */
94 #define BTA_JV_SERVICE_AUDIO            BTM_COD_SERVICE_AUDIO           /* 0x2000 */
95 #define BTA_JV_SERVICE_TELEPHONY        BTM_COD_SERVICE_TELEPHONY       /* 0x4000 */
96 #define BTA_JV_SERVICE_INFORMATION      BTM_COD_SERVICE_INFORMATION     /* 0x8000 */
97 
98 /* JV ID type */
99 #define BTA_JV_PM_ID_1             1    /* PM example profile 1 */
100 #define BTA_JV_PM_ID_2             2    /* PM example profile 2 */
101 #define BTA_JV_PM_ID_CLEAR         0    /* Special JV ID used to clear PM profile */
102 #define BTA_JV_PM_ALL              0xFF /* Generic match all id, see bta_dm_cfg.c */
103 typedef UINT8 tBTA_JV_PM_ID;
104 
105 #define BTA_JV_PM_HANDLE_CLEAR     0xFF /* Special JV ID used to clear PM profile  */
106 
107 /* define maximum number of registered PM entities. should be in sync with bta pm! */
108 #ifndef BTA_JV_PM_MAX_NUM
109 #define BTA_JV_PM_MAX_NUM 5
110 #endif
111 
112 /* JV pm connection states */
113 enum {
114     BTA_JV_CONN_OPEN = 0,   /* Connection opened state */
115     BTA_JV_CONN_CLOSE,      /* Connection closed state */
116     BTA_JV_APP_OPEN,        /* JV Application opened state */
117     BTA_JV_APP_CLOSE,       /* JV Application closed state */
118     BTA_JV_SCO_OPEN,        /* SCO connection opened state */
119     BTA_JV_SCO_CLOSE,       /* SCO connection opened state */
120     BTA_JV_CONN_IDLE,       /* Connection idle state */
121     BTA_JV_CONN_BUSY,       /* Connection busy state */
122     BTA_JV_MAX_CONN_STATE   /* Max number of connection state */
123 };
124 typedef UINT8 tBTA_JV_CONN_STATE;
125 
126 /* JV Connection types */
127 #define BTA_JV_CONN_TYPE_RFCOMM    0
128 #define BTA_JV_CONN_TYPE_L2CAP     1
129 #define BTA_JV_CONN_TYPE_L2CAP_LE  2
130 
131 /* Java I/F callback events */
132 /* events received by tBTA_JV_DM_CBACK */
133 #define BTA_JV_ENABLE_EVT           0  /* JV enabled */
134 #define BTA_JV_DISABLE_EVT          1  /* JV disabled */
135 #define BTA_JV_GET_SCN_EVT          6  /* Reserved an SCN */
136 #define BTA_JV_GET_PSM_EVT          7  /* Reserved a PSM */
137 #define BTA_JV_DISCOVERY_COMP_EVT   8  /* SDP discovery complete */
138 #define BTA_JV_CREATE_RECORD_EVT    11 /* the result for BTA_JvCreateRecord */
139 
140 /* events received by tBTA_JV_L2CAP_CBACK */
141 #if BTA_JV_L2CAP_INCLUDED
142 #define BTA_JV_L2CAP_OPEN_EVT       16 /* open status of L2CAP connection */
143 #define BTA_JV_L2CAP_CLOSE_EVT      17 /* L2CAP connection closed */
144 #define BTA_JV_L2CAP_START_EVT      18 /* L2CAP server started */
145 #define BTA_JV_L2CAP_CL_INIT_EVT    19 /* L2CAP client initiated a connection */
146 #define BTA_JV_L2CAP_DATA_IND_EVT   20 /* L2CAP connection received data */
147 #define BTA_JV_L2CAP_CONG_EVT       21 /* L2CAP connection congestion status changed */
148 #define BTA_JV_L2CAP_READ_EVT       22 /* the result for BTA_JvL2capRead */
149 #define BTA_JV_L2CAP_RECEIVE_EVT    23 /* the result for BTA_JvL2capReceive*/
150 #define BTA_JV_L2CAP_WRITE_EVT      24 /* the result for BTA_JvL2capWrite*/
151 #define BTA_JV_L2CAP_WRITE_FIXED_EVT 25 /* the result for BTA_JvL2capWriteFixed */
152 #endif /* BTA_JV_L2CAP_INCLUDED */
153 
154 /* events received by tBTA_JV_RFCOMM_CBACK */
155 #if BTA_JV_RFCOMM_INCLUDED
156 #define BTA_JV_RFCOMM_OPEN_EVT      26 /* open status of RFCOMM Client connection */
157 #define BTA_JV_RFCOMM_CLOSE_EVT     27 /* RFCOMM connection closed */
158 #define BTA_JV_RFCOMM_START_EVT     28 /* RFCOMM server started */
159 #define BTA_JV_RFCOMM_CL_INIT_EVT   29 /* RFCOMM client initiated a connection */
160 #define BTA_JV_RFCOMM_DATA_IND_EVT  30 /* RFCOMM connection received data */
161 #define BTA_JV_RFCOMM_CONG_EVT      31 /* RFCOMM connection congestion status changed */
162 #define BTA_JV_RFCOMM_READ_EVT      32 /* the result for BTA_JvRfcommRead */
163 #define BTA_JV_RFCOMM_WRITE_EVT     33 /* the result for BTA_JvRfcommWrite*/
164 #define BTA_JV_RFCOMM_SRV_OPEN_EVT  34 /* open status of Server RFCOMM connection */
165 #endif /* BTA_JV_RFCOMM_INCLUDED */
166 #define BTA_JV_FREE_SCN_EVT         35 /* FREE an SCN */
167 #define BTA_JV_MAX_EVT              36 /* max number of JV events */
168 
169 typedef UINT16 tBTA_JV_EVT;
170 
171 /* data associated with BTA_JV_SET_DISCOVER_EVT */
172 typedef struct {
173     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
174     tBTA_JV_DISC    disc_mode;  /* The current discoverable mode */
175 } tBTA_JV_SET_DISCOVER;
176 
177 /* data associated with BTA_JV_DISCOVERY_COMP_EVT_ */
178 typedef struct {
179     tBTA_JV_STATUS status;                    /* Whether the operation succeeded or failed. */
180     UINT8 scn_num;                            /* num of channel */
181     UINT8 scn[BTA_JV_MAX_SCN];                /* channel # */
182     const char *service_name[BTA_JV_MAX_SCN]; /* service_name */
183 } tBTA_JV_DISCOVERY_COMP;
184 
185 /* data associated with BTA_JV_CREATE_RECORD_EVT */
186 typedef struct {
187     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
188     UINT32          handle;     /* The SDP handle */
189 } tBTA_JV_CREATE_RECORD;
190 
191 #if BTA_JV_L2CAP_INCLUDED
192 /* data associated with BTA_JV_L2CAP_OPEN_EVT */
193 typedef struct {
194     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
195     UINT32          handle;     /* The connection handle */
196     BD_ADDR         rem_bda;    /* The peer address */
197     INT32           tx_mtu;     /* The transmit MTU */
198 } tBTA_JV_L2CAP_OPEN;
199 
200 /* data associated with BTA_JV_L2CAP_CLOSE_EVT */
201 typedef struct {
202     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
203     UINT32          handle;     /* The connection handle */
204     BOOLEAN         async;      /* FALSE, if local initiates disconnect */
205     void *          user_data;  /* piggyback caller's private data */
206 } tBTA_JV_L2CAP_CLOSE;
207 
208 /* data associated with BTA_JV_L2CAP_START_EVT */
209 typedef struct {
210     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
211     UINT32          handle;     /* The connection handle */
212     UINT8           sec_id;     /* security ID used by this server */
213 } tBTA_JV_L2CAP_START;
214 
215 /* data associated with BTA_JV_L2CAP_CL_INIT_EVT */
216 typedef struct {
217     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
218     UINT32          handle;     /* The connection handle */
219     UINT8           sec_id;     /* security ID used by this client */
220 } tBTA_JV_L2CAP_CL_INIT;
221 
222 /* data associated with BTA_JV_L2CAP_CONG_EVT */
223 typedef struct {
224     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
225     UINT32          handle;     /* The connection handle */
226     BOOLEAN         cong;       /* TRUE, congested. FALSE, uncongested */
227 } tBTA_JV_L2CAP_CONG;
228 
229 /* data associated with BTA_JV_L2CAP_READ_EVT */
230 typedef struct {
231     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
232     UINT32          handle;     /* The connection handle */
233     UINT32          req_id;     /* The req_id in the associated BTA_JvL2capRead() */
234     UINT8           *p_data;    /* This points the same location as the p_data
235                                  * parameter in BTA_JvL2capRead () */
236     UINT16          len;        /* The length of the data read. */
237 } tBTA_JV_L2CAP_READ;
238 
239 /* data associated with BTA_JV_L2CAP_RECEIVE_EVT */
240 typedef struct {
241     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
242     UINT32          handle;     /* The connection handle */
243     UINT32          req_id;     /* The req_id in the associated BTA_JvL2capReceive() */
244     UINT8           *p_data;    /* This points the same location as the p_data
245                                  * parameter in BTA_JvL2capReceive () */
246     UINT16          len;        /* The length of the data read. */
247 } tBTA_JV_L2CAP_RECEIVE;
248 
249 /* data associated with BTA_JV_L2CAP_WRITE_EVT */
250 typedef struct {
251     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
252     UINT32          handle;     /* The connection handle */
253     UINT32          req_id;     /* The req_id in the associated BTA_JvL2capWrite() */
254     UINT16          len;        /* The length of the data written. */
255     BOOLEAN         cong;       /* congestion status */
256 } tBTA_JV_L2CAP_WRITE;
257 
258 /* data associated with BTA_JV_L2CAP_OPEN_EVT for LE sockets */
259 typedef struct {
260     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
261     UINT32          handle;     /* The connection handle */
262     BD_ADDR         rem_bda;    /* The peer address */
263     INT32           tx_mtu;     /* The transmit MTU */
264     void          **p_p_cback;  /* set them for new socket */
265     void          **p_user_data;/* set them for new socket */
266 
267 } tBTA_JV_L2CAP_LE_OPEN;
268 
269 /*data associated with BTA_JV_L2CAP_DATA_IND_EVT if used for LE */
270 typedef struct {
271     UINT32          handle;     /* The connection handle */
272     BT_HDR         *p_buf;      /* The incoming data */
273 } tBTA_JV_LE_DATA_IND;
274 
275 /* data associated with BTA_JV_L2CAP_WRITE_FIXED_EVT */
276 typedef struct {
277     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
278     UINT16          channel;    /* The connection channel */
279     BD_ADDR         addr;       /* The peer address */
280     UINT32          req_id;     /* The req_id in the associated BTA_JvL2capWrite() */
281     UINT16          len;        /* The length of the data written. */
282     BOOLEAN         cong;       /* congestion status */
283 } tBTA_JV_L2CAP_WRITE_FIXED;
284 #endif /* BTA_JV_L2CAP_INCLUDED */
285 
286 #if BTA_JV_RFCOMM_INCLUDED
287 /* data associated with BTA_JV_RFCOMM_OPEN_EVT */
288 typedef struct {
289     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
290     UINT16          peer_mtu;   /* Max MTU that port can send */
291     UINT32          handle;     /* The connection handle */
292     BD_ADDR         rem_bda;    /* The peer address */
293 } tBTA_JV_RFCOMM_OPEN;
294 
295 /* data associated with BTA_JV_RFCOMM_SRV_OPEN_EVT */
296 typedef struct {
297     tBTA_JV_STATUS  status;             /* Whether the operation succeeded or failed. */
298     UINT16          peer_mtu;           /* Max MTU that port can send */
299     UINT32          handle;             /* The connection handle */
300     UINT32          new_listen_handle;  /* The new listen handle */
301     BD_ADDR         rem_bda;            /* The peer address */
302 } tBTA_JV_RFCOMM_SRV_OPEN;
303 
304 /* data associated with BTA_JV_RFCOMM_CLOSE_EVT */
305 typedef struct {
306     tBTA_JV_STATUS  status;      /* Whether the operation succeeded or failed. */
307     UINT32          port_status; /* PORT status */
308     UINT32          handle;      /* The connection handle */
309     BOOLEAN         async;       /* FALSE, if local initiates disconnect */
310     void *          user_data;   /* piggyback caller's private data */
311 } tBTA_JV_RFCOMM_CLOSE;
312 
313 /* data associated with BTA_JV_RFCOMM_START_EVT */
314 typedef struct {
315     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
316     UINT32          handle;     /* The connection handle */
317     UINT8           sec_id;     /* security ID used by this server */
318     UINT8           scn;        /* Server channe number */
319     BOOLEAN         use_co;     /* TRUE to use co_rfc_data */
320 } tBTA_JV_RFCOMM_START;
321 
322 /* data associated with BTA_JV_RFCOMM_CL_INIT_EVT */
323 typedef struct {
324     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
325     UINT32          handle;     /* The connection handle */
326     UINT8           sec_id;     /* security ID used by this client */
327     BOOLEAN         use_co;     /* TRUE to use co_rfc_data */
328 } tBTA_JV_RFCOMM_CL_INIT;
329 
330 /* data associated with BTA_JV_RFCOMM_CONG_EVT */
331 typedef struct {
332     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
333     UINT32          handle;     /* The connection handle */
334     BOOLEAN         cong;       /* TRUE, congested. FALSE, uncongested */
335 } tBTA_JV_RFCOMM_CONG;
336 
337 /* data associated with BTA_JV_RFCOMM_READ_EVT */
338 typedef struct {
339     tBTA_JV_STATUS  status;     /* Whether the operation succeeded or failed. */
340     UINT32          handle;     /* The connection handle */
341     UINT32          req_id;     /* The req_id in the associated BTA_JvRfcommRead() */
342     UINT8           *p_data;    /* This points the same location as the p_data
343                                  * parameter in BTA_JvRfcommRead () */
344     UINT16          len;        /* The length of the data read. */
345 } tBTA_JV_RFCOMM_READ;
346 
347 /* data associated with BTA_JV_RFCOMM_WRITE_EVT */
348 typedef struct {
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_JvRfcommWrite() */
352     int             len;        /* The length of the data written. */
353     BOOLEAN         cong;       /* congestion status */
354     BOOLEAN         old_cong;   /* congestion status */
355 } tBTA_JV_RFCOMM_WRITE;
356 #endif /* BTA_JV_RFCOMM_INCLUDED */
357 
358 /*data associated with BTA_JV_L2CAP_DATA_IND_EVT & BTA_JV_RFCOMM_DATA_IND_EVT */
359 typedef struct {
360     UINT32          handle;     /* The connection handle */
361     BT_HDR         *p_buf;      /* The incoming data */
362 } tBTA_JV_DATA_IND;
363 
364 /* data associated with BTA_JV_API_SET_PM_PROFILE_EVT */
365 typedef struct {
366     tBTA_JV_STATUS  status;     /* Status of the operation */
367     UINT32          handle;     /* Connection handle */
368     tBTA_JV_PM_ID   app_id;      /* JV app ID */
369 } tBTA_JV_SET_PM_PROFILE;
370 
371 /* data associated with BTA_JV_API_NOTIFY_PM_STATE_CHANGE_EVT */
372 typedef struct {
373     UINT32          handle;     /* Connection handle */
374     tBTA_JV_CONN_STATE  state;  /* JV connection stata */
375 } tBTA_JV_NOTIFY_PM_STATE_CHANGE;
376 
377 /* indicate server at which status */
378 typedef enum {
379     BTA_JV_SERVER_START_FAILED,
380     BTA_JV_SERVER_RUNNING,
381     BTA_JV_SERVER_STATUS_MAX,
382 } tBTA_JV_SERVER_STATUS;
383 
384 typedef struct {
385     tBTA_JV_SERVER_STATUS   server_status;
386     UINT32                  slot_id;
387 }tBTA_JV_FREE_SCN_USER_DATA;
388 
389 /* data associated with BTA_JV_FREE_SCN_EVT  */
390 typedef struct {
391     tBTA_JV_STATUS          status;         /* Status of the operation */
392     tBTA_JV_SERVER_STATUS   server_status;  /* Server status */
393     UINT8                   scn;            /* Server channe number */
394 } tBTA_JV_FREE_SCN;
395 
396 
397 /* union of data associated with JV callback */
398 typedef union {
399     tBTA_JV_STATUS          status;         /* BTA_JV_ENABLE_EVT */
400     tBTA_JV_DISCOVERY_COMP  disc_comp;      /* BTA_JV_DISCOVERY_COMP_EVT */
401     tBTA_JV_SET_DISCOVER    set_discover;   /* BTA_JV_SET_DISCOVER_EVT */
402     UINT8                   scn;            /* BTA_JV_GET_SCN_EVT */
403     UINT16                  psm;            /* BTA_JV_GET_PSM_EVT */
404     tBTA_JV_CREATE_RECORD   create_rec;     /* BTA_JV_CREATE_RECORD_EVT */
405 #if BTA_JV_L2CAP_INCLUDED
406     tBTA_JV_L2CAP_OPEN      l2c_open;       /* BTA_JV_L2CAP_OPEN_EVT */
407     tBTA_JV_L2CAP_CLOSE     l2c_close;      /* BTA_JV_L2CAP_CLOSE_EVT */
408     tBTA_JV_L2CAP_START     l2c_start;      /* BTA_JV_L2CAP_START_EVT */
409     tBTA_JV_L2CAP_CL_INIT   l2c_cl_init;    /* BTA_JV_L2CAP_CL_INIT_EVT */
410     tBTA_JV_L2CAP_CONG      l2c_cong;       /* BTA_JV_L2CAP_CONG_EVT */
411     tBTA_JV_L2CAP_READ      l2c_read;       /* BTA_JV_L2CAP_READ_EVT */
412     tBTA_JV_L2CAP_WRITE     l2c_write;      /* BTA_JV_L2CAP_WRITE_EVT */
413 #endif /* BTA_JV_L2CAP_INCLUDED */
414 #if BTA_JV_RFCOMM_INCLUDED
415     tBTA_JV_RFCOMM_OPEN     rfc_open;       /* BTA_JV_RFCOMM_OPEN_EVT */
416     tBTA_JV_RFCOMM_SRV_OPEN rfc_srv_open;   /* BTA_JV_RFCOMM_SRV_OPEN_EVT */
417     tBTA_JV_RFCOMM_CLOSE    rfc_close;      /* BTA_JV_RFCOMM_CLOSE_EVT */
418     tBTA_JV_RFCOMM_START    rfc_start;      /* BTA_JV_RFCOMM_START_EVT */
419     tBTA_JV_RFCOMM_CL_INIT  rfc_cl_init;    /* BTA_JV_RFCOMM_CL_INIT_EVT */
420     tBTA_JV_RFCOMM_CONG     rfc_cong;       /* BTA_JV_RFCOMM_CONG_EVT */
421     tBTA_JV_RFCOMM_READ     rfc_read;       /* BTA_JV_RFCOMM_READ_EVT */
422     tBTA_JV_RFCOMM_WRITE    rfc_write;      /* BTA_JV_RFCOMM_WRITE_EVT */
423 #endif /* BTA_JV_RFCOMM_INCLUDED */
424     tBTA_JV_DATA_IND        data_ind;       /* BTA_JV_L2CAP_DATA_IND_EVT
425                                                BTA_JV_RFCOMM_DATA_IND_EVT */
426     tBTA_JV_FREE_SCN        free_scn;       /* BTA_JV_FREE_SCN_EVT */
427 #if BTA_JV_L2CAP_INCLUDED
428     tBTA_JV_L2CAP_LE_OPEN      l2c_le_open;     /* BTA_JV_L2CAP_OPEN_EVT */
429     tBTA_JV_LE_DATA_IND        le_data_ind;     /* BTA_JV_L2CAP_LE_DATA_IND_EVT */
430     tBTA_JV_L2CAP_WRITE_FIXED  l2c_write_fixed; /* BTA_JV_L2CAP_WRITE_FIXED_EVT */
431 #endif /* BTA_JV_L2CAP_INCLUDED */
432 } tBTA_JV;
433 
434 /* JAVA DM Interface callback */
435 typedef void (tBTA_JV_DM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data);
436 
437 /* JAVA RFCOMM interface callback */
438 typedef void *(tBTA_JV_RFCOMM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data);
439 
440 #if BTA_JV_L2CAP_INCLUDED
441 /* JAVA L2CAP interface callback */
442 typedef void *(tBTA_JV_L2CAP_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_Data);
443 #endif /* BTA_JV_L2CAP_INCLUDED */
444 
445 /* JV configuration structure */
446 typedef struct {
447     UINT16  sdp_raw_size;           /* The size of p_sdp_raw_data */
448     UINT16  sdp_db_size;            /* The size of p_sdp_db */
449     UINT8   *p_sdp_raw_data;        /* The data buffer to keep raw data */
450     tSDP_DISCOVERY_DB   *p_sdp_db;  /* The data buffer to keep SDP database */
451 } tBTA_JV_CFG;
452 
453 /*******************************************************************************
454 **
455 ** Function         BTA_JvEnable
456 **
457 ** Description      Enable the Java I/F service. When the enable
458 **                  operation is complete the callback function will be
459 **                  called with a BTA_JV_ENABLE_EVT. This function must
460 **                  be called before other functions in the JV API are
461 **                  called.
462 **
463 ** Returns          BTA_JV_SUCCESS if successful.
464 **                  BTA_JV_FAIL if internal failure.
465 **
466 *******************************************************************************/
467 extern tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback);
468 
469 /*******************************************************************************
470 **
471 ** Function         BTA_JvDisable
472 **
473 ** Description      Disable the Java I/F. When the enable
474 **                  operation is complete the callback function will be
475 **                  called with a BTA_JV_DISABLE_EVT.
476 **
477 ** Returns          void
478 **
479 *******************************************************************************/
480 extern void BTA_JvDisable(tBTA_JV_RFCOMM_CBACK *p_cback);
481 
482 /*******************************************************************************
483 **
484 ** Function         BTA_JvFree
485 **
486 ** Description      Free JV configuration
487 **
488 ** Returns          void
489 **
490 *******************************************************************************/
491 extern void BTA_JvFree(void);
492 
493 /*******************************************************************************
494 **
495 ** Function         BTA_JvIsEnable
496 **
497 ** Description      Get the JV registration status.
498 **
499 ** Returns          TRUE, if registered
500 **
501 *******************************************************************************/
502 extern BOOLEAN BTA_JvIsEnable(void);
503 
504 /*******************************************************************************
505 **
506 ** Function         BTA_JvIsEncrypted
507 **
508 ** Description      This function checks if the link to peer device is encrypted
509 **
510 ** Returns          TRUE if encrypted.
511 **                  FALSE if not.
512 **
513 *******************************************************************************/
514 extern BOOLEAN BTA_JvIsEncrypted(BD_ADDR bd_addr);
515 
516 /*******************************************************************************
517 **
518 ** Function         BTA_JvGetChannelId
519 **
520 ** Description      This function reserves a SCN/PSM for applications running
521 **                  over RFCOMM or L2CAP. It is primarily called by
522 **                  server profiles/applications to register their SCN/PSM into the
523 **                  SDP database. The SCN is reported by the tBTA_JV_DM_CBACK
524 **                  callback with a BTA_JV_GET_SCN_EVT.
525 **                  If the SCN/PSM reported is 0, that means all SCN resources are
526 **                  exhausted.
527 **                  The channel parameter can be used to request a specific
528 **                  channel. If the request on the specific channel fails, the
529 **                  SCN/PSM returned in the EVT will be 0 - no attempt to request
530 **                  a new channel will be made. set channel to <= 0 to automatically
531 **                  assign an channel ID.
532 **
533 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
534 **                  BTA_JV_FAILURE, otherwise.
535 **
536 *******************************************************************************/
537 extern tBTA_JV_STATUS BTA_JvGetChannelId(int conn_type, void *user_data,
538         INT32 channel);
539 
540 /*******************************************************************************
541 **
542 ** Function         BTA_JvFreeChannel
543 **
544 ** Description      This function frees a SCN/PSM that was used
545 **                  by an application running over RFCOMM or L2CAP.
546 ** Parameters
547 **   channel        The channel to free
548 **   conn_type      one of BTA_JV_CONN_TYPE_
549 **   p_cback        tBTA_JV_RFCOMM_CBACK is called with BTA_JV_FREE_SCN_EVT when server frees a SCN/PSM
550 **   user_data      indicate the RFCOMM server status
551 **
552 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
553 **                  BTA_JV_FAILURE, otherwise.
554 **
555 *******************************************************************************/
556 extern tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
557 
558 /*******************************************************************************
559 **
560 ** Function         BTA_JvStartDiscovery
561 **
562 ** Description      This function performs service discovery for the services
563 **                  provided by the given peer device. When the operation is
564 **                  complete the tBTA_JV_DM_CBACK callback function will be
565 **                  called with a BTA_JV_DISCOVERY_COMP_EVT.
566 **
567 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
568 **                  BTA_JV_FAILURE, otherwise.
569 **
570 *******************************************************************************/
571 extern tBTA_JV_STATUS BTA_JvStartDiscovery(BD_ADDR bd_addr, UINT16 num_uuid,
572         tSDP_UUID *p_uuid_list, void *user_data);
573 
574 /*******************************************************************************
575 **
576 ** Function         BTA_JvCreateRecordByUser
577 **
578 ** Description      Create a service record in the local SDP database by user in
579 **                  tBTA_JV_DM_CBACK callback with a BTA_JV_CREATE_RECORD_EVT.
580 **
581 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
582 **                  BTA_JV_FAILURE, otherwise.
583 **
584 *******************************************************************************/
585 extern tBTA_JV_STATUS BTA_JvCreateRecordByUser(const char *name, UINT32 channel, void *user_data);
586 
587 /*******************************************************************************
588 **
589 ** Function         BTA_JvDeleteRecord
590 **
591 ** Description      Delete a service record in the local SDP database.
592 **
593 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
594 **                  BTA_JV_FAILURE, otherwise.
595 **
596 *******************************************************************************/
597 extern tBTA_JV_STATUS BTA_JvDeleteRecord(UINT32 handle);
598 
599 #if BTA_JV_L2CAP_INCLUDED
600 /*******************************************************************************
601 **
602 ** Function         BTA_JvL2capConnectLE
603 **
604 ** Description      Initiate a connection as an LE L2CAP client to the given BD
605 **                  Address.
606 **                  When the connection is initiated or failed to initiate,
607 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_CL_INIT_EVT
608 **                  When the connection is established or failed,
609 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT
610 **
611 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
612 **                  BTA_JV_FAILURE, otherwise.
613 **
614 *******************************************************************************/
615 extern tBTA_JV_STATUS BTA_JvL2capConnectLE(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
616         const tL2CAP_ERTM_INFO *ertm_info, UINT16 remote_chan,
617         UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
618         BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
619 
620 /*******************************************************************************
621 **
622 ** Function         BTA_JvL2capConnect
623 **
624 ** Description      Initiate a connection as a L2CAP client to the given BD
625 **                  Address.
626 **                  When the connection is initiated or failed to initiate,
627 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_CL_INIT_EVT
628 **                  When the connection is established or failed,
629 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT
630 **
631 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
632 **                  BTA_JV_FAILURE, otherwise.
633 **
634 *******************************************************************************/
635 extern tBTA_JV_STATUS BTA_JvL2capConnect(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
636         const tL2CAP_ERTM_INFO *ertm_info, UINT16 remote_psm,
637         UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
638         BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
639 
640 /*******************************************************************************
641 **
642 ** Function         BTA_JvL2capClose
643 **
644 ** Description      This function closes an L2CAP client connection
645 **
646 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
647 **                  BTA_JV_FAILURE, otherwise.
648 **
649 *******************************************************************************/
650 extern tBTA_JV_STATUS BTA_JvL2capClose(UINT32 handle, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
651 
652 /*******************************************************************************
653 **
654 ** Function         BTA_JvL2capCloseLE
655 **
656 ** Description      This function closes an L2CAP client connection for Fixed Channels
657 **                  Function is idempotent and no callbacks are called!
658 **
659 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
660 **                  BTA_JV_FAILURE, otherwise.
661 **
662 *******************************************************************************/
663 extern tBTA_JV_STATUS BTA_JvL2capCloseLE(UINT32 handle);
664 
665 /*******************************************************************************
666 **
667 ** Function         BTA_JvL2capStartServer
668 **
669 ** Description      This function starts an L2CAP server and listens for an L2CAP
670 **                  connection from a remote Bluetooth device.  When the server
671 **                  is started successfully, tBTA_JV_L2CAP_CBACK is called with
672 **                  BTA_JV_L2CAP_START_EVT.  When the connection is established,
673 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT.
674 **
675 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
676 **                  BTA_JV_FAILURE, otherwise.
677 **
678 *******************************************************************************/
679 extern tBTA_JV_STATUS BTA_JvL2capStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
680         const tL2CAP_ERTM_INFO *ertm_info,
681         UINT16 local_psm, UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
682         tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
683 
684 /*******************************************************************************
685 **
686 ** Function         BTA_JvL2capStartServerLE
687 **
688 ** Description      This function starts an LE L2CAP server and listens for an L2CAP
689 **                  connection from a remote Bluetooth device on a fixed channel
690 **                  over an LE link.  When the server
691 **                  is started successfully, tBTA_JV_L2CAP_CBACK is called with
692 **                  BTA_JV_L2CAP_START_EVT.  When the connection is established,
693 **                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT.
694 **
695 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
696 **                  BTA_JV_FAILURE, otherwise.
697 **
698 *******************************************************************************/
699 extern tBTA_JV_STATUS BTA_JvL2capStartServerLE(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
700         const tL2CAP_ERTM_INFO *ertm_info,
701         UINT16 local_chan, UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
702         tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
703 
704 /*******************************************************************************
705 **
706 ** Function         BTA_JvL2capStopServerLE
707 **
708 ** Description      This function stops the LE L2CAP server. If the server has an
709 **                  active connection, it would be closed.
710 **
711 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
712 **                  BTA_JV_FAILURE, otherwise.
713 **
714 *******************************************************************************/
715 extern tBTA_JV_STATUS BTA_JvL2capStopServerLE(UINT16 local_chan, void *user_data);
716 
717 /*******************************************************************************
718 **
719 ** Function         BTA_JvL2capStopServerLE
720 **
721 ** Description      This function stops the LE L2CAP server. If the server has an
722 **                  active connection, it would be closed.
723 **
724 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
725 **                  BTA_JV_FAILURE, otherwise.
726 **
727 *******************************************************************************/
728 extern tBTA_JV_STATUS BTA_JvL2capStopServer(UINT16 local_psm, void *user_data);
729 
730 /*******************************************************************************
731 **
732 ** Function         BTA_JvL2capRead
733 **
734 ** Description      This function reads data from an L2CAP connection
735 **                  When the operation is complete, tBTA_JV_L2CAP_CBACK is
736 **                  called with BTA_JV_L2CAP_READ_EVT.
737 **
738 ** Returns          Length of read data.
739 **
740 *******************************************************************************/
741 extern int BTA_JvL2capRead(UINT32 handle, UINT32 req_id, UINT8 *p_data, UINT16 len);
742 
743 /*******************************************************************************
744 **
745 ** Function         BTA_JvL2capReceive
746 **
747 ** Description      This function reads data from an L2CAP connection
748 **                  When the operation is complete, tBTA_JV_L2CAP_CBACK is
749 **                  called with BTA_JV_L2CAP_RECEIVE_EVT.
750 **                  If there are more data queued in L2CAP than len, the extra data will be discarded.
751 **
752 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
753 **                  BTA_JV_FAILURE, otherwise.
754 **
755 *******************************************************************************/
756 extern tBTA_JV_STATUS BTA_JvL2capReceive(UINT32 handle, UINT32 req_id,
757         UINT8 *p_data, UINT16 len);
758 
759 /*******************************************************************************
760 **
761 ** Function         BTA_JvL2capReady
762 **
763 ** Description      This function determined if there is data to read from
764 **                  an L2CAP connection
765 **
766 ** Returns          BTA_JV_SUCCESS, if data queue size is in *p_data_size.
767 **                  BTA_JV_FAILURE, if error.
768 **
769 *******************************************************************************/
770 extern tBTA_JV_STATUS BTA_JvL2capReady(UINT32 handle, UINT32 *p_data_size);
771 
772 /*******************************************************************************
773 **
774 ** Function         BTA_JvL2capWrite
775 **
776 ** Description      This function writes data to an L2CAP connection
777 **                  When the operation is complete, tBTA_JV_L2CAP_CBACK is
778 **                  called with BTA_JV_L2CAP_WRITE_EVT. Works for
779 **                  PSM-based connections
780 **
781 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
782 **                  BTA_JV_FAILURE, otherwise.
783 **
784 *******************************************************************************/
785 extern tBTA_JV_STATUS BTA_JvL2capWrite(UINT32 handle, UINT32 req_id,
786                                        UINT8 *p_data, UINT16 len, void *user_data);
787 
788 
789 /*******************************************************************************
790 **
791 ** Function         BTA_JvL2capWriteFixed
792 **
793 ** Description      This function writes data to an L2CAP connection
794 **                  When the operation is complete, tBTA_JV_L2CAP_CBACK is
795 **                  called with BTA_JV_L2CAP_WRITE_FIXED_EVT. Works for
796 **                  fixed-channel connections
797 **
798 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
799 **                  BTA_JV_FAILURE, otherwise.
800 **
801 *******************************************************************************/
802 extern tBTA_JV_STATUS BTA_JvL2capWriteFixed(UINT16 channel, BD_ADDR *addr, UINT32 req_id,
803         tBTA_JV_L2CAP_CBACK *p_cback,
804         UINT8 *p_data, UINT16 len, void *user_data);
805 #endif /* BTA_JV_L2CAP_INCLUDED */
806 
807 #if BTA_JV_RFCOMM_INCLUDED
808 /*******************************************************************************
809 **
810 ** Function         BTA_JvRfcommConfig
811 **
812 ** Description      This function is to configure RFCOMM.
813 **
814 **
815 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
816 **                  BTA_JV_FAILURE, otherwise.
817 **
818 *******************************************************************************/
819 extern tBTA_JV_STATUS BTA_JvRfcommConfig(BOOLEAN enable_l2cap_ertm);
820 
821 /*******************************************************************************
822 **
823 ** Function         BTA_JvRfcommConnect
824 **
825 ** Description      This function makes an RFCOMM conection to a remote BD
826 **                  Address.
827 **                  When the connection is initiated or failed to initiate,
828 **                  tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_CL_INIT_EVT
829 **                  When the connection is established or failed,
830 **                  tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_OPEN_EVT
831 **
832 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
833 **                  BTA_JV_FAILURE, otherwise.
834 **
835 *******************************************************************************/
836 extern tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
837         tBTA_JV_ROLE role, UINT8 remote_scn, BD_ADDR peer_bd_addr,
838         tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
839 
840 /*******************************************************************************
841 **
842 ** Function         BTA_JvRfcommClose
843 **
844 ** Description      This function closes an RFCOMM connection
845 **
846 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
847 **                  BTA_JV_FAILURE, otherwise.
848 **
849 *******************************************************************************/
850 extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data);
851 
852 /*******************************************************************************
853 **
854 ** Function         BTA_JvRfcommStartServer
855 **
856 ** Description      This function starts listening for an RFCOMM connection
857 **                  request from a remote Bluetooth device.  When the server is
858 **                  started successfully, tBTA_JV_RFCOMM_CBACK is called
859 **                  with BTA_JV_RFCOMM_START_EVT.
860 **                  When the connection is established, tBTA_JV_RFCOMM_CBACK
861 **                  is called with BTA_JV_RFCOMM_OPEN_EVT.
862 **
863 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
864 **                  BTA_JV_FAILURE, otherwise.
865 **
866 *******************************************************************************/
867 extern tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
868                                               UINT8 local_scn, UINT8 max_session,
869                                               tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
870 
871 /*******************************************************************************
872 **
873 ** Function         BTA_JvRfcommStopServer
874 **
875 ** Description      This function stops the RFCOMM server. If the server has an
876 **                  active connection, it would be closed.
877 **
878 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
879 **                  BTA_JV_FAILURE, otherwise.
880 **
881 *******************************************************************************/
882 extern tBTA_JV_STATUS BTA_JvRfcommStopServer(UINT32 handle, void *user_data);
883 
884 /*******************************************************************************
885 **
886 ** Function         BTA_JvRfcommRead
887 **
888 ** Description      This function reads data from an RFCOMM connection
889 **                  When the operation is complete, tBTA_JV_RFCOMM_CBACK is
890 **                  called with BTA_JV_RFCOMM_READ_EVT.
891 **
892 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
893 **                  BTA_JV_FAILURE, otherwise.
894 **
895 *******************************************************************************/
896 extern tBTA_JV_STATUS BTA_JvRfcommRead(UINT32 handle, UINT32 req_id, UINT8 *p_data, UINT16 len);
897 
898 /*******************************************************************************
899 **
900 ** Function         BTA_JvRfcommReady
901 **
902 ** Description      This function determined if there is data to read from
903 **                  an RFCOMM connection
904 **
905 ** Returns          BTA_JV_SUCCESS, if data queue size is in *p_data_size.
906 **                  BTA_JV_FAILURE, if error.
907 **
908 *******************************************************************************/
909 extern tBTA_JV_STATUS BTA_JvRfcommReady(UINT32 handle, UINT32 *p_data_size);
910 
911 /*******************************************************************************
912 **
913 ** Function         BTA_JvRfcommWrite
914 **
915 ** Description      This function writes data to an RFCOMM connection
916 **                  When the operation is complete, tBTA_JV_RFCOMM_CBACK is
917 **                  called with BTA_JV_RFCOMM_WRITE_EVT.
918 **
919 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
920 **                  BTA_JV_FAILURE, otherwise.
921 **
922 *******************************************************************************/
923 extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id, int len, UINT8 *p_data);
924 
925 /*******************************************************************************
926 **
927 ** Function         BTA_JvRfcommFlowControl
928 **
929 ** Description      This function gives the credit to the peer
930 **
931 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
932 **                  BTA_JV_FAILURE, otherwise.
933 **
934 *******************************************************************************/
935 extern tBTA_JV_STATUS BTA_JvRfcommFlowControl(UINT32 handle, UINT16 credits_given);
936 
937 /*******************************************************************************
938 **
939 ** Function         BTA_JvRfcommGetPortHdl
940 **
941 ** Description    This function fetches the rfcomm port handle
942 **
943 ** Returns          BTA_JV_SUCCESS, if the request is being processed.
944 **                  BTA_JV_FAILURE, otherwise.
945 **
946 *******************************************************************************/
947 UINT16 BTA_JvRfcommGetPortHdl(UINT32 handle);
948 #endif /* BTA_JV_RFCOMM_INCLUDED */
949 
950 /*******************************************************************************
951  **
952  ** Function    BTA_JVSetPmProfile
953  **
954  ** Description This function set or free power mode profile for different JV application
955  **
956  ** Parameters:  handle,  JV handle from RFCOMM or L2CAP
957  **              app_id:  app specific pm ID, can be BTA_JV_PM_ALL, see bta_dm_cfg.c for details
958  **              BTA_JV_PM_ID_CLEAR: removes pm management on the handle. init_st is ignored and
959  **              BTA_JV_CONN_CLOSE is called implicitely
960  **              init_st:  state after calling this API. typically it should be BTA_JV_CONN_OPEN
961  **
962  ** Returns      BTA_JV_SUCCESS, if the request is being processed.
963  **              BTA_JV_FAILURE, otherwise.
964  **
965  ** NOTE:        BTA_JV_PM_ID_CLEAR: In general no need to be called as jv pm calls automatically
966  **              BTA_JV_CONN_CLOSE to remove in case of connection close!
967  **
968  *******************************************************************************/
969 extern tBTA_JV_STATUS BTA_JvSetPmProfile(UINT32 handle, tBTA_JV_PM_ID app_id, tBTA_JV_CONN_STATE init_st);
970 
971 #endif  ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
972 #endif /* BTA_JV_API_H */
973