The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 27 | #include "bt_target.h" |
| 28 | #include "bt_types.h" |
| 29 | #include "bta_api.h" |
| 30 | #include "btm_api.h" |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 31 | #include "l2c_api.h" |
| 32 | |
Jakub Pawlowski | 713993d | 2016-04-21 13:16:45 -0700 | [diff] [blame] | 33 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 37 | /***************************************************************************** |
| 38 | ** Constants and data types |
| 39 | *****************************************************************************/ |
| 40 | /* status values */ |
| 41 | #define BTA_JV_SUCCESS 0 /* Successful operation. */ |
| 42 | #define BTA_JV_FAILURE 1 /* Generic failure. */ |
| 43 | #define BTA_JV_BUSY 2 /* Temporarily can not handle this request. */ |
| 44 | #define BTA_JV_NO_DATA 3 /* no data. */ |
Ganesh Ganapathi Batta | 2f338f2 | 2013-03-24 03:11:59 +0100 | [diff] [blame] | 45 | #define BTA_JV_NO_RESOURCE 4 /* No more set pm control block */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 46 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 47 | typedef uint8_t tBTA_JV_STATUS; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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 |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 53 | #define BTA_JV_MAX_L2C_CONN GAP_MAX_CONNECTIONS /* GAP handle is used as index, hence do not change this value */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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 | |
| 57 | #ifndef BTA_JV_DEF_RFC_MTU |
| 58 | #define BTA_JV_DEF_RFC_MTU (3*330) |
| 59 | #endif |
| 60 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 61 | #ifndef BTA_JV_MAX_RFC_SR_SESSION |
The Android Open Source Project | 689d66b | 2012-12-12 17:18:15 -0800 | [diff] [blame] | 62 | #define BTA_JV_MAX_RFC_SR_SESSION MAX_BD_CONNECTIONS |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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 | }; |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 82 | typedef uint16_t tBTA_JV_DISC; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 83 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 84 | #define BTA_JV_ROLE_SLAVE BTM_ROLE_SLAVE |
| 85 | #define BTA_JV_ROLE_MASTER BTM_ROLE_MASTER |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 86 | typedef uint32_t tBTA_JV_ROLE; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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 | |
Ganesh Ganapathi Batta | 2f338f2 | 2013-03-24 03:11:59 +0100 | [diff] [blame] | 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 */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 103 | typedef uint8_t tBTA_JV_PM_ID; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 104 | |
Ganesh Ganapathi Batta | 2f338f2 | 2013-03-24 03:11:59 +0100 | [diff] [blame] | 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 | { |
| 115 | BTA_JV_CONN_OPEN = 0, /* Connection opened state */ |
| 116 | BTA_JV_CONN_CLOSE, /* Connection closed state */ |
| 117 | BTA_JV_APP_OPEN, /* JV Application opened state */ |
| 118 | BTA_JV_APP_CLOSE, /* JV Application closed state */ |
| 119 | BTA_JV_SCO_OPEN, /* SCO connection opened state */ |
| 120 | BTA_JV_SCO_CLOSE, /* SCO connection opened state */ |
| 121 | BTA_JV_CONN_IDLE, /* Connection idle state */ |
| 122 | BTA_JV_CONN_BUSY, /* Connection busy state */ |
| 123 | BTA_JV_MAX_CONN_STATE /* Max number of connection state */ |
| 124 | }; |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 125 | typedef uint8_t tBTA_JV_CONN_STATE; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 126 | |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 127 | /* JV Connection types */ |
| 128 | #define BTA_JV_CONN_TYPE_RFCOMM 0 |
| 129 | #define BTA_JV_CONN_TYPE_L2CAP 1 |
| 130 | #define BTA_JV_CONN_TYPE_L2CAP_LE 2 |
| 131 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 132 | /* Java I/F callback events */ |
| 133 | /* events received by tBTA_JV_DM_CBACK */ |
| 134 | #define BTA_JV_ENABLE_EVT 0 /* JV enabled */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 135 | #define BTA_JV_GET_SCN_EVT 6 /* Reserved an SCN */ |
| 136 | #define BTA_JV_GET_PSM_EVT 7 /* Reserved a PSM */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 137 | #define BTA_JV_DISCOVERY_COMP_EVT 8 /* SDP discovery complete */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 138 | #define BTA_JV_CREATE_RECORD_EVT 11 /* the result for BTA_JvCreateRecord */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 139 | /* events received by tBTA_JV_L2CAP_CBACK */ |
| 140 | #define BTA_JV_L2CAP_OPEN_EVT 16 /* open status of L2CAP connection */ |
| 141 | #define BTA_JV_L2CAP_CLOSE_EVT 17 /* L2CAP connection closed */ |
| 142 | #define BTA_JV_L2CAP_START_EVT 18 /* L2CAP server started */ |
| 143 | #define BTA_JV_L2CAP_CL_INIT_EVT 19 /* L2CAP client initiated a connection */ |
| 144 | #define BTA_JV_L2CAP_DATA_IND_EVT 20 /* L2CAP connection received data */ |
| 145 | #define BTA_JV_L2CAP_CONG_EVT 21 /* L2CAP connection congestion status changed */ |
| 146 | #define BTA_JV_L2CAP_READ_EVT 22 /* the result for BTA_JvL2capRead */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 147 | #define BTA_JV_L2CAP_WRITE_EVT 24 /* the result for BTA_JvL2capWrite*/ |
| 148 | #define BTA_JV_L2CAP_WRITE_FIXED_EVT 25 /* the result for BTA_JvL2capWriteFixed */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 149 | |
| 150 | /* events received by tBTA_JV_RFCOMM_CBACK */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 151 | #define BTA_JV_RFCOMM_OPEN_EVT 26 /* open status of RFCOMM Client connection */ |
| 152 | #define BTA_JV_RFCOMM_CLOSE_EVT 27 /* RFCOMM connection closed */ |
| 153 | #define BTA_JV_RFCOMM_START_EVT 28 /* RFCOMM server started */ |
| 154 | #define BTA_JV_RFCOMM_CL_INIT_EVT 29 /* RFCOMM client initiated a connection */ |
| 155 | #define BTA_JV_RFCOMM_DATA_IND_EVT 30 /* RFCOMM connection received data */ |
| 156 | #define BTA_JV_RFCOMM_CONG_EVT 31 /* RFCOMM connection congestion status changed */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 157 | #define BTA_JV_RFCOMM_WRITE_EVT 33 /* the result for BTA_JvRfcommWrite*/ |
| 158 | #define BTA_JV_RFCOMM_SRV_OPEN_EVT 34 /* open status of Server RFCOMM connection */ |
| 159 | #define BTA_JV_MAX_EVT 35 /* max number of JV events */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 160 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 161 | typedef uint16_t tBTA_JV_EVT; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 162 | |
| 163 | /* data associated with BTA_JV_SET_DISCOVER_EVT */ |
| 164 | typedef struct |
| 165 | { |
| 166 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
| 167 | tBTA_JV_DISC disc_mode; /* The current discoverable mode */ |
| 168 | } tBTA_JV_SET_DISCOVER; |
| 169 | |
| 170 | /* data associated with BTA_JV_DISCOVERY_COMP_EVT_ */ |
| 171 | typedef struct |
| 172 | { |
| 173 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
| 174 | int scn; /* channel # */ |
| 175 | } tBTA_JV_DISCOVERY_COMP; |
| 176 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 177 | /* data associated with BTA_JV_CREATE_RECORD_EVT */ |
| 178 | typedef struct |
| 179 | { |
| 180 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
| 181 | } tBTA_JV_CREATE_RECORD; |
| 182 | |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 183 | /* data associated with BTA_JV_L2CAP_OPEN_EVT */ |
| 184 | typedef struct |
| 185 | { |
| 186 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 187 | uint32_t handle; /* The connection handle */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 188 | BD_ADDR rem_bda; /* The peer address */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 189 | int32_t tx_mtu; /* The transmit MTU */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 190 | } tBTA_JV_L2CAP_OPEN; |
| 191 | |
| 192 | /* data associated with BTA_JV_L2CAP_OPEN_EVT for LE sockets */ |
| 193 | typedef struct |
| 194 | { |
| 195 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 196 | uint32_t handle; /* The connection handle */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 197 | BD_ADDR rem_bda; /* The peer address */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 198 | int32_t tx_mtu; /* The transmit MTU */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 199 | void **p_p_cback; /* set them for new socket */ |
| 200 | void **p_user_data;/* set them for new socket */ |
| 201 | |
| 202 | } tBTA_JV_L2CAP_LE_OPEN; |
| 203 | |
| 204 | |
| 205 | /* data associated with BTA_JV_L2CAP_CLOSE_EVT */ |
| 206 | typedef struct |
| 207 | { |
| 208 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 209 | uint32_t handle; /* The connection handle */ |
| 210 | bool async; /* false, if local initiates disconnect */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 211 | } tBTA_JV_L2CAP_CLOSE; |
| 212 | |
| 213 | /* data associated with BTA_JV_L2CAP_START_EVT */ |
| 214 | typedef struct |
| 215 | { |
| 216 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 217 | uint32_t handle; /* The connection handle */ |
| 218 | uint8_t sec_id; /* security ID used by this server */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 219 | } tBTA_JV_L2CAP_START; |
| 220 | |
| 221 | /* data associated with BTA_JV_L2CAP_CL_INIT_EVT */ |
| 222 | typedef struct |
| 223 | { |
| 224 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 225 | uint32_t handle; /* The connection handle */ |
| 226 | uint8_t sec_id; /* security ID used by this client */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 227 | } tBTA_JV_L2CAP_CL_INIT; |
| 228 | |
| 229 | /* data associated with BTA_JV_L2CAP_CONG_EVT */ |
| 230 | typedef struct |
| 231 | { |
| 232 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 233 | uint32_t handle; /* The connection handle */ |
| 234 | bool cong; /* true, congested. false, uncongested */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 235 | } tBTA_JV_L2CAP_CONG; |
| 236 | |
| 237 | /* data associated with BTA_JV_L2CAP_READ_EVT */ |
| 238 | typedef struct |
| 239 | { |
| 240 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 241 | uint32_t handle; /* The connection handle */ |
| 242 | uint32_t req_id; /* The req_id in the associated BTA_JvL2capRead() */ |
| 243 | uint8_t *p_data; /* This points the same location as the p_data |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 244 | * parameter in BTA_JvL2capRead () */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 245 | uint16_t len; /* The length of the data read. */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 246 | } tBTA_JV_L2CAP_READ; |
| 247 | |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 248 | /* data associated with BTA_JV_L2CAP_WRITE_EVT */ |
| 249 | typedef struct |
| 250 | { |
| 251 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 252 | uint32_t handle; /* The connection handle */ |
| 253 | uint32_t req_id; /* The req_id in the associated BTA_JvL2capWrite() */ |
| 254 | uint16_t len; /* The length of the data written. */ |
| 255 | bool cong; /* congestion status */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 256 | } tBTA_JV_L2CAP_WRITE; |
| 257 | |
| 258 | |
| 259 | /* data associated with BTA_JV_L2CAP_WRITE_FIXED_EVT */ |
| 260 | typedef struct |
| 261 | { |
| 262 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 263 | uint16_t channel; /* The connection channel */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 264 | BD_ADDR addr; /* The peer address */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 265 | uint32_t req_id; /* The req_id in the associated BTA_JvL2capWrite() */ |
| 266 | uint16_t len; /* The length of the data written. */ |
| 267 | bool cong; /* congestion status */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 268 | } tBTA_JV_L2CAP_WRITE_FIXED; |
| 269 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 270 | /* data associated with BTA_JV_RFCOMM_OPEN_EVT */ |
| 271 | typedef struct |
| 272 | { |
| 273 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 274 | uint32_t handle; /* The connection handle */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 275 | BD_ADDR rem_bda; /* The peer address */ |
| 276 | } tBTA_JV_RFCOMM_OPEN; |
| 277 | /* data associated with BTA_JV_RFCOMM_SRV_OPEN_EVT */ |
| 278 | typedef struct |
| 279 | { |
| 280 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 281 | uint32_t handle; /* The connection handle */ |
| 282 | uint32_t new_listen_handle; /* The new listen handle */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 283 | BD_ADDR rem_bda; /* The peer address */ |
| 284 | } tBTA_JV_RFCOMM_SRV_OPEN; |
| 285 | |
| 286 | |
| 287 | /* data associated with BTA_JV_RFCOMM_CLOSE_EVT */ |
| 288 | typedef struct |
| 289 | { |
| 290 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 291 | uint32_t port_status; /* PORT status */ |
| 292 | uint32_t handle; /* The connection handle */ |
| 293 | bool async; /* false, if local initiates disconnect */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 294 | } tBTA_JV_RFCOMM_CLOSE; |
| 295 | |
| 296 | /* data associated with BTA_JV_RFCOMM_START_EVT */ |
| 297 | typedef struct |
| 298 | { |
| 299 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 300 | uint32_t handle; /* The connection handle */ |
| 301 | uint8_t sec_id; /* security ID used by this server */ |
| 302 | bool use_co; /* true to use co_rfc_data */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 303 | } tBTA_JV_RFCOMM_START; |
| 304 | |
| 305 | /* data associated with BTA_JV_RFCOMM_CL_INIT_EVT */ |
| 306 | typedef struct |
| 307 | { |
| 308 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 309 | uint32_t handle; /* The connection handle */ |
| 310 | uint8_t sec_id; /* security ID used by this client */ |
| 311 | bool use_co; /* true to use co_rfc_data */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 312 | } tBTA_JV_RFCOMM_CL_INIT; |
| 313 | /*data associated with BTA_JV_L2CAP_DATA_IND_EVT & BTA_JV_RFCOMM_DATA_IND_EVT */ |
| 314 | typedef struct |
| 315 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 316 | uint32_t handle; /* The connection handle */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 317 | } tBTA_JV_DATA_IND; |
| 318 | |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 319 | /*data associated with BTA_JV_L2CAP_DATA_IND_EVT if used for LE */ |
| 320 | typedef struct |
| 321 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 322 | uint32_t handle; /* The connection handle */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 323 | BT_HDR *p_buf; /* The incoming data */ |
| 324 | } tBTA_JV_LE_DATA_IND; |
| 325 | |
| 326 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 327 | /* data associated with BTA_JV_RFCOMM_CONG_EVT */ |
| 328 | typedef struct |
| 329 | { |
| 330 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 331 | uint32_t handle; /* The connection handle */ |
| 332 | bool cong; /* true, congested. false, uncongested */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 333 | } tBTA_JV_RFCOMM_CONG; |
| 334 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 335 | /* data associated with BTA_JV_RFCOMM_WRITE_EVT */ |
| 336 | typedef struct |
| 337 | { |
| 338 | tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 339 | uint32_t handle; /* The connection handle */ |
| 340 | uint32_t req_id; /* The req_id in the associated BTA_JvRfcommWrite() */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 341 | int len; /* The length of the data written. */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 342 | bool cong; /* congestion status */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 343 | } tBTA_JV_RFCOMM_WRITE; |
| 344 | |
Ganesh Ganapathi Batta | 2f338f2 | 2013-03-24 03:11:59 +0100 | [diff] [blame] | 345 | /* data associated with BTA_JV_API_SET_PM_PROFILE_EVT */ |
| 346 | typedef struct |
| 347 | { |
| 348 | tBTA_JV_STATUS status; /* Status of the operation */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 349 | uint32_t handle; /* Connection handle */ |
Ganesh Ganapathi Batta | 2f338f2 | 2013-03-24 03:11:59 +0100 | [diff] [blame] | 350 | tBTA_JV_PM_ID app_id; /* JV app ID */ |
| 351 | } tBTA_JV_SET_PM_PROFILE; |
| 352 | |
| 353 | /* data associated with BTA_JV_API_NOTIFY_PM_STATE_CHANGE_EVT */ |
| 354 | typedef struct |
| 355 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 356 | uint32_t handle; /* Connection handle */ |
Ganesh Ganapathi Batta | 2f338f2 | 2013-03-24 03:11:59 +0100 | [diff] [blame] | 357 | tBTA_JV_CONN_STATE state; /* JV connection stata */ |
| 358 | } tBTA_JV_NOTIFY_PM_STATE_CHANGE; |
| 359 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 360 | |
| 361 | /* union of data associated with JV callback */ |
| 362 | typedef union |
| 363 | { |
| 364 | tBTA_JV_STATUS status; /* BTA_JV_ENABLE_EVT */ |
| 365 | tBTA_JV_DISCOVERY_COMP disc_comp; /* BTA_JV_DISCOVERY_COMP_EVT */ |
| 366 | tBTA_JV_SET_DISCOVER set_discover; /* BTA_JV_SET_DISCOVER_EVT */ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 367 | uint8_t scn; /* BTA_JV_GET_SCN_EVT */ |
| 368 | uint16_t psm; /* BTA_JV_GET_PSM_EVT */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 369 | tBTA_JV_CREATE_RECORD create_rec; /* BTA_JV_CREATE_RECORD_EVT */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 370 | tBTA_JV_L2CAP_OPEN l2c_open; /* BTA_JV_L2CAP_OPEN_EVT */ |
| 371 | tBTA_JV_L2CAP_CLOSE l2c_close; /* BTA_JV_L2CAP_CLOSE_EVT */ |
| 372 | tBTA_JV_L2CAP_START l2c_start; /* BTA_JV_L2CAP_START_EVT */ |
| 373 | tBTA_JV_L2CAP_CL_INIT l2c_cl_init; /* BTA_JV_L2CAP_CL_INIT_EVT */ |
| 374 | tBTA_JV_L2CAP_CONG l2c_cong; /* BTA_JV_L2CAP_CONG_EVT */ |
| 375 | tBTA_JV_L2CAP_READ l2c_read; /* BTA_JV_L2CAP_READ_EVT */ |
| 376 | tBTA_JV_L2CAP_WRITE l2c_write; /* BTA_JV_L2CAP_WRITE_EVT */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 377 | tBTA_JV_RFCOMM_OPEN rfc_open; /* BTA_JV_RFCOMM_OPEN_EVT */ |
| 378 | tBTA_JV_RFCOMM_SRV_OPEN rfc_srv_open; /* BTA_JV_RFCOMM_SRV_OPEN_EVT */ |
| 379 | tBTA_JV_RFCOMM_CLOSE rfc_close; /* BTA_JV_RFCOMM_CLOSE_EVT */ |
| 380 | tBTA_JV_RFCOMM_START rfc_start; /* BTA_JV_RFCOMM_START_EVT */ |
| 381 | tBTA_JV_RFCOMM_CL_INIT rfc_cl_init; /* BTA_JV_RFCOMM_CL_INIT_EVT */ |
| 382 | tBTA_JV_RFCOMM_CONG rfc_cong; /* BTA_JV_RFCOMM_CONG_EVT */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 383 | tBTA_JV_RFCOMM_WRITE rfc_write; /* BTA_JV_RFCOMM_WRITE_EVT */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 384 | tBTA_JV_DATA_IND data_ind; /* BTA_JV_L2CAP_DATA_IND_EVT |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 385 | BTA_JV_RFCOMM_DATA_IND_EVT */ |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 386 | tBTA_JV_LE_DATA_IND le_data_ind; /* BTA_JV_L2CAP_LE_DATA_IND_EVT */ |
| 387 | tBTA_JV_L2CAP_LE_OPEN l2c_le_open; /* BTA_JV_L2CAP_OPEN_EVT */ |
| 388 | tBTA_JV_L2CAP_WRITE_FIXED l2c_write_fixed; /* BTA_JV_L2CAP_WRITE_FIXED_EVT */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 389 | } tBTA_JV; |
| 390 | |
| 391 | /* JAVA DM Interface callback */ |
| 392 | typedef void (tBTA_JV_DM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void * user_data); |
| 393 | |
| 394 | /* JAVA RFCOMM interface callback */ |
| 395 | typedef void* (tBTA_JV_RFCOMM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data); |
| 396 | |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 397 | /* JAVA L2CAP interface callback */ |
| 398 | typedef void (tBTA_JV_L2CAP_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_Data); |
| 399 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 400 | /* JV configuration structure */ |
| 401 | typedef struct |
| 402 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 403 | uint16_t sdp_raw_size; /* The size of p_sdp_raw_data */ |
| 404 | uint16_t sdp_db_size; /* The size of p_sdp_db */ |
| 405 | uint8_t *p_sdp_raw_data; /* The data buffer to keep raw data */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 406 | tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */ |
| 407 | } tBTA_JV_CFG; |
| 408 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 409 | /******************************************************************************* |
| 410 | ** |
| 411 | ** Function BTA_JvEnable |
| 412 | ** |
| 413 | ** Description Enable the Java I/F service. When the enable |
| 414 | ** operation is complete the callback function will be |
| 415 | ** called with a BTA_JV_ENABLE_EVT. This function must |
| 416 | ** be called before other functions in the JV API are |
| 417 | ** called. |
| 418 | ** |
| 419 | ** Returns BTA_JV_SUCCESS if successful. |
| 420 | ** BTA_JV_FAIL if internal failure. |
| 421 | ** |
| 422 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 423 | tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 424 | |
| 425 | /******************************************************************************* |
| 426 | ** |
| 427 | ** Function BTA_JvDisable |
| 428 | ** |
| 429 | ** Description Disable the Java I/F |
| 430 | ** |
| 431 | ** Returns void |
| 432 | ** |
| 433 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 434 | void BTA_JvDisable(void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 435 | |
| 436 | /******************************************************************************* |
| 437 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 438 | ** Function BTA_JvIsEncrypted |
| 439 | ** |
| 440 | ** Description This function checks if the link to peer device is encrypted |
| 441 | ** |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 442 | ** Returns true if encrypted. |
| 443 | ** false if not. |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 444 | ** |
| 445 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 446 | bool BTA_JvIsEncrypted(BD_ADDR bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 447 | |
| 448 | /******************************************************************************* |
| 449 | ** |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 450 | ** Function BTA_JvGetChannelId |
| 451 | ** |
| 452 | ** Description This function reserves a SCN/PSM for applications running |
| 453 | ** over RFCOMM or L2CAP. It is primarily called by |
| 454 | ** server profiles/applications to register their SCN/PSM into the |
| 455 | ** SDP database. The SCN is reported by the tBTA_JV_DM_CBACK |
| 456 | ** callback with a BTA_JV_GET_SCN_EVT. |
| 457 | ** If the SCN/PSM reported is 0, that means all SCN resources are |
| 458 | ** exhausted. |
| 459 | ** The channel parameter can be used to request a specific |
| 460 | ** channel. If the request on the specific channel fails, the |
| 461 | ** SCN/PSM returned in the EVT will be 0 - no attempt to request |
| 462 | ** a new channel will be made. set channel to <= 0 to automatically |
| 463 | ** assign an channel ID. |
| 464 | ** |
| 465 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 466 | ** BTA_JV_FAILURE, otherwise. |
| 467 | ** |
| 468 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 469 | tBTA_JV_STATUS BTA_JvGetChannelId(int conn_type, void* user_data, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 470 | int32_t channel); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 471 | |
| 472 | /******************************************************************************* |
| 473 | ** |
| 474 | ** Function BTA_JvFreeChannel |
| 475 | ** |
| 476 | ** Description This function frees a SCN/PSM that was used |
| 477 | ** by an application running over RFCOMM or L2CAP. |
| 478 | ** |
| 479 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 480 | ** BTA_JV_FAILURE, otherwise. |
| 481 | ** |
| 482 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 483 | tBTA_JV_STATUS BTA_JvFreeChannel(uint16_t channel, int conn_type); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 484 | |
| 485 | /******************************************************************************* |
| 486 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 487 | ** Function BTA_JvStartDiscovery |
| 488 | ** |
| 489 | ** Description This function performs service discovery for the services |
| 490 | ** provided by the given peer device. When the operation is |
| 491 | ** complete the tBTA_JV_DM_CBACK callback function will be |
| 492 | ** called with a BTA_JV_DISCOVERY_COMP_EVT. |
| 493 | ** |
| 494 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 495 | ** BTA_JV_FAILURE, otherwise. |
| 496 | ** |
| 497 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 498 | tBTA_JV_STATUS BTA_JvStartDiscovery(BD_ADDR bd_addr, uint16_t num_uuid, |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 499 | tSDP_UUID *p_uuid_list, void* user_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 500 | |
| 501 | /******************************************************************************* |
| 502 | ** |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 503 | ** Function BTA_JvCreateRecordByUser |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 504 | ** |
| 505 | ** Description Create a service record in the local SDP database by user in |
| 506 | ** tBTA_JV_DM_CBACK callback with a BTA_JV_CREATE_RECORD_EVT. |
| 507 | ** |
| 508 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 509 | ** BTA_JV_FAILURE, otherwise. |
| 510 | ** |
| 511 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 512 | tBTA_JV_STATUS BTA_JvCreateRecordByUser(void* user_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 513 | |
| 514 | /******************************************************************************* |
| 515 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 516 | ** Function BTA_JvDeleteRecord |
| 517 | ** |
| 518 | ** Description Delete a service record in the local SDP database. |
| 519 | ** |
| 520 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 521 | ** BTA_JV_FAILURE, otherwise. |
| 522 | ** |
| 523 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 524 | tBTA_JV_STATUS BTA_JvDeleteRecord(uint32_t handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 525 | |
| 526 | /******************************************************************************* |
| 527 | ** |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 528 | ** Function BTA_JvL2capConnectLE |
| 529 | ** |
| 530 | ** Description Initiate a connection as an LE L2CAP client to the given BD |
| 531 | ** Address. |
| 532 | ** When the connection is initiated or failed to initiate, |
| 533 | ** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_CL_INIT_EVT |
| 534 | ** When the connection is established or failed, |
| 535 | ** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT |
| 536 | ** |
| 537 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 538 | ** BTA_JV_FAILURE, otherwise. |
| 539 | ** |
| 540 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 541 | tBTA_JV_STATUS BTA_JvL2capConnectLE(tBTA_SEC sec_mask, tBTA_JV_ROLE role, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 542 | const tL2CAP_ERTM_INFO *ertm_info, uint16_t remote_chan, |
| 543 | uint16_t rx_mtu, tL2CAP_CFG_INFO *cfg, |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 544 | BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data); |
| 545 | |
| 546 | /******************************************************************************* |
| 547 | ** |
| 548 | ** Function BTA_JvL2capConnect |
| 549 | ** |
| 550 | ** Description Initiate a connection as a L2CAP client to the given BD |
| 551 | ** Address. |
| 552 | ** When the connection is initiated or failed to initiate, |
| 553 | ** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_CL_INIT_EVT |
| 554 | ** When the connection is established or failed, |
| 555 | ** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT |
| 556 | ** |
| 557 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 558 | ** BTA_JV_FAILURE, otherwise. |
| 559 | ** |
| 560 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 561 | tBTA_JV_STATUS BTA_JvL2capConnect(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 562 | const tL2CAP_ERTM_INFO *ertm_info, uint16_t remote_psm, |
| 563 | uint16_t rx_mtu, tL2CAP_CFG_INFO *cfg, |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 564 | BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data); |
| 565 | |
| 566 | /******************************************************************************* |
| 567 | ** |
| 568 | ** Function BTA_JvL2capClose |
| 569 | ** |
| 570 | ** Description This function closes an L2CAP client connection |
| 571 | ** |
| 572 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 573 | ** BTA_JV_FAILURE, otherwise. |
| 574 | ** |
| 575 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 576 | tBTA_JV_STATUS BTA_JvL2capClose(uint32_t handle); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 577 | |
| 578 | /******************************************************************************* |
| 579 | ** |
| 580 | ** Function BTA_JvL2capCloseLE |
| 581 | ** |
| 582 | ** Description This function closes an L2CAP client connection for Fixed Channels |
| 583 | ** Function is idempotent and no callbacks are called! |
| 584 | ** |
| 585 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 586 | ** BTA_JV_FAILURE, otherwise. |
| 587 | ** |
| 588 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 589 | tBTA_JV_STATUS BTA_JvL2capCloseLE(uint32_t handle); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 590 | |
| 591 | /******************************************************************************* |
| 592 | ** |
| 593 | ** Function BTA_JvL2capStartServer |
| 594 | ** |
| 595 | ** Description This function starts an L2CAP server and listens for an L2CAP |
| 596 | ** connection from a remote Bluetooth device. When the server |
| 597 | ** is started successfully, tBTA_JV_L2CAP_CBACK is called with |
| 598 | ** BTA_JV_L2CAP_START_EVT. When the connection is established, |
| 599 | ** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT. |
| 600 | ** |
| 601 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 602 | ** BTA_JV_FAILURE, otherwise. |
| 603 | ** |
| 604 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 605 | tBTA_JV_STATUS BTA_JvL2capStartServer(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role, |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 606 | const tL2CAP_ERTM_INFO *ertm_info, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 607 | uint16_t local_psm, uint16_t rx_mtu, tL2CAP_CFG_INFO *cfg, |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 608 | tBTA_JV_L2CAP_CBACK *p_cback, void *user_data); |
| 609 | |
| 610 | /******************************************************************************* |
| 611 | ** |
| 612 | ** Function BTA_JvL2capStartServerLE |
| 613 | ** |
| 614 | ** Description This function starts an LE L2CAP server and listens for an L2CAP |
| 615 | ** connection from a remote Bluetooth device on a fixed channel |
| 616 | ** over an LE link. When the server |
| 617 | ** is started successfully, tBTA_JV_L2CAP_CBACK is called with |
| 618 | ** BTA_JV_L2CAP_START_EVT. When the connection is established, |
| 619 | ** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT. |
| 620 | ** |
| 621 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 622 | ** BTA_JV_FAILURE, otherwise. |
| 623 | ** |
| 624 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 625 | tBTA_JV_STATUS BTA_JvL2capStartServerLE(tBTA_SEC sec_mask, tBTA_JV_ROLE role, |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 626 | const tL2CAP_ERTM_INFO *ertm_info, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 627 | uint16_t local_chan, uint16_t rx_mtu, tL2CAP_CFG_INFO *cfg, |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 628 | tBTA_JV_L2CAP_CBACK *p_cback, void *user_data); |
| 629 | |
| 630 | /******************************************************************************* |
| 631 | ** |
| 632 | ** Function BTA_JvL2capStopServerLE |
| 633 | ** |
| 634 | ** Description This function stops the LE L2CAP server. If the server has an |
| 635 | ** active connection, it would be closed. |
| 636 | ** |
| 637 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 638 | ** BTA_JV_FAILURE, otherwise. |
| 639 | ** |
| 640 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 641 | tBTA_JV_STATUS BTA_JvL2capStopServerLE(uint16_t local_chan, void *user_data); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 642 | |
| 643 | /******************************************************************************* |
| 644 | ** |
| 645 | ** Function BTA_JvL2capStopServerLE |
| 646 | ** |
| 647 | ** Description This function stops the LE L2CAP server. If the server has an |
| 648 | ** active connection, it would be closed. |
| 649 | ** |
| 650 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 651 | ** BTA_JV_FAILURE, otherwise. |
| 652 | ** |
| 653 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 654 | tBTA_JV_STATUS BTA_JvL2capStopServer(uint16_t local_psm, void *user_data); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 655 | |
| 656 | /******************************************************************************* |
| 657 | ** |
| 658 | ** Function BTA_JvL2capRead |
| 659 | ** |
| 660 | ** Description This function reads data from an L2CAP connection |
| 661 | ** When the operation is complete, tBTA_JV_L2CAP_CBACK is |
| 662 | ** called with BTA_JV_L2CAP_READ_EVT. |
| 663 | ** |
| 664 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 665 | ** BTA_JV_FAILURE, otherwise. |
| 666 | ** |
| 667 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 668 | tBTA_JV_STATUS BTA_JvL2capRead(uint32_t handle, uint32_t req_id, |
| 669 | uint8_t *p_data, uint16_t len); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 670 | |
| 671 | /******************************************************************************* |
| 672 | ** |
| 673 | ** Function BTA_JvL2capReady |
| 674 | ** |
| 675 | ** Description This function determined if there is data to read from |
| 676 | ** an L2CAP connection |
| 677 | ** |
| 678 | ** Returns BTA_JV_SUCCESS, if data queue size is in *p_data_size. |
| 679 | ** BTA_JV_FAILURE, if error. |
| 680 | ** |
| 681 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 682 | tBTA_JV_STATUS BTA_JvL2capReady(uint32_t handle, uint32_t *p_data_size); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 683 | |
| 684 | /******************************************************************************* |
| 685 | ** |
| 686 | ** Function BTA_JvL2capWrite |
| 687 | ** |
| 688 | ** Description This function writes data to an L2CAP connection |
| 689 | ** When the operation is complete, tBTA_JV_L2CAP_CBACK is |
| 690 | ** called with BTA_JV_L2CAP_WRITE_EVT. Works for |
| 691 | ** PSM-based connections |
| 692 | ** |
| 693 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 694 | ** BTA_JV_FAILURE, otherwise. |
| 695 | ** |
| 696 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 697 | tBTA_JV_STATUS BTA_JvL2capWrite(uint32_t handle, uint32_t req_id, |
| 698 | uint8_t *p_data, uint16_t len, void *user_data); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 699 | |
| 700 | |
| 701 | /******************************************************************************* |
| 702 | ** |
| 703 | ** Function BTA_JvL2capWriteFixed |
| 704 | ** |
| 705 | ** Description This function writes data to an L2CAP connection |
| 706 | ** When the operation is complete, tBTA_JV_L2CAP_CBACK is |
| 707 | ** called with BTA_JV_L2CAP_WRITE_FIXED_EVT. Works for |
| 708 | ** fixed-channel connections |
| 709 | ** |
| 710 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 711 | ** BTA_JV_FAILURE, otherwise. |
| 712 | ** |
| 713 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 714 | tBTA_JV_STATUS BTA_JvL2capWriteFixed(uint16_t channel, BD_ADDR *addr, uint32_t req_id, |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 715 | tBTA_JV_L2CAP_CBACK *p_cback, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 716 | uint8_t *p_data, uint16_t len, void *user_data); |
Kim Schulz | 8372aa5 | 2015-03-25 10:39:40 +0100 | [diff] [blame] | 717 | |
| 718 | /******************************************************************************* |
| 719 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 720 | ** Function BTA_JvRfcommConnect |
| 721 | ** |
| 722 | ** Description This function makes an RFCOMM conection to a remote BD |
| 723 | ** Address. |
| 724 | ** When the connection is initiated or failed to initiate, |
| 725 | ** tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_CL_INIT_EVT |
| 726 | ** When the connection is established or failed, |
| 727 | ** tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_OPEN_EVT |
| 728 | ** |
| 729 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 730 | ** BTA_JV_FAILURE, otherwise. |
| 731 | ** |
| 732 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 733 | tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 734 | tBTA_JV_ROLE role, uint8_t remote_scn, BD_ADDR peer_bd_addr, |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 735 | tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 736 | |
| 737 | /******************************************************************************* |
| 738 | ** |
| 739 | ** Function BTA_JvRfcommClose |
| 740 | ** |
| 741 | ** Description This function closes an RFCOMM connection |
| 742 | ** |
| 743 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 744 | ** BTA_JV_FAILURE, otherwise. |
| 745 | ** |
| 746 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 747 | tBTA_JV_STATUS BTA_JvRfcommClose(uint32_t handle, void* user_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 748 | |
| 749 | /******************************************************************************* |
| 750 | ** |
| 751 | ** Function BTA_JvRfcommStartServer |
| 752 | ** |
| 753 | ** Description This function starts listening for an RFCOMM connection |
| 754 | ** request from a remote Bluetooth device. When the server is |
| 755 | ** started successfully, tBTA_JV_RFCOMM_CBACK is called |
| 756 | ** with BTA_JV_RFCOMM_START_EVT. |
| 757 | ** When the connection is established, tBTA_JV_RFCOMM_CBACK |
| 758 | ** is called with BTA_JV_RFCOMM_OPEN_EVT. |
| 759 | ** |
| 760 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 761 | ** BTA_JV_FAILURE, otherwise. |
| 762 | ** |
| 763 | *******************************************************************************/ |
Sharvil Nanavati | 547a297 | 2016-04-06 14:46:49 -0700 | [diff] [blame] | 764 | tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 765 | tBTA_JV_ROLE role, uint8_t local_scn, uint8_t max_session, |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 766 | tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 767 | |
| 768 | /******************************************************************************* |
| 769 | ** |
| 770 | ** Function BTA_JvRfcommStopServer |
| 771 | ** |
| 772 | ** Description This function stops the RFCOMM server. If the server has an |
| 773 | ** active connection, it would be closed. |
| 774 | ** |
| 775 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 776 | ** BTA_JV_FAILURE, otherwise. |
| 777 | ** |
| 778 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 779 | tBTA_JV_STATUS BTA_JvRfcommStopServer(uint32_t handle, void* user_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 780 | |
| 781 | /******************************************************************************* |
| 782 | ** |
| 783 | ** Function BTA_JvRfcommWrite |
| 784 | ** |
| 785 | ** Description This function writes data to an RFCOMM connection |
| 786 | ** When the operation is complete, tBTA_JV_RFCOMM_CBACK is |
| 787 | ** called with BTA_JV_RFCOMM_WRITE_EVT. |
| 788 | ** |
| 789 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 790 | ** BTA_JV_FAILURE, otherwise. |
| 791 | ** |
| 792 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 793 | tBTA_JV_STATUS BTA_JvRfcommWrite(uint32_t handle, uint32_t req_id); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 794 | |
Ganesh Ganapathi Batta | 2f338f2 | 2013-03-24 03:11:59 +0100 | [diff] [blame] | 795 | /******************************************************************************* |
| 796 | ** |
| 797 | ** Function BTA_JVSetPmProfile |
| 798 | ** |
| 799 | ** Description This function set or free power mode profile for different JV application |
| 800 | ** |
| 801 | ** Parameters: handle, JV handle from RFCOMM or L2CAP |
| 802 | ** app_id: app specific pm ID, can be BTA_JV_PM_ALL, see bta_dm_cfg.c for details |
| 803 | ** BTA_JV_PM_ID_CLEAR: removes pm management on the handle. init_st is ignored and |
| 804 | ** BTA_JV_CONN_CLOSE is called implicitely |
| 805 | ** init_st: state after calling this API. typically it should be BTA_JV_CONN_OPEN |
| 806 | ** |
| 807 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 808 | ** BTA_JV_FAILURE, otherwise. |
| 809 | ** |
| 810 | ** NOTE: BTA_JV_PM_ID_CLEAR: In general no need to be called as jv pm calls automatically |
| 811 | ** BTA_JV_CONN_CLOSE to remove in case of connection close! |
| 812 | ** |
| 813 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 814 | tBTA_JV_STATUS BTA_JvSetPmProfile(uint32_t handle, tBTA_JV_PM_ID app_id, |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 815 | tBTA_JV_CONN_STATE init_st); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 816 | |
| 817 | /******************************************************************************* |
| 818 | ** |
| 819 | ** Function BTA_JvRfcommGetPortHdl |
| 820 | ** |
| 821 | ** Description This function fetches the rfcomm port handle |
| 822 | ** |
| 823 | ** Returns BTA_JV_SUCCESS, if the request is being processed. |
| 824 | ** BTA_JV_FAILURE, otherwise. |
| 825 | ** |
| 826 | *******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame^] | 827 | uint16_t BTA_JvRfcommGetPortHdl(uint32_t handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 828 | |
Jakub Pawlowski | 713993d | 2016-04-21 13:16:45 -0700 | [diff] [blame] | 829 | #ifdef __cplusplus |
| 830 | } |
| 831 | #endif |
| 832 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 833 | #endif /* BTA_JV_API_H */ |